7 | | The {{{sysupgrade}}} script for the Gateworks products provides: |
8 | | * the {{{/sbin/sysupgrade}}} script on the target will flash the kernel/rootfs contained in a specified image |
9 | | * the image contents will be validated via an md5 checksum in the image header |
10 | | * the kernel and rootfs will be updated (squashfs+jffs2, jffs2 supported, or ubi) |
11 | | * standard system config files will be retained (saved, then restored) (unless the {{{-n}}} cmdline option is provided) |
12 | | * the {{{-c}}} command-line argument will save all files on the overlay filesystem |
| 7 | In general the sysupgrade process will: |
| 8 | 1. create a backup of relavent configuration files (ie UCI config and anything else in /etc/config) as a sysupgrade.tgz file |
| 9 | 2. upgrade the rootfs |
| 10 | 3. store the sysupgrade.tgz file in sysupgrade.tgz in the rootfs so that do_mount_root boot hook will find it and restore it on the next boot |
| 11 | * In the event a squashfs+overlay filesystem is used the sysupgrade.tgz must be stored in a temporary location (because the squashfs rootfs is a read-only filesystem). This is done via the platform_copy_config() function in /lib/upgrade/platform.sh where a boot hook is used to then copy that file to the rootfs on the next boot |
14 | | A standard make in the OpenWrt buildroot tree will create a sysupgrade image for your target by default named: |
15 | | * newport: use the compressed disk image: openwrt-20.06-newport.img.gz |
16 | | * ventana: use the ubi image: bin/imx6/*-squashfs-nand_*.ubi |
| 13 | In a nutshell this is provided by: |
| 14 | * /sbin/sysupgrade script from the base-files package |
| 15 | * /lib/upgrade/platform.sh - target specific script providing functions to check the image integrity, perform the upgrade, and copy the backup file to flash following the upgrade |
| 16 | * /lib/preinit/79_move_config - identifies and moves the backup file from the flash so that it gets installed on first boot following the upgrade |
| 17 | |
| 18 | The {{{sysupgrade}}} script has some useful commandline arguments: |
| 19 | * -v will show verbose info |
| 20 | * -c will save all files on the overlay filesystem |
| 21 | * -n will upgrade without saving configuration |
| 22 | |
| 23 | For Gateworks Venice, Newport, and Ventana the file used for {{{sysupgrade}}} is the same used for an initial installation: |
| 24 | * venice: use the compressed disk image: openwrt-23.03-imx8mm.img.gz |
| 25 | * newport: use the compressed disk image: openwrt-20.06-newport.img.gz |
| 26 | * ventana: use the ubi image: bin/imx6/*-squashfs-nand_*.ubi |
| 27 | |
| 28 | When performing a {{{sysupgrade}}} with a large amount of backup data (ie using the {{{-c}}} argument with a lot of filesystem changes) it is important to ensure you have enough space to store the sysupgrade.tgz backup file. The backup file is stored in a target and boot device specific location: |
| 29 | * venice/emmc: on the 'boot' partition (P1) containing the kernel+dtb+script |
| 30 | * newport/emmc: on the 'boot' partition (P2) containing the kernel+dtb+script (Note that P1 on Newport is used by boot firmware) |
| 31 | * ventana/emmc: on the 'boot' partition (P1) containing the kernel+dtb+script |
| 32 | * ventana/NAND: directly on the 'rootfs_data' ubifs volume |