scripts/om-fwupgradecfg-gen.sh: add support for the MR600
authorGabor Juhos <juhosg@openwrt.org>
Sun, 18 Nov 2012 09:32:36 +0000 (09:32 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 18 Nov 2012 09:32:36 +0000 (09:32 +0000)
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 34233

scripts/om-fwupgradecfg-gen.sh
target/linux/ar71xx/image/Makefile

index baa0a7c2e3fe3956211a3bfb182f34ae8f07940c..779598a2f8f76daffed2ef9774eabf4a6663ffab 100644 (file)
@@ -7,28 +7,46 @@
 #
 
 usage() {
-       echo "Usage: $0 <out file path> <kernel path> <rootfs path>"
+       echo "Usage: $0 <OM2P|MR600> <out file path> <kernel path> <rootfs path>"
        rm -f $CFG_OUT
        exit 1
 }
 
-[ "$#" -lt 3 ] && usage
+[ "$#" -lt 4 ] && usage
+
+CE_TYPE=$1
+CFG_OUT=$2
+KERNEL_PATH=$3
+ROOTFS_PATH=$4
+
+case $CE_TYPE in
+       OM2P)
+               MAX_PART_SIZE=7168
+               KERNEL_FLASH_ADDR=0x1c0000
+               FLASH_BS=262144
+               MD5_SKIP_BLOCKS=1
+               ;;
+       MR600)
+               MAX_PART_SIZE=7808
+               KERNEL_FLASH_ADDR=0xb0000
+               FLASH_BS=65536
+               MD5_SKIP_BLOCKS=4
+               ;;
+       *)
+               echo "Error - unsupported ce type: $CE_TYPE"
+               exit 1
+               ;;
+esac
 
-FLASH_BS=262144
 CHECK_BS=65536
-MAX_PART_SIZE=7168
-CFG_OUT=$1
 
-KERNEL_PATH=$2
-KERNEL_FLASH_ADDR=0x1c0000
 KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH")
 KERNEL_MD5=$(md5=$(md5sum $KERNEL_PATH); echo ${md5%% *})
 KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024)))
 
-ROOTFS_PATH=$3
 ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr)
 ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH")
-ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - 1))
+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_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS)))
 ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE))
index d3d483d88f880af35d3b059b51ccece0eae1dd38..e21234850996b2e38c34f321c9d6aea47c2d89df 100644 (file)
@@ -681,12 +681,13 @@ endif
 define Image/Build/OpenMesh
        $(call MkuImageLzma,$(2))
        -sh $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
-               "$(BUILD_DIR)/om2p-fwupgrade.cfg" \
+               "$(4)" \
+               "$(BUILD_DIR)/fwupgrade.cfg-$(4)" \
                "$(KDIR_TMP)/vmlinux-$(2).uImage" \
                "$(KDIR)/root.$(1)"
        -sh $(TOPDIR)/scripts/combined-ext-image.sh \
                "$(4)" "$(call factoryname,$(1),$(2))" \
-               "$(BUILD_DIR)/om2p-fwupgrade.cfg" "fwupgrade.cfg" \
+               "$(BUILD_DIR)/fwupgrade.cfg-$(4)" "fwupgrade.cfg" \
                "$(KDIR_TMP)/vmlinux-$(2).uImage" "kernel" \
                "$(KDIR)/root.$(1)" "rootfs"
 endef