Changes between Initial Version and Version 1 of malibu/firmware


Ignore:
Timestamp:
04/07/2023 01:04:46 AM (19 months ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • malibu/firmware

    v1 v1  
     1[[PageOutline]]
     2
     3= Updating Malibu Firmware / Software
     4
     5This page is all about updating / flashing firmware / software onto a Malibu SBC.
     6
     7The various components of the 'firmware' on a Malibu board which you may want to update from time to time are (lowest level components listed first):
     8- GSC firmware
     9- SPL
     10- Linux device-tree
     11- U-Boot bootloader
     12- Linux kernel
     13- root filesystem
     14
     15Some components above you can update individually in Linux using {{{dd}}} or in U-Boot using {{{mmc write}}} taking care to place them at the right offset.
     16
     17= Pre-Built Firmware
     18[wiki:malibu/bsp#images Malibu Pre-Built Firmware / Software]
     19
     20JTAG binary images:
     21 - Flash with Gateworks JTAG dongle on a Linux host with instructions [#jtag
     22 - Note there are several variants of the i.MX8M processor (mini (mm), nano (mn), plus(mp)) which is indicated in the filename.
     23 - firmware-malibu-gw8901-jtag.bin
     24                       - JTAG image of boot firmware containing:
     25                         ATF, U-Boot, and U-Boot env.
     26                         Flash with JTAG if recovering a board from an
     27                         unknown state.
     28 - gsc_8901_v62.txt    - Latest GSC firmware release for GW891
     29
     30Disk Images (Update via Bootloader gzwrite or via Linux):
     31 - see http://trac.gateworks.com/wiki/malibu/firmware
     32 - jammy-malibu.img.gz
     33
     34
     35[=#firmware-version]
     36= Firmware Versioning
     37
     38You can determine the firmware version of various portions of the firmware by looking for banners on the serial console. For example:
     39{{{#!bash
     40Gateworks Malibu SPL v2.4(release):v2.4-5-g9f5a66e417b6 Built : 13:50:03, Apr  6 2023
     41DDR4-2133 4x16GiB: 8GiB
     42mv_ddr: devel-ged350176570c (Apr 06 2023 - 13:50:01)
     43SSCG_EN
     44Synopsys DDR43 PHY Firmware version: A-2017.11
     45...
     46U-Boot 2022.10-00019-gcbfa8885831d (Apr 06 2023 - 13:49:47 -0700)
     47...
     48GSCv3   : v62 0x4a26 RST:VIN Thermal protection:enabled at 96C
     49...
     50[    0.000000] Linux version 6.1.0-00021-g4225c178a023 (jenkins@buildbot) (aarch64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu
     51) 2.34) #5 SMP Thu Apr  6 08:55:30 PDT 2023
     52...
     53Ubuntu 22.04.1 LTS jammy-malibu ttyS0
     54
     55Gateworks-Ubuntu-gateworks-g67953fe Thu Aug 18 17:49:36 UTC 2022
     56...
     57}}}
     58
     59
     60The above output shows you:
     61 * Secondary Program Loader (SPL) GIT revision and build date
     62 * Marvell DDR version
     63 * U-Boot GIT revision and build date
     64 * GSC firmware version
     65 * Linux kernel version, GIT revision, build date and build source
     66 * Ubuntu root filesystem version and GIT revision of the Gateworks [https://github.com/gateworks/ubuntu-rootfs ubuntu-rootfs.sh] that created it (use {{{dpkg -l | grep "^ii"}}} to see what packages and versions are installed
     67
     68
     69[=#firmware-update]
     70= Updating Firmware
     71This section provides instructions for updating both GSC firmware as well as boot device firmware.
     72
     73There are two methods for updating firmware:
     74 * on a live board using Serial Console and Ethernet
     75 * using a GW16099 JTAG dongle (see [#jtag below])
     76
     77The various items that can be easily updated:
     78 * GSC Firmware - Can be updated via JTAG or at runtime - see [#gsc below])
     79 * Boot Firmware (Everything up to and including the Bootloader)
     80 * Root Filesystem (Operating System)
     81
     82[=#jtag]
     83== JTAG Programming
     84The Gateworks JTAG adapter (GW16099) is available in the Malibu Dev Kit as well as on the Gateworks web store [http://shop.gateworks.com/index.php?route=product/category&path=70_80 here]
     85
     86All Malibu boards have a 10-pin JTAG header which provides:
     87 * JTAG Programming for embedded emmc flash - see [wiki:jtag_instructions here] for instructions
     88 * Serial Console access via UART1 (/dev/ttyS0)
     89
     90Please Note:
     91 * Only program *jtag.bin files via the JTAG programmer and jtag_usbv4
     92 * Linux software is supported for programming Malibu (jtag_usbv4 required). Windows is not supported. (Serial console through Windows does work).
     93 * JTAG Programming of eMMC is supported by [http://dev.gateworks.com/jtag/jtag_usbv4 jtag_usbv4] - see [wiki:jtag_instructions here]. Due to this being a slow process for large eMMC devices it is recommended to program boot firmware via JTAG if you brick your board and use the bootloader to install firmware when possible for speed (see [#serial-ethernet] below).
     94 * JTAG Programming of the GSC firmware is supported by [http://dev.gateworks.com/jtag/jtag_usbv4 jtag_usbv4] - see [#jtag-gsc below]
     95
     96To flash the Malibu boot firmware (no operating system), use the following command:
     97{{{
     98sudo ./jtag_usbv4 –p firmware-malibu-gw8901-jtag.bin
     99}}}
     100
     101
     102[=#serial-ethernet]
     103== Update Firmware via Serial Console and Ethernet from Bootloader
     104The quickest and easiest way to update your firmware is via Serial Console and Ethernet. You can do this either in the U-Boot bootloader (recommended) or within a Linux OS.
     105
     106If updating firmware via !Bootloader/Serial/Ethernet (recommended for speed) you need to setup a TFTP server to host the files for transfer. Alternatively you could load firmware files from removable storage (microSD, or USB Mass Storage for example) however you will need to deviate from the examples below. For details on setting up a TFTP server see [wiki:tftpserver here].
     107
     108The following instructions assume your board target IP address is 192.168.1.1 and you have a TFTP server at 192.168.1.146. Adjust environment according to your network via 'setenv ipaddr <ipaddr>' and 'setenv serverip <serverip>'.
     109
     110The methods you use to update the firmware depends on what specifically you are trying to update.
     111
     112
     113==== Update OS
     114Updating the OS can be done via a Compressed Disk Image. This image includes the partition table and root filesystem which includes the kernel, device-tree and bootscript. Note for Malibu the boot firmware is contained on the emmc boot0 hardware partition keeping it separate from the OS on the emmc user parition.
     115
     116Complete Compressed Disk Images are available for download here: [http://dev.gateworks.com/malibu/images/]
     117
     118Procedure:
     119 * Via U-Boot:
     120{{{#!bash
     121#First, setup the IP and server IP as described above (example IPs below)
     122setenv ipaddr 192.168.1.1
     123setenv serverip 192.168.1.2
     124# setup network environment (use bootp or static by setting ipaddr/serverip and optional netmask/gatewayip)
     125setenv autoload 0; bootp  # use dhcp for network config but do not fetch a file
     126# choose the device to update
     127setenv dev 0 # sets MMC device to be flashed - see mmc list
     128# set your image
     129setenv image jammy-malibu.img.gz
     130# update
     131run update_all
     132}}}
     133  - This is what the update_all script does if your curious:
     134{{{#!bash
     135update_all=tftpboot ${loadaddr} ${image} && gzwrite mmc ${dev} ${loadaddr} ${filesize}
     136}}}
     137 * Via Linux (assuming the device you are updating is not mounted):
     138{{{#!bash
     139# fetch your file
     140cd /tmp
     141wget http://dev.gateworks.com/malibu/images/jammy-malibu.img.gz
     142# uncompress and write to the emmc device
     143zcat jammy-malibu.img.gz | dd of=/dev/mmcblk0 bs=4M
     144}}}
     145
     146
     147==== Updating just the boot firmware
     148Updating the [wiki:malibu/boot 'Boot firmware'] via this method updates the ATF and U-Boot bootloader. Note for Malibu the boot firmware is contained on the emmc boot0 hardware partition keeping it separate from the OS on the emmc user parition.
     149
     150The latest pre-built boot firmware images for Malibu are available for download here:
     151[http://dev.gateworks.com/malibu/boot_firmware/]
     152
     153Procedure:
     154 * Via U-Boot:
     155{{{#!bash
     156# setup network environment (use bootp or static by setting ipaddr/serverip and optional netmask/gatewayip)
     157bootp  # optional: use dhcp for network config
     158# update
     159run update_firmware
     160}}}
     161   - This is what the update_firmware script does if your curious:
     162{{{#!bash
     163tftpboot $loadaddr ${dir}/firmware-malibu-${board}.bin &&
     164  setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200 &&
     165  mmc dev 0 1 && mmc write $loadaddr 0 $blkcnt &&
     166  mmc dev 0 2 && mmc write $loadaddr 0 $blkcnt
     167}}}
     168 * Via Linux:
     169  - Updating via Linux requires you to download the 'firmware-malibu-${board}.bin' file (pre-built images can be found [http://dev.gateworks.com/malibu/boot_firmware/ here]
     170{{{#!bash
     171# fetch your file
     172cd /tmp
     173wget http://dev.gateworks.com/malibu/boot_firmware/firmware-malibu-${board}.bin
     174dd if=firmware-malibu-${board}.bin of=/dev/mmcblk2 bs=1K seek=0
     175}}}
     176
     177Note that if you want to update the boot firmware including the default U-Boot environment (overwriting any environment you already have) use the 'firmware-malibu-${board}.img' file.
     178
     179
     180
     181=== TFTP Error Troubleshooting
     182There are many reasons why TFTP may fail including:
     183 * firewall issue keeping your TFTP server for being accessible (make sure you can ping it!)
     184 * invalid network configuration (netmask, gatewayip, ipaddr, serverip) - again make sure you can ping it!
     185 * 'TFTP error: trying to overwrite reserved memory...' - indicates you are trying to transfer a file that is larger than system memory. You will need to split the file into chunks and flash them individually at the right offsets
     186
     187
     188= Updating GSC firmware
     189The GSC firmware is updated via the {{{gsc_update}}} application running under Linux as described at on the [wiki:gsc#firmware gsc wiki]. While it takes only a few seconds to update there is no recovery for a failed update. Gateworks has ensured that this update is robust but can not survive a power-cut or kernel crash in the middle of the update. Updates to the GSC firmware are expected to be rare.
     190
     191
     192[=#jtag-gsc]
     193=== Update GSC Firmware via JTAG ===
     194To update the GSC firmware via JTAG download the {{{jtag_usbv4}}} application on a Linux x86 host from [http://dev.gateworks.com/jtag/jtag_usbv4 here] and execute as follows:
     195{{{#!bash
     196./jtag_usbv4 -m gsc_8901_v62.txt
     197}}}
     198
     199Note that the {{{ftdi_sio}}} kernel module must not be loaded (sudo rmmod ftdi_sio) and you may need to run this command as root by pre-pending a sudo depending on the configuration of your linux host.
     200
     201For more details please see:
     202 * [wiki:jtag Gateworks JTAG wiki page]