mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
cc8228dbc6
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> SVN-Revision: 25176
33 lines
973 B
Bash
Executable File
33 lines
973 B
Bash
Executable File
#!/bin/sh
|
|
# my-mkimage
|
|
# 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
|
|
}
|
|
|
|
OLDSIZE=$(stat -c%s $1)
|
|
NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64))
|
|
|
|
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
|
|
|
|
rm temp vmlinuz.tmp
|