diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-02-25 17:59:23 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-02-25 17:59:23 +0000 |
commit | e719e0c4d9fa86ba0d0b907645c9b3dee58647e2 (patch) | |
tree | f038b16be3b85bf213dfbe6cd6682d58a5750f66 /target | |
parent | e3b8c1fa598e2470e9c6057523dbbf959e24d78f (diff) | |
download | upstream-e719e0c4d9fa86ba0d0b907645c9b3dee58647e2.tar.gz upstream-e719e0c4d9fa86ba0d0b907645c9b3dee58647e2.tar.bz2 upstream-e719e0c4d9fa86ba0d0b907645c9b3dee58647e2.zip |
add optional padding for x86 grub images (useful for running jffs2 images in qemu)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6359 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/x86-2.6/image/Config.in | 4 | ||||
-rw-r--r-- | target/linux/x86-2.6/image/Makefile | 2 | ||||
-rwxr-xr-x | target/linux/x86-2.6/image/gen_image.sh | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/target/linux/x86-2.6/image/Config.in b/target/linux/x86-2.6/image/Config.in index 511a8d9d09..fc2594f106 100644 --- a/target/linux/x86-2.6/image/Config.in +++ b/target/linux/x86-2.6/image/Config.in @@ -4,6 +4,10 @@ config X86_GRUB_IMAGES depends TARGET_ROOTFS_EXT2FS || TARGET_ROOTFS_JFFS2 default y +config X86_GRUB_IMAGES_PAD + bool "Pad GRUB images to filesystem size (for JFFS2)" + depends X86_GRUB_IMAGES + config X86_GRUB_BAUDRATE int "Serial port baud rate" depends X86_GRUB_IMAGES diff --git a/target/linux/x86-2.6/image/Makefile b/target/linux/x86-2.6/image/Makefile index dc1d333434..bb7d171faf 100644 --- a/target/linux/x86-2.6/image/Makefile +++ b/target/linux/x86-2.6/image/Makefile @@ -44,7 +44,7 @@ ifeq ($(CONFIG_X86_GRUB_IMAGES),y) -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1))) $(CONFIG_X86_GRUB_BOOTOPTS)#g' \ -e 's#@BAUDRATE@#$(CONFIG_X86_GRUB_BAUDRATE)#g' \ ./grub/menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst - PATH="$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/bin:$(PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) + PADDING="$(CONFIG_X86_GRUB_IMAGES_PAD)" PATH="$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/bin:$(PATH)" ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).image $(CONFIG_X86_GRUB_KERNELPART) $(KDIR)/root.grub $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1) endef endif diff --git a/target/linux/x86-2.6/image/gen_image.sh b/target/linux/x86-2.6/image/gen_image.sh index 314d7314fd..b4845f5a77 100755 --- a/target/linux/x86-2.6/image/gen_image.sh +++ b/target/linux/x86-2.6/image/gen_image.sh @@ -23,11 +23,13 @@ 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" |