merge_config.sh
配置片段
$ cd linux
$ git checkout v4.9
$ make x86_64_defconfig
$ grep -E 'CONFIG_(DEBUG_INFO|GDB_SCRIPTS)[= ]' .config
# CONFIG_DEBUG_INFO is not set
$ # GDB_SCRIPTS depends on CONFIG_DEBUG_INFO in lib/Kconfig.debug.
$ cat <<EOF >.config-fragment
> CONFIG_DEBUG_INFO=y
> CONFIG_GDB_SCRIPTS=y
> EOF
$ # Order is important here. Must be first base config, then fragment.
$ ./scripts/kconfig/merge_config.sh .config .config-fragment
$ grep -E 'CONFIG_(DEBUG_INFO|GDB_SCRIPTS)[= ]' .config
CONFIG_DEBUG_INFO=y
CONFIG_GDB_SCRIPTS=y
不幸的是,进程替换无法正常工作:
./scripts/kconfig/merge_config.sh arch/x86/configs/x86_64_defconfig \
<( printf 'CONFIG_DEBUG_INFO=y\nCONFIG_GDB_SCRIPTS=y\n' )
由于:https : //unix.stackexchange.com/a/164109/32558
merge_config.sh
是目标的简单前端make alldefconfig
。
交叉编译时,ARCH
必须在运行时导出merge_config.sh
,例如:
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make defconfig
./scripts/kconfig/merge_config.sh .config .config-fragment
可以使用KCONFIG_CONFIG
环境变量显式指定合并的输出文件。否则,它只会覆盖.config
:
KCONFIG_CONFIG=some/path/.config ./scripts/kconfig/merge_config.sh .config .config-fragment
Buildroot使用BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES
以下命令使其自动化:https : //stackoverflow.com/questions/1414968/how-do-i-configure-the-linux-kernel-within-buildroot
相关:https://stackoverflow.com/questions/7505164/how-do-you-non-interactively-turn-on-features-in-a-linux-kernel-config-file
make olddefconfig
吗?