Update gentoo kernel: Difference between revisions

From Bitpost wiki
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 4: Line 4:
This is to allow you to keep your kernel tuned for your machine.
This is to allow you to keep your kernel tuned for your machine.


Gentoo installs the source here:
== Quick Kernel Bump ==
 
* Probably already done: emerge a new kernel, mount /boot
* Compile and install the new kernel
su -
cd /usr/src && ls -t # find the newest, ensure it is not the target for the linux symlink
cd linux-#new-version#
# Run this, it will make && make modules_install.
# But first, if no .config is found, this will copy .config from ../linux, and run [make oldconfig] - hit Enter a LOT
build_kernel
cd .. && rm linux && ln -s linux-#new-version# linux
cd /boot
# MAKE SURE IT ENDS in .efi
mv vm-gentoo-latest__ vmlinuz-#new-version#-gentoo_your_desc_can_be_oldconfg.efi
# reboot
 
== OLDER NOTES ==
 
== Set up Symlink to Kernel Source ==
 
Gentoo installs the source in different "slots", here:


  /usr/src/linux-#kernelversion#-gentoo-#gentooreleaseversion#
  /usr/src/linux-#kernelversion#-gentoo-#gentooreleaseversion#


Because I have defined the "symlink" USE flag for gentoo-sources in /etc/portage/package.use, it will also symlink the latest downloaded source (whether you want it to or not) to:
I don't use the [symlink] USE flag for gentoo-sources. If you use it, it will symlink the latest downloaded source, as soon as you download it, to:


  /usr/src/linux
  /usr/src/linux


So once you emerge a new kernel source, you ought to install it or change the symlink if you don't have the time to do the kernel install.
I prefer to do this manually when I have time to actually install the kernel, so the pointer to the kernel header files matches the installed kernel - that seems important!  When you are ready to install the kernel, set up the symlink as follows:
 
cd /usr/src
cd linux-#kernelversion#-gentoo-#gentooreleaseversion#
build_kernel # or copy the .config over and make oldconfig and [make && make modules_install]
cd ..
rm linux
ln -s linux-#kernelversion#-gentoo-#gentooreleaseversion# linux
 
NOTE that last I checked (2017/07/13), portage seemed to have stripped Makefiles from every folder except the latest.


