X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/a1f92f4320b0e28dc07f333bd7667d9ba57e2a5b..a57b6f1f05a49a7a4766fd0ea44bf07632aef364:/target/linux/x86-2.6/image/gen_image.sh diff --git a/target/linux/x86-2.6/image/gen_image.sh b/target/linux/x86-2.6/image/gen_image.sh index 795a46b71..b4845f5a7 100755 --- a/target/linux/x86-2.6/image/gen_image.sh +++ b/target/linux/x86-2.6/image/gen_image.sh @@ -23,19 +23,22 @@ set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m` KERNELOFFSET="$(($1 / 512))" ROOTFSOFFSET="$(($2 / 512))" +ROOTFSSIZE="$(( ($3 - $2) / 512))" BLOCKS="$((($ROOTFSOFFSET - $KERNELOFFSET) / 2 - 1))" genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel" dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc +[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE" dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc #rm -f "$OUTPUT.kernel" which chpax >/dev/null && chpax -zp $(which grub) -grub --device-map=/dev/null <