LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-13-2023, 12:15 PM   #61
Windu
Member
 
Registered: Aug 2021
Distribution: Arch Linux, Debian, Slackware
Posts: 597

Rep: Reputation: Disabled

Quote:
Originally Posted by LuckyCyborg View Post
Yes, you are right. For the stock mkinitrd the -F parameter is mandatory.
...
My rationale for this patch is that a program (or script) should use in a mandatory way its configuration file, not in an optionally way how does the stock /sbin/mkinitrd . Yeah, probably the patch can be improved.

And yes, I played a bit with this script in the past, and me and ZhaoLin1457 shared along our experiences regarding the scripting of the boot(loader) setup.
This configuration file is not mandatory. I never use it. And what if you want to run mkinitrd with some other parameters than those you pre-programmed in the configuration file?
 
1 members found this post helpful.
Old 08-13-2023, 12:49 PM   #62
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,593

Rep: Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459
Quote:
Originally Posted by Windu View Post
This configuration file is not mandatory.
I've said that for the stock mkinitrd the parameter is mandatory for using the options from /etc/mkinitd.conf.

BTW, the parameters given on command line overwrites the options from that config file.

Last edited by LuckyCyborg; 08-13-2023 at 01:41 PM.
 
1 members found this post helpful.
Old 08-13-2023, 12:51 PM   #63
bigbadaboum
Member
 
Registered: Apr 2023
Posts: 159

Rep: Reputation: 63
/tmp$ls -l /tmp/grub-2.06-x86_64-*
-rw-r--r-- 1 root root 5386992 août 13 13:01 /tmp/grub-2.06-x86_64-4.txz
-rw-r--r-- 1 root root 12230968 août 13 12:47 /tmp/grub-2.06-x86_64-5.txz

I removed CFLAGS x86_64 v2 but I still have the same result
/tmp$ls -l /tmp/grub-2.06-x86_64-*

-rw-r--r-- 1 root root 5374304 août 13 19:31 /tmp/grub-2.06-x86_64-4.txz
-rw-r--r-- 1 root root 12196824 août 13 19:22 /tmp/grub-2.06-x86_64-5.txz
 
Old 08-13-2023, 01:00 PM   #64
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,713

Rep: Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392
Quote:
Originally Posted by Jeebizz View Post
Except if you use the menu in LILO you get a Slackware brand image...
I do like a little Slackware branding here and there. You can get quite creative with the grub menu, but I just slapped a background on mine.
Attached Thumbnails
Click image for larger version

Name:	screenshot2.jpg
Views:	108
Size:	88.6 KB
ID:	41477  
 
2 members found this post helpful.
Old 08-13-2023, 01:06 PM   #65
rizitis
Member
 
Registered: Mar 2009
Location: Greece,Crete
Distribution: Slackware64-current, Slint
Posts: 703
Blog Entries: 1

Rep: Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515Reputation: 515
The specific post is a question: Like many of you who have been using grub on slackware for years now, I have my own way (scripts) to manage some things as I want or as it suits me.
In particular, I very often build my own generic kernels to try things out and then throw them away. I always want to have 1-2 kernels backup. I also have a way to automatically initrd the generic kernel every time slackpkg upgrade-all changes the kernel and update grub at the same time.
Without mkinitrd using -c to get the backup kernels out of the way.
These 2 scripts are placed in /etc/rc.d/ and are called by rc.6 every time there is a reboot and shutdown, but ONLY if a kernel change has been made by slackpkg.

This is achieved by reading
Code:
/bin/ls -tr /var/lib/pkgtools/packages | grep kernel | tail -2
You can see the scripts here:
1) the one mkinitrd runs for the new kernel installed by slackpkg https://github.com/rizitis/autoslack-initrd/tree/main
2) the one run immediately after update-grub... https://github.com/rizitis/slackup-grub

Of course you will immediately understand that it is not "professional" work, but it is what my little knowledge allowed me to think and make. Nevertheless, I am very satisfied because so far they are doing their job and I have never had any failures. So for me it's perfect...
And to be honest I'm glad that slackware gave ALSO this topic a chance to think and build something for my system...

