aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2020-11-25 10:48:57 +0100
committerPetr Štetiar <ynezz@true.cz>2020-12-22 19:11:50 +0100
commita4c30d9399bdd7f5c42409b959d52230a97600c9 (patch)
treed684eaa2b6742777b61d42f41671dacf0f59247c
parent7c75eaadfcddd5375d0cfd8a4eeed8e8f9e1a094 (diff)
downloadupstream-a4c30d9399bdd7f5c42409b959d52230a97600c9.tar.gz
upstream-a4c30d9399bdd7f5c42409b959d52230a97600c9.tar.bz2
upstream-a4c30d9399bdd7f5c42409b959d52230a97600c9.zip
scripts/om-fwupgradecfg-gen.sh: Generate checksum over whole squashfs
The rootfs is padded to the full block size by padjffs2 and a 4 byte magic value ("deadc0de") is added to the end. On first boot, the JFFS2 is replacing the "deadc0de" marker when the rootfs_data is initialized. The static part of the rootfs is therefore $rootfs_size - 4 and not $rootfs_size - 262144 - 4. Signed-off-by: Sven Eckelmann <sven@narfation.org>
-rwxr-xr-xscripts/om-fwupgradecfg-gen.sh9
1 files changed, 3 insertions, 6 deletions
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh
index 915fbd05ab..ce33454a24 100755
--- a/scripts/om-fwupgradecfg-gen.sh
+++ b/scripts/om-fwupgradecfg-gen.sh
@@ -23,28 +23,24 @@ case $CE_TYPE in
OM2P)
MAX_PART_SIZE=7168
KERNEL_FLASH_ADDR=0x1c0000
- MD5_SKIP_BLOCKS=4
SIZE_FACTOR=1
SIZE_FORMAT="%d"
;;
OM5P|OM5PAC|MR600|MR900|MR1750|A60)
MAX_PART_SIZE=7808
KERNEL_FLASH_ADDR=0xb0000
- MD5_SKIP_BLOCKS=4
SIZE_FACTOR=1
SIZE_FORMAT="%d"
;;
A42)
MAX_PART_SIZE=15616
KERNEL_FLASH_ADDR=0x180000
- MD5_SKIP_BLOCKS=4
SIZE_FACTOR=1024
SIZE_FORMAT="0x%08x"
;;
A62)
MAX_PART_SIZE=15552
KERNEL_FLASH_ADDR=0x1a0000
- MD5_SKIP_BLOCKS=4
SIZE_FACTOR=1024
SIZE_FORMAT="0x%08x"
;;
@@ -64,11 +60,12 @@ KERNEL_PART_SIZE=$(printf $SIZE_FORMAT $(($KERNEL_PART_SIZE_KB * $SIZE_FACTOR)))
ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE_KB * 1024))); printf "0x%x" $addr)
ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH")
-ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS))
+ROOTFS_SQUASHFS_SIZE=$((ROOTFS_SIZE-4))
+ROOTFS_CHECK_BLOCKS=$((ROOTFS_SQUASHFS_SIZE / CHECK_BS))
ROOTFS_MD5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | mkhash md5)
ROOTFS_MD5_FULL=$(mkhash md5 $ROOTFS_PATH)
ROOTFS_SHA256_FULL=$(mkhash sha256 $ROOTFS_PATH)
-ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS)))
+ROOTFS_CHECK_SIZE=$(printf '0x%x' $ROOTFS_SQUASHFS_SIZE)
ROOTFS_PART_SIZE_KB=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE_KB))
ROOTFS_PART_SIZE=$(printf $SIZE_FORMAT $(($ROOTFS_PART_SIZE_KB * $SIZE_FACTOR)))