diff options
Diffstat (limited to 'recipes-core/ovmf')
-rw-r--r-- | recipes-core/ovmf/ovmf_git.bbappend | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/recipes-core/ovmf/ovmf_git.bbappend b/recipes-core/ovmf/ovmf_git.bbappend new file mode 100644 index 0000000..9fc7cb7 --- /dev/null +++ b/recipes-core/ovmf/ovmf_git.bbappend | |||
@@ -0,0 +1,112 @@ | |||
1 | # Overwrite the "do_compile" step in order to support AARCH64 targets. | ||
2 | |||
3 | COMPATIBLE_HOST='(i.86|x86_64|aarch64).*' | ||
4 | |||
5 | do_compile_class-target() { | ||
6 | export LFLAGS="${LDFLAGS}" | ||
7 | PARALLEL_JOBS="${@ '${PARALLEL_MAKE}'.replace('-j', '-n ')}" | ||
8 | OVMF_ARCH="X64" | ||
9 | if [ "${TARGET_ARCH}" != "x86_64" ] ; then | ||
10 | OVMF_ARCH="IA32" | ||
11 | fi | ||
12 | if [ "${TARGET_ARCH}" = "aarch64" ] ; then | ||
13 | OVMF_ARCH="AARCH64" | ||
14 | fi | ||
15 | |||
16 | # The build for the target uses BaseTools/Conf/tools_def.template | ||
17 | # from ovmf-native to find the compiler, which depends on | ||
18 | # exporting HOST_PREFIX. | ||
19 | export HOST_PREFIX="${HOST_PREFIX}" | ||
20 | |||
21 | # BaseTools/Conf gets copied to Conf, but only if that does not | ||
22 | # exist yet. To ensure that an updated template gets used during | ||
23 | # incremental builds, we need to remove the copy before we start. | ||
24 | rm -f `ls ${S}/Conf/*.txt | grep -v ReadMe.txt` | ||
25 | |||
26 | # ${WORKDIR}/ovmf is a well-known location where do_install and | ||
27 | # do_deploy will be able to find the files. | ||
28 | rm -rf ${WORKDIR}/ovmf | ||
29 | mkdir ${WORKDIR}/ovmf | ||
30 | OVMF_DIR_SUFFIX="X64" | ||
31 | if [ "${TARGET_ARCH}" != "x86_64" ] ; then | ||
32 | OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization | ||
33 | fi | ||
34 | if [ "${TARGET_ARCH}" = "aarch64" ] ; then | ||
35 | OVMF_DIR_SUFFIX="AArch64" # Note the different capitalization | ||
36 | fi | ||
37 | |||
38 | FIXED_GCCVER=$(fixup_target_tools ${GCC_VER}) | ||
39 | bbnote FIXED_GCCVER is ${FIXED_GCCVER} | ||
40 | |||
41 | if [ "${TARGET_ARCH}" = "aarch64" ] ; then | ||
42 | build_dir="${S}/Build/ArmVirtQemu-AARCH64/RELEASE_${FIXED_GCCVER}" | ||
43 | bbnote "Building without Secure Boot." | ||
44 | rm -rf ${S}/Build/ArmVirtQemu-AARCH64 | ||
45 | |||
46 | # If the local BaseTools directory is not found, the EDK_TOOLS_PATH | ||
47 | # variable is used to determine the location of the toolchain | ||
48 | rm -rf ${S}/BaseTools | ||
49 | export EDK_TOOLS_PATH=${WORKDIR}/recipe-sysroot-native/usr/bin/edk2_basetools/BaseTools | ||
50 | bash -c "(source ${S}/edksetup.sh; GCC5_AARCH64_PREFIX=aarch64-poky-linux- build -a AARCH64 -p ArmVirtPkg/ArmVirtQemu.dsc -t GCC5 -b RELEASE)" | ||
51 | else | ||
52 | build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}" | ||
53 | bbnote "Building without Secure Boot." | ||
54 | rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX | ||
55 | |||
56 | ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} | ||
57 | ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd | ||
58 | ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd | ||
59 | ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd | ||
60 | fi | ||
61 | |||
62 | ln ${build_dir}/${OVMF_ARCH}/Shell.efi ${WORKDIR}/ovmf/ | ||
63 | |||
64 | if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then | ||
65 | # See CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt and | ||
66 | # https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/ for | ||
67 | # building with Secure Boot enabled. | ||
68 | bbnote "Building with Secure Boot." | ||
69 | rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX | ||
70 | ln -sf ${OPENSSL_RELEASE} ${S}/CryptoPkg/Library/OpensslLib/openssl | ||
71 | ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${OVMF_SECURE_BOOT_FLAGS} | ||
72 | ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd | ||
73 | ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd | ||
74 | ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/ | ||
75 | fi | ||
76 | } | ||
77 | |||
78 | do_install_class-target() { | ||
79 | if [ "${TARGET_ARCH}" = "aarch64" ] ; then | ||
80 | FIXED_GCCVER=$(fixup_target_tools ${GCC_VER}) | ||
81 | build_dir="${S}/Build/ArmVirtQemu-AARCH64/RELEASE_${FIXED_GCCVER}" | ||
82 | |||
83 | install -d ${D}/usr/share/qemu | ||
84 | install -m 766 ${build_dir}/FV/QEMU_EFI.fd ${D}/usr/share/qemu/AAVMF_CODE.fd | ||
85 | install -m 766 ${build_dir}/FV/QEMU_VARS.fd ${D}/usr/share/qemu/AAVMF_VARS.fd | ||
86 | else | ||
87 | # Content for UEFI shell iso. We install the EFI shell as | ||
88 | # bootx64/ia32.efi because then it can be started even when the | ||
89 | # firmware itself does not contain it. | ||
90 | install -d ${D}/efi/boot | ||
91 | install ${WORKDIR}/ovmf/Shell.efi ${D}/efi/boot/boot${@ "ia32" if "${TARGET_ARCH}" != "x86_64" else "x64"}.efi | ||
92 | if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then | ||
93 | install ${WORKDIR}/ovmf/EnrollDefaultKeys.efi ${D} | ||
94 | fi | ||
95 | fi | ||
96 | } | ||
97 | |||
98 | FILES_${PN}_class-target_aarch64 += "/usr/share/qemu/" | ||
99 | |||
100 | do_deploy_class-target() { | ||
101 | if [ "${TARGET_ARCH}" != "aarch64" ] ; then | ||
102 | # For use with "runqemu ovmf". | ||
103 | for i in \ | ||
104 | ovmf \ | ||
105 | ovmf.code \ | ||
106 | ovmf.vars \ | ||
107 | ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'ovmf.secboot ovmf.secboot.code', '', d)} \ | ||
108 | ; do | ||
109 | qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/$i.fd ${DEPLOYDIR}/$i.qcow2 | ||
110 | done | ||
111 | fi | ||
112 | } | ||