But the question that arose for me after reading all the posts is the following:
Right now my ls /boot is
Code:
ls /boot/
MOK.crt                    config-huge-6.1.45.x64  signed_image/
MOK.der                    efi/                    slack.bmp
MOK.priv                   elilo-ia32.efi*         tuxlogo.bmp
README.initrd@             elilo-x86_64.efi*       tuxlogo.dat
System.map@                grub/                   vmlinuz@
System.map-6.4.5           initrd-tree/            vmlinuz-6.4.5
System.map-6.4.8           initrd.gz               vmlinuz-6.4.8
System.map-generic-6.1.45  inside.bmp              vmlinuz-6.4.8.signed
System.map-huge-6.1.45     inside.dat              vmlinuz-generic@
config@                    mymkinitrd.sh           vmlinuz-generic-6.1.45
config-6.4.8.x64           onlyblue.bmp            vmlinuz-huge@
config-generic-6.1.45.x64  onlyblue.dat            vmlinuz-huge-6.1.45
But a part of initrd.gz is https://pastebin.com/kz0DsNGX

The question is, will there theoretically be a problem at some point from the many entries in the initrd?
In a year or two for example or even sooner assuming I want to build every kernel that linux-kernel puts out to test and then uninstall?
thanks.
 
Old 08-13-2023, 02:10 PM   #66
Jeebizz
Senior Member
 
Registered: May 2004
Distribution: Slackware15.0 64-Bit Desktop, Debian 11 non-free Toshiba Satellite Notebook
Posts: 4,196

Rep: Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386
Quote:
Originally Posted by Daedra View Post
I do like a little Slackware branding here and there. You can get quite creative with the grub menu, but I just slapped a background on mine.
That looks really cool, whatever Pat decides is fine though in terms of what to use; but not to use an image would be weird, since again even LILO had a Slackware brand if you had a boot menu.
 
Old 08-13-2023, 08:14 PM   #67
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,713

Rep: Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392
Quote:
Originally Posted by garpu View Post
Wait, wait. I've always been generating a new initrd for every kernel (and naming it with the version name).

From mkinitrd_command_generator.sh:

Code:
-k <kernelversion>        Use specific kernel version. Or, support
	                            more than one kernel version by passing a
	                            list of versions separated by colons (:).
The more you know dot gif. I've only been doing separate ones for, oh, the past 15 years...
I think I had read that once but also completely forgot that this was possible. So as a test I fired up a fresh 15.0 VM and setup Grub like I usually do. My method is pretty much like Luckycyborg describes on post #7. Except this time I modified by mkinitrd.conf to generate an initrd.gz for all the kernels installed on the system. Like others have mentioned it's always good practice to keep at least one good working kernel around. I installed the last 2 kernels in patches along with 5.15.19. So I now have kernel 5.15.19, 5.15.94, and 5.15.117 installed. I modified the mkinitrd to accommodate all three kernels...

Code:
SOURCE_TREE="/boot/initrd-tree"
CLEAR_TREE="1"
OUTPUT_IMAGE="/boot/initrd.gz"
KERNEL_VERSION="$(ls /var/lib/pkgtools/packages/ | grep kernel-modules | cut -d- -f3 | awk 'BEGIN {ORS=":"} {print}' | sed 's/:$//')"
KEYMAP="us"
MODULE_LIST="virtio_blk:virtio_pci_modern_dev:virtio_pci:virtio:virtio_balloon:virtio_ring:virtio_net:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4"
LUKSDEV=""
ROOTDEV="/dev/vda2"
ROOTFS="ext4"
RESUMEDEV=""
RAID=""
LVM=""
UDEV="1"
WAIT="1"
then I installed Richard Cranium's grub script 09_slackware_linux and confirmed all three generic kernels boot perfectly. I use a bash script I wrote to automate my kernel updates, but now that I know I can generate one initrd.gz for multiple kernels I am going to modify it to do so. Thanks for the reminder this was possible. I have also been experimenting just using 09_slackware_linux and disabling 10_linux /etc/grub.d but I am not sure if that is wise yet. It doesn't seem to break anything. Here are two screenshots, the second just gives a slightly nice menu IMO when you disable 10_linux.
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2023-08-13 19-58-09.png
Views:	74
Size:	151.8 KB
ID:	41478   Click image for larger version

Name:	Screenshot at 2023-08-13 19-59-45.png
Views:	65
Size:	128.9 KB
ID:	41479  

