Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

19 Commits

Repository files navigation

cloud-boot/kernel

cloud-boot/kernel

Reproducible end-to-end test scaffolding for go-coff/stub: Dockerfiles that produce minimal cloud-guest Linux kernels (PE32+ EFISTUB) and a microscopic initramfs whose /init prints a magic banner before powering the VM down.

task from the stub repo then assembles them into a UKI via pec and boots it under QEMU + OVMF to validate that the whole pipeline — stub chain-load + EFI_LOAD_FILE2_PROTOCOL initrd + kernel handoff — works on a real Linux kernel.

Variants

FileArchApproachOutput
Dockerfile.arm64arm64defconfig + cloud fragment + vmlinuz.efiImage
Dockerfile.arm64-tinyarm64tinyconfig + tiny fragment + vmlinuz.efiImage
Dockerfile.arm64-ltoarm64Clang ThinLTO (reference, no measured win)Image
Dockerfile.amd64amd64defconfig + cloud fragmentbzImage
Dockerfile.amd64-tinyamd64tinyconfig + tiny fragmentbzImage
Dockerfile.arm64-diskarm64tiny + ext4 + GPT + kexec (bootstrap kernel)Image
Dockerfile.amd64-diskamd64tiny + ext4 + GPT + kexec (bootstrap kernel)bzImage
Dockerfile.initrd-arm64arm64tiny asm /init (write banner + reboot)initramfs.cpio.gz
Dockerfile.initrd-amd64amd64same, x86_64 syscall ABIinitramfs.cpio.gz

Naming convention: amd64 and arm64 everywhere except inside the Dockerfiles themselves, which still talk to the kernel build system in its native vocabulary (ARCH=x86_64, ARCH=arm64) and use the canonical LLVM/GCC triples (x86_64-linux-gnu, etc.).

Build

# Tiny + ZBOOT arm64 kernel, ~2.2 MiB.
docker build -f Dockerfile.arm64-tiny -t go-coff-kernel:arm64-tiny .
docker build -f Dockerfile.initrd-arm64 -t go-coff-initrd:arm64 .

Extract

docker create --name k go-coff-kernel:arm64-tiny && docker cp k:/Image .&& docker rm k
docker create --name i go-coff-initrd:arm64 && docker cp i:/initramfs.cpio.gz .&& docker rm i

Use

cd ../stub
go run ../pec append \
--linux=../kernel/Image \
--initrd=../kernel/initramfs.cpio.gz \
--cmdline=<(echo -n "console=ttyAMA0 ip=dhcp") \
-o BOOTAA64-real.EFI BOOTAA64.EFI
# … then boot under QEMU + OVMF as usual.

(The final EFI binary name BOOTAA64.EFI is mandated by the UEFI spec for the removable-media fallback path on arm64 — that's why it doesn't match our arm64 convention. Same story for BOOTX64.EFI on amd64.)

The first build of any variant takes 5–15 min (Linux source tarball + native make); subsequent builds hit the layer cache and are instant.

License

BSD 3-Clause.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors