From Gentoo Wiki
Jump to: navigation, search
Please take care! In this example we are working for gentoo-sources-4.7.10, please remember to change the version accordingly with what you are doing.

Get the linux-patches repository, it contains the previous incremental kernel patches and the Gentoo related kernel patches.

root #git clone git+ssh:// ~/linux-patches-4.7
root #cd linux-patches-4.7
root #git checkout 4.7

Get the genpatches-misc repository, it contains the scripts that will help during the kernel release:

root #git clone git+ssh:// ~/genpatches-misc
root #cd ~/genpatches-misc
root #git checkout genpatches-misc
root #ln -s /root/genpatch-misc/scripts/* /usr/local/bin/

Now we need the incremental patch for the kernel we want to patch. In the linux-patches folder there are already the incremental patches until kernel-4.7.9, so we need the incremental patches from 4.7.9 to 4.7.10

You can get the link from incremental patch screenshot

Now that we have the incremental patch link we download it and verify the gpg key:

The output will look something like this:

CODE GPG output
gpg: assuming signed data in 'patch-4.7.9-10'
gpg: Signature made Sat 22 Oct 2016 07:08:38 PM JST
gpg:                using RSA key 38DBBDC86092693E
gpg: Good signature from "Greg Kroah-Hartman (Linux kernel stable release signing key) <>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 647F 2865 4894 E3BD 4571  99BE 38DB BDC8 6092 693E
For verify the gpg key we need the releasing kernel gpg. you can get it from here Kernel signature
In the example we are using Greg k-h signature
root #gpg2 --keyserver hkp:// --recv-keys 38DBBDC86092693E

After check the patch signature we can move it to the linux-patches folder.

root #mv patch-4.7.9-10 ~/linux-patches/1009_linux-4.7.10.patch

We need to update the 0000_README file and add the patch added in the branch.

FILE ~/linux-patches/0000_READMElinux-patches readme file
Patch:  1008_linux-4.7.9.patch
Desc:   Linux 4.7.9

Patch:  1009_linux-4.7.10.patch
Desc:   Linux 4.7.10

Commit the change:

root #git add -- .
root #git commit -m "Linux patch 4.7.10"
root #git push -u origin 4.7

Get the Kernel vanilla source for 4.7.0:

root #cd /usr/portage/sys-kernel/vanilla-sources
root #cp vanilla-sources-4.7.10.ebuild vanilla-sources-4.7.0.ebuild
root #repoman manifest
root #ebuild vanilla-sources-4.7.0 merge
root #cp -R /usr/src/linux-4.7.0 /tmp/

Check the patch can be applied:

root #cd /tmp/
root #patch -p1 -N -d /tmp/linux-4.7.0/ < ~/linux-patches/*.patch
root #find . -name "*.rej"
If there is no reject file please go on, if there are reject files investigate on why.

Check the kernel can be compiled:

root #cd /tmp/linux-4.7.0
root #zcat /proc/config.gz > .config
root #make oldconfig
root #make -j6 && make modules
root #ls arch/x86/boot/bzImage -lah
Check that compile and the bzImage is built. check also the make log for problems.

If there is no problem about the previous warning, we can start releasing the kernel.

Let's configure gpdorelease.

You will have the gpdorelease conf if you are in the kernel team.
FILE ~/.genpatchesrcgpdorelease config file
# Your username for Gentoo GIT

# The path to the directory where you have checked out trunk

# Remote repository configuration



# Website/email stuff
SENDMAIL="ssh /usr/sbin/sendmail"

WE_WANT="base extras experimental"

Let's release the kernel.

This will:

  1. Tag the 4.7 branch as 4.7-11 (immediate commit)
  2. Produce genpatches-4.7-11 tarballs
  3. Upload tarballs to distfiles-local
  4. (Optionally) create and upload website
  5. (Optionally) send a release announcement to gentoo-kernel
root #cd ~/linux-patches/
root #gpdorelease 4.7

Let's make gentoo-sources-4.7.10:

root #cp /tmp/genpatches-* /usr/portage/distfiles
root #cd /usr/portage/sys-kernel/gentoo-sources/
root #cp gentoo-sources-4.7.9.ebuild gentoo-sources-4.7.10.ebuild

We need to increment the K_GENPATCHES_VER= number:

FILE gentoo-sources-4.7.9-10.diffgentoo-sources-4.7.9-10.diff
--- gentoo-sources-4.7.9.ebuild  2016-10-20 11:15:43.000000000 +0100
+++ gentoo-sources-4.7.10.ebuild 2016-10-22 15:43:39.000000000 +0100
@@ -5,7 +5,7 @@
 K_WANT_GENPATCHES="base extras experimental"
 inherit kernel-2

emerge gentoo-sources-4.7.10.ebuild

root #repoman manifest
root #ebuild gentoo-sources-4.7.10 merge

Select the new kernel:

root #eselect kernel set linux-4.7.10-gentoo
root #ls -la /usr/src/
Check that the symbolic link are pointing to the right kernel folder

Build the new kernel:

root #cd /usr/src/linux
root #zcat /proc/config.gz > .config
root #make oldconfig
root #make -j6 && make modules modules_install
root #make install
root #emerge @module-rebuild
Check that there are no problems in the process

Install the new kernel:

root #cp arch/x86/boot/bzImage /boot/kernel-4.7.6-gentoo
root #cp /boot/
root #cp .config /boot/config-4.7.10-gentoo
root #grub-mkconfig -o /boot/grub/grub.cfg
Reboot and select the new kernel. Check the there are no problem with the kernel during startup

Commit the Gentoo-sources file.

Gentoo-sources previously made (example):


How to commit to gentoo git repository:



mpagano for writing the first draft of this guide.