“make oldconfig”는 Linux 커널 makefile에서 정확히 무엇을합니까?
Linux 커널 makefile에서 대상 "oldconfig"가 정확히 무엇을하는지 설명 할 수 있습니까? 일부 빌드 문서에서 참조했지만 정확히 무엇을하는지 설명하지 않았습니다.
기존 .config
파일을 읽고 파일에서 찾을 수없는 현재 커널 소스의 옵션을 사용자에게 프롬프트합니다. 이것은 기존 구성을 가져와 새 커널로 이동할 때 유용합니다.
를 실행하기 전에 make oldconfig
이전 커널의 커널 구성 파일을 새 커널의 루트 디렉토리로 복사해야합니다.
에서 실행중인 시스템의 이전 커널 구성 파일 사본을 찾을 수 있습니다 /boot/config-3.11.0
. 또는 커널 소스 코드에 구성이 있습니다.linux-3.11.0/arch/x86/configs/{i386_defconfig / x86_64_defconfig}
커널 소스가 다음 위치에있는 경우 /usr/src/linux
:
cd /usr/src/linux
cp /boot/config-3.9.6-gentoo .config
make oldconfig
요약
Ignacio 에서 언급했듯이 .config
커널 소스를 업데이트 한 후 업데이트합니다 (예 : git pull
.
기존 옵션을 유지하려고합니다.
다음과 같은 이유로 스크립트가 있으면 도움이됩니다.
새 옵션이 추가되었거나 이전 옵션이 제거되었을 수 있습니다.
커널의 Kconfig 구성 형식에는 다음과 같은 옵션이 있습니다.
- 서로를 통해 암시
select
- 다른 것을 통해 의존
depends
이러한 옵션 관계는 수동 구성 해결을 더욱 어렵게 만듭니다.
- 서로를 통해 암시
구성을 해결하는 방법을 이해하기 위해 .config를 수동으로 수정 해 보겠습니다.
먼저 다음을 사용하여 기본 구성을 생성하십시오.
make defconfig
이제 생성 된 .config
파일을 수동으로 편집하여 커널 업데이트를 에뮬레이트하고 다음을 실행합니다.
make oldconfig
무슨 일이 일어나는지 볼 수 있습니다. 몇 가지 결론 :
유형의 라인 :
# CONFIG_XXX is not set
단순한 주석이 아니라 실제로 매개 변수가 설정되지 않았 음을 나타냅니다.
예를 들어, 라인을 제거하면 :
# CONFIG_DEBUG_INFO is not set
실행
make oldconfig
하면 다음 과 같은 메시지가 표시됩니다.Compile the kernel with debug info (DEBUG_INFO) [N/y/?] (NEW)
완료되면
.config
파일이 업데이트됩니다.행의 문자를 변경하면 (예 :로
# CONFIG_DEBUG_INFO
) 계산되지 않습니다.유형의 라인 :
# CONFIG_XXX is not set
다음과 같은 경우에도 항상 속성의 부정에 사용됩니다.
CONFIG_XXX=n
부정으로도 이해됩니다.
예를 들어, 제거
# CONFIG_DEBUG_INFO is not set
하고 대답하는 경우 :Compile the kernel with debug info (DEBUG_INFO) [N/y/?] (NEW)
를 사용
N
하면 출력 파일에 다음이 포함됩니다.# CONFIG_DEBUG_INFO is not set
그리고 아닙니다 :
CONFIG_DEBUG_INFO=n
또한 라인을 다음과 같이 수동으로 수정하는 경우 :
CONFIG_DEBUG_INFO=n
실행
make oldconfig
하면 줄이 다음과 같이 수정됩니다.# CONFIG_DEBUG_INFO is not set
oldconfig
우리에게 묻지 않고 .종속성이 충족되지 않는 구성은
.config
. 다른 모든 것.예를 들어 다음을 설정하십시오.
CONFIG_DEBUG_INFO=y
그리고 실행하십시오
make oldconfig
. : 지금 우리를 물어볼 것DEBUG_INFO_REDUCED
,DEBUG_INFO_SPLIT
등 CONFIGS.Those properties did not appear on the
defconfig
before.If we look under
lib/Kconfig.debug
where they are defined, we see that they depend onDEBUG_INFO
:config DEBUG_INFO_REDUCED bool "Reduce debugging information" depends on DEBUG_INFO
So when
DEBUG_INFO
was off, they did not show up at all.Configs which are
selected
by turned on configs are automatically set without asking the user.For example, if
CONFIG_X86=y
and we remove the line:CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
and run
make oldconfig
, the line gets recreated without asking us, unlikeDEBUG_INFO
.This happens because
arch/x86/Kconfig
contains:config X86 def_bool y [...] select ARCH_MIGHT_HAVE_PC_PARPORT
and select forces that option to be true. See also: https://unix.stackexchange.com/questions/117521/select-vs-depends-in-kernel-kconfig
Configs whose constraints are not met are asked for.
For example,
defconfig
had set:CONFIG_64BIT=y CONFIG_RCU_FANOUT=64
If we edit:
CONFIG_64BIT=n
and run
make oldconfig
, it will ask us:Tree-based hierarchical RCU fanout value (RCU_FANOUT) [32] (NEW)
This is because
RCU_FANOUT
is defined atinit/Kconfig
as:config RCU_FANOUT int "Tree-based hierarchical RCU fanout value" range 2 64 if 64BIT range 2 32 if !64BIT
Therefore, without
64BIT
, the maximum value is32
, but we had64
set on the.config
, which would make it inconsistent.
Bonuses
make olddefconfig
sets every option to their default value without asking interactively. It gets run automatically on make
to ensure that the .config
is consistent in case you've modified it manually like we did. See also: https://serverfault.com/questions/116299/automatically-answer-defaults-when-doing-make-oldconfig-on-a-kernel-tree
make alldefconfig
is like make olddefconfig
, but it also accepts a config fragment to merge. This target is used by the merge_config.sh
script: https://stackoverflow.com/a/39440863/895245
And if you want to automate the .config
modification, that is not too simple: How do you non-interactively turn on features in a Linux kernel .config file?
Updates an old config with new/changed/removed options.
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.
It's torture. Instead of including a generic conf file, they make you hit return 9000 times to generate one.
'programing' 카테고리의 다른 글
LINQ를 사용하여 목록에서 중복을 계산하는 방법 (0) | 2020.10.26 |
---|---|
Visual Studio 2010 : 솔루션에서 프로젝트 빌드 순서를 적용하는 방법은 무엇입니까? (0) | 2020.10.26 |
ZSH의 기록에서 항목을 제거하는 방법 (0) | 2020.10.26 |
함수에 변수를 전달할 때 Python timeit을 사용하는 방법은 무엇입니까? (0) | 2020.10.26 |
유성 배포 앱에서 데이터를 내보내는 간단한 방법이 있습니까? (0) | 2020.10.26 |