To the extent possible under law,
Dmitrii Okunev
has waived all copyright and related or neighboring rights to
"A docker image to build EDK2-based projects.
This work is published from:
Ireland".
The purpose of this project is to prepare a comprehensive build environment which will just build EDK2 based projects without tons of pain.
Take any EDK2-based project you need to compile, for example "github.com/andreiw/UefiToolsPkg":
cd "`mktemp -d`"
mkdir -m 1777 /tmp/UefiToolsPkg-build
git clone --recursive https://github.com/andreiw/UefiToolsPkg
docker pull xaionaro2/edk2-builder:vUDK2018
# removing "SetCon" from the list if components, because the tool is not buildable
sed -e 's% UefiToolsPkg/Applications/SetCon/SetCon.inf%# UefiToolsPkg/Applications/SetCon/SetCon.inf%' \
-i-orig UefiToolsPkg/UefiToolsPkg.dsc
docker run --rm \
-e CFLAGS=-Wno-error \
-e DSC_PATH=UefiToolsPkg/UefiToolsPkg.dsc \
-e BUILD_TARGET=DEBUG \
-v "$PWD/:/home/edk2/src" -v "/tmp/UefiToolsPkg-build:/home/edk2/Build" \
xaionaro2/edk2-builder:vUDK2018
That's it :)
The result will be in /tmp/UefiToolsPkg-build
.
Explanation:
vUDK2018
is a version of EDK2./home/edk2/Build
is defined in UefiToolsPkg/UefiToolsPkg.dsc
as Build
, since the working directory is /home/edk2
/home/edk2/src
is hardcoded in the Dockerfile
as the directory with the source code of what do we want to compile.cd "`mktemp -d`"
mkdir -m 1777 /tmp/RefindPlusPkg-build
git clone --recursive https://github.com/dakanji/RefindPlus RefindPlusPkg
docker pull xaionaro2/edk2-builder:RefindPlusUDK
#!/bin/bash -xe
mkdir -m 1777 out
git clone --recursive https://github.com/dakanji/RefindPlus RefindPlusPkg
docker pull xaionaro2/edk2-builder:RefindPlusUDK
# hacky fix for duplication error of lodepng_malloc and lodepng_free
sed -e 's/void[*] lodepng_refit_malloc/void* _dup_lodepng_refit_malloc/' \
-e 's/void lodepng_refit_free/void _dup_lodepng_refit_free/' \
-i-orig RefindPlusPkg/libeg/lodepng_xtra.c
docker run --rm \
-e CFLAGS=-Wno-error \
-e TOOLCHAIN=CLANG38 \
-e BUILD_TARGET=RELEASE \
-e DSC_PATH=RefindPlusPkg/RefindPlusPkg.dsc \
-v "$PWD/RefindPlusPkg/:/home/edk2/edk2/RefindPlusPkg/" \
-v "$PWD/out:/home/edk2/Build" \
xaionaro2/edk2-builder:RefindPlusUDK
cd "`mktemp -d`"
# We clone the edk2 source code again, just to be able to
# do custom changes to OVMF, but this is not necessary.
git clone https://github.com/tianocore/edk2 edk2 -b edk2-stable202208
docker run --rm \
-e CFLAGS=-Wno-error \
-e DSC_PATH=OvmfPkg/OvmfPkgX64.dsc \
-e BUILD_TARGET=RELEASE \
-v "$PWD/edk2/OvmfPkg:/home/edk2/src/" \
-v "$PWD/out:/home/edk2/Build" \
xaionaro2/edk2-builder:edk2-stable202208
For example if one needs to build the latest EDK2 then they may use:
EDK2_VERSION=latest DOCKERFILE_PATH=Dockerfile IMAGE_NAME=xaionaro2/edk2-builder:latest hooks/build
Or if edk2-stable202111
then:
EDK2_VERSION=edk2-stable202111 DOCKERFILE_PATH=Dockerfile IMAGE_NAME=xaionaro2/edk2-builder:stable202111 hooks/build
Fork the repository, add the repository to file clone-edk2.sh
with a new special tag,
and then run:
EDK2_VERSION=<THE SPECIAL TAG HERE> DOCKERFILE_PATH=Dockerfile IMAGE_NAME=<SOME IMAGE NAME>:<SOME TAG> hooks/build
It will build a docker image <SOME IMAGE NAME>:<SOME TAG>
using the custom EDK2 repository.
It would also be nice if after that there will be a Pull Request to push this changes back to here :)