1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 05:04:40 +02:00

x86: add grub2 iso support

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33639 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2012-10-07 23:01:52 +00:00
parent 3d4fd91c66
commit 1be0626273
4 changed files with 45 additions and 4 deletions

View File

@ -81,7 +81,7 @@ menu "Target Images"
config TARGET_ROOTFS_ISO config TARGET_ROOTFS_ISO
bool "iso" bool "iso"
default n default n
depends TARGET_ROOTFS_INITRAMFS && TARGET_x86 depends on TARGET_x86_generic
help help
Create some bootable ISO image Create some bootable ISO image

View File

@ -0,0 +1,5 @@
check_for_iso() {
grep -qE '/dev/root.*iso9660' /proc/mounts && ramoverlay
}
boot_hook_add preinit_mount_root check_for_iso

View File

@ -10,6 +10,7 @@ include $(INCLUDE_DIR)/image.mk
export PATH=$(TARGET_PATH):/sbin export PATH=$(TARGET_PATH):/sbin
GRUB2_MODULES = at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga GRUB2_MODULES = at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga
GRUB2_MODULES_ISO = at_keyboard biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga
GRUB_TERMINALS = GRUB_TERMINALS =
GRUB_SERIAL_CONFIG = GRUB_SERIAL_CONFIG =
GRUB_TERMINAL_CONFIG = GRUB_TERMINAL_CONFIG =
@ -159,6 +160,30 @@ define Image/Build/squashfs
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs) $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
endef endef
ifdef CONFIG_X86_USE_GRUB2
define Image/Build/iso
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
grub-mkimage \
-o $(KDIR)/grub2/eltorito.img \
-O i386-pc \
-c ./grub-early.cfg \
$(GRUB2_MODULES_ISO)
cat \
$(STAGING_DIR_HOST)/lib/grub/i386-pc/cdboot.img \
$(KDIR)/grub2/eltorito.img \
> $(KDIR)/root.grub/boot/grub/eltorito.img
sed \
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
-e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait $(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
endef
else
define Image/Build/iso define Image/Build/iso
$(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
$(CP) \ $(CP) \
@ -174,6 +199,7 @@ define Image/Build/iso
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table \ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table \
-o $(KDIR)/root.iso $(KDIR)/root.grub -o $(KDIR)/root.iso $(KDIR)/root.grub
endef endef
endif
ifneq ($(CONFIG_X86_VDI_IMAGES),) ifneq ($(CONFIG_X86_VDI_IMAGES),)
define Image/Build/vdi define Image/Build/vdi

View File

@ -0,0 +1,10 @@
@SERIAL_CONFIG@
@TERMINAL_CONFIG@
set default="0"
set timeout="@TIMEOUT@"
set root='(cd)'
menuentry "OpenWrt" {
linux /boot/vmlinuz @CMDLINE@ noinitrd reboot=bios
}