Builds the Linux kernel into OCI images.
This repo is a series of helper scripts and Github Actions that
- Use config.yaml and various scripts in
hack/build
to generate a matrix of kernel upstream versions, variants, and flavors to be built. - Fetches
kernel.org
tarballs, applies custom config flags, and patches, depending on version, flavor and variant. - Builds those kernels for x86_64/arm64.
See the configs directory for more info.
See the patches directory for the current set of patches Edera carries against upstream kernels.
Note that not all the patches will be applied to all kernel versions, this is driven by version constraints in config.yaml.
For most of the kernels in this registry, debugging symbols and features are disabled, to keep the kernel artifacts small.
You may want or need to build your own debugging kernel with custom patches/options locally, and publish it to a transient OCI registry (like ) for testing purposes.
To do this, you will need docker
installed and configured correctly to support cross-builds (docker buildx
) in your local environment.
The simplest way to do that is to
-
Clone this repo locally:
git clone git@github.com:edera-dev/linux-kernel-oci.git
-
Manually edit config.yaml on-disk:
-
to change the
imageNameFormat
key to push to an OCI registry you have access to. -
to change the
architectures
YAML key to only include the architectures you care about (x86_64, arm64, or both -docker buildx
is used so you can build arm64 on x86_64 and vice-versa). -
to change the
flavors
YAML key to only include the flavors you care about (host, or zone, or both). -
to change the
versions
YAML key to only include thekernel.org
versions you care about. For instance, to only build the latest5.4
kernel.org upstream release, use:versions: - series: '5.4'
-
For example, if I wanted to only build the
zone
kernel flavor, only forx86_64
, only the latest6.15
point release, and tag the result for a customttl.sh/hackben
registry, the final result would look something like this:imageNameFormat: "ttl.sh/hackben/[image]:[tag]" architectures: - x86_64 flavors: - name: zone-debu constraints: series: - '6.15' versions: - current: true
-
-
Run hack/build/docker-build.sh
- It is important you follow the previous step, and edit the config.yaml locally to reduce the number of kernels the script will try to build, or you may end up building 15+ different kernels in parallel on your local box, which will take a very, very long time.
- When this command runs, it will generate a build matrix and print out what it will build.
-
When the above command finishes, you can see the local OCI images that were built by running
docker image list
. The images will be tagged with the repo you specified inimageNameFormat
in the config.yaml. -
From this point, you may push those images to an OCI registry with standard commands like
docker image push <image tag>
, and consume them how you wish. -
If you wish to unpack and inspect the final image (for instance, to make sure certain modules or firmware exist in the correct paths, or that the final
config.gz
has the options you expect), you can do the following to fetch and extract the image artifact you just pushed to your local disk withcrane
:crane export ttl.sh/hackben/zone-kernel:6.15.6 - --platform=linux/amd64 | tar --keep-directory-symlink -xf - -C . cd `kernel` zcat config.gz unsquashfs addons.squashfs ...