Project:Kernel/Gentoo-sources
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://git@git.gentoo.org/proj/linux-patches.git ~/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://git@git.gentoo.org/proj/linux-patches.git ~/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 https://cdn.kernel.org/pub/linux/kernel/v4.x/incr/patch-4.7.9-10.xz
You can get the link from kernel.org.
Now that we have the incremental patch link we download it and verify the gpg key:
root #
xz -d patch-4.7.9-10.xz | gpg2 --verify patch-4.7.9-10.sign
The output will look something like this:
'"`UNIQ--pre-00000000-QINU`"'
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://keys.gnupg.net --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.
Patch: 1008_linux-4.7.9.patch
From: http://www.kernel.org
Desc: Linux 4.7.9
Patch: 1009_linux-4.7.10.patch
From: http://www.kernel.org
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 #
pkgdev 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.
# Your username for Gentoo GIT
USERNAME="larry"
# The path to the directory where you have checked out trunk
LOCAL_PATCHES_TRUNK="~/linux-patches"
LOCAL_TMP="/tmp"
# Remote repository configuration
REMOTE_BASE="git+ssh://git@git.gentoo.org/proj/linux-patches.git"
TARBALL_BASENAME="genpatches"
KERNEL_NAME="genpatches"
DO_WEBSITE="no"
DO_EMAIL_ANNOUNCEMENT="yes"
# Website/email stuff
WEB_LOCAL="/opt/genpatch-misc/web"
WEB_GENPATCHES_BASE="dev.gentoo.org:/home/larry/public_html/genpatches"
SENDMAIL="ssh larry@dev.gentoo.org /usr/sbin/sendmail"
WE_WANT="base extras experimental"
Let's release the kernel.
This will:
- Tag the 4.7 branch as 4.7-11 (immediate commit)
- Produce genpatches-4.7-11 tarballs
- Upload tarballs to distfiles-local
- (Optionally) create and upload website
- (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:
--- 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 @@
EAPI="5"
ETYPE="sources"
K_WANT_GENPATCHES="base extras experimental"
-K_GENPATCHES_VER="10"
+K_GENPATCHES_VER="11"
inherit kernel-2
detect_version
emerge gentoo-sources-4.7.10.ebuild
root #
pkgdev 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 System.map /boot/System.map-4.7.10-gentoo
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:
Gentoo_git_workflow#Repository_settings
Acknowledgements
Mike Pagano (mpagano) for writing the first draft of this guide.