X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;ds=sidebyside;f=target%2Flinux%2Fadm8668%2Fimage%2Fmy-mkimage;h=7ed6666e797da01dfaa7ef8512c82a7e339cc283;hb=HEAD;hp=7012d7b97579d6747d1f0f49aa8c1269f6ffcca4;hpb=d9a42c5436a0bdc49696edaf80958cfa9a3f26cc;p=lede-git%2F.git diff --git a/target/linux/adm8668/image/my-mkimage b/target/linux/adm8668/image/my-mkimage index 7012d7b975..7ed6666e79 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 +[ $# -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