Last edited by Daedra; 08-13-2023 at 08:53 PM.
 
Old 08-14-2023, 12:51 AM   #68
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,932

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
Quote:
Originally Posted by rizitis View Post
The question is, will there theoretically be a problem at some point from the many entries in the initrd?
In a year or two for example or even sooner assuming I want to build every kernel that linux-kernel puts out to test and then uninstall?
It's not useful to keep old modules in the initrd if you don't have the corresponding kernel and modules. Whenever you removepkg a kernel and modules, you can rm -rf the corresponding directory under /boot/initrd-tree/lib/modules.
 
2 members found this post helpful.
Old 08-14-2023, 01:01 AM   #69
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,932

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
Quote:
Originally Posted by Daedra View Post
Code:
KERNEL_VERSION="$(ls /var/lib/pkgtools/packages/ | grep kernel-modules | cut -d- -f3 | awk 'BEGIN {ORS=":"} {print}' | sed 's/:$//')"
This will also find custom kernels installed without Slackware style packages:
Code:
KERNEL_VERSION=$(cd /lib/modules;echo *|sed 's/ /:/')
 
1 members found this post helpful.
Old 08-14-2023, 01:04 AM   #70
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,713

Rep: Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392
Quote:
Originally Posted by Petri Kaukasoina View Post
This will also find custom kernels installed without Slackware style packages:
Code:
KERNEL_VERSION=$(cd /lib/modules;echo *|sed 's/ /:/')
Yeah I always use Pat's scripts when making a custom kernel, but this would be more useful in a scenario where you build a kernel manually. Not to mention its just shorter and cleaner. Thank you sir . I did make one small change though

Code:
KERNEL_VERSION=$(cd /lib/modules; echo * | sed 's/ /:/g')

Last edited by Daedra; 08-14-2023 at 01:13 AM.
 
1 members found this post helpful.
Old 08-14-2023, 01:45 AM   #71
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,932

Rep: Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566Reputation: 1566
Quote:
Originally Posted by Daedra View Post
sed 's/ /:/g
Correct, thanks.

Even this works without colons...
Code:
KERNEL_VERSION=$(cd /lib/modules;echo *)
Except that %KVER% expansion would not work: if you use versioned initrd name then you don't get the right name. (The right name for OUTPUT_IMAGE=/boot/initrd-%KVER%.gz is something like /boot/initrd-5.15.117:5.15.19:5.15.94.gz)

Last edited by Petri Kaukasoina; 08-14-2023 at 01:49 AM.
 
Old 08-14-2023, 09:56 AM   #72
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,593

Rep: Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459
Quote:
Originally Posted by Daedra View Post
I think I had read that once but also completely forgot that this was possible. So as a test I fired up a fresh 15.0 VM and setup Grub like I usually do. My method is pretty much like Luckycyborg describes on post #7. Except this time I modified by mkinitrd.conf to generate an initrd.gz for all the kernels installed on the system. Like others have mentioned it's always good practice to keep at least one good working kernel around. I installed the last 2 kernels in patches along with 5.15.19. So I now have kernel 5.15.19, 5.15.94, and 5.15.117 installed. I modified the mkinitrd to accommodate all three kernels...

Code:
SOURCE_TREE="/boot/initrd-tree"
CLEAR_TREE="1"
OUTPUT_IMAGE="/boot/initrd.gz"
KERNEL_VERSION="$(ls /var/lib/pkgtools/packages/ | grep kernel-modules | cut -d- -f3 | awk 'BEGIN {ORS=":"} {print}' | sed 's/:$//')"
KEYMAP="us"
MODULE_LIST="virtio_blk:virtio_pci_modern_dev:virtio_pci:virtio:virtio_balloon:virtio_ring:virtio_net:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4"
LUKSDEV=""
ROOTDEV="/dev/vda2"
ROOTFS="ext4"
RESUMEDEV=""
RAID=""
LVM=""
UDEV="1"
WAIT="1"
then I installed Richard Cranium's grub script 09_slackware_linux and confirmed all three generic kernels boot perfectly. I use a bash script I wrote to automate my kernel updates, but now that I know I can generate one initrd.gz for multiple kernels I am going to modify it to do so. Thanks for the reminder this was possible. I have also been experimenting just using 09_slackware_linux and disabling 10_linux /etc/grub.d but I am not sure if that is wise yet. It doesn't seem to break anything. Here are two screenshots, the second just gives a slightly nice menu IMO when you disable 10_linux.
I am very glad that you have tried this.

