Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
524 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...