Jump to content

[Armbian build PR] - Fix forced kernel options and make `kernel-config` consistent with `rewrite-kernel-config`


RSS Bot

Recommended Posts

Description

The issue

When using ./compile.sh rewrite-kernel-config and then running the menuconfig with ./compile.sh kernel-config, just exiting and saving without any manual changes, the kernel config may still change. This is because rewrite-kernel-config does force some kernel options without any additional checks e.g. for dependencies. Using the config menu with kernel-config does those checks automatically and solves all dependencies.

Example: Using ./compile.sh kernel-config on linux-rockchip64-edge.config (e.g. with BOARD=nanopi-r5c), the option CONFIG_DEBUG_KERNEL=y is automatically selected, since it is a dependency for CONFIG_EXPERT=y, which is selected in this kernel config as well. But then, ./compile.sh rewrite-kernel-config forces CONFIG_DEBUG_KERNEL to disabled. However, this breaks the dependency for CONFIG_EXPERT=y, which is still enabled. In consequence, CONFIG_DEBUG_KERNEL will be set to =y next time anyone runs ./compile.sh kernel-config on this config.

The goal

Doing a kernel-config (with no manual changes, just start and exit with saving) or a rewrite-kernel-config should lead to the exact same config file. It should be consistent.

The solution

This PR tries to solve this in the following way:

  1. Save the config right after the forced configs were applied
  2. Do an oldconfig after forced configs were applied to have kernel make solve any issues (will add ~3 seconds on each rewrite-kernel-config)
  3. Let the user see what was changed by kernel make so changes can be made accordingly

Changes in forced kernel options by armbian-kernel.sh

  • Set DEBUG_INFO_NONE=y instead of DEBUG_INFO=n since the latter is not configurable
  • Remove GDB_SCRIPTS=n since DEBUG_INFO_NONE=y already implies this

Example output in build log (for rk3588-legacy kernel):

[🚸] Forced kernel options introduced misconfigurations or missing dependencies! [ Please re-run rewrite-kernel-config ]
[🚸] If this warning persists [ please remove dependent options using kernel-config or adapt your custom_kernel_config hooks ]
[πŸ›] In some cases, the issue might also be [ misconfigured options in armbian_kernel_config hooks ]
[πŸ”¨]   -DEBUG_INFO_NONE y
[πŸ”¨]   -MODULE_COMPRESS_NONE y
[πŸ”¨]    DEBUG_KERNEL n -> y
[πŸ”¨]    EXPERT n -> y
[🚸] See options above which have been changed automatically [ to solve dependencies and/or misconfigurations ]

As you can see, some of the forced kernel options did not have the expected results since kernel make had to change these to solve dependencies and make the config sane.

Warning:

  • This will output lots of changes on the first time it runs. Re-run it, the second run will output only the relevant changes.
  • Some kernel configs will have to be adapted to solve the issues which are output in the warnings (like above), or armbian-kernel.sh might have to be adapted a bit

linux-rockchip64-edge.config is an example, I just ran rewrite-kernel-config on this and kernel make did its magic. Overall, this should lead to more sane kernel configs.

How Has This Been Tested?

  • [x] rewrite-kernel-config for nanopi-r5c-edge
  • [ ] Other kernels should be tested as well

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] My changes generate no new warnings

View the full article

Link to comment
Share on other sites

Γ—
Γ—
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines