aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm4908/base-files/lib/upgrade/platform.sh
Commit message (Collapse)AuthorAgeFilesLines
* bcm4908: support "rootfs_data" on U-Boot devicesRafał Miłecki2022-03-041-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | 1. Create "rootfs_data" dynamicaly U-Boot firmware images can contain only 2 UBI volumes: bootfs (container with U-Boot + kernel + DTBs) and rootfs (e.g. squashfs). There is no way to include "rootfs_data" UBI volume or make firmware file tell U-Boot to create one. For that reason "rootfs_data" needs to be created dynamically. Use preinit script to handle that. Fire it right before "mount_root" one. 2. Relate "rootfs_data" to flashed firmware As already explained flashing new firmware with U-Boot will do nothing to the "rootfs_data". It could result in new firmware reusing old "rootfs_data" overlay UBI volume and its file. Users expect a clean state after flashing firmware (even if flashing the same one). Solve that by reading flash counter of running firmware and storing it in "rootfs_data" UBI volume. Every mismatch will result in wiping old data. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* target/linux: replace egrep with grep -ERosen Penev2022-02-071-4/+4
| | | | | | | egrep is deprecated and replaced by grep -E. The latter is used throughout the tree. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* bcm4908: sysupgrade: add pkgtb format supportRafał Miłecki2021-12-131-2/+183
| | | | | | | | | | | | | | BCM4908 devices with U-Boot use pkgtb firmware format. It's based on U-Boot's FIT: DTB with configurations, images & embedded data. This format contains bootfs, rootfs and optionally a first stage U-Boot loader. Contained images need to be extracted & flashed. Broadcom used two sets of firmwares: main & backup. It uses UBI volumes "metadata1" & "metadata2" for storing U-Boot env variables with info about flashed images. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm4908: sysupgrade: refactor handling different firmware formatsRafał Miłecki2021-12-021-32/+76
| | | | | | | | | | This results in setting format specific data (format info, extract commands) in a single function. It should help maintaining sysupgrade code. This change has been tested on Asus GT-AC5300 and Netgear R8000P. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bcm4908: fix calculation of new cferam indexSungbo Eo2021-11-041-2/+2
| | | | | | | | | | | | | The arithmetic expansion fails when idx becomes a two digit number. Fix this by relying on expr command. root@OpenWrt:/# echo $(((028 + 0) % 1000)) /bin/ash: arithmetic syntax error root@OpenWrt:/# echo $(($(expr 028 + 0) % 1000)) 28 Fixes: a6a0b252baa6 ("bcm4908: add sysupgrade support") Signed-off-by: Sungbo Eo <mans0n@gorani.run>
* bcm4908: add sysupgrade supportRafał Miłecki2021-04-071-0/+213
It supports flashing OpenWrt images (bootfs & UBI upgrade) as well as vendor images (whole MTD partition write). Upgrading cferom is unsupported. It requires copying device specific data (like MAC) to target image before flashing. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>