aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/adm8668/image/my-mkimage
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-11-06 18:54:20 +0000
committerFlorian Fainelli <florian@openwrt.org>2010-11-06 18:54:20 +0000
commitd9a42c5436a0bdc49696edaf80958cfa9a3f26cc (patch)
tree8426747c468d82fa0461445c9c616d536cd77534 /target/linux/adm8668/image/my-mkimage
parent1f8f2aaa37114460df167dda37260190e714e6fc (diff)
downloadupstream-d9a42c5436a0bdc49696edaf80958cfa9a3f26cc.tar.gz
upstream-d9a42c5436a0bdc49696edaf80958cfa9a3f26cc.tar.bz2
upstream-d9a42c5436a0bdc49696edaf80958cfa9a3f26cc.zip
Merge branch 'adm8668'
SVN-Revision: 23900
Diffstat (limited to 'target/linux/adm8668/image/my-mkimage')
-rwxr-xr-xtarget/linux/adm8668/image/my-mkimage26
1 files changed, 26 insertions, 0 deletions
diff --git a/target/linux/adm8668/image/my-mkimage b/target/linux/adm8668/image/my-mkimage
new file mode 100755
index 0000000000..7012d7b975
--- /dev/null
+++ b/target/linux/adm8668/image/my-mkimage
@@ -0,0 +1,26 @@
+#!/bin/sh
+# my-mkimage
+# This will just pad the kernel partition to 64k boundary, then add rootfs.
+# but we have to be fancy because u-boot mkimage is going to add 64 byte header.
+#
+# Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
+
+PATH_LOADER=$1
+PATH_ROOTFS=$2
+OUTPUT=$3
+
+# todo - check arguments...? nah...
+if [ -x $OUTPUT ]; then
+ echo usage: $0 loader.bin root.squashfs output.bin
+ exit
+fi
+
+OLDSIZE=$(stat -c%s $PATH_LOADER)
+NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64))
+
+dd if=$PATH_LOADER of=vmlinuz.tmp bs=$NEWSIZE conv=sync
+cat $PATH_ROOTFS >>vmlinuz.tmp
+../../../../staging_dir/host/bin/mkimage -A mips -O linux -T kernel -C none -a 0x400000 -e 0x400000 -n "ADM8668 Linux Kernel(2.4.31)" -d vmlinuz.tmp $OUTPUT
+rm vmlinuz.tmp
+
+printf '\n\nOk done, now your squashfs starts on an erase boundary of %x :)\n\n' $((NEWSIZE+64))