Kernel/Configuration/ko
An alternative to manual configuration that uses 'safe defaults' to build a generic kernel are the distribution kernels.
심볼릭 링크 설정
/usr/src/linux 심볼릭 링크는 언제든 현재 사용하는 커널 소스를 가리킵니다. 다음 세가지 방법 중 하나로 끝낼 수 있습니다:
1. symlink USE 플래그를 활성화한 후 커널 소스를 설치하십시오. /usr/src/linux가 가리키는 대상을 새로 설치한 커널 소스로 설정합니다. 필요하다면 다음의 수정된 두가지 방식으로 나중에 수정할 수 있습니다:
2. eselect로 심볼릭 링크를 선택하십시오:
root #eselect kernel listAvailable kernel symlink targets: [1] linux-3.3.8-gentoo [2] linux-3.4.9-gentoo
이 출력 내용에는 사용할 수 있는 커널 소스가 있습니다. 별표 기호는 선택한 소스를 나타냅니다. 커널 소스를 바꾸려면 (예: 두번째 항목) 다음 명령을 실행하십시오:
root #eselect kernel set 23. 직접 심볼릭 링크를 설정합니다:
root #ln -sf /usr/src/linux-3.4.9-gentoo /usr/src/linux root #ls -l /usr/src/linux 설정
설정 도구
커널에서는 자체를 설정할 수 있는 몇가지 도구를 제공합니다.
| Command | Description |
|---|---|
| make config | Text based configuration. The options are prompted one after another. All options need to be answered, and out-of-order access to former options is not possible. |
| make menuconfig | An ncurses-based pseudo-graphical menu (only text input). Navigate through the menu to modify the desired options. |
| make defconfig | Generates a new config with default from the ARCH supplied defconfig file. Use this option to get back the default configuration file that came with the sources. |
| make nconfig | Pseudo-graphical menu based on ncurses. Requires sys-libs/ncurses to be installed. |
| make xconfig | Graphical menu using Qt5. Requires dev-qt/qtwidgets to be installed. |
| make gconfig | Graphical menu using GTK. Requires x11-libs/gtk+ , dev-libs/glib , and gnome-base/libglade to be installed. |
| make oldconfig | Review changes between kernel versions and update to create a new .config for the kernel. |
| make olddefconfig | Generates a new configuration with default values from the ARCH supplied defconfig file while, at the same time, maintaining all the previous options set in the .config file found at /usr/src/linux/.config. This is a fast and safe method for upgrading a config file that has all the configuration options it needs for hardware support while at the same time gaining bug fixes and security patches. |
| make localmodconfig | Creates a config based on the current config and the currently loaded modules, as viewable via the lsmod command. |
| make allyesconfig | Enables all configuration options in the kernel. It will set all kernel options to *. Make sure a backup of the current kernel configuration is acquired before using this option!
|
| make allmodconfig | Enables all modules in kernel. Note that this operation will consume quite a bit of disk space. |
기타 기본 설정을 만들 몇가지 스크립트도 있습니다. 더 깊은 단계에 있는 설정을 처리하여 시간을 효율적으로 단축할 수 있습니다. 메이크 대상 전체 목록을 보려면 다음 명령을 실행하십시오:
root #make help이 글에서는 make menuconfig를 사용하여 설정하는 방법을 설명합니다만, 절차는 다른 메뉴랑 비슷합니다.
root #cd /usr/src/linux
root #make menuconfig사용법
화면에 나타난 메뉴에서 푸른색 막대는 커서 현재 위치를 나타냅니다. ↑, ↓ 화살표 키로 커서 위치를 바꿀 수 있습니다. ←, → 화살표 키로 메뉴 표시줄 하단을 순회하며 Enter 키를 누르면 어떤 설정을 할 지 정할 수 있습니다. ---> 로 끝나는 메뉴 항목에서 Select를 누르면 하위 메뉴로 들어갈 수 있고, Exit를 누르면 하위 메뉴에서 나갑니다. Exit를 선택하는 대신 Esc 키를 두번 쳐서 나갈 수 있습니다.
관련 문자 키를 A 키부터 Z 키까지 눌러보면 강조 문자를 가진 줄로 커서줄이 이동합니다. 여기서 Y, M, N 키는 다른 목적으로 사용하는 신성한 키므로(ᄏᄏ) 탐색 문자에서 제외했습니다. Y, M, N 중 한 문자로 시작하는 줄이 있다면 다음 글자를 강조하며 해당 문자를 가진 줄로 건너뛸 수 있습니다. 예를 들자면, 커서 현재 위치에 따라 다음줄이 "Network Device Support --->" 라면 E 키를 눌렀을 때 해당 줄로 커서를 이동합니다.
다음 기호 문자는 메뉴 줄 앞에 나타날 수 있습니다:
| Symbol(s) | Description |
|---|---|
[ ], [*]
|
Options in square brackets can be activated or deactivated. The asterisk marks the menu entry as activated. The value can be changed with the space key. It is also possible to press Y key (Yes) to activate or N key (No) to deactivate the selected entry.
|
< >, <M>, <*>
|
Options in angle brackets can be activated or deactivated, but also activated as module (indicated by a M). The values can be modified by pressing Y/N keys as before or by pressing the M key to activate the feature/driver as a module.
|
{M}, {*}
|
Options in curly brackets can be activated or activated as module but not be deactivated. This happens because another feature/driver is dependent on this feature. |
-M-, -*-
|
Options between hyphens are activated in the shown way by another feature/driver. There is no choice. |
게다가 어떤 항목은 뒷부분에 이런 표시를 붙였습니다:
| Tag | Description |
|---|---|
(NEW)
|
This driver is new in the kernel and is maybe not stable enough. |
(EXPERIMENTAL)
|
This driver is experimental and most likely not stable enough. |
(DEPRECATED)
|
This driver is deprecated and not needed for most systems. |
(OBSOLETE)
|
This driver is obsolete and should not be activated. |
대부분 옵션에는 H 키를 누르거나 메뉴 표시줄의 Help를 선택하면 설명이 뜹니다.
드라이버 선택
모듈 검색
menuconfig에서 모듈을 검색하려면 / 키를 사용하십시오.
아래에서 보시는 바와 같이, 검색 결과는 일치하는 결과 앞에 번호를 나타내는 방식으로 표시합니다. 예제에서 1 을 누르면 make menuconfig로 바로 건너뛴 후 메뉴 구조상의 Bluetooth device drivers 옵션으로 이동합니다.
Symbol: BT_HCIBTUSB [=m] Type : tristate Prompt: HCI USB driver Location: -> Networking support (NET [=y]) -> Bluetooth subsystem support (BT [=y]) (1) -> Bluetooth device drivers Defined at drivers/bluetooth/Kconfig:5 Depends on: NET [=y] && BT [=y] && USB [=m]
젠투 리눅스 일반 설정 활성화
sys-kernel/gentoo-sources 와 젠투에서 관리하는 다른 커널 프로젝트 에서만 나타나는 CONFIG_GENTOO_LINUX 커널 설정 옵션이 있습니다. 자체적으론 하는 일이 없지만, 일반 설치 과정에서 필요한 다양한 설정 옵션을 설정합니다.
이 설정은 젠투 리눅스에서 /dev를 처리하는데 필요한 tmpfs와 devtmpfs 지원을 자동으로 선택하지만, 젠투 리눅스 시스템의 다른 필수적 설정을 차후에 활성화하기 위해 확장됩니다. 더 많은 내용을 알아보려면, 이 안내서에 앞서 설명한 커널 설정 시스템을 통해 제공하는 도움말 정보를 읽어보십시오.
Kbuild
Be very careful of changing environment variables as it may break the kernel in unexpected ways. DO NOT MIX GNU binutils and LLVM binutils!!! For example make CC=gcc LD=ld.lld AR=llvm-ar will not work because LLVM's ar and ld is not compatible with GCC.
The Kernel build system can be used to change how Kernel builds in a more advanced way than make *config, similar to GNU Make. Kbuild also support Environment Variables like LLVM=1. For example, the kernel will be build with LLVM and with aggressive optimization flags:
root #make LLVM=1 KCFLAGS="-O3 -march=native -pipe"Additional variables are explained in Clang/LLVM.
빌드
커널 설정을 완벽하게 끝냈다면 커널을 컴파일하십시오:
root #make-j$(nproc) tells make to use all available CPU cores to speed up compiling.
설치
드라이버를 모듈로 활성화 했다면, 설치해야 합니다:
root #make modules_install모듈은 /lib/modules의 하위 디렉터리에 복사합니다.
If you have enabled the dracut USE flag on sys-kernel/installkernel to automate initramfs generation during make install, it is recommended to run
root #emerge --ask @module-rebuild실제 커널을 설치하려면:
root #make install이 명령은 sys-apps/debianutils 꾸러미의 일부인 /sbin/installkernel 을 실행합니다. 새 커널은 {{Path|/boot/vmlinuz-{version}}}에 설치합니다. /boot/vmlinuz 심볼릭 링크가 이미 있다면, 새 커널에 대해 만든/boot/vmlinuz 링크를 만들고 바꾸며, 이전에 설치한 커널은 /boot/vmlinuz.old로 둡니다.(installkernel man page). config와 System.map파일과 같습니다. 이 심볼릭 링크는 파일 경로를 바꾸지 않고 항상 새로운 커널을 가리키기 때문에 단순합니다(예: 부트로더 설정에서 쓸 수 있습니다).
부트로더
시스템 부트 로더 설정을 바꾸어 새 커널로 부팅하도록 고르십시오.
마지막으로 새 커널로 시스템을 다시 부팅하십시오.
현재 커널 설정과 기본 설정 비교
기본 설정을 이어받은 커널 설정을 전반적으로 확인하려면 다음 과정을 활용하십시오. 설정 수정시에는 추가 설정이 필요함을 염두에 두십시오.
root #cd /usr/src/linux
root #cp .config ../.config.working
root #make defconfig
root #mv .config ../.config.default
root #cp ../.config.working .config
root #cd ..
root #/usr/src/linux/scripts/diffconfig .config.working .config.default > .config.diff
make menuconfig의 검색 기능은 플래그 및 해석을 찾을때 사용할 수 있습니다. 과정이 끝났다면 남은 파일을 지우십시오:
root #cd /usr/src/
root #rm .config.working .config.default .config.diff
Theming Menuconfig
It is possible to select different color schemes for menuconfig using the variable MENUCONFIG_COLOR. To select a theme use:
root #make MENUCONFIG_COLOR=<theme> menuconfigAvailable themes are as follows:
| Theme | Description |
|---|---|
| mono | Colors suitable for monochrome displays |
| blackbg | A color scheme with black background |
| classic | A color scheme with blue background. The classic look |
| bluetitle | An LCD friendly version of classic. (default) |
추가 참조
- Kernel
- Kernel/Gentoo Kernel Configuration Guide
- Project:Distribution Kernel — maintains sys-kernel/*-kernel packages.
External resources
- Building the kernel as root can be harmful
- Modprobed-db - logs every module that is modprobed to be used to make a custom config