Program the firmware from Linux
You can update the entire system from a local update package using the included command tools.
Requirements:
- Recovery partition programmed with the recovery image generated by Digi Embedded Yocto. See Recovery partition and utils.
- A software update package with the new firmware.
Follow these steps to update your system from the command line using an already generated package:
- Make sure the update package is accessible locally. See Build a software update package for more information.
Note You can download Digi provided pre-built image from ftp://ftp1.digi.com/support/digiembeddedyocto/2.2/r3/images/ccimx6ulstarter/fb/core-image-base-swu-ccimx6ulstarter-20171215013922.swu
For example, in the update partition:
$ ls -l /mnt/update/ -rw-r--r-- 1 root root 731810304 Jan 26 18:15 core-image-base-swu-<platform>-<timestamp>.swuOr in external media:
$ ls -l /run/media/sda1 -rwxrwx--- 1 root disk 241062400 Jan 18 19:30 core-image-base-swu-<platform>-<timestamp>.swu $ ls -l /run/media/mmcblk1p1 -rwxrwx--- 1 root disk 241062400 Jan 18 19:30 core-image-base-swu-<platform>-<timestamp>.swu
- Use the update-firmware command to trigger the firmware update process via the recovery boot mode:
$ update-firmware /mnt/update/core-image-base-swu-<platform>.swu The recovery commands have been properly configured and the system will reboot into recovery mode in 10 seconds (^C to cancel). [...]
If you need to set a new file system encryption key (see Digi TrustFence™ for Yocto), use the --encryption-key option:
- The update-firmware tool uses a base64-encoded string of a 32-byte binary key:
#> update-firmware --encryption-key=YjNz1psJsO3PsxIcdQwCjW7MA0Y5IryT38UCddViJNM= /mnt/update/core-image-base-swu-<platform>.swu
- Or it can generate a random key if one is not provided:
#> update-firmware --encryption-key /mnt/update/core-image-base-swu-<platform>.swu
The reboot timeout is configurable using option -T of the update-firmware command.
CAUTION! The system will be restarted during the update process.
You can also install an update package from your custom application using the Firmware update API provided by Digi. See Recovery library (firmware update).
Firmware update process
Once the firmware update process is triggered, it follows these steps:
- Device reboots into recovery mode. The kernel and initramfs in the recovery partition are booted instead of the kernel in the linux partition.
- The recovery init reads U-Boot's environment recovery_command variable for the software update package file name.
- The recovery init looks for the software update package in the update partition and in external media.
- The recovery init executes the swupdate tool to program the firmware into the module.
- The device reboots and the firmware update is complete.