Skip to content

Build Linux guest kernels from defconfigs - #5

Merged
cmainas merged 2 commits into
mainfrom
feat/linux_kernels
Oct 20, 2026
Merged

cmainas merged 2 commits into
mainfrom
feat/linux_kernels

Conversation

@cmainas

@cmainas cmainas commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Description

Adds .github/workflows/kernels.yml. It builds the Linux guest kernels described under linux_kernel/ and publishes each one as a signed image that bunnyfiles can reference by digest. It also adds a generic kernel for amd64 and arm64.

How it works

  • Layout: linux_kernel/<name>/defconfig-<arch>, where <arch> is amd64 or arm64. Each directory is one kernel, published as ghcr.io/urunc-dev/unikernel-build/linux-kernel:<name>, with an entry for each arch it defines.
  • Version: a # KVER=x.y.z line in the defconfig pins the kernel version. Without one, the latest LTS release is used. All arches of a kernel must resolve to the same version.
  • Build:
    • The kernel.org tarball must carry a valid release signature.
    • The defconfig is expanded, and the build fails if any =y symbol does not end up built in.
    • The kernel is compiled natively per arch in a digest-pinned gcc image with fixed build metadata, so builds are reproducible.
    • amd64 produces vmlinux, arm64 produces Image.
  • Pull requests: only kernels whose directory changed are built. The PR gets a comment linking the artifacts, and nothing is pushed.
  • Pushes to main: the built kernels are published, tagged <name>, <name>-<kver> and <name>-<sha>, and signed with cosign.

Image contents

Path Contents
/.boot/kernel The kernel
/.boot/config The full expanded .config
/.boot/COPYING, /.boot/LICENSES/ The kernel license

Labels record the kernel version, the source tarball URL and its SHA-256, and the defconfig used. That identifies the GPL source of every published kernel: an unmodified kernel.org release plus this repository.

Also add license and update README to document how to add or change a kernel and how to build one locally.

Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
Add a workflow that builds each kernel under linux_kernel/<name>/ and
publishes it as a signed multi-arch image,
ghcr.io/<repo>/linux-kernel:<name>, with the kernel at /.boot/kernel.
Bunnyfiles can then reference a kernel by digest instead of copying a
binary into their build context. A generic kernel for amd64 and arm64
is included.

Kernels are described by one defconfig per arch, which keeps the
configuration small and reviewable. A `# KVER=` line pins the kernel
version; otherwise the latest LTS release is used. The build fails if a
symbol set to =y does not end up built in, since drivers the guest needs
to mount its root cannot be loaded as modules.

To keep builds trustworthy and reproducible, the source tarball must
carry a valid kernel.org release signature, and it is compiled in a
digest-pinned gcc image with fixed build metadata.

Each image ships the kernel license and the full .config, and its
labels record the source tarball, its checksum and the defconfig used,
so the GPL source of every published kernel is identifiable.

Pull requests build the changed kernels and get a comment linking the
artifacts; pushes to main publish them.

Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Kernel builds

Kernel Arch Linux Uncompressed Compressed
generic amd64 6.18.57 kernel-generic-amd64-uncompressed (7.3 MiB zipped, 23.1 MiB unzipped) kernel-generic-amd64-compressed (6.3 MiB zipped, 6.4 MiB unzipped)
generic arm64 6.18.57 kernel-generic-arm64-uncompressed (5.2 MiB zipped, 11.4 MiB unzipped) kernel-generic-arm64-compressed (5.1 MiB zipped, 5.1 MiB unzipped)

On merge: ghcr.io/urunc-dev/unikernel-build/linux-kernel:generic, ghcr.io/urunc-dev/unikernel-build/linux-kernel:generic-compressed

Workflow run

@cmainas
cmainas force-pushed the feat/linux_kernels branch 5 times, most recently from 04549cd to 988bcb3 Compare October 20, 2026 17:21
@cmainas
cmainas merged commit af5f536 into main Oct 20, 2026
44 of 68 checks passed
@cmainas
cmainas deleted the feat/linux_kernels branch October 20, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant