summaryrefslogtreecommitdiffstats
path: root/target/linux/adm8668/image
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-01-27 21:50:00 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-01-27 21:50:00 +0000
commit9406119753d584262c190825147c4181bbc2e452 (patch)
tree14575818b79c90ad573db07f42e56885017971b3 /target/linux/adm8668/image
parentc2ffdb04c4dbeac68495850314b01e5f53c69c53 (diff)
[adm8668] fix firstboot with new MTD map driver
my-mkimage previously did not include the fs_mark of deadc0de because upon formatting of jffs2 partition, U-Boot's CRC validation would not allow the image to boot. This new MTD map will shrink the kernel+rootfs+fs_mark image and recalculate the CRC, so that only the kernel is part of the image validation. This also improves boot time, since less is copied from FLASH->RAM. This is mostly from brcm47xx, just with u-boot image vs TRX partitions. Signed-off-by: Scott Nicholas <scott.nicholas@scottn.us> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25176 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm8668/image')
-rw-r--r--target/linux/adm8668/image/Makefile5
-rwxr-xr-xtarget/linux/adm8668/image/my-mkimage42
2 files changed, 28 insertions, 19 deletions
diff --git a/target/linux/adm8668/image/Makefile b/target/linux/adm8668/image/Makefile
index e9d183b78..57b8d7ba5 100644
--- a/target/linux/adm8668/image/Makefile
+++ b/target/linux/adm8668/image/Makefile
@@ -16,11 +16,14 @@ define Image/Prepare
$(MAKE) -C lzma-loader \
KDIR="$(KDIR)" \
clean compile
+ rm -f $(KDIR)/fs_mark
+ touch $(KDIR)/fs_mark
+ $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
endef
define Image/Build
./my-mkimage $(KDIR)/loader.bin $(KDIR)/root.squashfs \
- $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
+ $(KDIR)/fs_mark $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
endef
$(eval $(call BuildImage))
diff --git a/target/linux/adm8668/image/my-mkimage b/target/linux/adm8668/image/my-mkimage
index 7012d7b97..7ed6666e7 100755
--- a/target/linux/adm8668/image/my-mkimage
+++ b/target/linux/adm8668/image/my-mkimage
@@ -1,26 +1,32 @@
#!/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.
+# This will pad given files to 64k boundaries to make a single u-boot image.
+# we have to be fancy because u-boot mkimage is going to add 64 byte header, ...
+# and i only know basic arithmetic.. ;)
#
# Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
+[ $# -lt 2 ] && {
+ echo usage: $0 loader.bin [rootfs.squashfs [fs_mark [...]]] output.bin
+}
-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)
+OLDSIZE=$(stat -c%s $1)
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
+dd if=$1 of=vmlinuz.tmp bs=$NEWSIZE conv=sync >/dev/null 2>&1
+shift
+appends=$(($# - 1))
+echo
+while [ $appends -gt 0 ]; do
+ dd if=$1 of=temp bs=64k conv=sync >/dev/null 2>&1
+ printf "### '%s' starts at 0x%x\n" "`basename $1`" "$((NEWSIZE+64))"
+ cat temp >>vmlinuz.tmp
+ shift
+ appends=$((appends-1))
+ NEWSIZE=$(stat -c%s vmlinuz.tmp)
+done
+echo
+../../../../staging_dir/host/bin/mkimage -A mips -O linux -T kernel \
+-C none -a 0x80400000 -e 0x80400000 -n "ADM8668 Linux Kernel(2.4.31)" \
+-d vmlinuz.tmp $1
-printf '\n\nOk done, now your squashfs starts on an erase boundary of %x :)\n\n' $((NEWSIZE+64))
+rm temp vmlinuz.tmp