Make kernel.org Rpm for Tumbleweed: Difference between revisions

From JoBaPedia
Jump to navigation Jump to search
(Created page with "= Build Kernel Rpm for Tumbleweed = basically followed this guide: https://tutorialforlinux.com/2021/01/05/step-by-step-build-kernel-opensuse-easy-guide/ You need write access to /usr/src sudo zypper ref && sudo zypper update # sudo reboot sudo zypper in -t pattern devel_basis sudo zypper in bc openssl openssl-devel dwarves rpm-build libelf-devel elfutils-libelf-devel # dl and unpack kernel from kernel.org or clone e.g. from git://anongit.freedesktop.org/drm-tip,...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Build Kernel Rpm for Tumbleweed =
= Build and Install Kernel Rpm for Tumbleweed =


basically followed this guide: https://tutorialforlinux.com/2021/01/05/step-by-step-build-kernel-opensuse-easy-guide/
basically followed this guide: https://tutorialforlinux.com/2021/01/05/step-by-step-build-kernel-opensuse-easy-guide/


You need write access to /usr/src
# prepare dev environment
 
  sudo zypper ref && sudo zypper update
  sudo zypper ref && sudo zypper update
  # sudo reboot
  # sudo reboot
  sudo zypper in -t pattern devel_basis
  sudo zypper in -t pattern devel_basis
  sudo zypper in bc openssl openssl-devel dwarves rpm-build libelf-devel elfutils-libelf-devel
  sudo zypper in bc openssl openssl-devel dwarves rpm-build libelf-devel elfutils-libelf-devel
# provide desired kernel source
  # dl and unpack kernel from kernel.org or clone e.g. from git://anongit.freedesktop.org/drm-tip, or ...
  # dl and unpack kernel from kernel.org or clone e.g. from git://anongit.freedesktop.org/drm-tip, or ...
  # cd into source dir (e.g. kernel or drm-tip, or ...
  # cd into source dir downloaded and unpacked from whereever (e.g. kernel.org branches, kernel or drm-tip, or ...)
# create config file to add necessary changes (tag name from directory, not signed, whatever else might be needed for your task)
  find /boot/ \( -iname "*config*" -a -iname "*`uname -r`*" \) -exec cp -i -t ./ {} \;
  find /boot/ \( -iname "*config*" -a -iname "*`uname -r`*" \) -exec cp -i -t ./ {} \;
  mv *`uname -r`* .config
  mv *`uname -r`* .config
tag="${PWD##*/}"
tag=${tag//-/.}
sed -i "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=\"-$tag\"/" .config
  sed -i 's/^CONFIG_MODULE_SIG_KEY/#CONFIG_MODULE_SIG_KEY/' .config
  sed -i 's/^CONFIG_MODULE_SIG_KEY/#CONFIG_MODULE_SIG_KEY/' .config
  # make menuconfig
  # make menuconfig
  make binrpm-pkg
# compile kernel source and create package
  make -j8 binrpm-pkg
  # make rpm-pkg
  # make rpm-pkg
  ls /usr/src/packages/RPMS/x86_64/ | grep kernel
   
  sudo zypper in /usr/src/packages/RPMS/x86_64/kernel*.rpm
# install kernel and make it known to bootloader
sudo zypper in ~/rpmbuild/RPMS/x86_64/kernel-*
  kver=`ls -t1 /lib/modules | head -1`
sudo dracut --kver "$kver"
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
# use the new kernel (and check it worked)
  sudo reboot
  sudo reboot
  uname -r
  uname -r


A build took ~10min on a 11gen intel cpu with nvme disk
This took ~45 min on a 11gen intel cpu with nvme disk


Builds fail mostly while building modules. Then easiset way out: you probably don't need the module, so deactivate it in .config
If builds fail it is mostly while building modules. Then easiset way out: you probably don't need the module, so deactivate it in .config


Kernel is not signed -> safeboot needs to be deactivated. For signing kernel or modules look elsewhere (e.g. kernel tree docs)
Kernel is not signed -> safeboot needs to be deactivated. For signing kernel or modules look elsewhere (e.g. kernel tree docs)

Latest revision as of 10:23, 8 February 2023

Build and Install Kernel Rpm for Tumbleweed

basically followed this guide: https://tutorialforlinux.com/2021/01/05/step-by-step-build-kernel-opensuse-easy-guide/

# prepare dev environment
sudo zypper ref && sudo zypper update
# sudo reboot
sudo zypper in -t pattern devel_basis
sudo zypper in bc openssl openssl-devel dwarves rpm-build libelf-devel elfutils-libelf-devel

# provide desired kernel source
# dl and unpack kernel from kernel.org or clone e.g. from git://anongit.freedesktop.org/drm-tip, or ...
# cd into source dir downloaded and unpacked from whereever (e.g. kernel.org branches, kernel or drm-tip, or ...)

# create config file to add necessary changes (tag name from directory, not signed, whatever else might be needed for your task)
find /boot/ \( -iname "*config*" -a -iname "*`uname -r`*" \) -exec cp -i -t ./ {} \;
mv *`uname -r`* .config
tag="${PWD##*/}"
tag=${tag//-/.}
sed -i "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=\"-$tag\"/" .config
sed -i 's/^CONFIG_MODULE_SIG_KEY/#CONFIG_MODULE_SIG_KEY/' .config
# make menuconfig

# compile kernel source and create package
make -j8 binrpm-pkg
# make rpm-pkg

# install kernel and make it known to bootloader
sudo zypper in ~/rpmbuild/RPMS/x86_64/kernel-*
kver=`ls -t1 /lib/modules | head -1`
sudo dracut --kver "$kver" 
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# use the new kernel (and check it worked)
sudo reboot
uname -r

This took ~45 min on a 11gen intel cpu with nvme disk

If builds fail it is mostly while building modules. Then easiset way out: you probably don't need the module, so deactivate it in .config

Kernel is not signed -> safeboot needs to be deactivated. For signing kernel or modules look elsewhere (e.g. kernel tree docs)