This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Kernel/Upgrade

From Gentoo Wiki (test)
< Kernel
Jump to:navigation Jump to:search
This page is a translated version of the page Kernel/Upgrade and the translation is 68% complete.
Outdated translations are marked like this.

이 글은 새 커널(kernel)로 업그레이드 하는 과정을 설명합니다.

새 커널 설치 및 활용

A kernel upgrade may be a good idea when new kernel sources are installed. New kernel sources are sometimes installed while updating the system by running the following command:

root #emerge --ask --update --deep --with-bdeps=y --newuse @world

Of course, they can be installed directly using the next command (replace gentoo-sources with hardened-sources when using a hardened profile):

root #emerge --ask --update --deep --with-bdeps=y --newuse sys-kernel/gentoo-sources

새 커널 소스 설치 과정은 사용자에게 새 커널을 제공하는 과정이 아닙니다. 새 소스 코드로부터 새 커널을 만들어 설치한 다음 시스템을 다시 부팅하여 새 커널을 활성화해야합니다.

Making a new kernel from the new sources is basically the same process as making a kernel when installing the system. The difference is that one can use the configuration of the old kernel to create a configuration for the new kernel. Using the old configuration saves the user from going through all the kernel options (like make menuconfig) again.

커널의 설정은 커널 소스 코드가 담긴 디렉터리에 .config 파일로 저장합니다. 새 커널은 이전 커널에서는 없는 새 옵션이나 기능을 가지고 있거나 이전 커널에서 더 이상 지니고 있지 않을 기능 또는 옵션이 빠져있습니다. 커널 설정은 커널의 기능 또는 옵션을 활성화 할 지 말 지를 지정하고 커널이 넣고 빌드할 건지 모듈로 빌드하여 커널 실행 과정에서 요청하면 불러올 건지를 결정합니다. 따라서 새 커널의 설정 파일은 이전 커널의 설정에 없는 설정 파일의 새 항목을 지니고 있고 이전 커널의 설정 파일에 있던 항목이 더 이상 없을 수도 있습니다.

바뀐 설정 파일을 다루려면, 이전 커널의 설정 파일을 새 설정에서 사용할 수 있는 설정으로 변환해야합니다. 이 글에서는 이전 커널의 설정을 새 커널에 맞게 변환하고, 새 커널 소스 코드로 커널을 만드는 방법을 보여드리겠습니다.

현재 커널 설정 백업

커널 설정을 백업하여 이전 설정이 없어지지 않도록 하는 방식이 현명합니다. 이 과정을 모두 넘기고 나면 대부분의 사용자는 시스템에 가장 걸맞는 설정을 하기 위해 충분한 시간동안 정성을 쏟고, 분명하게, 설정 정보를 잃고 싶지 않습니다.

현재 커널 설정을 백업하는건 쉽습니다:

root #cd /usr/src/linux
root #cp .config ~/kernel-config-`uname -r`

제공한 커널 소스코드의 심볼릭 링크를 올바르게 설정하고 나면, 현재 사용중인 커널의 설정을 내 폴더 최상위 위치에 복사하고, 현재 실행 중인 리눅스 커널의 버전을 kernel-config- 다음에 붙인 이름을 커널 설정 파일의 이름으로 붙입니다.

새 커널 소스에 심볼릭 링크 설정

/usr/src/linux 심볼릭 링크는 언제든 현재 사용하는 커널 소스를 가리킵니다. 다음 세가지 방법 중 하나로 끝낼 수 있습니다:

  1. USE="symlink" USE 플래그를 활용하여 커널 소스 설치
  2. eselect로 링크 설정
  3. 직접 심볼릭 링크 업데이트

symlink USE 플래그로 커널 소스 설치하기

이 과정은 /usr/src/linux 심볼릭 링크가 새로 설치한 커널 소스코드를 가리키도록 합니다.

필요하다면, 두가지 방식 중 한가지 방법으로 고칠 수 있습니다.

eselect로 링크 설정

To set the symlink with eselect:

root #eselect kernel list
Available kernel symlink targets:
 [1] linux-3.14.14-gentoo *
 [2] linux-3.16.3-gentoo

이 명령의 결과에서 존재하는 커널 소스코드 목록을 출력합니다. 애스터리스크(*)는 선택한 소스 코드를 나타냅니다.

