-
Notifications
You must be signed in to change notification settings - Fork 2.5k
sh: support building multiple kernel variants #5999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JackThomson2
wants to merge
6
commits into
firecracker-microvm:feature/secret-hiding
Choose a base branch
from
JackThomson2:feat/dual_kernel_build
base: feature/secret-hiding
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+270
−24
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b34b1b7
sh: support building multiple kernel variants
JackThomson2 56542e0
sh: test: parametrize hiding kernel build over variants
JackThomson2 b5a1930
ci: build each secret hiding kernel variant separately
JackThomson2 ef90b2e
sh: document the kernel variant layout
JackThomson2 956e420
sh: add Amazon Linux 6.18 kernel variant
JackThomson2 a5bad4b
sh: ci: skip untouched kernel variants
JackThomson2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Secret Hiding kernel CI | ||
|
|
||
| This directory builds the "Secret Freedom" / direct-map-removal kernels used by | ||
| Firecracker's secret-hiding CI. Its layout lets you build **multiple kernel | ||
| variants of different versions** while sharing as much as possible between them. | ||
|
|
||
| ## Layout | ||
|
|
||
| ``` | ||
| resources/hiding_ci/ | ||
| ├── build_and_install_kernel.sh # builds (and optionally installs) a variant | ||
| ├── apply_kernel_patches.sh # applies a variant's patch series to a kernel tree | ||
| ├── dkms.conf # shared ENA driver DKMS config (AL2023) | ||
| ├── install_ena.sh # shared ENA driver installer (AL2023) | ||
| ├── kernel_url # shared default git repo to clone from | ||
| ├── base_config # shared base kernel config overrides | ||
| └── kernels/ | ||
| └── <version>-<feature>/ # one subfolder per variant, e.g. 6.18-secret-hiding | ||
| ├── kernel_commit_hash # REQUIRED: base commit to check out | ||
| ├── kernel_url # OPTIONAL: repo override (defaults to ../../kernel_url) | ||
| ├── config_overrides # OPTIONAL: config overrides merged on top of base_config | ||
| └── linux_patches/ # REQUIRED: patch series applied on top of the base commit | ||
| ├── GPL-2.0 # license for the patches (travels with them) | ||
| ├── README.md | ||
| └── NN-feature/*.patch | ||
| ``` | ||
|
|
||
| ### Shared vs per-variant | ||
|
|
||
| - **Shared (root):** the build scripts, the ENA helpers, the default | ||
| `kernel_url`, and `base_config` (config knobs common to every hiding kernel). | ||
| - **Per-variant (`kernels/<variant>/`):** the base commit, the patch series, and | ||
| any version-specific config or repo overrides. | ||
|
|
||
| The build layers config overrides **base first, then the variant's | ||
| `config_overrides` on top** (later values win), matching | ||
| `scripts/kconfig/merge_config.sh -m` semantics. `resources/rebuild.sh` uses the | ||
| same approach for guest kernels. | ||
|
|
||
| ## Naming convention | ||
|
|
||
| Name variant folders `<base-version>-<feature>`, e.g. `6.18-secret-hiding`. The | ||
| version prefix is the upstream kernel version of the pinned base commit | ||
| (`make -s kernelversion` at that commit). | ||
|
|
||
| ## Adding a new variant | ||
|
|
||
| 1. Create `kernels/<version>-<feature>/`. | ||
| 1. Add `kernel_commit_hash` with the base commit to check out. | ||
| 1. Add a `linux_patches/` directory with the patch series (include a `GPL-2.0` | ||
| copy alongside the patches, since the license must travel with them). | ||
| 1. Optionally add `kernel_url` if the variant pulls from a different repo than | ||
| the shared root default. | ||
| 1. Optionally add `config_overrides` for config knobs specific to this variant; | ||
| anything common to all variants belongs in the root `base_config`. | ||
|
|
||
| The pytest test (`tests/integration_tests/build/test_hiding_kernel.py`) and the | ||
| Buildkite PR pipeline (`.buildkite/pipeline_pr.py`) discover variants from | ||
| `kernels/`, so a new variant gets its own build job with no further wiring. | ||
|
|
||
| ## Building locally | ||
|
|
||
| ```sh | ||
| cd resources/hiding_ci | ||
| # Build a specific variant without installing it, cleaning up the temp tree after: | ||
| ./build_and_install_kernel.sh 6.18-secret-hiding --no-install --tidy | ||
|
|
||
| # If exactly one variant exists, the selector may be omitted: | ||
| ./build_and_install_kernel.sh --no-install --tidy | ||
| ``` | ||
|
|
||
| Pass `--install` (or answer the prompt) to install the built kernel. Use | ||
| `apply_kernel_patches.sh <variant>` from inside an already checked-out kernel | ||
| tree to apply the patch series on its own. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
resources/hiding_ci/kernels/6.18-amazon-linux/kernel_commit_hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 275d294b2b24abcd65452198551cd8a5b8d4f775 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| https://github.com/amazonlinux/linux.git |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.