]>
Commit | Line | Data |
---|---|---|
536d2173 LE |
1 | #!/bin/bash |
2 | ||
3 | # Wrapper shell script for building a virtual platform firmware in edk2. | |
4 | # | |
5 | # Copyright (C) 2019 Red Hat, Inc. | |
6 | # | |
7 | # This program and the accompanying materials are licensed and made available | |
8 | # under the terms and conditions of the BSD License that accompanies this | |
9 | # distribution. The full text of the license may be found at | |
10 | # <http://opensource.org/licenses/bsd-license.php>. | |
11 | # | |
12 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT | |
13 | # WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
14 | ||
15 | set -e -u -C | |
16 | ||
17 | # Save the command line arguments. We need to reset $# to 0 before sourcing | |
18 | # "edksetup.sh", as it will inherit $@. | |
19 | emulation_target=$1 | |
20 | shift | |
21 | num_args=0 | |
22 | args=() | |
23 | for arg in "$@"; do | |
24 | args[num_args++]="$arg" | |
25 | done | |
26 | shift $num_args | |
27 | ||
28 | cd edk2 | |
29 | ||
037973bb | 30 | export PYTHON_COMMAND=${EDK2_PYTHON_COMMAND:-python3} |
536d2173 LE |
31 | |
32 | # Source "edksetup.sh" carefully. | |
33 | set +e +u +C | |
34 | source ./edksetup.sh | |
35 | ret=$? | |
36 | set -e -u -C | |
37 | if [ $ret -ne 0 ]; then | |
38 | exit $ret | |
39 | fi | |
40 | ||
41 | # Fetch some option arguments, and set the cross-compilation environment (if | |
42 | # any), for the edk2 "build" utility. | |
43 | source ../edk2-funcs.sh | |
44 | edk2_toolchain=$(qemu_edk2_get_toolchain "$emulation_target") | |
037973bb | 45 | MAKEFLAGS=$(qemu_edk2_quirk_tianocore_1607 "$MAKEFLAGS") |
536d2173 LE |
46 | edk2_thread_count=$(qemu_edk2_get_thread_count "$MAKEFLAGS") |
47 | qemu_edk2_set_cross_env "$emulation_target" | |
48 | ||
49 | # Build the platform firmware. | |
50 | build \ | |
51 | --cmd-len=65536 \ | |
52 | -n "$edk2_thread_count" \ | |
53 | --buildtarget=DEBUG \ | |
54 | --tagname="$edk2_toolchain" \ | |
55 | "${args[@]}" |