Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
526 views
in Technique[技术] by (71.8m points)

build - How do you non-interactively turn on features in a Linux kernel .config file?

I have a situation where our software needs to work with several different Linux kernel distributions / kernel trees. (including Android forks)

In trying to automate our build process, I am finding that some of the defconfig files for particular builds we need to support do not include the kernel modules we depend on.

For example, let's imagine I need an option called XXX in my .config. For some dependencies, I can do something like this:

sed -i 's/# CONFIG_XXX is not set/CONFIG_XXX=m/' .config

For others, it's not so easy since the dependency may span multiple lines of .config statements.

Is there a more supported way to do this non-interactively, or am I stuck writing a more complex search-and-replace script?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The kernel has a tool (./scripts/config) to change specific options on .config. Here is an example:

./scripts/config --set-val CONFIG_OPTION y

Although, it doesn't check the validity of the .config file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...