Linux内核源码里scripts/config和scripts/kconfig/merge_config.sh作用

Linux内核源码的scripts目录,其作用主要存储内核编译和配置相关脚本。这里主要介绍两个常用脚本:scripts/config和scripts/kconfig/merge_config.sh功能如下:

scripts/config

用于操作.config 文件脚本:
使用方式:

Usage:
$myname options command ...
commands:
	--enable|-e option   Enable option
	--disable|-d option  Disable option
	--module|-m option   Turn option into a module
	--set-str option string
	                     Set option to "string"
	--set-val option value
	                     Set option to value
	--undefine|-u option Undefine option
	--state|-s option    Print state of option (n,y,m,undef)

	--enable-after|-E beforeopt option
                             Enable option directly after other option
	--disable-after|-D beforeopt option
                             Disable option directly after other option
	--module-after|-M beforeopt option
                             Turn option into module directly after other option

	commands can be repeated multiple times

options:
	--file config-file   .config file to change (default .config)
	--keep-case|-k       Keep next symbols' case (dont' upper-case it)

$myname doesn't check the validity of the .config file. This is done at next
make time.

By default, $myname will upper-case the given symbol. Use --keep-case to keep
the case of all following symbols unchanged.

$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...

常见使用方式,为.config 文件新增或屏蔽CONFIG选项。
注意:新增或屏蔽CONFIG选项必须在原.config下是存在的选项,否则无法进行控制
举例eg:

./scripts/config --file build/.config \   #生成.config 文件到build/.config
                -d CONFIG_HZ_100\  #失能CONFIG_HZ_100选项
                -e CONFIG_HZ_250\  #使能CONFIG_HZ_100选项
                --set-val CONFIG_NR_CPUS 4 \  #CONFIG_NR_CPUS 设置为4
                --set-str CONFIG_INITRAMFS_SOURCE "test"  # CONFIG_INITRAMFS_SOURCE 设置为"test"

scripts/kconfig/merge_config.sh

目的是将两个deconfig进行merge一个新的deconfig,对于arm64, deconfig 文件通常位于arch/arm64/configs/下。
用法:

	echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
	echo "  -h    display this help text"
	echo "  -m    only merge the fragments, do not execute the make command"
	echo "  -n    use allnoconfig instead of alldefconfig"
	echo "  -r    list redundant entries when merging fragments"
	echo "  -y    make builtin have precedence over modules"
	echo "  -O    dir to put generated output files.  Consider setting \$KCONFIG_CONFIG instead."
	echo "  -s    strict mode. Fail if the fragment redefines any value."
	echo
	echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."

举例eg:合并build/.config和arch/arm64/configs/demo_deconfig生成的新的.config 位于build/下。

 ./scripts/kconfig/merge_config.sh -m -O \
                ./build/ \   #合并后生成路径
                ./build/.config \  #被merge的config1
                ./arch/arm64/configs/demo_deconfig  # #被merge的config2
  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值