This moves our docs to a hugo-based doc setup with docsy theme. Signed-off-by: Spencer Smith <spencer.smith@talos-systems.com>
2.6 KiB
title, description
| title | description |
|---|---|
| Adding a proprietary kernel module to Talos Linux |
-
Patching and building the kernel image
-
Clone the
pkgsrepository from Github and check out the revision corresponding to your version of Talos Linuxgit clone https://github.com/talos-systems/pkgs pkgs && cd pkgs git checkout v0.8.0 -
Clone the Linux kernel and check out the revision that pkgs uses (this can be found in
kernel/kernel-prepare/pkg.yamland it will be something like the following:https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-x.xx.x.tar.xz)git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git && cd linux git checkout v5.15 -
Your module will need to be converted to be in-tree. The steps for this are different depending on the complexity of the module to port, but generally it would involve moving the module source code into the
driverstree and creating a new Makefile and Kconfig. -
Stage your changes in Git with
git add -A. -
Run
git diff --cached --no-prefix > foobar.patchto generate a patch from your changes. -
Copy this patch to
kernel/kernel/patchesin thepkgsrepo. -
Add a
patchline in thepreparesegment ofkernel/kernel/pkg.yaml:patch -p0 < /pkg/patches/foobar.patch -
Build the kernel image. Make sure you are logged in to
ghcr.iobefore running this command, and you can change or omitPLATFORMdepending on what you want to target.make kernel PLATFORM=linux/amd64 USERNAME=your-username PUSH=true -
Make a note of the image name the
makecommand outputs.
-
-
Building the installer image
-
Copy the following into a new
Dockerfile:FROM scratch AS customization COPY --from=ghcr.io/your-username/kernel:<kernel version> /lib/modules /lib/modules FROM ghcr.io/talos-systems/installer:<talos version> COPY --from=ghcr.io/your-username/kernel:<kernel version> /boot/vmlinuz /usr/install/${TARGETARCH}/vmlinuz -
Run to build and push the installer:
INSTALLER_VERSION=<talos version> IMAGE_NAME="ghcr.io/your-username/talos-installer:$INSTALLER_VERSION" DOCKER_BUILDKIT=0 docker build --build-arg RM="/lib/modules" -t "$IMAGE_NAME" . && docker push "$IMAGE_NAME"
-
-
Deploying to your cluster
talosctl upgrade --image ghcr.io/your-username/talos-installer:<talos version> --preserve=true