- Patching and building the kernel image
- Clone the
pkgsrepository from Github and check out the revision corresponding to your version of Talos OSgit 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.
- Clone the
- 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"
- Copy the following into a new
- Deploying to your cluster
talosctl upgrade --image ghcr.io/your-username/talos-installer:<talos version> --preserve=true
Created
November 30, 2021 18:54
-
-
Save RealityAnomaly/f35178eb8bcc226025acbdbd1e2abf49 to your computer and use it in GitHub Desktop.
Adding a proprietary kernel module to Talos OS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment