Skip to contentSkip to conversation

Reintroduce OVMF support

PATCH Superseded Wei Liu 2 participants 8 messages Oct 29, 2013 Kbuild

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Reintroduce OVMF support

OVMF (open virtual machine firmware) is used to provide UEFI support for virtual machines. It was first introduced about a year ago but was disabled due to compilation problem. Now that the compilation problem is resolved we can reintorduce it.

OVMF tree can be pulled from
git://xenbits.xen.org/people/liuw/ovmf.git for-xenbits

Wei.

Ian Campbell (3):
tools: clone ovmf to ovmf-dir directory
tools: support system supplied ovmf binary
tools: Enable OVMF build by default

Wei Liu (2):
libxl: bump LIBXL_MAXMEM_CONSTANT to 2048
Config.mk: update OVMF changeset

 Config.mk                         |    2 +-
 Makefile                          |    4 ++++
 config/Tools.mk.in                |    1 +
 tools/configure                   |   20 +++++++++++++++-----
 tools/configure.ac                |   13 ++++++++++++-
 tools/firmware/Makefile           |   31 ++++++++++++-------------------
 tools/firmware/hvmloader/Makefile |    8 ++++++--
 tools/libxl/libxl_internal.h      |    2 +-
 8 files changed, 52 insertions(+), 29 deletions(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH v2 1/5 libxl: bump LIBXL_MAXMEM_CONSTANT to 2048

When using OVMF we need to have 1MiB of memory in place for firmware. Without this change we have:

(XEN) HVM128: Loading OVMF ...
(XEN) page_alloc.c:1460:d128 Over-allocation for domain 128: 33025 > 33024 (XEN) memory.c:132:d128 Could not allocate order=0 extent: id=128 memflags=0 (0 of 1)

This is not a fatal error as hvmloader will instead use low memory to load OVMF, but it's better to eliminate such error.

Changing this constant doesn't necessary increase the total amount of memory a guest uses because it's just a limit.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
---
 tools/libxl/libxl_internal.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/libxl_internal.h +1 -1
index 165dc00..908af20 100644
@@ -87,7 +87,7 @@
 #define LIBXL_QEMU_BODGE_TIMEOUT 2
 #define LIBXL_XENCONSOLE_LIMIT 1048576
 #define LIBXL_XENCONSOLE_PROTOCOL "vt100"
-#define LIBXL_MAXMEM_CONSTANT 1024
+#define LIBXL_MAXMEM_CONSTANT 2048
 #define LIBXL_PV_EXTRA_MEMORY 1024
 #define LIBXL_HVM_EXTRA_MEMORY 2048
 #define LIBXL_MIN_DOM0_MEM (128*1024)
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH v2 2/5 tools: clone ovmf to ovmf-dir directory

In reply to Wei Liu

From: Ian Campbell <[email protected]>

for consistency with other foo-dir e.g. qemu, seabios.

Remove obsolete ovmf-find target.

---
 Makefile                          |    4 ++++
 tools/firmware/Makefile           |   29 ++++++++++-------------------
 tools/firmware/hvmloader/Makefile |    2 +-
 3 files changed, 15 insertions(+), 20 deletions(-)
Makefile +4 -0
index d915660..4e48457 100644
@@ -110,6 +110,10 @@ endif
 tools/firmware/seabios-dir-force-update:
 	$(MAKE) -C tools/firmware seabios-dir-force-update
 
+.PHONY: tools/firmware/ovmf-dir-force-update
+tools/firmware/ovmf-dir-force-update:
+	$(MAKE) -C tools/firmware ovmf-dir-force-update
+
 .PHONY: install-docs
 install-docs:
 	$(MAKE) -C docs install
tools/firmware/Makefile +10 -19
index f064765..8633748 100644
@@ -6,7 +6,7 @@ TARGET      := hvmloader/hvmloader
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS-y :=
-SUBDIRS-$(CONFIG_OVMF) += ovmf
+SUBDIRS-$(CONFIG_OVMF) += ovmf-dir
 ifeq ($(SEABIOS_PATH),)
 SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
 endif
@@ -15,9 +15,9 @@ 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;
+ovmf-dir:
+	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf-dir
+	cp ovmf-makefile ovmf-dir/Makefile;
 
 seabios-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
@@ -52,32 +52,23 @@ subdir-distclean-etherboot: .phony
 	$(MAKE) -C etherboot distclean
 
 subdir-distclean-ovmf: .phony
-	rm -rf ovmf ovmf-remote
+	rm -rf ovmf-dir ovmf-dir-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:
+.PHONY: ovmf-dir-force-update
+ovmf-dir-force-update:
 	set -ex; \
 	if [ "$(OVMF_UPSTREAM_REVISION)" ]; then \
-		cd ovmf-remote; \
+		cd ovmf-dir-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; \
+	set -e; if test -d ovmf-dir/.; then \
+		$(MAKE) -C ovmf-dir clean; \
 	fi
 
 .PHONY: seabios-dir-force-update
tools/firmware/hvmloader/Makefile +1 -1
index 8ab1429..e27e457 100644
@@ -37,7 +37,7 @@ endif
 
 CIRRUSVGA_DEBUG ?= n
 
-OVMF_DIR := ../ovmf
+OVMF_DIR := ../ovmf-dir
 ROMBIOS_DIR := ../rombios
 SEABIOS_DIR := ../seabios-dir
 
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH v2 3/5 tools: support system supplied ovmf binary

In reply to Wei Liu

From: Ian Campbell <[email protected]>

Debian Jessie at least contains an ovmf package that includes /usr/share/ovmf/OVMF.fd. It's also possible that user may want to supply his/her own ovmf binary.

---
 config/Tools.mk.in                |    1 +
 tools/configure                   |   16 +++++++++++++---
 tools/configure.ac                |   11 +++++++++++
 tools/firmware/Makefile           |    2 ++
 tools/firmware/hvmloader/Makefile |    6 +++++-
 5 files changed, 32 insertions(+), 4 deletions(-)
config/Tools.mk.in +1 -0
index 67f5782..d9d3239 100644
@@ -24,6 +24,7 @@ BCC                 := @BCC@
 IASL                := @IASL@
 FETCHER             := @FETCHER@
 SEABIOS_PATH        := @seabios_path@
+OVMF_PATH           := @ovmf_path@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
tools/configure +13 -3
index 1da8652..22e74a7 100755
@@ -682,6 +682,7 @@ APPEND_LIB
 APPEND_INCLUDES
 PREPEND_LIB
 PREPEND_INCLUDES
+ovmf_path
 seabios_path
 qemu_xen
 qemu_traditional
@@ -768,6 +769,7 @@ enable_blktap1
 enable_qemu_traditional
 with_system_qemu
 with_system_seabios
+with_system_ovmf
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1440,6 +1442,9 @@ Optional Packages:
   --with-system-seabios[=PATH]
                           Use system supplied seabios PATH instead of building
                           and installing our own version
+  --with-system-ovmf[=PATH]
+                          Use system supplied OVMF PATH instead of building
+                          and installing our own version
 
 Some influential environment variables:
   CC          C compiler command
@@ -3771,9 +3776,14 @@ fi
 
 
 
-
-
-
+# Check whether --with-system-ovmf was given.
+if test "${with_system_ovmf+set}" = set; then :
+  withval=$with_system_ovmf;
+    case $withval in
+        no) ovmf_path= ;;
+        *)  ovmf_path=$withval ;;
+    esac
+fi
 
 
 for cppflag in $PREPEND_INCLUDES