Yes, the GRUB2 scripts are just Bash scripts - then highly customizable, as demonstrated by Richard Cranium's 09_slackware_linux .

As you certainly noticed, that 09_slackware_linux creates a flat menu, by walking the /boot/vmlinuz-generic-* and /boot/vmlinuz-huge-* without initrd support, skipping the initrd support for the huge kernels. And skipping the symlinks at all. And please note that it uses the versioned names of the kernel files.

However, there I have some critics on the design of that 09_slackware_linux:

First of all, it support only the Slackware naming of the kernels. So, if you want to setup a custom built kernel you must name it on the likes of vmlinuz-generic-* or vmlinuz-huge-*

Secondly, even the huge kernels may need an initrd - for applying the CPU microcode.

Anyway, it's 7 years old code and it does not respect $GRUB_DISABLE_RECOVERY used today, it looking instead for $GRUB_DISABLE_LINUX_RECOVERY. Hence, I use a small patch for my experiments with it.
Code:
--- 09_slackware_linux.orig	2023-08-14 05:20:18.903467413 +0300
+++ 09_slackware_linux	2023-08-14 05:54:54.121013569 +0300
@@ -118,7 +118,8 @@
 	    for i in "initrd-${version}.gz" "initrd.gz" \
 		"initrd.img-${version}" "initrd-${version}.img" \
 		"initrd-${version}" "initrd.img-${alt_version}" \
-		"initrd-${alt_version}.img" "initrd-${alt_version}"; do
+		"initrd-${alt_version}.img" "initrd-${alt_version}" \
+		"initrd-generic-${version}.gz" "initrd-generic-${version}.img"; do
 		if test -e "${dirname}/${i}" ; then
 		    initrd="$i"
 		    break
@@ -137,7 +138,7 @@
 
 	linux_entry "${OS}" "${tag}" "${version}" false \
 	    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
-	if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
+	if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
 	    linux_entry "${OS}" "${tag}" "${version}" true \
 		"single ${GRUB_CMDLINE_LINUX}"
 	fi
