Best method to modify kernel config?

I believe that OpenWrt makes it kernel config from two files:

  1. The default: target/linux/generic/config-6.1
  2. The subtarget specific: target/linux/x86/64/config-6.1

What is the best strategy for user to tweak these default to make a custom config?

AFAIK kernel flags are only exposed through the buildroot in a limited way; but you can set additional kernel flags by adding them into the files you mentioned and using a specific prefix. I cannot remember offhand which one, but if you know flags that are exposed already you can check those. I believe it's something like CONFIG_KERNEL_

Thanks @Borromini.. .for now I am happy to directly edit the files but I am confused over the heiriarchy that governs how they are applied. Is there a priority? Just logically, I would think they are read in this order:

  1. The default: target/linux/generic/config-6.1
  2. The target: target/linux/x86/config-6.1
  3. The subtarget: target/linux/x86/64/config-6.1

If I want to override values, is it sane to just put them at the end of the file, for testing purposes: target/linux/x86/64/config-6.1

To my knowledge , they are applied in that order. First the global defaults, then target, then subtarget.

You should be able to put override values at the end for testing, but then the early old/wrong value might already trigger some config dependency in some cases. (But not sure about that...)

1 Like

My entries in the subtarget config are ignored.

I added the following at the bottom of target/linux/x86/64/config-6.1 and built the kernel, but there is no mention of the config option in /scratch/union/build_dir/target-x86_64_musl/linux-x86_64/linux-6.1.38/.config

...
CONFIG_CRYPTO_DEV_CCP=y
CONFIG_CRYPTO_DEV_CCP_DEBUGFS=y
CRYPTO_DEV_CCP_DD=y
% grep CRYPTO_DEV_CCP /scratch/union/build_dir/target-x86_64_musl/linux-x86_64/linux-6.1.38/.config

They are set to disable in the generic config:

% i=CONFIG_CRYPTO_DEV_CCP
% grep $i target/linux/generic/config-6.1 target/linux/x86/config-6.1 target/linux/x86/64/config-6.1
target/linux/generic/config-6.1:# CONFIG_CRYPTO_DEV_CCP is not set
target/linux/generic/config-6.1:# CONFIG_CRYPTO_DEV_CCP_DEBUGFS is not set
target/linux/x86/64/config-6.1:CONFIG_CRYPTO_DEV_CCP=y
target/linux/x86/64/config-6.1:CONFIG_CRYPTO_DEV_CCP_DEBUGFS=y

EDIT: Ah!! I see, you have to hit every option relating to the symbols you want to add... I was omitting the following in my subtarget config that was set to disabled in the generic one:

CONFIG_CRYPTO_HW=y

This is complex!