Support building images from outside of coreboot tree

This commit is contained in:
Jeremy Soller
2019-05-02 14:42:31 -06:00
parent de9fef3d89
commit 37f650fc67
5 changed files with 918 additions and 0 deletions

19
scripts/_build/coreboot.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
if [ -z "$1" -o ! -e "$1" -o -z "$2" ]
then
echo "$0 [coreboot.config] [coreboot.rom]" >&2
exit 1
fi
CONFIG="$(realpath "$1")"
COREBOOT="$(realpath "$2")"
pushd coreboot >/dev/null
make CPUS="$(nproc)" crossgcc-i386
make distclean
cp -v "${CONFIG}" .config
make --jobs="$(nproc)"
cp -v "build/coreboot.rom" "${COREBOOT}"
popd >/dev/null

31
scripts/_build/edk2.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -e
if [ -z "$1" ]
then
echo "$0 [UEFIPAYLOAD.fd]" >&2
exit 1
fi
UEFIPAYLOAD="$(realpath "$1")"
BUILD_TYPE=RELEASE
TOOLCHAIN=GCC5
export PACKAGES_PATH="$(realpath edk2-platforms):$(realpath apps)"
pushd edk2 >/dev/null
make -C BaseTools --jobs="$(nproc)"
source edksetup.sh --reconfig
build \
-a IA32 \
-a X64 \
-b "${BUILD_TYPE}" \
-t "${TOOLCHAIN}" \
-p CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
cp -v \
"Build/CorebootPayloadPkgX64/${BUILD_TYPE}_${TOOLCHAIN}/FV/UEFIPAYLOAD.fd" \
"${UEFIPAYLOAD}"
popd >/dev/null

32
scripts/build.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
if [ -z "$1" ]
then
echo "$0 [model]" >&2
exit 1
fi
MODEL="$1"
if [ ! -d "models/${MODEL}" ]
then
echo "model '${MODEL}' not found" >&2
exit 1
fi
MODEL_DIR="$(realpath "models/${MODEL}")"
rm -rf build
mkdir -p build
# Rebuild firmware-setup (used by edk2)
touch apps/firmware-setup/Cargo.toml
make -C apps/firmware-setup
# Rebuild CorebootPayloadPkg using edk2
./scripts/_build/edk2.sh build/UEFIPAYLOAD.fd
# Rebuild coreboot
export FIRMWARE_OPEN_UEFIPAYLOAD="$(realpath build/UEFIPAYLOAD.fd)"
export FIRMWARE_OPEN_MODEL_DIR="${MODEL_DIR}"
./scripts/_build/coreboot.sh "${MODEL_DIR}/coreboot.config" "build/$MODEL.rom"