Núcleo/Actualización

From Gentoo Wiki
Jump to: navigation, search
This page is a translated version of the page Kernel/Upgrade and the translation is 35% complete.

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎日本語 • ‎한국어 • ‎Nederlands • ‎русский • ‎中文(中国大陆)‎

Este artículo describe los pasos para actualizar a un nuevo núcleo.

Instalación

Puede que se necesite la actualización del núcleo cuando se instales nuevos fuentes del mismo después de la actualización del sistema o cuando desee instalar nuevas fuentes del núcleo.

Installing new kernel sources doesn't provide the user with a new kernel. It is necessary to make and install a new kernel from the new sources and then reboot the system to actually run the new kernel.

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.

The configuration of the kernel is saved in a file named .config in the directory that holds the kernel sources. A new kernel may have options or features the old kernel does not have, or it might not have a feature or option anymore which the old kernel still has. The kernel configuration specifies whether the features and options of a kernel are to be enabled or not, perhaps built into the kernel, or perhaps built as modules which can be loaded into the running kernel on demand. Hence the configuration file of the new kernel may have new entries the configuration file of the old kernel doesn't have, and it might not have entries anymore which are present in the configuration file of the old kernel.

To deal with such changes of the configuration file, the configuration file of the old kernel needs to be converted to a configuration that can be used with the new kernel. This article shows how to make a new kernel from new kernel sources with converting the configuration file of the old kernel.

Make a backup of the current kernel configuration

It is wise to make a backup of the kernel configuration so that the previous configurations are not lost. After all, many users devote considerable time to figure out the best configuration for the system, and losing that information is definitely not wanted.

It is easy to make a backup of the current kernel configuration:

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

Provided that the symlink to the kernel sources has been set correctly, this copies the configuration of the currently used kernel to the home directory of root, renaming the configuration to kernel-config- followed by the version of the current running Linux kernel.

Set symlink to new kernel sources

El enlace simbólico /usr/src/linux debe apuntar siempre a los ficheros fuente del núcleo que se esté utilizando. Esto se puede realizar de tres formas:

  1. Installing the kernel sources with USE="symlink"
  2. Setting the link with eselect
  3. Manually updating the symbolic link

Installing the kernel sources with the symlink USE flag

This will make the /usr/src/linux point to the newly installed kernel sources.

If necessary, it can still be modified later with one of the other two methods.

Setting the link with 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

This outputs the available kernel sources. The asterisk indicates the chosen sources.

To change the kernel sources, e.g. to the second entry, do:

root #eselect kernel set 2

Manually updating the symbolic link

To set the symbolic link manually:

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

Copy previous kernel configuration

The configuration of the old kernel needs to be copied to the new one. It can be found in several places:

  • En el sistema de ficheros procfs si la opción del núcleo Enable access to .config through /proc/config.gz se activó en su núcleo actual:
  • En el directorio /boot si instaló allí su fichero de configuración:
  • En el directorio del núcleo que actualmente está corriendo:

Configure the new kernel

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 oldconfig or make silentoldconfig.

make oldconfig gives many choices, make silentoldconfig does not. Use either, not both.

make oldconfig

The following configuration is like the text based configuration with make config. For new configuration options, it gives a choice. For example:

root #make oldconfig
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 answer is capitalized (here Y). The help explains the option or driver.

Unfortunately make oldconfig doesn't show - next to the help - a lot more information for each option, like the context, so that 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 silentoldconfig

If interactivity is not wanted (no questions should be asked), then use make silentoldconfig:

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

Construcción

Importante
When external kernel modules are installed (like nvidia or zfs), it may be necessary to run make modules_prepare as described below before bulding the kernel. Some modules cannot be installed or prepared before the kernel has been built.
Importante
Do not forget to reconfigure the bootloader to account for the new kernel filenames, and rebuild the initramfs if one is used as well.

Para realizar este paso, siga lo indicado en el artículo de configuración manual.

Reinstalar módulos externos del núcleo

Cualquier módulo externo del núcleo como los módulos binarios del núcleo, necesitan reconstruirse cada vez que se actualiza el núcleo. Si todavía no ha construido su núcleo deberá prepararse en primer lugar para la construcción de los módulos externos del núcleo:

root #make modules_prepare

Puede reconstruir los paquetes usando el conjunto @module-rebuild:

root #emerge --ask @module-rebuild

Solving build problems

Si tiene problemas cuando está reconstruyendo el núcleo actual, podría ser de utilidad sanear los ficheros fuente del núcleo. Asegúrese en primer lugar de hacer una copia de seguridad del fichero .config ya que esta operación lo eliminará. Asegúrese de no utilizar los sufijos .bak o ~ como indicador de copia de respaldo ya que make distclean también los eliminará.

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

Eliminar núcleos antiguos

Lea el artículo sobre la eliminación del núcleo.

Recursos externos