[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH]Load the cirrus vga rom for the OVMF UEFI support in hvmloader



Hi All,

Now, OVMF UEFI can boot on the Xen hvmloader. But, there is no VGA bios for OVMF from the source code hvmloader/ovmf.c in the upstream Xen. 
I have tried the vgabios provided by Xen, but I can see nothing through the vnc client or sdl graphic window. Actually, if we check the boot trace log of OVMF, we find that OVMF has booted into the OS installer grub. 
When I try the cirrus_vga bios (named OvmfVideo.rom in edk2) provided by OVMF, I can see the OVMF boot successfully through the vnc client or sdl graphic window. 

So, this patch makes the hvmloader load the cirrus_vga bios for OVMF on Xen. Any suggestions and comments are appreciated.


diff -r 4e1d091d10d8 tools/firmware/Makefile
--- a/tools/firmware/Makefile Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/Makefile Thu Mar 22 15:47:22 2012 +0800
@@ -6,12 +6,17 @@
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS-y :=
+SUBDIRS-$(CONFIG_OVMF) += ovmf
 SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
 SUBDIRS-$(CONFIG_ROMBIOS) += rombios
 SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
 SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
 SUBDIRS-y += hvmloader
 
+ovmf:
+ GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf
+ cp ovmf-makefile ovmf/Makefile;
+
 seabios-dir:
  GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
  cp seabios-config seabios-dir/.config;
@@ -44,9 +49,35 @@
 subdir-distclean-etherboot: .phony
  $(MAKE) -C etherboot distclean
 
+subdir-distclean-ovmf: .phony
+ rm -rf ovmf ovmf-remote
+
 subdir-distclean-seabios-dir: .phony
  rm -rf seabios-dir seabios-dir-remote
 
+.PHONY: ovmf-find
+ovmf-find:
+ if test -d $(OVMF_UPSTREAM_URL) ; then \
+ mkdir -p ovmf; \
+ else \
+ export GIT=$(GIT); \
+ $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf ; \
+ fi
+
+.PHONY: ovmf-force-update
+ovmf-force-update:
+ set -ex; \
+ if [ "$(OVMF_UPSTREAM_REVISION)" ]; then \
+ cd ovmf-remote; \
+ $(GIT) fetch origin; \
+ $(GIT) reset --hard $(OVMF_UPSTREAM_REVISION); \
+ fi
+
+subdir-clean-ovmf:
+ set -e; if test -d ovmf/.; then \
+ $(MAKE) -C ovmf clean; \
+ fi
+
 .PHONY: seabios-dir-force-update
 seabios-dir-force-update:
  set -ex; \
diff -r 4e1d091d10d8 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile Thu Mar 22 15:47:22 2012 +0800
@@ -57,7 +57,8 @@
 OBJS += ovmf.o
 CFLAGS += -DENABLE_OVMF
 OVMF_ROM := $(OVMF_DIR)/ovmf.bin
-ROMS += $(OVMF_ROM)
+OVMF_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-cirrus-vga.bin
+ROMS += $(OVMF_ROM) $(OVMF_CIRRUS_VGA_ROM)
 endif
 
 ifeq ($(CONFIG_ROMBIOS),y)
@@ -122,6 +123,11 @@
  sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> $@.new
  echo "#endif" >> $@.new
 endif
+ifneq ($(OVMF_CIRRUS_VGA_ROM),)
+ echo "#ifdef ROM_INCLUDE_OVMF_CIRRUS_VGA" >> $@.new
+ sh ./mkhex ovmf_cirrus_vga $(OVMF_CIRRUS_VGA_ROM) >> $@.new
+ echo "#endif" >> $@.new
+endif
 
  mv $@.new $@
 
diff -r 4e1d091d10d8 tools/firmware/hvmloader/ovmf.c
--- a/tools/firmware/hvmloader/ovmf.c Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/hvmloader/ovmf.c Thu Mar 22 15:47:22 2012 +0800
@@ -36,6 +36,7 @@
 #include <xen/memory.h>
 
 #define ROM_INCLUDE_OVMF
+#define ROM_INCLUDE_OVMF_CIRRUS_VGA
 #include "roms.inc"
 
 #define OVMF_BEGIN              0xFFF00000ULL
@@ -55,6 +56,12 @@
     xen_pfn_t mfn;
     uint64_t addr = OVMF_BEGIN;
 
+    /* Copy video ROM. */
+    memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+     ovmf_cirrus_vga, sizeof(ovmf_cirrus_vga));
+    printf("OVMF Cirrus [0x%x-0x%x]\n", VGABIOS_PHYSICAL_ADDRESS,
+        VGABIOS_PHYSICAL_ADDRESS + sizeof(ovmf_cirrus_vga));
+
     /* Copy low-reset vector portion. */
     memcpy((void *) LOWCHUNK_BEGIN, (uint8_t *) config->image
            + OVMF_SIZE


Best Regards,
Bei Guan

Attachment: ovmf-on-xen.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.