tools/configure.ac +11 -0
index 4f3c33a..b2941a4 100644
@@ -108,6 +108,17 @@ AC_ARG_WITH([system-seabios],
 ],[])
 AC_SUBST(seabios_path)
 
+AC_ARG_WITH([system-ovmf],
+    AS_HELP_STRING([--with-system-ovmf@<:@=PATH@:>@],
+       [Use system supplied OVMF PATH instead of building and installing
+        our own version]),[
+    case $withval in
+        no) ovmf_path= ;;
+        *)  ovmf_path=$withval ;;
+    esac
+],[])
+AC_SUBST(ovmf_path)
+
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
 AC_ARG_VAR([PREPEND_LIB],
tools/firmware/Makefile +2 -0
index 8633748..cb13212 100644
@@ -6,7 +6,9 @@ TARGET      := hvmloader/hvmloader
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS-y :=
+ifeq ($(OVMF_PATH),)
 SUBDIRS-$(CONFIG_OVMF) += ovmf-dir
+endif
 ifeq ($(SEABIOS_PATH),)
 SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
 endif
tools/firmware/hvmloader/Makefile +5 -1
index e27e457..00ee952 100644
@@ -56,7 +56,11 @@ ROMS :=
 ifeq ($(CONFIG_OVMF),y)
 OBJS += ovmf.o
 CFLAGS += -DENABLE_OVMF
-OVMF_ROM := $(OVMF_DIR)/ovmf.bin
+ifeq ($(OVMF_PATH),)
+	OVMF_ROM := $(OVMF_DIR)/ovmf.bin
+else
+	OVMF_ROM := $(OVMF_PATH)
+endif
 ROMS += $(OVMF_ROM)
 endif
 
Signature · 1 line
1.7.10.4
author
#4 lore raw

PATCH v2 4/5 tools: Enable OVMF build by default

In reply to Wei Liu

From: Ian Campbell <[email protected]>

The issues with non-GCC4.4 builds seem to have been resolved.

---
 tools/configure    |    4 ++--
 tools/configure.ac |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
tools/configure +2 -2
index 22e74a7..eb58bcd 100755
@@ -1422,7 +1422,7 @@ Optional Features:
   --enable-xenapi         Enable Xen API Bindings (default is DISABLED)
   --disable-ocamltools    Disable Ocaml tools (default is ENABLED)
   --disable-xsmpolicy     Disable XSM policy compilation (default is ENABLED)
-  --enable-ovmf           Enable OVMF (default is DISABLED)
+  --disable-ovmf          Enable OVMF (default is ENABLED)
   --disable-rombios       Disable ROM BIOS (default is ENABLED)
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-debug         Disable debug build of tools (default is ENABLED)
@@ -3584,7 +3584,7 @@ elif test "x$enable_ovmf" = "xyes"; then :
 
 elif test -z $ax_cv_ovmf; then :
 
-    ax_cv_ovmf="n"
+    ax_cv_ovmf="y"
 
 fi
 ovmf=$ax_cv_ovmf
tools/configure.ac +1 -1
index b2941a4..86fcb28 100644
@@ -53,7 +53,7 @@ AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
 AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings])
 AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
-AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
+AX_ARG_DEFAULT_ENABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([rombios], [Disable ROM BIOS])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
Signature · 1 line
1.7.10.4
#5 lore raw

Re: [PATCH V2 4/5] tools: Enable OVMF build by default

Quoted 4 lines
Quoted 1 line
Quoted 1 line · Wei Liu

From: Ian Campbell <[email protected]>

The issues with non-GCC4.4 builds seem to have been resolved.

Shouldn't this come _after_ the changeset update patch then?

Jan

author
#6 lore raw

Re: [PATCH V2 4/5] tools: Enable OVMF build by default

Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Wei Liu

From: Ian Campbell <[email protected]>

The issues with non-GCC4.4 builds seem to have been resolved.

Shouldn't this come _after_ the changeset update patch then?

Oops, my bad. Will resend this series in right order.

Wei.

Quoted 1 line

Jan

author
#7 lore raw

PATCH v2 5/5 Config.mk: update OVMF changeset

In reply to Wei Liu
---
 Config.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Config.mk +1 -1
index 1879454..dad2dc4 100644
@@ -232,7 +232,7 @@ OVMF_UPSTREAM_URL ?= git://xenbits.xen.org/ovmf.git
 QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/qemu-upstream-unstable.git
 SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 endif
-OVMF_UPSTREAM_REVISION ?= b0855f925c6e2e0b21fbb03fab4b5fb5b6876871
+OVMF_UPSTREAM_REVISION ?= a93b0e3f6895a074b99c8817181dfa6dbc7a4807
 QEMU_UPSTREAM_REVISION ?= 1c514a7734b7f98625a0d18d5e8ee7581f26e50c
 SEABIOS_UPSTREAM_TAG ?= rel-1.7.3.1
 # Fri Aug 2 14:12:09 2013 -0400
Signature · 1 line
1.7.10.4