-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_edk.sh
executable file
·66 lines (45 loc) · 1.46 KB
/
build_edk.sh
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
#!/bin/bash
if [[ -z "$1" ]]; then
echo EDK2_PATH argument missing. Set it to point to your edk2 clone.
exit 1
fi
EDK2_PATH="$1"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo Copying package to edk2 root
cp -r ${SCRIPT_DIR}/edk/HypePkg ${EDK2_PATH}/
if [ ! -f ${EDK2_PATH}/Conf/target.txt ]; then
echo Creating backup of original Conf/target.txt
cp ${EDK2_PATH}/Conf/target.txt ${EDK2_PATH}/Conf/target.txt.old
fi
echo Copying target definitions to edk2 root
cp ${SCRIPT_DIR}/edk/target.txt ${EDK2_PATH}/Conf/target.txt
echo Running build for HypePkg
pushd ${EDK2_PATH}
. ./edksetup.sh BaseTools
build
popd
echo Copying target definitions to edk2 root
cp ${SCRIPT_DIR}/edk/target_ovmf.txt ${EDK2_PATH}/Conf/target.txt
echo Running build for OvmfPkg
pushd ${EDK2_PATH}
. ./edksetup.sh BaseTools
build
popd
echo Restoring edk2 root
if [ ! -f ${EDK2_PATH}/Conf/target.txt.old ]; then
mv ${EDK2_PATH}/Conf/target.txt.old ${EDK2_PATH}/Conf/target.txt
fi
rm -r ${EDK2_PATH}/HypePkg
echo Copying build data
BUILD_ROOT=${EDK2_PATH}/Build/HypeX64/RELEASE_CLANGPDB/X64
BUILD_ROOT_OVMF=${EDK2_PATH}/Build/OvmfX64/RELEASE_GCC5
DST_ROOT=${SCRIPT_DIR}/.edk2build
rm -rf ${DST_ROOT}
mkdir -p ${DST_ROOT}/libs
pushd ${BUILD_ROOT}
find . -name \*.lib -exec cp {} ${DST_ROOT}/libs \;
popd
rm ${DST_ROOT}/libs/Hype.lib
cp ${BUILD_ROOT}/HypePkg/Hype/Hype/DEBUG/AutoGen.c ${DST_ROOT}
cp ${BUILD_ROOT_OVMF}/FV/OVMF.fd ${DST_ROOT}
echo Done