== Steps To Install Kernel ==
== Steps To Install Kernel ==
Line 18: Line 47:
* su -
* su -
* emerge sys-kernel/gentoo-sources
* emerge sys-kernel/gentoo-sources
* Check the /usr/src/linux symlink and make sure it points to your newly-emerged kernel sources package
* Check the /usr/src/linux symlink, as described above.
* cd /usr/src/linux
* cd /usr/src/linux
* make menuconfig (and configure - see [[Configure MythTV kernel]])
* make menuconfig (and configure - see [[Configure MythTV kernel]])
Line 26: Line 55:
* cp arch/x86_64/boot/bzImage /boot/kernel-genkernel-x86)64-#kernelversion#-gentoo-#gentooreleaseversion#_mdm-menuconfig
* cp arch/x86_64/boot/bzImage /boot/kernel-genkernel-x86)64-#kernelversion#-gentoo-#gentooreleaseversion#_mdm-menuconfig
* emacs /boot/grub/grub.conf (and add your shiny new kernel to the default top of the list)
* emacs /boot/grub/grub.conf (and add your shiny new kernel to the default top of the list)
* (optional) purge older kernels from /usr/src/ and /boot/
* (optional) emerge -av --unmerge "<gentoo-sources-2.6.##"
* (optional) purge older kernels from /boot/ (and /usr/src/ if previous step didn't do the trick)


== Post-kernel-installation Steps ==
== Post-kernel-installation Steps ==
Line 32: Line 62:
There are certain packages that are kernel-specific, and must be installed AFTER the kernel is updated.  Note that this is only necessary if you are changing kernel versions, NOT if you just adjust the settings on an already-installed kernel.
There are certain packages that are kernel-specific, and must be installed AFTER the kernel is updated.  Note that this is only necessary if you are changing kernel versions, NOT if you just adjust the settings on an already-installed kernel.


* install nvidia binary driver
* install nvidia or ati binary driver ([nvidia-drivers], [ati-drivers])
* install a new ivtv that matches the new kernel version
* (old) install a new ivtv that matches the new kernel version
* "If your (ntfs3g) driver stops working after you have upgraded your kernel then you should reinstall fuse."
* "If your (ntfs3g) driver stops working after you have upgraded your kernel then you should reinstall fuse."
* lirc (for LCD display, and maybe some day, a remote)  :>
* lirc (for LCD display, and maybe some day, a remote)  :>
Line 44: Line 74:


  module-rebuild list                  # to see what it WOULD rebuild
  module-rebuild list                  # to see what it WOULD rebuild
  emerge nvidia-drivers
  emerge ati-drivers
  eselect opengl set nvidia
  eselect opengl set ati
  reboot
  reboot
emacs /etc/portage/package.mask      # adjust ivtv version if needed
  emerge sys-fs/fuse lirc media-libs/svgalib (etc)
                                      # it has to match your kernel version
                                      # comment out ivtv line to get latest version
emerge ivtv
  emerge sys-fs/fuse
emerge lirc
  update-modules
  update-modules
  reboot
  reboot
Line 59: Line 84:


  module-rebuild list                  # to see what it WOULD rebuild
  module-rebuild list                  # to see what it WOULD rebuild
  emerge nvidia-drivers ivtv sys-fs/fuse lirc
  emerge ati-drivers sys-fs/fuse lirc media-libs/svgalib (etc)
  update-modules
  update-modules
  eselect opengl set nvidia
  eselect opengl set ati
  reboot
  reboot


If you've done an emerge of media-video/nvidia-settings, you can run it to adjust the resolution, etc., dynamically in X.
If you've done an emerge of media-video/nvidia-settings, you can run it to adjust the resolution, etc., dynamically in X.

Latest revision as of 19:58, 3 August 2018

In gentoo, everything gets updated via portage using "emerge". For the kernel, emerge only updates the source. You have to manually configure, compile, and install the kernel source into a kernel binary. This is to allow you to keep your kernel tuned for your machine.

Quick Kernel Bump

  • Probably already done: emerge a new kernel, mount /boot
  • Compile and install the new kernel
su -
cd /usr/src && ls -t # find the newest, ensure it is not the target for the linux symlink
cd linux-#new-version#
# Run this, it will make && make modules_install.
# But first, if no .config is found, this will copy .config from ../linux, and run [make oldconfig] - hit Enter a LOT
build_kernel
cd .. && rm linux && ln -s linux-#new-version# linux
cd /boot
# MAKE SURE IT ENDS in .efi
mv vm-gentoo-latest__ vmlinuz-#new-version#-gentoo_your_desc_can_be_oldconfg.efi
# reboot

OLDER NOTES

Set up Symlink to Kernel Source

Gentoo installs the source in different "slots", here:

/usr/src/linux-#kernelversion#-gentoo-#gentooreleaseversion#

I don't use the [symlink] USE flag for gentoo-sources. If you use it, it will symlink the latest downloaded source, as soon as you download it, to:

/usr/src/linux

I prefer to do this manually when I have time to actually install the kernel, so the pointer to the kernel header files matches the installed kernel - that seems important! When you are ready to install the kernel, set up the symlink as follows:

cd /usr/src
cd linux-#kernelversion#-gentoo-#gentooreleaseversion#
build_kernel # or copy the .config over and make oldconfig and [make && make modules_install]
cd ..
rm linux
ln -s linux-#kernelversion#-gentoo-#gentooreleaseversion# linux

NOTE that last I checked (2017/07/13), portage seemed to have stripped Makefiles from every folder except the latest.

Steps To Install Kernel

  • su -
  • emerge sys-kernel/gentoo-sources
  • Check the /usr/src/linux symlink, as described above.
  • cd /usr/src/linux
  • make menuconfig (and configure - see Configure MythTV kernel)
  • make && make modules_install
  • mount /boot (if needed)
  • ls /boot
  • cp arch/x86_64/boot/bzImage /boot/kernel-genkernel-x86)64-#kernelversion#-gentoo-#gentooreleaseversion#_mdm-menuconfig
  • emacs /boot/grub/grub.conf (and add your shiny new kernel to the default top of the list)
  • (optional) emerge -av --unmerge "<gentoo-sources-2.6.##"
  • (optional) purge older kernels from /boot/ (and /usr/src/ if previous step didn't do the trick)

Post-kernel-installation Steps

There are certain packages that are kernel-specific, and must be installed AFTER the kernel is updated. Note that this is only necessary if you are changing kernel versions, NOT if you just adjust the settings on an already-installed kernel.

  • install nvidia or ati binary driver ([nvidia-drivers], [ati-drivers])
  • (old) install a new ivtv that matches the new kernel version
  • "If your (ntfs3g) driver stops working after you have upgraded your kernel then you should reinstall fuse."
  • lirc (for LCD display, and maybe some day, a remote)  :>

In theory you can use the following to automatically reinstall kernel-dependent modules:

module-rebuild rebuild

But I used a more manual approach, as module-rebuild didn't work:

module-rebuild list                   # to see what it WOULD rebuild
emerge ati-drivers
eselect opengl set ati
reboot
emerge sys-fs/fuse lirc media-libs/svgalib (etc)
update-modules
reboot

Even better, if you have just adjusted the kernel, and not bumped up the version, just do this:

module-rebuild list                   # to see what it WOULD rebuild
emerge ati-drivers sys-fs/fuse lirc media-libs/svgalib (etc)
update-modules
eselect opengl set ati
reboot

If you've done an emerge of media-video/nvidia-settings, you can run it to adjust the resolution, etc., dynamically in X.