From 2a7250f79eb1b9aed953785ef05e11cfcd31031d Mon Sep 17 00:00:00 2001 From: juhosg Date: Sun, 25 Nov 2012 16:16:07 +0000 Subject: AA: scripts: rename om2p-fwupgradecfg-gen.sh to more generic om-fwupgradecfg-gen.sh Backport of r34200. It will be used for non OM2P boards as well. Signed-off-by: Marek Lindner Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@34344 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- scripts/om-fwupgradecfg-gen.sh | 52 ++++++++++++++++++++++++++++++++++++++ scripts/om2p-fwupgradecfg-gen.sh | 52 -------------------------------------- target/linux/ar71xx/image/Makefile | 2 +- 3 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 scripts/om-fwupgradecfg-gen.sh delete mode 100644 scripts/om2p-fwupgradecfg-gen.sh diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh new file mode 100644 index 000000000..baa0a7c2e --- /dev/null +++ b/scripts/om-fwupgradecfg-gen.sh @@ -0,0 +1,52 @@ +#/bin/sh +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +usage() { + echo "Usage: $0 " + rm -f $CFG_OUT + exit 1 +} + +[ "$#" -lt 3 ] && usage + +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_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)) + +cat << EOF > $CFG_OUT +[vmlinux] +filename=kernel +md5sum=$KERNEL_MD5 +flashaddr=$KERNEL_FLASH_ADDR +checksize=0x0 +cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv +cmd_fail=reset + +[rootfs] +filename=rootfs +md5sum=$ROOTFS_MD5 +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 +cmd_fail=reset +EOF diff --git a/scripts/om2p-fwupgradecfg-gen.sh b/scripts/om2p-fwupgradecfg-gen.sh deleted file mode 100644 index c323c90ef..000000000 --- a/scripts/om2p-fwupgradecfg-gen.sh +++ /dev/null @@ -1,52 +0,0 @@ -#/bin/sh -# -# Copyright (C) 2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -usage() { - echo "Usage: $0 " - rm -f $CFG_OUT - exit 1 -} - -[ "$#" -lt 3 ] && usage - -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_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)) - -cat << EOF > $CFG_OUT -[vmlinux] -filename=kernel -md5sum=$KERNEL_MD5 -flashaddr=$KERNEL_FLASH_ADDR -checksize=0x0 -cmd_success=setenv bootseq 1,2; setenv kernel_size_1 $KERNEL_PART_SIZE; saveenv -cmd_fail=reset - -[rootfs] -filename=rootfs -md5sum=$ROOTFS_MD5 -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 -cmd_fail=reset -EOF diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 764e245f6..d3d483d88 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -680,7 +680,7 @@ endif define Image/Build/OpenMesh $(call MkuImageLzma,$(2)) - -sh $(TOPDIR)/scripts/om2p-fwupgradecfg-gen.sh \ + -sh $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \ "$(BUILD_DIR)/om2p-fwupgrade.cfg" \ "$(KDIR_TMP)/vmlinux-$(2).uImage" \ "$(KDIR)/root.$(1)" -- cgit v1.2.3