3 # Copyright (C) 2011 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
10 echo "Usage: $0 <OM2P|OM5P|OM5PAC|MR600|MR900|MR1750|A60|A42|A62> <out file path> <kernel path> <rootfs path>"
15 [ "$#" -lt 4 ] && usage
25 KERNEL_FLASH_ADDR
=0x1c0000
31 OM5P|OM5PAC|MR600|MR900|MR1750|A60
)
33 KERNEL_FLASH_ADDR
=0xb0000
41 KERNEL_FLASH_ADDR
=0x180000
49 KERNEL_FLASH_ADDR
=0x1a0000
56 echo "Error - unsupported ce type: $CE_TYPE"
63 KERNEL_SIZE
=$
(stat
-c%s
"$KERNEL_PATH")
64 KERNEL_MD5
=$
(mkhash md5
$KERNEL_PATH)
65 KERNEL_SHA256
=$
(mkhash sha256
$KERNEL_PATH)
66 KERNEL_PART_SIZE_KB
=$
(size
=$
(($KERNEL_SIZE / $FLASH_BS)); [ $
(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size
=$
(($size + 1)); echo $
(($size * $FLASH_BS / 1024)))
67 KERNEL_PART_SIZE
=$
(printf $SIZE_FORMAT $
(($KERNEL_PART_SIZE_KB * $SIZE_FACTOR)))
69 ROOTFS_FLASH_ADDR
=$
(addr
=$
(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE_KB * 1024))); printf "0x%x" $addr)
70 ROOTFS_SIZE
=$
(stat
-c%s
"$ROOTFS_PATH")
71 ROOTFS_CHECK_BLOCKS
=$
((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS))
72 ROOTFS_MD5
=$
(dd if=$ROOTFS_PATH bs
=$CHECK_BS count
=$ROOTFS_CHECK_BLOCKS 2>&- | mkhash md5
)
73 ROOTFS_MD5_FULL
=$
(mkhash md5
$ROOTFS_PATH)
74 ROOTFS_SHA256_FULL
=$
(mkhash sha256
$ROOTFS_PATH)
75 ROOTFS_CHECK_SIZE
=$
(printf '0x%x' $
(($ROOTFS_CHECK_BLOCKS * $CHECK_BS)))
76 ROOTFS_PART_SIZE_KB
=$
(($MAX_PART_SIZE - $KERNEL_PART_SIZE_KB))
77 ROOTFS_PART_SIZE
=$
(printf $SIZE_FORMAT $
(($ROOTFS_PART_SIZE_KB * $SIZE_FACTOR)))
83 filemd5sum=$KERNEL_MD5
84 filesha256sum=$KERNEL_SHA256
85 flashaddr=$KERNEL_FLASH_ADDR
87 cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv
93 filemd5sum=$ROOTFS_MD5_FULL
94 filesha256sum=$ROOTFS_SHA256_FULL
95 flashaddr=$ROOTFS_FLASH_ADDR
96 checksize=$ROOTFS_CHECK_SIZE
97 cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; setenv rootfs_size_1 $ROOTFS_PART_SIZE; saveenv