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"