Using kernel-source package

Jump to: navigation, search

The kernel-source package provides the kernel source corresponding to the kernel used in the distribution, packaged in a rpm that can be easily installed with zypper.

  sudo zypper in kernel-source

With kernel-source installed the /usr/src/linux link should point to recent kernel sources

  ls -l /usr/src/linux
  lrwxrwxrwx 1 root root 24 Jun  5 18:05 /usr/src/linux -> linux-6.4.0-150600.23.50
  

With recommends enabled you should also have the tools required to build the kernel.

To build the kernel create a directory to hold the object files

  mkdir kernel-bin

copy the configuration of the currently running kernel to the build directory

  zcat /proc/config.gz > kernel-bin/.config

or use the config from an installed package

  cp /boot/config-$(uname -r) kernel-bin/.config

remove the certificate configuration

 sed -ie /CONFIG_MODULE_SIG_KEY=/d kernel-bin/.config

To do one-off kernel installation (without a signature, only works with secure boot disabled)

  make -C /usr/src/linux O=$PWD/kernel-bin -j $(nproc) && sudo make -C /usr/src/linux O=$PWD/kernel-bin modules_install && make -C /usr/src/linux O=$PWD/kernel-bin install

More information:

- Upstream kernel building guide