aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-09-14 20:10:10 +0000
committerJohn Crispin <blogic@openwrt.org>2015-09-14 20:10:10 +0000
commit6334cffd9a426d64e3cfe19438377e4c4f2c48cb (patch)
tree8fb6055d8e2000afc5fb51dd889740bb4f8a5541 /scripts
parent21e0eaebd6d4d5adf3d335a1c296ee74e517079d (diff)
downloadmaster-187ad058-6334cffd9a426d64e3cfe19438377e4c4f2c48cb.tar.gz
master-187ad058-6334cffd9a426d64e3cfe19438377e4c4f2c48cb.tar.bz2
master-187ad058-6334cffd9a426d64e3cfe19438377e4c4f2c48cb.zip
scripts/om-fwupgradecfg-gen.sh: Fix u-boot image md5sum check
The u-boot on Open Mesh devices checks the whole transfered image against a md5sum. This is stored inside the option filemd5sum inside the fwupgrade.cfg. The bootloader will not check it when this setting is missing and could therefore write invalid images to the flash. Signed-off-by: Sven Eckelmann <sven@open-mesh.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46925 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts')
-rw-r--r--scripts/om-fwupgradecfg-gen.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh
index e1329549b8..d385e5e264 100644
--- a/scripts/om-fwupgradecfg-gen.sh
+++ b/scripts/om-fwupgradecfg-gen.sh
@@ -48,6 +48,7 @@ ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); p
ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH")
ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS))
ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *})
+ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *})
ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS)))
ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE))
@@ -55,6 +56,7 @@ cat << EOF > $CFG_OUT
[vmlinux]
filename=kernel
md5sum=$KERNEL_MD5
+filemd5sum=$KERNEL_MD5
flashaddr=$KERNEL_FLASH_ADDR
checksize=0x0
cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv
@@ -63,6 +65,7 @@ cmd_fail=reset
[rootfs]
filename=rootfs
md5sum=$ROOTFS_MD5
+filemd5sum=$ROOTFS_MD5_FULL
flashaddr=$ROOTFS_FLASH_ADDR
checksize=$ROOTFS_CHECK_SIZE
cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; setenv rootfs_size_1 $ROOTFS_PART_SIZE; saveenv