3 # This will pad given files to 64k boundaries to make a single u-boot image.
4 # we have to be fancy because u-boot mkimage is going to add 64 byte header, ...
5 # and i only know basic arithmetic.. ;)
7 # Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
9 echo usage: $0 loader.bin [rootfs.squashfs [fs_mark [...]]] output.bin
12 OLDSIZE=$(stat -c%s $1)
13 NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64))
15 dd if=$1 of=vmlinuz.tmp bs=$NEWSIZE conv=sync >/dev/null 2>&1
19 while [ $appends -gt 0 ]; do
20 dd if=$1 of=temp bs=64k conv=sync >/dev/null 2>&1
21 printf "### '%s' starts at 0x%x\n" "`basename $1`" "$((NEWSIZE+64))"
22 cat temp >>vmlinuz.tmp
24 appends=$((appends-1))
25 NEWSIZE=$(stat -c%s vmlinuz.tmp)
28 ../../../../staging_dir/host/bin/mkimage -A mips -O linux -T kernel \
29 -C none -a 0x80400000 -e 0x80400000 -n "ADM8668 Linux Kernel(2.4.31)" \