1

我的目标是使用命令行更改 kbuild 配置,而不会弄乱依赖关系。

为此,我通过编辑我的默认设置创建了一个“参考”.config配置make menuconfig。我改变的“唯一”事情是从 64 位更改为 32 位。

现在我使用了我的原始配置并应用了以下命令(来自 linux 内核根目录)

scripts/kconfig/merge_config.sh original.conf 32bit.conf

的内容32bit.conf很简单CONFIG_64=n

在区分这两个.configs frommake menuconfig和我的命令后,我发现几乎每个更改 frommake menuconfig也存在于另一个文件中。但只有几乎每一个变化。

$ diff .config.mkmenuconfig .config.command
104d103
< # CONFIG_NO_HZ_FULL is not set
112d110
< # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
327d324
< # CONFIG_MPSC is not set
330d326
< # CONFIG_GENERIC_CPU is not set
345c341,342
< # CONFIG_HPET_TIMER is not set
---
> CONFIG_HPET_TIMER=y
> CONFIG_HPET_EMULATE_RTC=y

这些差异来自哪里,是否有.config通过命令行操作 kbuild 的官方方法?

4

1 回答 1

0

从 5.2+ Linux 内核开始,CONFIG 可以接收第二个文件.config并将它们自动合并到最终的.config.

但首先,在关于配置文件差异的稍微相关的注释中,为了显示您的旧.config版本与 Linux 内核新发布的版本之间的差异,请执行:

make listnewconfig
(outputs a list of CONFIG_* that are newly added over old .config)

配置文件列表

使用包含文件列表的实用程序KCONFIG_DEFCONFIG_LIST读取 ' ' shell 定义,每个文件由空格分隔。make

config.network将与MakefileLinux 内核位于同一目录中。

CONFIG_BRIDGE=y
CONFIG_ARP=y
CONFIG_IP=y
CONFIG_IP6=y

并且config.notebook-toshiba可能有

CONFIG_SCSI=y
CONFIG_AHCI=y
CONFIG_RTC_INTF_DEV=y

然后执行:

KCONFIG_DEFCONFIG_LIST="config.network config.notebook-toshiba" make bzImage modules

Miniconfig 方法

(部分基于来自/来自 Rob Landley 的 lkml 电子邮件,re: miniconfig)

///变体还可以将环境变量用作标志allyesconfig或文件名allmodconfig,其中包含用户需要设置为特定值的配置符号。allnoconfigrandconfigKCONFIG_ALLCONFIG

如果KCONFIG_ALLCONFIG在没有文件名的情况下使用 whereKCONFIG_ALLCONFIG == “”</code> or KCONFIG_ALLCONFIG == “1”</code>, make *config checks for a file named “<code>all{yes/mod/no/def/random}.config” (corresponding to the *config command that was used) for symbol values that are to be forced.

If this file is not found, it checks for a file named “all.config” to contain forced values.

This enables you to create “miniature” config (miniconfig) or custom config files containing just the config symbols that you are interested in. Then the kernel config system generates the full .config file, including symbols of your miniconfig file.

This ‘<code>KCONFIG_ALLCONFIG' 文件是一个配置文件,其中包含(通常是所有的子集)预设配置符号。这些变量设置仍需接受正常的依赖性检查。

例子:

KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig

或者:

KCONFIG_ALLCONFIG=mini.config make allnoconfig

或者:

make KCONFIG_ALLCONFIG=mini.config allnoconfig

这些示例将禁用大多数选项 (allnoconfig),但启用或禁用在指定 mini-config 文件中明确列出的选项。

参考

于 2022-01-16T09:38:53.783 回答