“make oldconfig”在 Linux 内核 makefile 中究竟做了什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4178526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:50:43  来源:igfitidea点击:

What does "make oldconfig" do exactly in the Linux kernel makefile?

linuxmakefilelinux-kernel

提问by fred basset

Can anyone explain what the target "oldconfig" does exactly in the Linux kernel makefile? I see it referenced in some build documentation but never explained what it does exactly.

谁能解释一下目标“oldconfig”在 Linux 内核 makefile 中究竟做了什么?我在一些构建文档中看到它被引用,但从未解释过它究竟做了什么。

采纳答案by Ignacio Vazquez-Abrams

It reads the existing .configfile and prompts the user for options in the current kernel source that are not found in the file. This is useful when taking an existing configuration and moving it to a new kernel.

它读取现有.config文件并提示用户选择当前内核源文件中未找到的选项。这在采用现有配置并将其移动到新内核时很有用。

回答by ?imon Tóth

Updates an old config with new/changed/removed options.

使用新的/更改的/删除的选项更新旧配置。

回答by Angelo Babudro

Before you run make oldconfig, you need to copy a kernel configuration file from an older kernel into the root directory of the new kernel.

在运行之前make oldconfig,您需要将旧内核中的内核配置文件复制到新内核的根目录中。

You can find a copy of the old kernel configuration file on a running system at /boot/config-3.11.0. Alternatively, kernel source code has configs in linux-3.11.0/arch/x86/configs/{i386_defconfig / x86_64_defconfig}

您可以在正在运行的系统上找到旧内核配置文件的副本,网址为/boot/config-3.11.0。或者,内核源代码中有配置linux-3.11.0/arch/x86/configs/{i386_defconfig / x86_64_defconfig}

If your kernel source is located at /usr/src/linux:

如果您的内核源代码位于/usr/src/linux

cd /usr/src/linux
cp /boot/config-3.9.6-gentoo .config
make oldconfig

回答by Nan Xiao

From this page:

从这个页面

Make oldconfig takes the .config and runs it through the rules of the Kconfig files and produces a .config which is consistant with the Kconfig rules. If there are CONFIG values which are missing, the make oldconfig will ask for them.

If the .config is already consistant with the rules found in Kconfig, then make oldconfig is essentially a no-op.

If you were to run make oldconfig, and then run make oldconfig a second time, the second time won't cause any additional changes to be made.

Make oldconfig 获取 .config 并通过 Kconfig 文件的规则运行它,并生成一个与 Kconfig 规则一致的 .config。如果缺少 CONFIG 值,make oldconfig 将要求它们。

如果 .config 已经与 Kconfig 中的规则一致,那么 make oldconfig 本质上是一个空操作。

如果您要运行 make oldconfig,然后第二次运行 make oldconfig,第二次将不会导致进行任何其他更改。

回答by Danial

It's torture. Instead of including a generic conf file, they make you hit return 9000 times to generate one.

这是折磨。它们没有包含一个通用的 conf 文件,而是让你点击 return 9000 次来生成一个。