Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
systemd-boot+ukify:How to determine kernel boot label
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
equaeghe
l33t
l33t


Joined: 22 Feb 2005
Posts: 637

PostPosted: Mon Apr 15, 2024 8:24 am    Post subject: systemd-boot+ukify:How to determine kernel boot label Reply with quote

I am using systemd-boot and this weekend I've moved my kernel setup to one using UKIs generated using ukify (all works semi-automagically upon `make install` by setting the right use flags). However, the kernel boot label is now "Gentoo (2.14)". I would like it to be more informative, i.e., use just or at least include the kernel version string "x.y.z-gentoo-suffix", where 'suffix' is the extra string I set in the kernel itself. This version string is also used to identify the subfolder of /lib/modules where its modules are. Can I configure this and if so, where?
Back to top
View user's profile Send private message
gabrielbo954
n00b
n00b


Joined: 12 Apr 2024
Posts: 2

PostPosted: Fri Apr 19, 2024 12:41 pm    Post subject: Reply with quote

Sure, systemd-boot uses the entries in '/boot/loader/entries/' to define what kernels to boot and their labels. The labels are set in each entry file for your kernels.

If you're using UKIs with systemd-boot, your '/boot' might contain a '.conf' file for each kernel. You'd typically see a list of entries like 'title', 'linux', 'initrd', and 'options'.

Here's what you can do:

1. Navigate to the '/boot/loader/entries/' directory.
2. Open the '.conf' file corresponding to your kernel in a text editor.
3. Look for the 'title' line. It might look something like this:

Code:
title   Gentoo (2.14)


4. Change it to include your kernel version string like so:

Code:
title   Gentoo x.y.z-gentoo-suffix


Replace 'x.y.z-gentoo-suffix' with the actual version string of your kernel.

Save the file and reboot. systemd-boot should now display the new title in the boot menu.
If you want this process to be automated when you use 'make install', you would need to adjust your kernel's makefile or the script that handles the installations to modify this title for you. This could involve a simple 'sed' command to replace the title line in the '.conf' file with your desired label, including the dynamic version string fetched from your kernel build.

Here's an example of what that 'sed' command might look like:

Code:
sed -i 's|title.*|title   Gentoo x.y.z-gentoo-suffix|' /boot/loader/entries/gentoo.conf


Make sure to replace the 'gentoo.conf' with the actual name of your kernel's entry file and 'x.y.z-gentoo-suffix' with the command or variable that fetches your current kernel version string.

Remember to test any automated changes carefully to ensure they work as expected and don't disrupt your boot process.
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 272
Location: Nijmegen

PostPosted: Fri Apr 19, 2024 9:18 pm    Post subject: Reply with quote

The method described by the previous post will work, but let me add some more context.

The 2.14 system-boot reads from the os-release section of the UKI, ukify in turn adds this section based on the contents of /etc/os-release. This file is owned by the baselayout package (of which you have version 2.14 installed).

You can change it by either modifying VERSION_ID in /etc/os-release, or by instructing ukify to use a custom os-release file via /etc/kernel/uki.conf. Note though that you don't actually have to do this to distinguish between installed UKIs. As soon as systemd-boot finds two or more UKIs with the same os-release section it will also print the name of the file, containing the kernel version number, in the boot menu.
_________________
OS: Gentoo 6.7.3-gentoo-dist, ~amd64, 17.1/desktop/plasma/systemd/merged-usr
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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