Honestly, the support for initrd-generic-* names is rather a matter of my taste (just like our BDFL's mega-initrd), as usually I use to name this way the initrd for the Slackware generic kernels.

BUT, if you like the flat menus (with no submenus) also the stock GRUB2's 10_linux has support for this, by using this configuration option bellow on /etc/default/grub
Code:
# Disable the submenus
GRUB_DISABLE_SUBMENU="true"
By adding this option (and refreshing the GRUB2 config file) you will get a flat menu just like one given by 09_slackware_linux

And bellow is a patch for 10_linux to skip the symlinks vmlinuz-generic and vmlinuz-huge which generates duplicate entries - along with the support for initrd-generic-* filenames as you suspect.

Code:
--- 10_linux.new	2021-09-10 21:45:00.000000000 +0300
+++ 10_linux	2023-08-14 17:01:09.904249712 +0300
@@ -194,7 +194,6 @@
 is_top_level=true
 while [ "x$list" != "x" ] ; do
   linux=`version_find_latest $list`
-  gettext_printf "Found linux image: %s\n" "$linux" >&2
   basename=`basename $linux`
   dirname=`dirname $linux`
   rel_dirname=`make_system_path_relative_to_its_root $dirname`
@@ -202,6 +201,13 @@
   alt_version=`echo $version | sed -e "s,\.old$,,g"`
   linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
+  # We will skip the vmlinuz-generic and and vmlinuz-huge which are symlinks
+  if [ "x${version}" = xgeneric ] || [ "x${version}" = xhuge ]; then
+    list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
+    continue
+  fi
+  gettext_printf "Found linux image: %s\n" "$linux" >&2
+
   initrd_early=
   for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
 	   ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
@@ -219,6 +225,7 @@
 	   "initramfs-genkernel-${alt_version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
+	   "initrd-generic-${version}.gz" "initrd-generic-${version}.img" \
 	   "initrd.gz"; do
     if test -e "${dirname}/${i}" ; then
       initrd_real="${i}"
I for one I do not use huge kernels and I have never did, unless I consider first installation of Slackware which I did. So, I did not added special handling for them.

However, I am quite sure that someone interested can add support for skipping the usage of an initrd for the huge kernels, preferable wrapped in an configuration option, because even these kernels may need a full fledged initrd to unlock encrypted partitions of to handle RAID or LVM devices.

As bottom line(s), I for one I do not think that these GRUB2 scripts are complicated, and someone who knows Bash scriptng (i.e. a reasonable seasoned Slacker) bothers to look within them, they can be adapted as the user wishes.

In fact, I consider these GRUB2 scripts one of the best features of the GRUB2. Best enough that I contemplate the making of a limine-mkconfig.

Honestly, on Slackware I did not go further than adding custom kernels, but on Ubuntu I have customized them like hell, adding entries for MemTest86(+), for chainloading Windows or other operating systems - mostly Linux, but also BSDs. Meanwhile the Ubuntu silently mowed its own turf by keeping care of its own kernels.

And no, I do NOT believe in booting directly alien operating systems - from my experience, it's a pain in ass in the end, so I prefer the chainloading, then using the stock bootloader from the named operating system.

Anyway, like I said, I believe that these GRUB2 scripts are barely adapted for Slackware even today - this GRUB2 package seems trowed from orbit in the general direction of A series of Slackware packages tree.

Last edited by LuckyCyborg; 08-14-2023 at 11:03 AM.
 
2 members found this post helpful.
Old 08-14-2023, 11:57 AM   #73
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,713

Rep: Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392Reputation: 1392
Quote:
Originally Posted by LuckyCyborg View Post
Anyway, it's 7 years old code and it does not respect $GRUB_DISABLE_RECOVERY used today, it looking instead for $GRUB_DISABLE_LINUX_RECOVERY. Hence, I use a small patch for my experiments with it.
I patched this when I first started using it years ago and reported it on his Github page. I believe there is a pull request for custom kernels. Nothing ever came of it so I think he probably abandoned the script, but it is easy enough to patch like you have done.
 
Old 08-14-2023, 02:51 PM   #74
ZhaoLin1457
Senior Member
 
Registered: Jan 2018
Posts: 1,047

Rep: Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260Reputation: 1260
Quote:
Originally Posted by LuckyCyborg View Post
And bellow is a patch for 10_linux to skip the symlinks vmlinuz-generic and vmlinuz-huge which generates duplicate entries - along with the support for initrd-generic-* filenames as you suspect.

Code:
--- 10_linux.new	2021-09-10 21:45:00.000000000 +0300
+++ 10_linux	2023-08-14 17:01:09.904249712 +0300
@@ -194,7 +194,6 @@
 is_top_level=true
 while [ "x$list" != "x" ] ; do
   linux=`version_find_latest $list`
-  gettext_printf "Found linux image: %s\n" "$linux" >&2
   basename=`basename $linux`
   dirname=`dirname $linux`
   rel_dirname=`make_system_path_relative_to_its_root $dirname`
@@ -202,6 +201,13 @@
   alt_version=`echo $version | sed -e "s,\.old$,,g"`
   linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
+  # We will skip the vmlinuz-generic and and vmlinuz-huge which are symlinks
+  if [ "x${version}" = xgeneric ] || [ "x${version}" = xhuge ]; then
+    list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
+    continue
+  fi
+  gettext_printf "Found linux image: %s\n" "$linux" >&2
+
   initrd_early=
   for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
 	   ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
@@ -219,6 +225,7 @@
 	   "initramfs-genkernel-${alt_version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
+	   "initrd-generic-${version}.gz" "initrd-generic-${version}.img" \
 	   "initrd.gz"; do
     if test -e "${dirname}/${i}" ; then
       initrd_real="${i}"
I for one I do not use huge kernels and I have never did, unless I consider first installation of Slackware which I did. So, I did not added special handling for them.

However, I am quite sure that someone interested can add support for skipping the usage of an initrd for the huge kernels, preferable wrapped in an configuration option, because even these kernels may need a full fledged initrd to unlock encrypted partitions of to handle RAID or LVM devices.
Based on your patch, I made a patch to add support for managing Slackware kernel flavors.

to disable the use of initrd for huge kernels, use the option:

Code:
GRUB_DISABLE_INITRD_FOR_HUGE_KERNELS="true"
The menu entries for Slackware kernels are like this: "Slackware-15.0 GNU/Linux, with Linux Generic 5.15.118"

Combined with disabling the sub-menus, a flat menu results, similar to that custom script.

Code:
--- 10_linux.new	2021-09-10 21:45:00.000000000 +0300
+++ 10_linux	2023-08-14 23:32:11.601222790 +0300
@@ -84,17 +84,22 @@
   os="$1"
   version="$2"
   type="$3"
-  args="$4"
+  flavor="$4"
+  args="$5"
 
   if [ -z "$boot_device_id" ]; then
       boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
   fi
   if [ x$type != xsimple ] ; then
+      niceflavor=
+      if [ "x${flavor}" != xdefault ]; then
+        niceflavor="${flavor^} "
+      fi
       case $type in
 	  recovery)
