Skip to content

Validate custom kernel configurations exist in fully generated config - #266

Merged
ginglis13 merged 6 commits into
bottlerocket-os:developfrom
ginglis13:kernel-configs-arch-specific
Sep 11, 2025
Merged

Validate custom kernel configurations exist in fully generated config#266
ginglis13 merged 6 commits into
bottlerocket-os:developfrom
ginglis13:kernel-configs-arch-specific

Conversation

@ginglis13

@ginglis13 ginglis13 commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

Issue number:

Closes #265

Description of changes:

Previously, architecture-specific kernel configuration options were mixed into the common config-bottlerocket files for both kernel-6.1 and kernel-6.12. This PR separates these configurations into dedicated
architecture-specific files and improves build time checks to ensure that custom kernel configs are always applied.

While making this change, I discovered some minor improvements to our configs that are included in this PR as separate commits:

  • kernel: change CONFIG_ZSTD_COMPRESS from built-in to module - Changed from built-in (=y) to module (=m); the merged configuration was always writing as =m
  • kernel: remove CONFIG_FCOE_FNIC from common kernel configs - added for metal support, but we've since dropped the module needed for this option.
  • kernel-6.12: remove CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE - deprecated per https://www.kernelconfig.io/config_security_selinux_checkreqprot_value?q=&kernelversion=6.12.44&arch=x86 and not appearing in final config for kernel 6.12

Configuration Structure changes

  • packages/kernel-6.1/config-bottlerocket-aarch64
  • packages/kernel-6.1/config-bottlerocket-x86_64
  • packages/kernel-6.12/config-bottlerocket-aarch64
  • packages/kernel-6.12/config-bottlerocket-x86_64
  • Removed architecture-specific options from config-bottlerocket files

I identified architecture specific options following the steps outlined in this gist: https://gist.github.com/ginglis13/e918b649d1b3bf2e910c771ca0a8798a

Build changes:

  • Updated kernel spec files to include architecture-specific configs
  • Updated merge_config.sh commands to include arch-specific configs
  • Added automatic validation to tools/latest-kernel-full-config.sh

New configuration merge order:

  1. Base Amazon Linux config (../config-)
  2. Microcode config (x86_64 only)
  3. Common Bottlerocket config (config-bottlerocket)
  4. Architecture-specific Bottlerocket config (config-bottlerocket-)

Testing done:

make ARCH=x86_64 && make ARCH=aarch64 -> success here implies no changes to the full generated config as a result of this PR

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Comment thread packages/kernel-6.1/config-bottlerocket-x86_64 Outdated
Comment thread packages/kernel-6.1/config-bottlerocket Outdated
Comment thread packages/kernel-6.1/kernel-6.1.spec Outdated
Comment thread tools/latest-kernel-full-config.sh Outdated
Comment thread tools/latest-kernel-full-config.sh Outdated
Change ZSTD compression from built-in (=y) to module (=m) for both
kernel-6.1 and kernel-6.12. This was being done implicltly by the kernel
config merging script in building the full configs for both kernels and
bring parity between our config and generated config.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
Remove CONFIG_FCOE_FNIC from the common kernel configuration.
This configuration was originally added for bare-metal support
in 2022 but Bottlerocket dropped support for bare-metal variants with
the last supported variant being metal-k8s-1.28.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
Remove CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE from kernel-6.12
configuration as this option was removed from the Linux kernel source
code between versions 6.1 and 6.12.

The kernelconfig.io link states this option is deprecated:
https://www.kernelconfig.io/config_security_selinux_checkreqprot_value?q=&kernelversion=6.12.44&arch=x86

This config option gets silently ignored during the merge_config.sh
process, so removing it prevents confusion.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
Remove architecture-specific configurations from common config files
and update kernel spec files to merge architecture-specific configs
during the build process.

Add architecture-specific kernel configuration files to separate
aarch64 and x86_64 specific options from the common configurations.

The kernel build now follows this configuration merge order:
1. Base Amazon Linux config (../config-<arch>)
2. Microcode config (x86_64 only)
3. Common Bottlerocket config (config-bottlerocket)
4. Architecture-specific Bottlerocket config (config-bottlerocket-<arch>)

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
Add automatic validation to the kernel configuration generation script
to ensure that all expected configuration options from both common and
architecture-specific config files are present in the generated
config-full-bottlerocket-<arch> files.

The validation runs after config generation and:
* Checks that all configs from config-bottlerocket are present in the
  full config
* Checks that all configs from config-bottlerocket-<arch> are present in
  the full config
* Ignores commented configs to avoid false failures from removed options
* Fails the build if any expected configs are missing

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
Update README files for both kernel-6.1 and kernel-6.12 to document
the new architecture-specific configuration structure.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
@ginglis13
ginglis13 force-pushed the kernel-configs-arch-specific branch from 91d4f55 to c7356e1 Compare September 9, 2025 00:02
@ginglis13

Copy link
Copy Markdown
Contributor Author

^ force push addresses comments regarding

  • config option to cleanup
  • organization of the new config sources
  • shell scripting best practices

@ginglis13
ginglis13 merged commit e745862 into bottlerocket-os:develop Sep 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom kernel configuration enhancements

5 participants