]>
Commit | Line | Data |
---|---|---|
77db55fc LE |
1 | #!/bin/bash |
2 | ||
3 | # Build script that determines the edk2 toolchain to use, invokes the edk2 | |
4 | # "build" utility, and copies the built UEFI binary to the requested location. | |
5 | # | |
6 | # Copyright (C) 2019, Red Hat, Inc. | |
7 | # | |
8 | # This program and the accompanying materials are licensed and made available | |
9 | # under the terms and conditions of the BSD License that accompanies this | |
10 | # distribution. The full text of the license may be found at | |
11 | # <http://opensource.org/licenses/bsd-license.php>. | |
12 | # | |
13 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT | |
14 | # WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
15 | ||
16 | set -e -u -C | |
17 | ||
18 | # Save the command line arguments. We need to reset $# to 0 before sourcing | |
19 | # "edksetup.sh", as it will inherit $@. | |
20 | program_name=$(basename -- "$0") | |
21 | edk2_dir=$1 | |
22 | dsc_component=$2 | |
23 | emulation_target=$3 | |
24 | uefi_binary=$4 | |
25 | shift 4 | |
26 | ||
27 | # Set up the environment for edk2 building. | |
28 | export PACKAGES_PATH=$(realpath -- "$edk2_dir") | |
29 | export WORKSPACE=$PWD | |
30 | mkdir -p Conf | |
31 | ||
174404af LE |
32 | # Work around <https://bugzilla.tianocore.org/show_bug.cgi?id=1607>. |
33 | export PYTHON_COMMAND=python2 | |
34 | ||
77db55fc LE |
35 | # Source "edksetup.sh" carefully. |
36 | set +e +u +C | |
37 | source "$PACKAGES_PATH/edksetup.sh" | |
38 | ret=$? | |
39 | set -e -u -C | |
40 | if [ $ret -ne 0 ]; then | |
41 | exit $ret | |
42 | fi | |
43 | ||
65a109ab LE |
44 | # Fetch some option arguments, and set the cross-compilation environment (if |
45 | # any), for the edk2 "build" utility. | |
46 | source "$edk2_dir/../edk2-funcs.sh" | |
47 | edk2_arch=$(qemu_edk2_get_arch "$emulation_target") | |
48 | edk2_toolchain=$(qemu_edk2_get_toolchain "$emulation_target") | |
49 | qemu_edk2_set_cross_env "$emulation_target" | |
77db55fc LE |
50 | |
51 | # Build the UEFI binary | |
52 | mkdir -p log | |
53 | build \ | |
54 | --arch="$edk2_arch" \ | |
55 | --buildtarget=DEBUG \ | |
56 | --platform=UefiTestToolsPkg/UefiTestToolsPkg.dsc \ | |
57 | --tagname="$edk2_toolchain" \ | |
58 | --module="UefiTestToolsPkg/$dsc_component/$dsc_component.inf" \ | |
59 | --log="log/$dsc_component.$edk2_arch.log" \ | |
60 | --report-file="log/$dsc_component.$edk2_arch.report" | |
61 | cp -a -- \ | |
62 | "Build/UefiTestTools/DEBUG_${edk2_toolchain}/$edk2_arch/$dsc_component.efi" \ | |
63 | "$uefi_binary" |