summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSven Eckelmann <sven.eckelmann@open-mesh.com>2017-11-30 14:30:06 +0100
committerMathias Kresin <dev@kresin.me>2018-01-13 07:58:49 +0100
commitb02fa3336baed826374b637903127603808728ee (patch)
treecfbd755f21c11182c271f5186c9223ad4d97f5b5 /scripts
parenta28bf67c2643a9fe19f561d08002e0e30ed52a17 (diff)
downloadmtk-20170518-b02fa3336baed826374b637903127603808728ee.zip
mtk-20170518-b02fa3336baed826374b637903127603808728ee.tar.gz
mtk-20170518-b02fa3336baed826374b637903127603808728ee.tar.bz2
om-fwupgradecfg-gen.sh: add support for the A42
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/om-fwupgradecfg-gen.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh
index 4960149..38e8e3f 100755
--- a/scripts/om-fwupgradecfg-gen.sh
+++ b/scripts/om-fwupgradecfg-gen.sh
@@ -7,7 +7,7 @@
#
usage() {
- echo "Usage: $0 <OM2P|OM5P|OM5PAC|MR600|MR900|MR1750|A60> <out file path> <kernel path> <rootfs path>"
+ echo "Usage: $0 <OM2P|OM5P|OM5PAC|MR600|MR900|MR1750|A60|A42> <out file path> <kernel path> <rootfs path>"
rm -f $CFG_OUT
exit 1
}
@@ -25,12 +25,24 @@ case $CE_TYPE in
KERNEL_FLASH_ADDR=0x1c0000
FLASH_BS=262144
MD5_SKIP_BLOCKS=1
+ SIZE_FACTOR=1
+ SIZE_FORMAT="%d"
;;
OM5P|OM5PAC|MR600|MR900|MR1750|A60)
MAX_PART_SIZE=7808
KERNEL_FLASH_ADDR=0xb0000
FLASH_BS=65536
MD5_SKIP_BLOCKS=4
+ SIZE_FACTOR=1
+ SIZE_FORMAT="%d"
+ ;;
+ A42)
+ MAX_PART_SIZE=15616
+ KERNEL_FLASH_ADDR=0x180000
+ FLASH_BS=65536
+ MD5_SKIP_BLOCKS=4
+ SIZE_FACTOR=1024
+ SIZE_FORMAT="0x%08x"
;;
*)
echo "Error - unsupported ce type: $CE_TYPE"
@@ -43,16 +55,18 @@ CHECK_BS=65536
KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH")
KERNEL_MD5=$(mkhash md5 $KERNEL_PATH)
KERNEL_SHA256=$(mkhash sha256 $KERNEL_PATH)
-KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024)))
+KERNEL_PART_SIZE_KB=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024)))
+KERNEL_PART_SIZE=$(printf $SIZE_FORMAT $(($KERNEL_PART_SIZE_KB * $SIZE_FACTOR)))
-ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr)
+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_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_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE))
+ROOTFS_PART_SIZE_KB=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE_KB))
+ROOTFS_PART_SIZE=$(printf $SIZE_FORMAT $(($ROOTFS_PART_SIZE_KB * $SIZE_FACTOR)))
cat << EOF > $CFG_OUT
[vmlinux]