qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RfC PATCH 2/3] edk2: add build script and rules


From: Gerd Hoffmann
Subject: [Qemu-devel] [RfC PATCH 2/3] edk2: add build script and rules
Date: Wed, 23 Nov 2016 14:24:43 +0100

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]