-	      title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
+	      title="$(gettext_printf "%s, with Linux %s%s (recovery mode)" "${os}" "${niceflavor}" "${version}")" ;;
 	  *)
-	      title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
+	      title="$(gettext_printf "%s, with Linux %s%s" "${os}" "${niceflavor}" "${version}")" ;;
       esac
       if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
 	  replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
@@ -102,7 +107,7 @@
 	  title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
 	  grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
       fi
-      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$flavor-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
   else
       echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
   fi      
@@ -194,7 +199,6 @@
 is_top_level=true
 while [ "x$list" != "x" ] ; do
   linux=`version_find_latest $list`
-  gettext_printf "Found linux image: %s\n" "$linux" >&2
   basename=`basename $linux`
   dirname=`dirname $linux`
   rel_dirname=`make_system_path_relative_to_its_root $dirname`
@@ -202,6 +206,13 @@
   alt_version=`echo $version | sed -e "s,\.old$,,g"`
   linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
+  # We will skip the vmlinuz-generic and and vmlinuz-huge which are symlinks
+  if [ "x${version}" = xgeneric ] || [ "x${version}" = xhuge ]; then
+    list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
+    continue
+  fi
+  gettext_printf "Found linux image: %s\n" "$linux" >&2
+
   initrd_early=
   for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
 	   ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
@@ -219,6 +230,7 @@
 	   "initramfs-genkernel-${alt_version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
+	   "initrd-generic-${version}.gz" "initrd-generic-${version}.img" \
 	   "initrd.gz"; do
     if test -e "${dirname}/${i}" ; then
       initrd_real="${i}"
@@ -226,6 +238,16 @@
     fi
   done
 
+  flavor="default"
+  if echo $basename | grep -wq vmlinuz-huge ; then
+    if [ "x${GRUB_DISABLE_INITRD_FOR_HUGE_KERNELS}" = xyes ]; then
+      initrd_real=
+    fi
+    flavor="huge"
+  elif echo $basename | grep -wq vmlinuz-generic ; then
+    flavor="generic"
+  fi 
+
   initrd=
   if test -n "${initrd_early}" || test -n "${initrd_real}"; then
     initrd="${initrd_early} ${initrd_real}"
@@ -284,10 +306,10 @@
     is_top_level=false
   fi
 
-  linux_entry "${OS}" "${version}" advanced \
+  linux_entry "${OS}" "${version}" advanced "$flavor" \
               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
-    linux_entry "${OS}" "${version}" recovery \
+    linux_entry "${OS}" "${version}" recovery "$flavor" \
                 "single ${GRUB_CMDLINE_LINUX}"
   fi

Last edited by ZhaoLin1457; 08-14-2023 at 03:33 PM.
 
2 members found this post helpful.
Old 08-14-2023, 03:31 PM   #75
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,077

Rep: Reputation: Disabled
ZhaoLin1457 and LuckyCyborg : these patches could help generating a grub.conf from Slackware with its current naming scheme, but do not address the issues when it is generated from another OS installed in the same machine, unless you want to patch also the grub files of these other OS. For this reason I would rather just write a grub.conf and never change it (for users intending to run Slackware only) or adopt the same naming scheme for the kernel and initrd as other distributions, as I already wrote.
 
4 members found this post helpful.
  


Reply

Tags
grub, grub2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration