Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Patching gentoo-sources with RT patch
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Wed Feb 21, 2024 5:11 pm    Post subject: Patching gentoo-sources with RT patch Reply with quote

I went looking for info about patching gentoo-sources with the RT patch, and found exactly what I was looking for. I prefer a step-by-step guide, so I wrote one of my own. Hope it's useful.

(Why? Well, it made sense to me to want a kernel patched with Gentoo patches and the RT patch. Why does it have to be either a Gentoo-patched kernel or a vanilla kernel patched with RT? Turns out it was a pretty simple thing to do.)

----------------------------------

Exact versions must match. Check https://cdn.kernel.org/pub/linux/kernel/projects/rt/ and compare with eix gentoo-sources.
Example: As of 20 Feb 2024, there is both gentoo-sources-6.6.15 and patch-6.6.15-rt22.patch.xz.

Notes:
* Make sure your portage is up-to-date and your system has been depcleaned.
* rm -rf unused kernel dirs in /usr/src - but double check that they are unused (unmerged or depcleaned).
* rm .old stuff in /boot if not needed.

1. First, make sure the unpatched kernel works on your computer. While it most likely will work with genkernel, this is not a 100% safe assumption. As a general reminder of procedures:

a. Emerge the sources
b. eselect the version
c. make sure /boot is mounted
d. genkernel all
e. grub-mkconfig
f. reboot. If it fails to find your root device, you either need to find which driver was not compiled in by default, and/or check to make sure nvme is compiled in, not compiled as module(s).

2. emerge =gentoo-sources-6.6.15 (no use flags enabled)

3. eselect kernel list

4. eselect kernel set (number corresponding to linux-6.6.15-gentoo)

5. cd /usr/src/linux

6. cp .config .config-working (or whatever identifier you prefer)

7. wget https://cdn.kernel.org/pub/linux/kernel/projects/rt/6.6/patch-6.6.15-rt22.patch.xz

8. xzcat patch-6.6.15-rt22.patch.xz | patch -p1

9. genkernel --menuconfig all

10. Select General setup ---> Configure standard kernel features (expert users)

11. Select General setup ---> Preemption Model (Fully Preemptible Kernel (Real Time))

12. Deselect Mitigations for speculative execution vulnerabilities

13. Select Power management and ACPI options ---> CPU Frequency scaling ---> Default CPUFreq governor (performance)

14. Any other kernel config options you need, if you know you need them.

15. Exit out of menuconfig, chose Yes to save config, and let genkernel work. This will create new kernel images with "rt" in the filenames, so no need to worry about overwriting your working existing images.

16. grub-mkconfig -o /boot/grub/grub.cfg

17. Reboot

18. Test by running Cadence or similar software that identifies your system's RT status.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1660

PostPosted: Wed Feb 21, 2024 5:40 pm    Post subject: Re: Patching gentoo-sources with RT patch Reply with quote

audiodef wrote:
8. xzcat patch-6.6.15-rt22.patch.xz | patch -p1

Why not just unpack this to /etc/portage/patches/sys-kernel/gentoo-sources-6.6.15/ ? Then it gets auto-applied during emerge.
Back to top
View user's profile Send private message
Suicidal
l33t
l33t


Joined: 30 Jul 2003
Posts: 959
Location: /dev/null

PostPosted: Thu Feb 22, 2024 2:04 pm    Post subject: Re: Patching gentoo-sources with RT patch Reply with quote

grknight wrote:
audiodef wrote:
8. xzcat patch-6.6.15-rt22.patch.xz | patch -p1

Why not just unpack this to /etc/portage/patches/sys-kernel/gentoo-sources-6.6.15/ ? Then it gets auto-applied during emerge.


The rt patchset seems to have over 100 patches. From a manageability perspective, it seems like dropping genpatches into /etc/portage/patches/sys-kernel/gentoo-sources-6.6.15/ would be less work if someting goes sideways. I do this with the experimental genpatches on gentoo-kernel.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Mon Mar 11, 2024 5:11 pm    Post subject: Re: Patching gentoo-sources with RT patch Reply with quote

grknight wrote:
audiodef wrote:
8. xzcat patch-6.6.15-rt22.patch.xz | patch -p1

Why not just unpack this to /etc/portage/patches/sys-kernel/gentoo-sources-6.6.15/ ? Then it gets auto-applied during emerge.


This is much better idea. Thanks.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Mon Mar 11, 2024 6:05 pm    Post subject: Re: Patching gentoo-sources with RT patch Reply with quote

audiodef wrote:
Exact versions must match. Check https://cdn.kernel.org/pub/linux/kernel/projects/rt/ and compare with eix gentoo-sources.
Example: As of 20 Feb 2024, there is both gentoo-sources-6.6.15 and patch-6.6.15-rt22.patch.xz.

Almost.
A specific patch may work with later kernel minor version:
Code:
patch-6.7.1-r1-rc5-rt5.patch.xz -> patch-6.7-rc5-rt5.patch.xz
did work for sys-kernel/gentoo-sources-6.7.1-r1.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Mon Mar 11, 2024 6:11 pm    Post subject: Reply with quote

Using patch-xxxxx here too instead of patches-xxxxx.
I've never understood how to work with patches-xxxxx, which failed when applied in a straight forward way.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Mon Mar 11, 2024 9:35 pm    Post subject: Reply with quote

I tried patches myself, and I suspect all of the patches need to be directly in /etc/portage/patches/sys-kernel/gentoo-sources-x.y.z/ instead of in a subdir called "patches", which is what you get when you unpack the patches archive.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Mon Mar 11, 2024 9:46 pm    Post subject: Reply with quote

Do you have any idea of an advantage of patches-xxxx over patch-xxxx, as patches is much bigger, iirc?

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3138

PostPosted: Mon Mar 11, 2024 11:52 pm    Post subject: Reply with quote

Bonus point, if you omit version number in the directory name, emerge will attempt to apply those patches to all versions of the package (gentoo-sources in this case).
Obviously, this may or may not result in conflicts, but it is a nice feature when it works.
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Tue Mar 12, 2024 10:45 am    Post subject: Reply with quote

szatox wrote:
Bonus point, if you omit version number in the directory name, emerge will attempt to apply those patches to all versions of the package (gentoo-sources in this case).
Obviously, this may or may not result in conflicts, but it is a nice feature when it works.

As far as patch-xxxxx is concerned I'd mostly expect failures when versionning doesn't match.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Sat Apr 06, 2024 5:48 pm    Post subject: Reply with quote

Code:
patch-6.8.4-rt11.patch.xz -> patch-6.8.2-rt11.patch.xz
builds fine here.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum