# Building Tianocore UEFI Firmware

A binary `ovmf` package is available in Debian Stretch, and Buster, but it
doesn't seem to be recent enough for testing images generated by Isar.

## Get the Sources

```
git clone https://github.com/tianocore/edk2
cd edk2
git checkout 3858b4a1ff09d3243fea8d07bd135478237cb8f7
```

## Install Build Dependencies

```
sudo apt-get install acpica-tools g++ make nasm python uuid-dev
```

## Build BaseTools

* `BaseTools/Source/C/Makefiles/header.makefile`: Remove `-Werror`
* `make -C BaseTools`

## Initialize Build Environment

`. ./edksetup.sh`

## Build X64 Firmware

Usable with qemu-system-x86_64.

Edit `Conf/target.txt` as follows:
```
ACTIVE_PLATFORM       = OvmfPkg/OvmfPkgX64.dsc
TARGET                = RELEASE
TARGET_ARCH           = X64
TOOL_CHAIN_TAG        = GCC49
MAX_CONCURRENT_THREAD_NUMBER = 8
```

```
build
```

Tested on Stretch.

## Build IA32 Firmware

Usable with qemu-system-i386 or qemu-system-x86_64. If the X64 version works
for you, skip this section.

Edit `Conf/target.txt` as follows:
```
ACTIVE_PLATFORM       = OvmfPkg/OvmfPkgIa32.dsc
TARGET                = RELEASE
TARGET_ARCH           = IA32
TOOL_CHAIN_TAG        = GCC49
MAX_CONCURRENT_THREAD_NUMBER = 8
```

```
build
```

Tested on Jessie.

## TODO

* Test sid `ovmf` later than 2018-08-07. If it doesn't work, provide an updated
  package.
