2 # Copyright (C) 2006 - 2007 OpenWrt.org
5 echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image>"
19 cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512)))
21 # create partition table
22 set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m`
24 KERNELOFFSET="$(($1 / 512))"
25 KERNELSIZE="$(($2 / 512))"
26 ROOTFSOFFSET="$(($3 / 512))"
27 ROOTFSSIZE="$(($4 / 512))"
29 BLOCKS="$((($KERNELSIZE / 2) - 1))"
31 genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel"
32 dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
33 [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
34 dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
35 #rm -f "$OUTPUT.kernel"