diff options
author | Sven Eckelmann <sven.eckelmann@open-mesh.com> | 2016-05-19 20:21:02 +0200 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2016-09-21 18:16:54 +0200 |
commit | d64a7f65b377300a38bfdd500f473f6054d0c291 (patch) | |
tree | 8bb0f5a9a91c53fb0c5c9b537fb73cfb7ffc7185 /scripts | |
parent | d6cd09a0d0c80f4b7a726cb85c82cfe631e6b88e (diff) | |
download | upstream-d64a7f65b377300a38bfdd500f473f6054d0c291.tar.gz upstream-d64a7f65b377300a38bfdd500f473f6054d0c291.tar.bz2 upstream-d64a7f65b377300a38bfdd500f473f6054d0c291.zip |
scripts/om-fwupgradecfg-gen.sh: Generate sha256sum for uboot verification
Future Open Mesh u-boot versions are changing the check of the image files
(vmlinux, rootfs) from md5 to sha256. Having both in them should be enough
to ensure backward and forward compatibility.
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Backport of r49140
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/om-fwupgradecfg-gen.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh index fab1582854..e208e6d366 100644 --- a/scripts/om-fwupgradecfg-gen.sh +++ b/scripts/om-fwupgradecfg-gen.sh @@ -42,6 +42,7 @@ CHECK_BS=65536 KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") KERNEL_MD5=$(md5=$(md5sum $KERNEL_PATH); echo ${md5%% *}) +KERNEL_SHA256=$(openssl dgst -sha256 $KERNEL_PATH | awk '{print $2}') KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024))) ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr) @@ -49,6 +50,7 @@ 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_SHA256_FULL=$(openssl dgst -sha256 $ROOTFS_PATH | awk '{print $2}') ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) @@ -57,6 +59,7 @@ cat << EOF > $CFG_OUT filename=kernel md5sum=$KERNEL_MD5 filemd5sum=$KERNEL_MD5 +filesha256sum=$KERNEL_SHA256 flashaddr=$KERNEL_FLASH_ADDR checksize=0x0 cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv @@ -66,6 +69,7 @@ cmd_fail=reset filename=rootfs md5sum=$ROOTFS_MD5 filemd5sum=$ROOTFS_MD5_FULL +filesha256sum=$ROOTFS_SHA256_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 |