aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/generic
diff options
context:
space:
mode:
authorMichael Pratt <mcpratt@pm.me>2022-12-09 17:47:11 -0500
committerHauke Mehrtens <hauke@hauke-m.de>2023-01-06 15:34:07 +0100
commit766de7013fcef2a9d759e056bb40c1cb58cfd65f (patch)
tree8b9b02ecb76304fbb80a702de864054d70840e50 /target/linux/ath79/generic
parent8342c092a03caedbf160d4ac3982c6a9be91261f (diff)
downloadupstream-766de7013fcef2a9d759e056bb40c1cb58cfd65f.tar.gz
upstream-766de7013fcef2a9d759e056bb40c1cb58cfd65f.tar.bz2
upstream-766de7013fcef2a9d759e056bb40c1cb58cfd65f.zip
ath79: allow skipping hash for Senao sysupgrade
Some vendors of Senao boards have a similar flash layout situation that causes the need to split the firmware partition and use the lzma-loader, but do not store checksums of the partitions or otherwise do not even have a uboot environment partition. This adds simple shell logic to skip that part. Also, simplify some lines and variable usage. Signed-off-by: Michael Pratt <mcpratt@pm.me>
Diffstat (limited to 'target/linux/ath79/generic')
-rw-r--r--target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh28
-rw-r--r--target/linux/ath79/generic/base-files/lib/upgrade/platform.sh1
2 files changed, 15 insertions, 14 deletions
diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh b/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh
index de84233de1..23847a1aae 100644
--- a/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh
+++ b/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh
@@ -8,8 +8,6 @@
# So the kernel check is for the loader, the rootfs check is for kernel + rootfs
platform_do_upgrade_failsafe_datachk() {
- local setenv_script="/tmp/fw_env_upgrade"
-
local flash_base=0x9f000000
local kernel_mtd=$(find_mtd_index ${KERNEL_PART:-kernel})
@@ -34,31 +32,33 @@ platform_do_upgrade_failsafe_datachk() {
local rootfs_md5=$($IMAGE_CMD $ROOTFS_FILE | dd bs=4k count=$rootfs_blocks iflag=fullblock | md5sum | cut -d ' ' -f1)
# prepare new u-boot-env vars
- printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $setenv_script
- printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $setenv_script
- printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script
+ printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $ENV_SCRIPT
+ printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $ENV_SCRIPT
+ printf "vmlinux_checksum %s\n" ${kernel_md5} >> $ENV_SCRIPT
- printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $setenv_script
- printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $setenv_script
- printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script
+ printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $ENV_SCRIPT
+ printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $ENV_SCRIPT
+ printf "rootfs_checksum %s\n" ${rootfs_md5} >> $ENV_SCRIPT
# store u-boot-env
mkdir -p /var/lock
- fw_setenv -s $setenv_script || {
+ [ -n "$SKIP_HASH" ] || fw_setenv -s $ENV_SCRIPT || {
echo 'failed to update U-Boot environment'
exit 1
}
# sysupgrade
- sleep 2
- sync
- echo 3 > /proc/sys/vm/drop_caches
+ sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches
+
$IMAGE_CMD $KERNEL_FILE | mtd $MTD_ARGS write - ${KERNEL_PART:-kernel}
- sleep 2
- sync
+
+ sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches
+
if [ -n "$UPGRADE_BACKUP" ]; then
$IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j $UPGRADE_BACKUP write - ${ROOTFS_PART:-rootfs}
else
$IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS write - ${ROOTFS_PART:-rootfs}
fi
+
+ sync
}
diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
index c58e005344..0de3dbf3b5 100644
--- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
@@ -45,6 +45,7 @@ platform_do_upgrade() {
watchguard,ap100|\
watchguard,ap200|\
watchguard,ap300)
+ ENV_SCRIPT="/tmp/fw_env"
IMAGE_LIST="tar tzf $1"
IMAGE_CMD="tar xzOf $1"
KERNEL_PART="loader"