> patch for Xen-unstable. Could you give me some comments? Thank you very
> much.
>
> This patch can enable Xen-unstable hvmloader to load OVMF BIOS as Xen HVM
> UEFI support. It supports OVMF BIOS in IA32 and X86 environment. The loaded
> OVMF BIOS can get Xen SMBIOS and ACPI tables contents inside itself.
>
> In order to be clear, I divide the patch into three parts:
> ovmf_xen_support.patch Enable Xen hvmloader to load OVMF
> ovmf_firmware.patch OVMF binary files
> ovmf_xl_xend.patch Add hvmloader/bios xenstore key in libxl and xend
>
>
> Usage:
> Add an option field in HVM config file.
> # OVMF support. When enabled, hvmloader can load OVMF bios of
> IA32("ovmf-ia32") and X64("ovmf-x64")
> hvmbios = "ovmf-ia32"
> #hvmbios = "ovmf-x64"
>
> Note:
> You should enable the HVM guest ACPI: acpi=1
> You can use the OVMF to boot into a UEFI-aware OS, such as
> ubuntu-10.10-desktop-amd64.
> iso. Just set the "disk" option like this:
> disk = [ 'file:/root/<img_name>.img,ioemu:hda,w',
> 'file:/root/ubuntu-10.10-desktop-amd64.iso,hdc:cdrom,r' ]
>
>
> *ovmf_xen_support.patch:*
> ------
>
> # HG changeset patch
> # User
gbtju85@xxxxxxxxx
> #
>
> diff -r e298ce67777e tools/firmware/hvmloader/Makefile
> --- a/tools/firmware/hvmloader/Makefile Mon Jul 18 14:38:31 2011 +0100
> +++ b/tools/firmware/hvmloader/Makefile Fri Jul 22 23:00:20 2011 +0800
> @@ -43,6 +43,19 @@
> CFLAGS += -DENABLE_ROMBIOS
> ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
> endif
> +OVMF_DIR := ../ovmf
> +OVMF32_ROM := $(OVMF_DIR)/ovmf-ia32.bin
> +OVMF64_ROM := $(OVMF_DIR)/ovmf-x64.bin
> +OVMF32_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-ia32-cirrus-vga.bin
> +OVMF64_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-x64-cirrus-vga.bin
> +
> +ifneq ($(OVMF32_ROM),)
> +OBJS += ovmf.o
> +endif
> +
> +ifneq ($(OVMF64_ROM),)
> +OBJS += ovmf.o
> +endif
>
> ifneq ($(SEABIOS_DIR),)
> OBJS += seabios.o
> @@ -69,7 +82,7 @@
> $(OBJCOPY) hvmloader.tmp hvmloader
> rm -f hvmloader.tmp
>
> -roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
> ../etherboot/eb-roms.h
> +roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
> $(OVMF32_ROM) $(OVMF64_ROM) $(OVMF32_CIRRUS_VGA_ROM)
> $(OVMF64_CIRRUS_VGA_ROM) ../etherboot/eb-roms.h
> echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
>
> ifneq ($(ROMBIOS_ROM),)
> @@ -84,6 +97,30 @@
> echo "#endif" >> $@.new
> endif
>
> +ifneq ($(OVMF32_ROM),)
> + echo "#ifdef ROM_INCLUDE_OVMF32" >> $@.new
> + sh ./mkhex ovmf32 $(OVMF32_ROM) >> $@.new
> + echo "#endif" >> $@.new
> +endif
> +
> +ifneq ($(OVMF64_ROM),)
> + echo "#ifdef ROM_INCLUDE_OVMF64" >> $@.new
> + sh ./mkhex ovmf64 $(OVMF64_ROM) >> $@.new
> + echo "#endif" >> $@.new
> +endif
> +
> +ifneq ($(OVMF32_CIRRUS_VGA_ROM),)
> + echo "#ifdef ROM_INCLUDE_OVMF32_CIRRUS_VGA" >> $@.new
> + sh ./mkhex ovmf32_cirrus_vga $(OVMF32_CIRRUS_VGA_ROM) >> $@.new
> + echo "#endif" >> $@.new
> +endif
> +
> +ifneq ($(OVMF64_CIRRUS_VGA_ROM),)
> + echo "#ifdef ROM_INCLUDE_OVMF64_CIRRUS_VGA" >> $@.new
> + sh ./mkhex ovmf64_cirrus_vga $(OVMF64_CIRRUS_VGA_ROM) >> $@.new
> + echo "#endif" >> $@.new
> +endif
> +
> ifneq ($(STDVGA_ROM),)
> echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
> sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
> diff -r e298ce67777e tools/firmware/hvmloader/config.h
> --- a/tools/firmware/hvmloader/config.h Mon Jul 18 14:38:31 2011 +0100
> +++ b/tools/firmware/hvmloader/config.h Fri Jul 22 23:00:20 2011 +0800
> @@ -3,7 +3,7 @@
>
> #include <stdint.h>
>
> -enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt };
> +enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt, VGA_custom };
> extern enum virtual_vga virtual_vga;
>
> struct bios_config {
> @@ -16,6 +16,9 @@
> /* Physical address to load at */
> unsigned int bios_address;
>
> + /* Custom load function. */
> + void (*load)(const struct bios_config *config);
> + void (*pci_setup)(void);
> /* ROMS */
> int load_roms;
> unsigned int optionrom_start, optionrom_end;
> @@ -36,6 +39,8 @@
>
> extern struct bios_config rombios_config;
> extern struct bios_config seabios_config;
> +extern struct bios_config ovmf32_config;
> +extern struct bios_config ovmf64_config;
>
> #define PAGE_SHIFT 12
> #define PAGE_SIZE (1ul << PAGE_SHIFT)
> diff -r e298ce67777e tools/firmware/hvmloader/hvmloader.c
> --- a/tools/firmware/hvmloader/hvmloader.c Mon Jul 18 14:38:31 2011 +0100
> +++ b/tools/firmware/hvmloader/hvmloader.c Fri Jul 22 23:00:20 2011 +0800
> @@ -360,6 +360,8 @@
> #ifdef ENABLE_SEABIOS
> { "seabios", &seabios_config, },
> #endif
> + { "ovmf-ia32", &ovmf32_config, },
> + { "ovmf-x64", &ovmf64_config, },
> { NULL, NULL }
> };
>
> @@ -416,9 +418,13 @@
> bios->create_smbios_tables();
> }
>
> - printf("Loading %s ...\n", bios->name);
> - memcpy((void *)bios->bios_address, bios->image,
> - bios->image_size);
> + if (bios->load) {