Skip to contentSkip to conversation

Add UEFI firmware for qemux86*

PATCH Superseded [email protected] 3 participants 8 messages Jun 17, 2015 – Jul 8, 2015

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add UEFI firmware for qemux86*

From: Leonardo Sandoval <[email protected]>

These two patches include:

1. Recipe: Including the OVMF recipe (taken from luv-yocto repository) on Poky
2. Boot script: Instrumenting runqemu to include OECORE_MACHINE_SYSROOT, so the OVMF BIOS can be found.

[YOCTO #5654]

The following changes since commit 062678c4ab88fa94ed38efa6520c3b4e2d88ca73:

sysvinit: Only enable recipe in builds where its applicable (2015-06-10 12:03:19 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib lsandov1/efi-qemux86
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lsandov1/efi-qemux86

Leonardo Sandoval (2):
ovmf: Recipe taken from luv-yocto repository
runqemu: Define OECORE_MACHINE_SYSROOT on setup_sysroot

 ...s-Force-tools-variables-to-host-toolchain.patch | 50 ++++++++++++++++++
 meta/recipes-core/ovmf/ovmf_git.bb                 | 61 ++++++++++++++++++++++
 scripts/runqemu                                    | 13 ++++-
 3 files changed, 123 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
 create mode 100644 meta/recipes-core/ovmf/ovmf_git.bb
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH 1/2 ovmf: Recipe taken from luv-yocto repository

From: Leonardo Sandoval <[email protected]>

OVMF metadata taken from the luv-yocto[1] repository and copied into Poky's meta layer.

[1] https://github.com/01org/luv-yocto/tree/master/meta-luv/recipes-core/ovmf

[YOCTO #5654]

---
 ...s-Force-tools-variables-to-host-toolchain.patch | 50 ++++++++++++++++++
 meta/recipes-core/ovmf/ovmf_git.bb                 | 61 ++++++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
 create mode 100644 meta/recipes-core/ovmf/ovmf_git.bb
meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch new file +50 -0
new file mode 100644
index 0000000..94c4d4c
@@ -0,0 +1,50 @@
+From 6e24bde1979c2d7149b37d142fb882dfde0e9770 Mon Sep 17 00:00:00 2001
+From: Matt Fleming <[email protected]>
+Date: Fri, 27 Jun 2014 11:12:18 +0100
+Subject: [PATCH] BaseTools: Force tools variables to host toolchain
+
+Upstream-Status: Pending
+
+Signed-off-by: Matt Fleming <[email protected]>
+---
+ BaseTools/Source/C/Makefiles/app.makefile | 7 +++++++
+ BaseTools/Source/C/VfrCompile/GNUmakefile | 5 +++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile
+index 19269a1..62aad0f 100644
+--- a/BaseTools/Source/C/Makefiles/app.makefile
++++ b/BaseTools/Source/C/Makefiles/app.makefile
+@@ -16,6 +16,13 @@ include $(MAKEROOT)/Makefiles/header.makefile
+ 
+ APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+ 
++CC = gcc
++CXX = g++
++AS = gcc
++AR = ar
++LD = ld
++LINKER = $(CC)
++
+ .PHONY:all
+ all: $(MAKEROOT)/bin $(APPLICATION) 
+ 
+diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
+index 82005e1..5ac5f7e 100644
+--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
++++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
+@@ -26,6 +26,11 @@ OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyn
+ 
+ VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(CPPFLAGS)
+ 
++CC = gcc
++CXX = g++
++AS = gcc
++AR = ar
++LD = ld
+ LINKER = $(CXX)
+ 
+ EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
+-- 
+1.9.0
+
meta/recipes-core/ovmf/ovmf_git.bb new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.8.4.5
#2 lore raw

Re: [PATCH 1/2] ovmf: Recipe taken from luv-yocto repository

Quoted 4 lines · On 06/17/2015 02:43 AM, [email protected] wrote:

From: Leonardo Sandoval <[email protected]>

OVMF metadata taken from the luv-yocto[1] repository and copied into Poky's meta layer.

What is Poky?

Quoted 137 lines

[1] https://github.com/01org/luv-yocto/tree/master/meta-luv/recipes-core/ovmf

[YOCTO #5654]

---
 ...s-Force-tools-variables-to-host-toolchain.patch | 50 ++++++++++++++++++
 meta/recipes-core/ovmf/ovmf_git.bb                 | 61 ++++++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
 create mode 100644 meta/recipes-core/ovmf/ovmf_git.bb
meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch new file +50 -0
new file mode 100644
index 0000000..94c4d4c
@@ -0,0 +1,50 @@
+From 6e24bde1979c2d7149b37d142fb882dfde0e9770 Mon Sep 17 00:00:00 2001
+From: Matt Fleming <[email protected]>
+Date: Fri, 27 Jun 2014 11:12:18 +0100
+Subject: [PATCH] BaseTools: Force tools variables to host toolchain
+
+Upstream-Status: Pending
+
+Signed-off-by: Matt Fleming <[email protected]>
+---
+ BaseTools/Source/C/Makefiles/app.makefile | 7 +++++++
+ BaseTools/Source/C/VfrCompile/GNUmakefile | 5 +++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile
+index 19269a1..62aad0f 100644
+--- a/BaseTools/Source/C/Makefiles/app.makefile
++++ b/BaseTools/Source/C/Makefiles/app.makefile
+@@ -16,6 +16,13 @@ include $(MAKEROOT)/Makefiles/header.makefile
+ 
+ APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+ 
++CC = gcc
++CXX = g++
++AS = gcc
++AR = ar
++LD = ld
++LINKER = $(CC)
++
+ .PHONY:all
+ all: $(MAKEROOT)/bin $(APPLICATION) 
+ 
+diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
+index 82005e1..5ac5f7e 100644
+--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
++++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
+@@ -26,6 +26,11 @@ OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyn
+ 
+ VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(CPPFLAGS)
+ 
++CC = gcc
++CXX = g++
++AS = gcc
++AR = ar
++LD = ld
+ LINKER = $(CXX)
+ 
+ EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
+-- 
+1.9.0
+
meta/recipes-core/ovmf/ovmf_git.bb new file +61 -0
new file mode 100644
index 0000000..ce7e4f8
@@ -0,0 +1,61 @@
+DESCRIPTION = "OVMF - UEFI firmware for Qemu and KVM"
+HOMEPAGE = "http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=ffd52cf9a8e0e036b9a61a0de2dc87ed"
+
+SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \
+	file://0001-BaseTools-Force-tools-variables-to-host-toolchain.patch"
+
+SRCREV="dc4ad1532e59fd1a185d6b90d1c2a92cf8713f40"
+
+S = "${WORKDIR}/git"
+
+DEPENDS_class-native="util-linux-native iasl-native"
+
+# OVMF has trouble building with the default optimization of -O2.
+BUILD_OPTIMIZATION="-pipe"
+
+# OVMF supports IA only, although it could conceivably support ARM someday.
+COMPATIBLE_HOST='(i.86|x86_64).*'
+
+do_patch_append() {
+    bb.build.exec_func('do_fix_iasl', d)
+    bb.build.exec_func('do_fix_toolchain', d)
+}
+
+do_fix_iasl() {
+    sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template
+}
+
+do_fix_toolchain(){
+    sed -i -e 's#DEF(ELFGCC_BIN)/#${TARGET_PREFIX}#' ${S}/BaseTools/Conf/tools_def.template
+    sed -i -e 's#DEF(GCC.*PREFIX)#${TARGET_PREFIX}#' ${S}/BaseTools/Conf/tools_def.template
+    sed -i -e "s#^LINKER\(.*\)#LINKER\1\nLFLAGS += ${BUILD_LDFLAGS}#" ${S}/BaseTools/Source/C/Makefiles/app.makefile
+    sed -i -e "s#^LINKER\(.*\)#LINKER\1\nCFLAGS += ${BUILD_CFLAGS}#" ${S}/BaseTools/Source/C/Makefiles/app.makefile
+    sed -i -e "s#^LINKER\(.*\)#LINKER\1\nLFLAGS += ${BUILD_LDFLAGS}#" ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
+    sed -i -e "s#^LINKER\(.*\)#LINKER\1\nCFLAGS += ${BUILD_CFLAGS}#" ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
+}
+
+GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}' | awk -F. '{print $1$2}')"
+
+do_compile() {
+    export LFLAGS="${LDFLAGS}"
+    OVMF_ARCH="X64"
+    if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+        OVMF_ARCH="IA32"
+    fi
+    ${S}/OvmfPkg/build.sh -a $OVMF_ARCH -b RELEASE -t GCC${GCC_VER}
+}
+
+do_install() {
+    OVMF_DIR_SUFFIX="X64"
+    if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+        OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
+    fi
+    install -d ${D}${datadir}/ovmf
+    build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_GCC${GCC_VER}"
+    install -m 0755 ${build_dir}/FV/OVMF.fd \
+	${D}${datadir}/ovmf/bios.bin
+}
+
+BBCLASSEXTEND = "native"
#3 lore raw

Re: [PATCH 1/2] ovmf: Recipe taken from luv-yocto repository

Quoted 9 lines · Philip Balister
Quoted 4 lines · On 06/17/2015 02:43 AM, [email protected] wrote:

From: Leonardo Sandoval <[email protected]>

OVMF metadata taken from the luv-yocto[1] repository and copied into Poky's meta layer.

What is Poky?

You are right, I meant openembedded (OE)

Quoted 6 lines
Quoted 6 lines

[1] https://github.com/01org/luv-yocto/tree/master/meta-luv/recipes-core/ovmf

[YOCTO #5654]

#4 lore raw

PATCH 2/2 runqemu: Define OECORE_MACHINE_SYSROOT on setup_sysroot

In reply to [email protected]

From: Leonardo Sandoval <[email protected]>

At least the OVFM (UEFI Firmware for Qemu and KVM) recipe stores the BIOS under $OE_TMPDIR/sysroots/$MACHINE, now defined as OECORE_MACHINE_SYSROOT. The latter is used when searching BIOS, VGA BIOS and keymaps. As a example, to boot a OVFM BIOS, one can run the following command:

$ runqemu qemux86 core-image-minimal \
    biosdir=usr/share/ovmf  \
    biosfilename=bios.bin \
    nographic

Note the bios* parameters: these two are needed to specify the subfolder (parent folder is OECORE_MACHINE_SYSROOT) and BIOS filename (without it, it picks a BIOS named bios-256k.bin).

[YOCTO #5654]

---
 scripts/runqemu | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
scripts/runqemu +12 -1
index 84ece4d..155824b 100755
@@ -397,6 +397,13 @@ setup_sysroot() {
 
         OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
     fi 
+
+    # Some recipes store the BIOS under $OE_TMPDIR/sysroots/$MACHINE,
+    # now defined as OECORE_MACHINE_SYSROOT. The latter is used when searching
+    # BIOS, VGA BIOS and keymaps.
+    if [ -z "$OECORE_MACHINE_SYSROOT" ]; then
+        OECORE_MACHINE_SYSROOT=$OE_TMPDIR/sysroots/$MACHINE
+    fi
 }
 
 # Locate a rootfs image to boot which matches our expected
@@ -486,7 +493,7 @@ fi
 echo "FSTYPE: [$FSTYPE]"
 
 setup_sysroot
-# OECORE_NATIVE_SYSROOT is now set for all cases
+# OECORE_NATIVE_SYSROOT and OECORE_MACHINE_SYSROOT are now set for all cases
 
 INTERNAL_SCRIPT="$0-internal"
 if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
@@ -498,10 +505,14 @@ if [ ! -z "$CUSTOMBIOSDIR" ]; then
     if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then
         echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
         SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
+    elif [ -d "$OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR" ]; then
+        echo "Assuming biosdir is $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
+        SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
     else
         if [ ! -d "$CUSTOMBIOSDIR" ]; then
             echo "Custom BIOS directory not found. Tried: $CUSTOMBIOSDIR"
             echo "and $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
+            echo "and $OECORE_MACHINE_SYSROOT/$CUSTOMBIOSDIR"
             exit 1;
         fi
         echo "Assuming biosdir is $CUSTOMBIOSDIR"
Signature · 1 line
1.8.4.5
#5 lore raw
In reply to [email protected]

ping

Quoted 30 lines · On 06/17/2015 01:43 AM, [email protected] wrote:

From: Leonardo Sandoval <[email protected]>

These two patches include:

1. Recipe: Including the OVMF recipe (taken from luv-yocto repository) on Poky
2. Boot script: Instrumenting runqemu to include OECORE_MACHINE_SYSROOT, so the OVMF BIOS can be found.

[YOCTO #5654]

The following changes since commit 062678c4ab88fa94ed38efa6520c3b4e2d88ca73:

sysvinit: Only enable recipe in builds where its applicable (2015-06-10 12:03:19 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib lsandov1/efi-qemux86
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lsandov1/efi-qemux86

Leonardo Sandoval (2):
ovmf: Recipe taken from luv-yocto repository
runqemu: Define OECORE_MACHINE_SYSROOT on setup_sysroot

  ...s-Force-tools-variables-to-host-toolchain.patch | 50 ++++++++++++++++++
  meta/recipes-core/ovmf/ovmf_git.bb                 | 61 ++++++++++++++++++++++
  scripts/runqemu                                    | 13 ++++-
  3 files changed, 123 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch create mode 100644 meta/recipes-core/ovmf/ovmf_git.bb

#6 lore raw
Quoted 1 line · Leonardo Sandoval

ping

There was a piece of feedback on the series which you've not done anything about?

Cheers,

Richard

#7 lore raw

Feedback was related to the one of the commit's log (I used the word Poky instead of OE-Core). I will send a V2 patch and send it.

Leo

Quoted 10 lines · Richard Purdie
Quoted 1 line · Leonardo Sandoval

ping

There was a piece of feedback on the series which you've not done anything about?

Cheers,

Richard