Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xaionaro/edk2-builder-docker

Docker container to build EDK2-based projects. Supports all EDK2 releases out of the box. And has examples of usage.
https://github.com/xaionaro/edk2-builder-docker

build builder compile container docker edk2 edkii make tianocore

Last synced: 27 days ago
JSON representation

Docker container to build EDK2-based projects. Supports all EDK2 releases out of the box. And has examples of usage.

Awesome Lists containing this project

README

        

![Build examples](https://github.com/xaionaro/edk2-builder-docker/actions/workflows/github-actions-test.yml/badge.svg)
![DockerHub](https://github.com/xaionaro/edk2-builder-docker/actions/workflows/github-actions-push.yml/badge.svg)



CC0



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
".

# Goal

The purpose of this project is to prepare a comprehensive build environment which will just build EDK2 based projects without tons of pain.

# Quick start

Take any EDK2-based project you need to compile, for example "[github.com/andreiw/UefiToolsPkg](https://github.com/andreiw/UefiToolsPkg)":
```sh
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](https://github.com/tianocore/edk2/tags).
* Directory `/home/edk2/Build` is defined in `UefiToolsPkg/UefiToolsPkg.dsc` as `Build`, since the working directory is `/home/edk2`
* Directory `/home/edk2/src` is hardcoded in the `Dockerfile` as the directory with the source code of what do we want to compile.

### Another example

```sh
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
```

### OVMF

```sh
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
```

# Rebuild

For example if one needs to build the latest EDK2 then they may use:
```sh
EDK2_VERSION=latest DOCKERFILE_PATH=Dockerfile IMAGE_NAME=xaionaro2/edk2-builder:latest hooks/build
```

Or if [`edk2-stable202111`](https://github.com/tianocore/edk2/tags) then:
```
EDK2_VERSION=edk2-stable202111 DOCKERFILE_PATH=Dockerfile IMAGE_NAME=xaionaro2/edk2-builder:stable202111 hooks/build
```

# Add a custom EDK2 repository

Fork the repository, add the repository to file [`clone-edk2.sh`](https://github.com/xaionaro/edk2-builder-docker/blob/main/clone-edk2.sh) with a new special tag,
and then run:
```
EDK2_VERSION= DOCKERFILE_PATH=Dockerfile IMAGE_NAME=: hooks/build
```
It will build a docker image `:` 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 :)