From 1e29a94e5724d3dadcba1c6066a797303f7c6064 Mon Sep 17 00:00:00 2001 From: Jarrett Tierney Date: Wed, 11 Dec 2024 23:09:20 +0000 Subject: [PATCH] kernel-kit: create the new bottlerocket kernel kit --- .github/workflows/cache.yml | 2 +- BUILDING.md | 20 +++--- Cargo.lock | 82 +++++++++++++++++++++++++ Cargo.toml | 16 +++++ Makefile | 2 +- README.md | 16 ++--- Twoliter.lock | 9 +++ Twoliter.toml | 10 +++ kits/bottlerocket-kernel-kit/Cargo.toml | 26 ++++++++ tools/collect-kernel-config | 2 +- 10 files changed, 164 insertions(+), 21 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 Twoliter.lock create mode 100644 Twoliter.toml create mode 100644 kits/bottlerocket-kernel-kit/Cargo.toml diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 1ecc570d..e9674bcc 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -6,7 +6,7 @@ on: branches: [develop] jobs: cache: - if: github.repository == 'bottlerocket-os/bottlerocket-core-kit' + if: github.repository == 'bottlerocket-os/bottlerocket-kernel-kit' runs-on: group: bottlerocket labels: bottlerocket_ubuntu-latest_32-core diff --git a/BUILDING.md b/BUILDING.md index 0a419d4c..7156d8b9 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,6 +1,6 @@ -# How to build the Bottlerocket core kit +# How to build the Bottlerocket kernel kit -If you'd like to build your own copy of the core kit for local development, follow these steps. +If you'd like to build your own copy of the kernel kit for local development, follow these steps. ## Dependencies #### System Requirements @@ -57,9 +57,9 @@ The following configuration is needed in your `/etc/docker/daemon.json` The installation instructions for [crane](https://github.com/google/go-containerregistry/tree/main/cmd/crane) should help you set it up for use with Twoliter. -## Build the core kit +## Build the kernel kit -Building the core kit can be done by using the makefile targets. +Building the kernel kit can be done by using the makefile targets. ``` make ARCH= ``` @@ -69,7 +69,7 @@ After the kit has been built you can then publish the kit image to your private ### Use a private registry for development It is recommended that you have some form of protected container registry to use for testing. -For testing purposes you can either utilize mutable tags to allow overriding of multiple versions of a core kit as you test, or you can use immutable tags and continuously bump the core kit version via the `Twoliter.toml`. +For testing purposes you can either utilize mutable tags to allow overriding of multiple versions of a kernel kit as you test, or you can use immutable tags and continuously bump the kernel kit version via the `Twoliter.toml`. ### Configure Infra.toml An `Infra.toml` file needs to be created and should have a definition of your vendor (container registry) in order to publish the kits you build. To do so make sure that the `Infra.toml` has the below. @@ -82,22 +82,22 @@ After the kit has been built locally, the kit can be published to the provided v aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ####.dkr.ecr.us-west-2.amazonaws.com ``` -Finally, publishing the core kit images can be handled by the makefile target. +Finally, publishing the kernel kit images can be handled by the makefile target. ``` make publish VENDOR= ``` -At this point, there should be a core kit image in your private registry which can be consumed when building a variant to test and validate. +At this point, there should be a kernel kit image in your private registry which can be consumed when building a variant to test and validate. ## Consuming the published kit image -This section will cover building a variant to test a build of the core kit as done above. Please note this section does not cover the complete complexity of testing a change to Bottlerocket. For this see the [BUILDING](https://github.com/bottlerocket-os/bottlerocket/blob/develop/BUILDING.md) section in the [Bottlerocket](https://github.com/bottlerocket-os/bottlerocket/) repository. +This section will cover building a variant to test a build of the kernel kit as done above. Please note this section does not cover the complete complexity of testing a change to Bottlerocket. For this see the [BUILDING](https://github.com/bottlerocket-os/bottlerocket/blob/develop/BUILDING.md) section in the [Bottlerocket](https://github.com/bottlerocket-os/bottlerocket/) repository. ### Configure Twoliter.toml -To consume a private copy of the Bottlerocket core kit with your changes built into it, you need to define the vendor that points to your container registry in `Twoliter.toml` and adjust the core kit dependency: +To consume a private copy of the Bottlerocket kernel kit with your changes built into it, you need to define the vendor that points to your container registry in `Twoliter.toml` and adjust the kernel kit dependency: ``` [vendor.my-vendor] registry = "####.dkr.ecr.us-west-2.amazonaws.com" [[kit]] -name = "bottlerocket-core-kit" # Name of your ECR repo +name = "bottlerocket-kernel-kit" # Name of your ECR repo version = "2.x.y" # your version tag you want to test vendor = "my-vendor" ``` diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..567b348b --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,82 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "bottlerocket-kernel-kit" +version = "0.1.0" +dependencies = [ + "grub", + "kernel-5_10", + "kernel-5_15", + "kernel-6_1", + "kmod-5_10-nvidia", + "kmod-5_15-nvidia", + "kmod-6_1-nvidia", + "libkcapi", + "linux-firmware", + "microcode", + "shim", +] + +[[package]] +name = "grub" +version = "0.1.0" + +[[package]] +name = "kernel-5_10" +version = "0.1.0" +dependencies = [ + "microcode", +] + +[[package]] +name = "kernel-5_15" +version = "0.1.0" +dependencies = [ + "microcode", +] + +[[package]] +name = "kernel-6_1" +version = "0.1.0" +dependencies = [ + "microcode", +] + +[[package]] +name = "kmod-5_10-nvidia" +version = "0.1.0" +dependencies = [ + "kernel-5_10", +] + +[[package]] +name = "kmod-5_15-nvidia" +version = "0.1.0" +dependencies = [ + "kernel-5_15", +] + +[[package]] +name = "kmod-6_1-nvidia" +version = "0.1.0" +dependencies = [ + "kernel-6_1", +] + +[[package]] +name = "libkcapi" +version = "0.1.0" + +[[package]] +name = "linux-firmware" +version = "0.1.0" + +[[package]] +name = "microcode" +version = "0.1.0" + +[[package]] +name = "shim" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..07aa5f93 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[workspace] +resolver = "2" +members = [ + "kits/bottlerocket-kernel-kit", + "packages/grub", + "packages/kernel-5.10", + "packages/kernel-5.15", + "packages/kernel-6.1", + "packages/kmod-5.10-nvidia", + "packages/kmod-5.15-nvidia", + "packages/kmod-6.1-nvidia", + "packages/linux-firmware", + "packages/microcode", + "packages/libkcapi", + "packages/shim", +] diff --git a/Makefile b/Makefile index 5e3d144a..db74ad8e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ CARGO_HOME := $(TOP).cargo TWOLITER_VERSION ?= "0.6.0" TWOLITER_SHA256_AARCH64 ?= "73a961ff8b9e829b764a86e096b9c2630b452dadc2099f678d57b2146f6a18f9" TWOLITER_SHA256_X86_64 ?= "739c5ed0bbd9b0f50ca641964e03b1a92ae9b2c814b1c3463e22f54bc8968e35" -KIT ?= bottlerocket-core-kit +KIT ?= bottlerocket-kernel-kit UNAME_ARCH = $(shell uname -m) ARCH ?= $(UNAME_ARCH) VENDOR ?= bottlerocket diff --git a/README.md b/README.md index 1f3ef5b9..0f466ed1 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# Bottlerocket Core Kit -This is the core kit for [Bottlerocket](https://github.com/bottlerocket-os/bottlerocket). +# Bottlerocket Kernel Kit +This is the kernel kit for [Bottlerocket](https://github.com/bottlerocket-os/bottlerocket). It includes many common dependencies for downstream package and variant builds. ## Contents -The core kit includes: -* Shared libraries such as glibc and libz -* Management daemons such as systemd and dbus-broker -* Agents for settings API and in-place updates +The kernel kit includes: +* multiple versions of the Linux kernel +* bootloaders +* firmware ### Availability -The [Bottlerocket core kit](https://gallery.ecr.aws/bottlerocket/bottlerocket-core-kit) is available through Amazon ECR Public. +The [Bottlerocket kernel kit](https://gallery.ecr.aws/bottlerocket/bottlerocket-kernel-kit) is available through Amazon ECR Public. ### Development -The core kit can be built on either an **x86_64** or an **aarch64** host. To do this you can use the following commands. +The kernel kit can be built on either an **x86_64** or an **aarch64** host. To do this you can use the following commands. ```shell make ``` diff --git a/Twoliter.lock b/Twoliter.lock new file mode 100644 index 00000000..5f2ca4e7 --- /dev/null +++ b/Twoliter.lock @@ -0,0 +1,9 @@ +schema-version = 1 +kit = [] + +[sdk] +name = "bottlerocket-sdk" +version = "0.50.0" +vendor = "bottlerocket" +source = "public.ecr.aws/bottlerocket/bottlerocket-sdk:v0.50.0" +digest = "Rjpy/gVgBhU/B696xaK1Y4/drz4pNJu+fyyZSIk9oLE=" diff --git a/Twoliter.toml b/Twoliter.toml new file mode 100644 index 00000000..97a574f3 --- /dev/null +++ b/Twoliter.toml @@ -0,0 +1,10 @@ +schema-version = 1 +release-version = "1.0.0" + +[vendor.bottlerocket] +registry = "public.ecr.aws/bottlerocket" + +[sdk] +name = "bottlerocket-sdk" +version = "0.50.0" +vendor = "bottlerocket" diff --git a/kits/bottlerocket-kernel-kit/Cargo.toml b/kits/bottlerocket-kernel-kit/Cargo.toml new file mode 100644 index 00000000..1c38c8c7 --- /dev/null +++ b/kits/bottlerocket-kernel-kit/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "bottlerocket-kernel-kit" +version = "0.1.0" +edition = "2021" +publish = false +build = "../build.rs" + +[package.metadata.build-kit] +vendor = "bottlerocket" + +[lib] +path = "../kit.rs" + +[build-dependencies] +grub = { path = "../../packages/grub" } +kernel-5_10 = { path = "../../packages/kernel-5.10" } +kernel-5_15 = { path = "../../packages/kernel-5.15" } +kernel-6_1 = { path = "../../packages/kernel-6.1" } +kmod-5_10-nvidia = { path = "../../packages/kmod-5.10-nvidia" } +kmod-5_15-nvidia = { path = "../../packages/kmod-5.15-nvidia" } +kmod-6_1-nvidia = { path = "../../packages/kmod-6.1-nvidia" } +linux-firmware = { path = "../../packages/linux-firmware" } +microcode = { path = "../../packages/microcode" } +libkcapi = { path = "../../packages/libkcapi" } +shim = { path = "../../packages/shim" } + diff --git a/tools/collect-kernel-config b/tools/collect-kernel-config index a5fd83e2..f5306abe 100755 --- a/tools/collect-kernel-config +++ b/tools/collect-kernel-config @@ -5,7 +5,7 @@ output_dir=/tmp/configs usage() { cat <