forked from freebsd/uefi-edk2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·108 lines (89 loc) · 2.11 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
usage() {
cat <<- EOM
Usage: $0 [-bov] [-j <jobs>] <clean|RELEASE|DEBUG>
-b - Build BHYVE firmware (default)
-o - Build OVMF firmware (for Propolis)
-j jobs - Set parallelism - jobs defaults to 1 or the value of \$JOBS
-v - Verbose output
'clean' will clean up the directory any remove old build remnants
RELEASE|DEBUG specify the firmware variant to be built
EOM
exit 1
}
verbose=0
stock=0
: "${JOBS:=1}"
while [[ "$1" = -* ]]; do
case "$1" in
-csm)
echo "This branch does not support building the CSM variant"
exit 1
;;
-v) verbose=1 ;;
-b) stock=0 ;;
-o) stock=1 ;;
-j)
[ $# -ge 2 ] || usage
JOBS="$2"
shift
;;
*) usage ;;
esac
shift
done
clean=0
case "$1" in
DEBUG) flavour=DEBUG
;;
RELEASE) flavour=RELEASE
;;
clean) clean=1 ;;
*) usage ;;
esac
shift
[ -n "$1" ] && usage
: "${GCCVER:=7}"
: "${GCCPATH:=/opt/gcc/$GCCVER}"
: "${GCC:=$GCCPATH/bin/gcc}"
: "${GXX:=$GCCPATH/bin/g++}"
: "${GMAKE:=/usr/bin/gmake}"
: "${GAS:=/usr/bin/gas}"
: "${GAR:=/usr/bin/gar}"
: "${GLD:=/usr/bin/gld}"
: "${GOBJCOPY:=/usr/bin/gobjcopy}"
export GCCVER GCCPATH GCC GXX GMAKE GAS GAR GLD GOBJCOPY
MAKE_ARGS="
AS=$GAS
AR=$GAR
LD=$GLD
OBJCOPY=$GOBJCOPY
CC=$GCC BUILD_CC=$GCC
CXX=$GXX BUILD_CXX=$GXX
GCCPATH=$GCCPATH
"
[ $stock -eq 1 ] && platform=OvmfPkg/OvmfPkgX64.dsc \
|| platform=OvmfPkg/Bhyve/BhyveX64.dsc
ILLGCC_BIN=$GCCPATH/bin/
BUILD_ARGS="-DDEBUG_ON_SERIAL_PORT=TRUE -DNETWORK_HTTP_BOOT_ENABLE=TRUE"
BUILD_ARGS+=" -DFD_SIZE_2MB"
PYTHON3_ENABLE=TRUE
[ $verbose -eq 1 ] && BUILD_ARGS+=" -v"
export MAKE_ARGS ILLGCC_BIN BUILD_ARGS PYTHON3_ENABLE
rm -rf Conf/{target,build_rule,tools_def}.txt Conf/.cache
if [ $clean -eq 1 ]; then
gmake -j$JOBS $MAKE_ARGS HOST_ARCH=X64 ARCH=X64 -C BaseTools clean
rm -rf Build/
exit 0
fi
set -e
gmake -j$JOBS $MAKE_ARGS HOST_ARCH=X64 ARCH=X64 -C BaseTools
source edksetup.sh
./BaseTools/BinWrappers/PosixLike/build \
-n $JOBS \
-p $platform \
-a X64 \
-b $flavour \
-t ILLGCC \
$BUILD_ARGS