From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [RfC PATCH 2/3] edk2: add build script and rules
Date: Wed, 23 Nov 2016 14:24:43 +0100 [thread overview]
Message-ID: <1479907484-4988-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1479907484-4988-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
roms/Makefile | 28 ++++++++++++++++++++++++-
roms/compile-edk2.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+), 1 deletion(-)
create mode 100755 roms/compile-edk2.sh
diff --git a/roms/Makefile b/roms/Makefile
index b5e5a69..be20fe4 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -37,6 +37,8 @@ find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1))))
powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64)
powerpc_cross_prefix := $(call find-cross-prefix,powerpc)
x86_64_cross_prefix := $(call find-cross-prefix,x86_64)
+arm_cross_prefix := $(call find-cross-prefix,arm)
+aarch64_cross_prefix := $(call find-cross-prefix,aarch64)
# tag our seabios builds
SEABIOS_EXTRAVERSION="-prebuilt.qemu-project.org"
@@ -151,7 +153,31 @@ skiboot:
$(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix)
cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
-clean:
+
+edk2: edk2-ovmf32 edk2-ovmf64 edk2-arm edk2-aarch64
+
+edk2-ovmf32:
+ sh ./compile-edk2.sh i386 $(x86_64_cross_prefix)
+
+edk2-ovmf64:
+ sh ./compile-edk2.sh x86_64 $(x86_64_cross_prefix)
+
+edk2-arm:
+ sh ./compile-edk2.sh arm $(arm_cross_prefix)
+
+edk2-aarch64:
+ sh ./compile-edk2.sh aarch64 $(aarch64_cross_prefix)
+
+edk2-clean:
+ make -C edk2/BaseTools clean
+ rm -rf edk2/Build
+ rm -rf edk2/Conf/BuildEnv.sh
+ rm -rf edk2/Conf/build_rule.txt
+ rm -rf edk2/Conf/target.txt
+ rm -rf edk2/Conf/tools_def.txt
+
+
+clean: edk2-clean
rm -rf seabios/.config seabios/out seabios/builds
$(MAKE) -C vgabios clean
rm -f vgabios/VGABIOS-lgpl-latest*
diff --git a/roms/compile-edk2.sh b/roms/compile-edk2.sh
new file mode 100755
index 0000000..1339028
--- /dev/null
+++ b/roms/compile-edk2.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# args
+arch="$1"
+cross="$2"
+
+# figure gcc version, set cross build prefix vars
+gccver=$(${cross}gcc --version \
+ | awk '{ print $3; exit}' \
+ | cut -d. -f1,2 \
+ | tr -d ".")
+case "$gccver" in
+4*) # nothing, keep "4x"
+ ;;
+5* | 6*)
+ gccver=5
+ ;;
+esac
+toolchain="GCC$gccver"
+eval "export GCC${gccver}_X64_PREFIX=${cross}"
+eval "export GCC${gccver}_ARM_PREFIX=${cross}"
+eval "export GCC${gccver}_AARCH64_PREFIX=${cross}"
+
+# what we are going to build?
+case "$arch" in
+i386)
+ barch="IA32"
+ project="OvmfPkg/OvmfPkgIa32.dsc"
+ match="OvmfIa32/*/FV/OVMF_*.fd"
+ ;;
+x86_64)
+ barch="X64"
+ project="OvmfPkg/OvmfPkgX64.dsc"
+ match="OvmfX64/*/FV/OVMF_*.fd"
+ ;;
+arm | aarch64)
+ barch="$(echo $arch | tr 'a-z' 'A-Z')"
+ project="ArmVirtPkg/ArmVirtQemu.dsc"
+ match="ArmVirtQemu-${barch}/*/FV/QEMU_*.fd"
+ ;;
+esac
+
+# setup edk2 build environment
+cd edk2
+source ./edksetup.sh --reconfig
+bopts=""
+bopts="$bopts -t $toolchain"
+bopts="$bopts -D HTTP_BOOT_ENABLE"
+bopts="$bopts -a $barch"
+bopts="$bopts -p $project"
+
+# go build everything
+make -C BaseTools || exit 1
+build $bopts || exit 1
+
+# copy over results
+dest="../../pc-bios/edk2-${arch}"
+mkdir -p "$dest"
+cp -v Build/${match} "$dest"
--
1.8.3.1
next prev parent reply other threads:[~2016-11-23 13:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 13:24 [Qemu-devel] [RfC PATCH 0/3] edk2: add efi firmware builds Gerd Hoffmann
2016-11-23 13:24 ` [Qemu-devel] [RfC PATCH 1/3] edk2: add submodule Gerd Hoffmann
2016-11-23 13:24 ` Gerd Hoffmann [this message]
2016-11-23 13:24 ` [Qemu-devel] [RfC PATCH 3/3] edk2: use EfiRom utility from edk2 submodule Gerd Hoffmann
2016-11-23 14:54 ` [Qemu-devel] [RfC PATCH 0/3] edk2: add efi firmware builds Daniel P. Berrange
2016-11-28 10:07 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479907484-4988-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).