Root/target/linux/adm8668/image/my-mkimage

1#!/bin/sh
2# my-mkimage
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.. ;)
6#
7# Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
8[ $# -lt 2 ] && {
9    echo usage: $0 loader.bin [rootfs.squashfs [fs_mark [...]]] output.bin
10}
11
12OLDSIZE=$(stat -c%s $1)
13NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64))
14
15dd if=$1 of=vmlinuz.tmp bs=$NEWSIZE conv=sync >/dev/null 2>&1
16shift
17appends=$(($# - 1))
18echo
19while [ $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
23    shift
24    appends=$((appends-1))
25    NEWSIZE=$(stat -c%s vmlinuz.tmp)
26done
27echo
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)" \
30-d vmlinuz.tmp $1
31
32rm temp vmlinuz.tmp
33

Archive Download this file



interactive