커널 소스를 (예를 들어 두번째 항목 처럼)바꾸려면 다음 명령을 실행하십시오:

root #eselect kernel set 2

심볼릭 링크 직접 업데이트

심볼릭 링크를 직접 설정하려면:

root #ln -sf /usr/src/linux-3.16.3 /usr/src/linux
root #ls -l /usr/src/linux
lrwxrwxrwx 1 root root 19 Oct  4 10:21 /usr/src/linux -> linux-3.16.3-gentoo

이전 커널 설정 복사

이전 커널의 설정을 새 커널의 설정으로 복사해야 합니다. 이전 커널의 설정은 다음 여러 곳에서 찾을 수 있습니다:

  • procfs 파일 시스템에서 현재 커널로부터 Enable access to .config through /proc/config.gz 옵션을 활성화 했다면:
root #zcat /proc/config.gz > /usr/src/linux/.config
  • From the old kernel. This will only work when the old kernel was compiled with CONFIG_IKCONFIG:
root #/usr/src/linux/scripts/extract-ikconfig /path/to/old/kernel >/usr/src/linux/.config
  • In the /boot directory, if the configuration was installed there:
root #cp /boot/config-3.14.14-gentoo /usr/src/linux/.config
  • 현재 동작 중인 커널의 디렉터리에서:
root #cp /usr/src/linux-3.14.14-gentoo/.config /usr/src/linux/
  • In the /etc/kernels/ directory, if SAVE_CONFIG="yes" is set in /etc/genkernel.conf and genkernel was previously used:
root #cp /etc/kernels/kernel-config-x86_64-3.14.14-gentoo /usr/src/linux/.config

새 커널 설정

To use the configuration of the old kernel with the new kernel, it needs to be converted. The conversion can be done by running either make silentoldconfig or make olddefconfig. Use either, not both.

make silentoldconfig

The following configuration is like the text based configuration with make config. For new configuration options, the user is asked for a decision. For example:

root #cd /usr/src/linux
root #make silentoldconfig
Anticipatory I/O scheduler (IOSCHED_AS) [Y/n/m/?] (NEW)

The string (NEW) at the end of the line marks this option as new. Left to the string in square brackets are the possible answers: Yes, no, module or ? to show the help. The recommend (i.e. default) answer is capitalized (here Y). The help explains the option or driver.

Unfortunately make silentoldconfig doesn't show a lot more information for each option, such as the context, so it is sometimes difficult to give the right answer. In this case the best way to go is to remember the option name and revise it afterwards through one of the graphical kernel configuration tools.

make olddefconfig

If all new configuration options should be set to their recommended (i.e. default) values use make olddefconfig:

root #cd /usr/src/linux
root #make olddefconfig

make help

Use make help to see other conversion methods available:

root #make help

빌드

중요
When external kernel modules are installed (like nvidia or zfs), it may be necessary to run make modules_prepare as described below before building the kernel. Some modules cannot be installed or prepared before the kernel has been built.
중요
새 커널 파일 이름에 맞게 부트로더를 다시 설정하는 절차를 잊지 마시고, initramfs는 이미 사용중인 경우에도 마찬가지로 다시 빌드하십시오.

이 단계에서 다음 단계는 직접 설정하기 글에 있습니다.

외부 커널 모듈 다시 설치

이진 커널 모듈 같은 어떤 외부 커널 모듈은 각각의 새 커널에 대해 다시 빌드해야 할 대가 있습니다. 아직 커널을 빌드하지 않았다면 외부 커널 모듈을 빌드하기 위해 우선 준비해야합니다:

root #make modules_prepare

Packages containing kernel modules can be rebuilt using the @module-rebuild set:

root #emerge --ask @module-rebuild

빌드 문제 해결

When experiencing build problems while rebuilding the current kernel, it might help to sanitize the kernel sources. Make sure to backup the .config file first, as the operation will remove it. Make sure not to use a .bak or ~ suffix as backup as make distclean will clean those up as well.

root #cp .config /usr/src/kernel_config_bk
root #make distclean
root #mv /usr/src/kernel_config_bk .config

오래된 커널 제거

커널 제거 글을 보십시오.

외부 자료