mostly from: https://git.alpinelinux.org/cgit/aports/tree/community/edk2/APKBUILD
docker run --rm -ti -v $(pwd):/out alpine
apk add --no-cache bash python2 iasl nasm util-linux-dev gcc musl-dev make g++ git
# need to clone in container as on Mac the host FS is not case sensitive
git clone [email protected]:tianocore/edk2.git
bash
cd edk2
. edksetup.sh
make -j1 -C BaseTools
export WORKSPACE=$PWD
export PACKAGES_PATH=$PWD
export EDK_TOOLS_PATH=$PWD/BaseTools/
export PATH=$PWD/BaseTools/BinWrappers/PosixLike/:$PATH
TOOLCHAIN=GCC49
RELEASE=DEBUG
TARGET_ARCH=X64
OVMFPKG=OvmfPkgX64.dsc
command build -b ${RELEASE} -a ${TARGET_ARCH} -p OvmfPkg/${OVMFPKG} -t ${TOOLCHAIN} -n ${JOBS:-2}
cp Build/OvmfX64/DEBUG_GCC49/FV/OVMF*.fd /out
qemu-system-x86_64 -machine q35 -nographic -drive if=pflash,format=raw,file=./OVMF.fd
- build a linuxkit image/initrd
- move them into a separate directory, sat
./foo
- rename the kernel to something ending in
.efi
, saybzImage.efi
Then start qemu:
qemu-system-x86_64 -machine q35 -nographic -drive if=pflash,format=raw,file=./OVMF.fd -drive file=fat:rw:./foo
This turns the directory ./foo
into a fat formated hard disk on the fly.
On the EFI shell:
fs0:
bzImage.efi console=ttyS0 efi=debug initrd=/linuxkit-initrd.img
This cd
s into the the drive fs0
and then executes the kernel (via the EFI stub built into it) with the command line provided.