요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
======
Kbuild
======
Output files
============
modules.order
-------------
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.
modules.builtin
---------------
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.
modules.builtin.modinfo
-----------------------
This file contains modinfo from all modules that are built into the kernel.
Unlike modinfo of a separate module, all fields are prefixed with module name.
modules.builtin.ranges
----------------------
This file contains address offset ranges (per ELF section) for all modules
that are built into the kernel. Together with System.map, it can be used
to associate module names with symbols.
Environment variables
=====================
KCPPFLAGS
---------
Additional options to pass when preprocessing. The preprocessing options
will be used in all cases where kbuild does preprocessing including
building C files and assembler files.
KAFLAGS
-------
Additional options to the assembler (for built-in and modules).
AFLAGS_MODULE
-------------
Additional assembler options for modules.
AFLAGS_KERNEL
-------------
Additional assembler options for built-in.
KCFLAGS
-------
Additional options to the C compiler (for built-in and modules).
KRUSTFLAGS
----------
Additional options to the Rust compiler (for built-in and modules).
CFLAGS_KERNEL
-------------
Additional options for $(CC) when used to compile
code that is compiled as built-in.
CFLAGS_MODULE
-------------
Additional module specific options to use for $(CC).
RUSTFLAGS_KERNEL
----------------
Additional options for $(RUSTC) when used to compile
code that is compiled as built-in.
RUSTFLAGS_MODULE
----------------
Additional module specific options to use for $(RUSTC).
LDFLAGS_MODULE
--------------
Additional options used for $(LD) when linking modules.
HOSTCFLAGS
----------
Additional flags to be passed to $(HOSTCC) when building host programs.
HOSTCXXFLAGS
------------
Additional flags to be passed to $(HOSTCXX) when building host programs.
HOSTRUSTFLAGS
-------------
Additional flags to be passed to $(HOSTRUSTC) when building host programs.
PROCMACROLDFLAGS
----------------
Flags to be passed when linking Rust proc macros. Since proc macros are loaded
by rustc at build time, they must be linked in a way that is compatible with
the rustc toolchain being used.
For instance, it can be useful when rustc uses a different C library than
the one the user wants to use for host programs.
If unset, it defaults to the flags passed when linking host programs.
HOSTLDFLAGS
-----------
Additional flags to be passed when linking host programs.
HOSTLDLIBS
----------
Additional libraries to link against when building host programs.
.. _userkbuildflags:
USERCFLAGS
----------
Additional options used for $(CC) when compiling userprogs.
USERLDFLAGS
-----------
Additional options used for $(LD) when linking userprogs. userprogs are linked
with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.
KBUILD_KCONFIG
--------------
Set the top-level Kconfig file to the value of this environment
variable. The default name is "Kconfig".
KBUILD_VERBOSE
--------------
Set the kbuild verbosity. Can be assigned same values as "V=...".
See make help for the full list.
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD
-------------
Set the directory to look for the kernel source when building external
modules.
Setting "M=..." takes precedence over KBUILD_EXTMOD.
KBUILD_OUTPUT
-------------
Specify the output directory when building the kernel.
This variable can also be used to point to the kernel output directory when
building external modules against a pre-built kernel in a separate build
directory. Please note that this does NOT specify the output directory for the
external modules themselves. (Use KBUILD_EXTMOD_OUTPUT for that purpose.)
The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT.
KBUILD_EXTMOD_OUTPUT
--------------------
Specify the output directory for external modules.
Setting "MO=..." takes precedence over KBUILD_EXTMOD_OUTPUT.
KBUILD_EXTRA_WARN
-----------------
Specify the extra build checks. The same value can be assigned by passing
W=... from the command line.
See `make help` for the list of the supported values.
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
KBUILD_DEBARCH
--------------
For the deb-pkg target, allows overriding the normal heuristics deployed by
deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
the UTS_MACHINE variable, and on some architectures also the kernel config.
The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
architecture.
KDOCFLAGS
---------
Specify extra (warning/error) flags for kernel-doc checks during the build,
see scripts/kernel-doc for which flags are supported. Note that this doesn't
(currently) apply to documentation builds.
ARCH
----
Set ARCH to the architecture to be built.
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
But some architectures such as x86 and sparc have aliases.
- x86: i386 for 32 bit, x86_64 for 64 bit
- parisc: parisc64 for 64 bit
- sparc: sparc32 for 32 bit, sparc64 for 64 bit
CROSS_COMPILE
-------------
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.
CROSS_COMPILE is also used for ccache in some setups.
CF
--
Additional options for sparse.
CF is often used on the command-line like this::
make CF=-Wbitwise C=2
INSTALL_PATH
------------
INSTALL_PATH specifies where to place the updated kernel and system map
images. Default is /boot, but you can set it to other values.
INSTALLKERNEL
-------------
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
- $1 - kernel version
- $2 - kernel image file
- $3 - kernel map file
- $4 - default install path (use root directory if blank)
The implementation of "make install" is architecture specific
and it may differ from the above.
INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
MODLIB
------
Specify where to install modules.
The default value is::
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
INSTALL_MOD_PATH
----------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
INSTALL_MOD_STRIP
-----------------
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used. Otherwise,
INSTALL_MOD_STRIP value will be used as the options to the strip command.
INSTALL_HDR_PATH
----------------
INSTALL_HDR_PATH specifies where to install user space headers when
executing "make headers_*".
The default value is::
$(objtree)/usr
$(objtree) is the directory where output files are saved.
The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
INSTALL_DTBS_PATH
-----------------
INSTALL_DTBS_PATH specifies where to install device tree blobs for
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
KBUILD_ABS_SRCTREE
--------------------------------------------------
Kbuild uses a relative path to point to the tree when possible. For instance,
when building in the source tree, the source tree path is '.'
Setting this flag requests Kbuild to use absolute path to the source tree.
There are some useful cases to do so, like when generating tag files with
absolute path entries etc.
KBUILD_SIGN_PIN
---------------
This variable allows a passphrase or PIN to be passed to the sign-file
utility when signing kernel modules, if the private key requires such.
KBUILD_MODPOST_WARN
-------------------
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
KBUILD_MODPOST_NOFINAL
----------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
This is solely useful to speed up test compiles.
KBUILD_EXTRA_SYMBOLS
--------------------
For modules that use symbols from other modules.
See more details in modules.rst.
ALLSOURCE_ARCHS
---------------
For tags/TAGS/cscope targets, you can specify more than one arch
to be included in the databases, separated by blank space. E.g.::
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
To get all available archs you can also specify all. E.g.::
$ make ALLSOURCE_ARCHS=all tags
IGNORE_DIRS
-----------
For tags/TAGS/cscope targets, you can choose which directories won't
be included in the databases, separated by blank space. E.g.::
$ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope
KBUILD_BUILD_TIMESTAMP
----------------------
Setting this to a date string overrides the timestamp used in the
UTS_VERSION definition (uname -v in the running kernel). The value has to
be a string that can be passed to date -d. The default value
is the output of the date command at one point during build.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
------------------------------------
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
LLVM
----
If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
of GCC and GNU binutils to build the kernel.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Kbuild module 출력 파일
1-30`modules.order`는 module이 Makefile에 나타나는 순서를 기록합니다. `modprobe`는 여러 module과 일치하는 alias를 결정론적으로 해석할 때 이 순서를 사용합니다.
`modules.builtin`은 kernel에 built-in된 모든 module을 나열합니다. `modprobe`가 built-in 기능을 load하려다 실패로 처리하지 않도록 합니다.
`modules.builtin.modinfo`는 kernel에 built-in된 모든 module의 modinfo를 담습니다. 별도 module의 modinfo와 달리 모든 field 앞에 module 이름이 붙습니다.
`modules.builtin.ranges`는 built-in module마다 ELF section별 address offset 범위를 담습니다. `System.map`과 함께 사용하면 symbol을 module 이름과 연결할 수 있습니다.
네 파일이 module 탐색·정보·symbol 대응에 맡는 역할입니다.
======
Kbuild
======
Output files
============
modules.order
-------------
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.
modules.builtin
---------------
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.
modules.builtin.modinfo
-----------------------
This file contains modinfo from all modules that are built into the kernel.
Unlike modinfo of a separate module, all fields are prefixed with module name.
modules.builtin.ranges
----------------------
This file contains address offset ranges (per ELF section) for all modules
that are built into the kernel. Together with System.map, it can be used
to associate module names with symbols.
Target·host·user program compile flag
31-123`KCPPFLAGS`는 C와 assembler file build를 포함해 Kbuild가 preprocessing하는 모든 경우에 추가 option을 전달합니다. `KAFLAGS`는 built-in과 module assembler 공통 option이며 `AFLAGS_MODULE`과 `AFLAGS_KERNEL`은 각각 module과 built-in 전용 assembler option입니다.
`KCFLAGS`는 built-in과 module의 C compiler 공통 option이고 `KRUSTFLAGS`는 Rust compiler 공통 option입니다. `CFLAGS_KERNEL`과 `CFLAGS_MODULE`은 `$(CC)`의 built-in·module 전용 option이며 `RUSTFLAGS_KERNEL`과 `RUSTFLAGS_MODULE`은 `$(RUSTC)`의 대응 option입니다. `LDFLAGS_MODULE`은 `$(LD)`가 module을 link할 때 사용합니다.
공통 flag와 built-in·module 전용 flag를 구분합니다.
Host program에는 `HOSTCFLAGS`, `HOSTCXXFLAGS`, `HOSTRUSTFLAGS`가 각각 `$(HOSTCC)`, `$(HOSTCXX)`, `$(HOSTRUSTC)` compile option을 추가합니다. `HOSTLDFLAGS`는 host program link flag, `HOSTLDLIBS`는 link할 추가 library입니다.
`PROCMACROLDFLAGS`는 Rust proc macro link flag입니다. Proc macro는 build 중 rustc가 load하므로 사용 중인 rustc toolchain과 호환되는 방식으로 link해야 합니다. Rustc가 host program에 쓰려는 C library와 다른 library를 사용할 때 유용하며, 설정하지 않으면 host program link flag가 기본입니다.
Build host에서 실행되는 program과 proc macro에 적용됩니다.
`USERCFLAGS`는 `$(CC)`로 userprog를 compile할 때, `USERLDFLAGS`는 `$(LD)` 관련 userprog link에 추가됩니다. Userprog는 실제로 CC로 link하므로 필요한 linker option에는 `-Wl,` prefix를 포함해야 합니다.
Kernel tree에서 만드는 사용자 공간 program에 적용합니다.
Environment variables
=====================
KCPPFLAGS
---------
Additional options to pass when preprocessing. The preprocessing options
will be used in all cases where kbuild does preprocessing including
building C files and assembler files.
KAFLAGS
-------
Additional options to the assembler (for built-in and modules).
AFLAGS_MODULE
-------------
Additional assembler options for modules.
AFLAGS_KERNEL
-------------
Additional assembler options for built-in.
KCFLAGS
-------
Additional options to the C compiler (for built-in and modules).
KRUSTFLAGS
----------
Additional options to the Rust compiler (for built-in and modules).
CFLAGS_KERNEL
-------------
Additional options for $(CC) when used to compile
code that is compiled as built-in.
CFLAGS_MODULE
-------------
Additional module specific options to use for $(CC).
RUSTFLAGS_KERNEL
----------------
Additional options for $(RUSTC) when used to compile
code that is compiled as built-in.
RUSTFLAGS_MODULE
----------------
Additional module specific options to use for $(RUSTC).
LDFLAGS_MODULE
--------------
Additional options used for $(LD) when linking modules.
HOSTCFLAGS
----------
Additional flags to be passed to $(HOSTCC) when building host programs.
HOSTCXXFLAGS
------------
Additional flags to be passed to $(HOSTCXX) when building host programs.
HOSTRUSTFLAGS
-------------
Additional flags to be passed to $(HOSTRUSTC) when building host programs.
PROCMACROLDFLAGS
----------------
Flags to be passed when linking Rust proc macros. Since proc macros are loaded
by rustc at build time, they must be linked in a way that is compatible with
the rustc toolchain being used.
For instance, it can be useful when rustc uses a different C library than
the one the user wants to use for host programs.
If unset, it defaults to the flags passed when linking host programs.
HOSTLDFLAGS
-----------
Additional flags to be passed when linking host programs.
HOSTLDLIBS
----------
Additional libraries to link against when building host programs.
.. _userkbuildflags:
USERCFLAGS
----------
Additional options used for $(CC) when compiling userprogs.
USERLDFLAGS
-----------
Additional options used for $(LD) when linking userprogs. userprogs are linked
with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.
Kconfig·verbosity·build directory·warning 변수
124-185`KBUILD_KCONFIG`은 top-level Kconfig file을 지정하며 기본 이름은 `Kconfig`입니다.
`KBUILD_VERBOSE`는 `V=...`와 같은 값으로 Kbuild verbosity를 정합니다. 전체 값 목록은 `make help`에 있으며 command line의 `V=...`가 우선합니다.
`KBUILD_EXTMOD`는 external module을 build할 때 kernel source를 찾을 directory를 지정하고 `M=...`가 우선합니다.
`KBUILD_OUTPUT`은 kernel output directory를 지정합니다. 별도 build directory의 pre-built kernel을 대상으로 external module을 build할 때 kernel output을 가리키는 데도 쓰지만 external module 자체의 output directory를 지정하지는 않습니다. 그 용도는 `KBUILD_EXTMOD_OUTPUT`이며 각각 command line `O=...`, `MO=...`가 우선합니다.
같은 설정의 command-line assignment가 environment variable보다 우선합니다.
`KBUILD_EXTRA_WARN`은 추가 build check를 정하며 지원 값은 `make help`에서 확인합니다. `W=...`가 우선합니다.
`KBUILD_DEBARCH`는 `deb-pkg` target의 architecture 추정 heuristic을 override합니다. 보통 `UTS_MACHINE`과 일부 architecture의 kernel config로 추정하지만 이 variable 값은 검증하지 않고 유효한 Debian architecture라고 가정합니다.
`KDOCFLAGS`는 build 중 kernel-doc check에 warning/error flag를 추가합니다. 지원 flag는 `scripts/kernel-doc`을 참고하며 현재 documentation build에는 적용되지 않습니다.
KBUILD_KCONFIG
--------------
Set the top-level Kconfig file to the value of this environment
variable. The default name is "Kconfig".
KBUILD_VERBOSE
--------------
Set the kbuild verbosity. Can be assigned same values as "V=...".
See make help for the full list.
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD
-------------
Set the directory to look for the kernel source when building external
modules.
Setting "M=..." takes precedence over KBUILD_EXTMOD.
KBUILD_OUTPUT
-------------
Specify the output directory when building the kernel.
This variable can also be used to point to the kernel output directory when
building external modules against a pre-built kernel in a separate build
directory. Please note that this does NOT specify the output directory for the
external modules themselves. (Use KBUILD_EXTMOD_OUTPUT for that purpose.)
The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT.
KBUILD_EXTMOD_OUTPUT
--------------------
Specify the output directory for external modules.
Setting "MO=..." takes precedence over KBUILD_EXTMOD_OUTPUT.
KBUILD_EXTRA_WARN
-----------------
Specify the extra build checks. The same value can be assigned by passing
W=... from the command line.
See `make help` for the list of the supported values.
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
KBUILD_DEBARCH
--------------
For the deb-pkg target, allows overriding the normal heuristics deployed by
deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
the UTS_MACHINE variable, and on some architectures also the kernel config.
The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
architecture.
KDOCFLAGS
---------
Specify extra (warning/error) flags for kernel-doc checks during the build,
see scripts/kernel-doc for which flags are supported. Note that this doesn't
(currently) apply to documentation builds.
Architecture, cross compile과 kernel 설치
186-236`ARCH`는 build할 architecture를 지정합니다. 대부분 `arch/` directory 이름과 같지만 x86, parisc, sparc에는 alias가 있습니다.
Bitness에 따라 사용하는 architecture 이름입니다.
`CROSS_COMPILE`은 binutils filename의 고정 부분을 지정합니다. Filename prefix 또는 전체 path일 수 있고 일부 구성에서는 ccache에도 사용됩니다.
`CF`는 sparse에 추가 option을 전달합니다. 예제 `make CF=-Wbitwise C=2`는 bitwise warning과 sparse checking level을 함께 지정합니다.
`INSTALL_PATH`는 갱신한 kernel과 system map image를 놓을 위치이며 기본값은 `/boot`입니다.
`INSTALLKERNEL`은 `make install`에서 호출할 install script 이름이며 기본은 `installkernel`입니다. Argument는 `$1` kernel version, `$2` kernel image file, `$3` kernel map file, `$4` 기본 install path이고 `$4`가 비면 root directory를 사용합니다.
Install script가 받는 네 positional argument입니다.
`make install` 구현은 architecture별이므로 위 형식과 다를 수 있습니다. `INSTALLKERNEL`은 cross compile 중 custom installer를 지정할 수 있도록 제공됩니다.
ARCH
----
Set ARCH to the architecture to be built.
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
But some architectures such as x86 and sparc have aliases.
- x86: i386 for 32 bit, x86_64 for 64 bit
- parisc: parisc64 for 64 bit
- sparc: sparc32 for 32 bit, sparc64 for 64 bit
CROSS_COMPILE
-------------
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.
CROSS_COMPILE is also used for ccache in some setups.
CF
--
Additional options for sparse.
CF is often used on the command-line like this::
make CF=-Wbitwise C=2
INSTALL_PATH
------------
INSTALL_PATH specifies where to place the updated kernel and system map
images. Default is /boot, but you can set it to other values.
INSTALLKERNEL
-------------
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
- $1 - kernel version
- $2 - kernel image file
- $3 - kernel map file
- $4 - default install path (use root directory if blank)
The implementation of "make install" is architecture specific
and it may differ from the above.
INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
Module·header·DTB 설치와 build 진단
237-303`MODLIB`은 module 설치 위치이며 기본값은 `$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)`입니다. 직접 override하면 기본값은 무시됩니다.
`INSTALL_MOD_PATH`는 build root에서 module directory를 relocate하기 위해 `MODLIB` 앞에 붙이는 prefix입니다. Makefile에 정의되지는 않지만 필요할 때 make argument로 전달합니다.
`INSTALL_MOD_STRIP`을 정의하면 설치 뒤 module을 strip합니다. 값이 `1`이면 기본 `--strip-debug` option을 쓰고, 다른 값이면 그 값을 strip command option으로 사용합니다.
Module destination과 strip 동작을 제어합니다.
`INSTALL_HDR_PATH`는 `make headers_*`의 사용자 공간 header 설치 root입니다. 기본은 `$(objtree)/usr`이며 `$(objtree)`는 output file이 저장되는 directory로 보통 command line `O=...`로 정합니다. Variable을 override하면 기본값은 무시됩니다.
`INSTALL_DTBS_PATH`는 build root relocation을 위한 device tree blob 설치 위치입니다. Makefile에는 정의되지 않으며 필요할 때 make argument로 전달합니다.
Kbuild는 가능하면 tree를 상대 path로 가리킵니다. Source tree 안 build에서는 source path가 `.`입니다. `KBUILD_ABS_SRCTREE`를 설정하면 tag file 등에 absolute path entry가 필요할 때 source tree의 absolute path를 사용합니다.
`KBUILD_SIGN_PIN`은 private key에 passphrase나 PIN이 필요할 때 module signing의 `sign-file` utility로 값을 전달합니다.
`KBUILD_MODPOST_WARN`은 final module link에서 undefined symbol error를 warning으로 바꿉니다. `KBUILD_MODPOST_NOFINAL`은 module의 final link를 건너뛰며 test compile 속도를 높이는 용도로만 사용합니다.
Signing과 modpost 동작을 조정합니다.
MODLIB
------
Specify where to install modules.
The default value is::
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
INSTALL_MOD_PATH
----------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
INSTALL_MOD_STRIP
-----------------
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used. Otherwise,
INSTALL_MOD_STRIP value will be used as the options to the strip command.
INSTALL_HDR_PATH
----------------
INSTALL_HDR_PATH specifies where to install user space headers when
executing "make headers_*".
The default value is::
$(objtree)/usr
$(objtree) is the directory where output files are saved.
The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
INSTALL_DTBS_PATH
-----------------
INSTALL_DTBS_PATH specifies where to install device tree blobs for
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
KBUILD_ABS_SRCTREE
--------------------------------------------------
Kbuild uses a relative path to point to the tree when possible. For instance,
when building in the source tree, the source tree path is '.'
Setting this flag requests Kbuild to use absolute path to the source tree.
There are some useful cases to do so, like when generating tag files with
absolute path entries etc.
KBUILD_SIGN_PIN
---------------
This variable allows a passphrase or PIN to be passed to the sign-file
utility when signing kernel modules, if the private key requires such.
KBUILD_MODPOST_WARN
-------------------
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
KBUILD_MODPOST_NOFINAL
----------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
This is solely useful to speed up test compiles.
추가 symbol, tag database와 build identity
304-343`KBUILD_EXTRA_SYMBOLS`는 다른 module의 symbol을 사용하는 module build에 쓰며 자세한 내용은 `modules.rst`를 참고합니다.
`ALLSOURCE_ARCHS`는 `tags`, `TAGS`, `cscope` target database에 넣을 architecture를 공백으로 구분해 여러 개 지정합니다. 예제는 `make ALLSOURCE_ARCHS="x86 mips arm" tags`이며 모든 architecture는 `make ALLSOURCE_ARCHS=all tags`로 지정합니다.
`IGNORE_DIRS`는 tag database에서 제외할 directory를 공백으로 구분해 정합니다. 예제는 `make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope`입니다.
Architecture 범위와 제외 directory를 따로 정합니다.
`KBUILD_BUILD_TIMESTAMP`는 실행 kernel의 `uname -v`에 보이는 `UTS_VERSION` timestamp를 override합니다. 값은 `date -d`에 전달 가능한 date string이어야 하고 기본값은 build 중 한 시점의 `date` 출력입니다.
`KBUILD_BUILD_USER`와 `KBUILD_BUILD_HOST`는 boot 중과 `/proc/version`에 보이는 `user@host`를 override합니다. 기본값은 각각 `whoami`와 `host` command 출력입니다.
`LLVM=1`이면 Kbuild는 GCC와 GNU binutils 대신 Clang과 LLVM utility로 kernel을 build합니다.
명시하지 않은 값은 host command 결과를 사용합니다.
KBUILD_EXTRA_SYMBOLS
--------------------
For modules that use symbols from other modules.
See more details in modules.rst.
ALLSOURCE_ARCHS
---------------
For tags/TAGS/cscope targets, you can specify more than one arch
to be included in the databases, separated by blank space. E.g.::
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
To get all available archs you can also specify all. E.g.::
$ make ALLSOURCE_ARCHS=all tags
IGNORE_DIRS
-----------
For tags/TAGS/cscope targets, you can choose which directories won't
be included in the databases, separated by blank space. E.g.::
$ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope
KBUILD_BUILD_TIMESTAMP
----------------------
Setting this to a date string overrides the timestamp used in the
UTS_VERSION definition (uname -v in the running kernel). The value has to
be a string that can be passed to date -d. The default value
is the output of the date command at one point during build.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
------------------------------------
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
LLVM
----
If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
of GCC and GNU binutils to build the kernel.
요약·해설
kbuild.rst:1-343Kbuild의 환경 변수는 target·host·user compile flag, kernel과 external module output, installation root, warning·signing·modpost, tag database와 build identity를 세밀하게 제어합니다. Command-line의 `V/M/O/MO/W` assignment가 대응 environment variable보다 우선합니다.
Kernel, external module, 설치 destination을 분리해 지정합니다.