LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-03-2023, 04:17 AM   #16
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561

Quote:
Originally Posted by Petri Kaukasoina View Post
Even faster if you once prepare /etc/mkinitrd.conf
Thanks for the tip!
 
Old 09-03-2023, 04:21 AM   #17
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Quote:
Originally Posted by rkelsen View Post
How long does it take to go through all of the configuration options to work out precisely what is needed and what is not?
Quote:
Originally Posted by enorbet View Post
I'm not saying anyone is silly for using a generic kernel and an initrd and messing with mklinitrd or geninitrd. If that works for you that is perfectly valid but I am going to build a custom kernel anyway...
I build my kernels, too, because I follow the latest kernels (now 6.5.1). It is not needed to go through all of the configuration options. For example, if you would only use initrd to load the ext4 module, it does not take many seconds to copy Patrick's latest config-generic-6.1.51.x64 to .config, run 'make menuconfig', and change "The Extended 4 (ext4) filesystem" setting (CONFIG_EXT4_FS) to compile ext4 built-in. And you can use the same .config next time, no need to reconfigure.
 
Old 09-03-2023, 04:29 AM   #18
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,797

Rep: Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436
Quote:
Originally Posted by rkelsen View Post
The barrier is in your head. You've built it up in your mind to be bigger than it is.

Everything you need to know is in the 598 word mini-HOWTO symlinked in the /boot directory of a standard Slackware installation. This document first appeared in Slackware on 21 June 2004, and was first included in the 10.0 release... >19 years ago. It's worth reading, if only to slay the dragon in your own head.
It's my imagination because my workflow isn't the same as yours? I don't understand why you don't get it that within just a few minutes of first boot or a kernel upgrade I rebuild the kernel anyway, so why not make one step, taking mere seconds longer, to avoid complexity and further steps? I've been working this way since Slackware v7.
 
Old 09-03-2023, 04:41 AM   #19
fourtysixandtwo
Member
 
Registered: Jun 2021
Location: Alberta
Distribution: Slackware...mostly
Posts: 325

Rep: Reputation: 216Reputation: 216Reputation: 216
To expand on Petri's method (using /etc/mkinitrd.conf) and if you have multiple kernels installed via installpkg...

For multiple kernels, I found checking /lib/modules unreliable due to orphan directories being left behind. But obviously not a problem if you keep it clean or use it like Petri does for a single kernel.

Code:
kmod=`( cd /var/lib/pkgtools/packages/ ; ls -v kernel-modules* ) | awk -F- '{printf"%s:", $3}' |sed 's/:$//'` && echo $kmod

mkinitrd -F -k $kmod
 
1 members found this post helpful.
Old 09-03-2023, 04:49 AM   #20
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Still another variation:
Code:
KERNEL_VERSION=$(cd /boot; echo vmlinuz-generic-*|sed 's/vmlinuz-generic-//g'|sed 's/ /:/g')
It may be more reliable than looking at the module directories (third-party modules left there?)
 
3 members found this post helpful.
Old 09-03-2023, 05:08 AM   #21
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,463
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by enorbet View Post
It's my imagination because my workflow isn't the same as yours?
Don't get upset. It's your system, go do whatever you like.

But don't claim that building a kernel is quicker or easier than using an initrd, because it's not... by a substantial margin.
 
Old 09-03-2023, 05:20 AM   #22
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,409

Rep: Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142
Quote:
Originally Posted by Petri Kaukasoina View Post
Still another variation:
Code:
KERNEL_VERSION=$(cd /boot; echo vmlinuz-generic-*|sed 's/vmlinuz-generic-//g'|sed 's/ /:/g')
It may be more reliable than looking at the module directories (third-party modules left there?)
I use this one:
Code:
KERNEL_VERSION=$(grep "^VERSION = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev).$(grep "^PATCHLEVEL = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev).$(grep "^SUBLEVEL = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev)$(grep "^EXTRAVERSION = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev)

Last edited by marav; 09-03-2023 at 05:22 AM.
 
1 members found this post helpful.
Old 09-03-2023, 05:28 AM   #23
fourtysixandtwo
Member
 
Registered: Jun 2021
Location: Alberta
Distribution: Slackware...mostly
Posts: 325

Rep: Reputation: 216Reputation: 216Reputation: 216
Quote:
Originally Posted by Petri Kaukasoina View Post
Still another variation:
Code:
KERNEL_VERSION=$(cd /boot; echo vmlinuz-generic-*|sed 's/vmlinuz-generic-//g'|sed 's/ /:/g')
It may be more reliable than looking at the module directories (third-party modules left there?)
Indeed, and would work better with manually installed kernels.

In my case it's the misc dir and modules.* files that get left there.
 
Old 09-03-2023, 05:41 AM   #24
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,982

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by marav View Post
I use this one:
Code:
KERNEL_VERSION=$(grep "^VERSION = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev).$(grep "^PATCHLEVEL = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev).$(grep "^SUBLEVEL = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev)$(grep "^EXTRAVERSION = " /usr/src/linux/Makefile | rev | cut -d' ' -f1 | rev)
what about
Code:
KERNEL_VERSION=$(make -f <makefile> -s kernelversion)
?
 
Old 09-03-2023, 05:52 AM   #25
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,409

Rep: Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142
Quote:
Originally Posted by pan64 View Post
what about
Code:
KERNEL_VERSION=$(make -f <makefile> -s kernelversion)
?
That means you must have a compiler to catch the version
 
Old 09-03-2023, 05:59 AM   #26
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,982

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by marav View Post
That means you must have a compiler to catch the version
No, that means make should be available. No compiler required.
Otherwise a simple awk can work too:
Code:
awk '/^VERSION = / {v=$NF} 
     /^PATCHLEVEL = / {pl=$NF}
     /^SUBLEVEL = / {sl=$NF}
     /^EXTRAVERSION = / {ev=$NF}
     END { printf "%s.%s.%s%s", v, pl, sl, ev }' <makefile>
(something like this)
 
Old 09-03-2023, 06:10 AM   #27
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,409

Rep: Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142
Quote:
Originally Posted by pan64 View Post
No, that means make should be available. No compiler required.
Otherwise a simple awk can work too:
Code:
awk '/^VERSION = / {v=$NF} 
     /^PATCHLEVEL = / {pl=$NF}
     /^SUBLEVEL = / {sl=$NF}
     /^EXTRAVERSION = / {ev=$NF}
     END { printf "%s.%s.%s%s", v, pl, sl, ev }' <makefile>
(something like this)
It's just based on what Pat does:
http://ftp.slackware.com/pub/slackwa...ric.SlackBuild
There are several way to do it, I just choose one :-)

Last edited by marav; 09-03-2023 at 06:12 AM.
 
Old 09-03-2023, 07:05 AM   #28
gus3
Member
 
Registered: Jun 2014
Distribution: Slackware
Posts: 490

Rep: Reputation: Disabled
I had this, 3 years ago:

A desktop, a server/firewall, a (normal-sized) laptop, and a netbook, all running Slackware-current. All set up to install the latest kernel with "mkinitrd -F ... && lilo" with the same command. And of course, the same "su" password (but that's because I'm just lazy). The next step? Duplicate the 4 sessions into a single input, via "multixterm". I could "upgradepkg", with symlinks for x86_64 or i686, and then go to /boot to do the installation stuff.

That setup beforehand, paid off really well, with outputs showing health and consistency
 
Old 09-03-2023, 09:29 AM   #29
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
We all do things a bit differently. I use symlinks in /boot to reference the kernels; vmlinuz-generic-stock, vmlinuz-generic-working and occasionally vmlinuz-generic-testing.

In my mkinitrd.conf I have the following:
Code:
KERNEL_VERSION=$(readlink vmlinuz-generic-[swt]* | cut -d- -f3 | sort | sed ':a;N;$!ba;s/\n/:/g')
This nicely formats to 'KERNEL_VERSION=6.1.50:6.1.51'

The "sort" is not really needed as mkinitrd does not care about what order the kernel versions are in the list, that "sort" is for me.

So all I need is to use is 'mkinitrd -F'

Thanks to @Petri Kaukasoina for this idea.

What I used to do was 'mkinitrd -F -k 6.1.50:6.1.51'

I always run mkinitrd from /boot/.

Last edited by chrisretusn; 09-03-2023 at 09:32 AM.
 
Old 09-03-2023, 01:03 PM   #30
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,797

Rep: Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436
Quote:
Originally Posted by rkelsen View Post
Don't get upset. It's your system, go do whatever you like.

But don't claim that building a kernel is quicker or easier than using an initrd, because it's not... by a substantial margin.
I wasn't upset before but now I am a wee bit because you are misrepresenting what I have written. I never made the claim that an isolated instance of building a kernel is quicker or easier than generating an initrd. I won't bore everyone with what I actually wrote since it is already a matter of record. Just please stop misepresenting my words to suit your personal preference and workflow. Your way is fine and so is mine.
 
  


Reply



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
to initrd or not to initrd... svu Slackware 34 01-18-2023 02:09 AM
os-initrd-mgr -new option to slim down the OS InitRD drmozes Slackware - ARM 2 05-26-2022 10:25 AM
WHen I rebooted my laptop it is stuck at "initrd /boot/initrd.img Shadowmeph Linux - Newbie 2 03-07-2014 03:03 PM
How to create new initrd.gz (or initrd.img) file? kkpal Programming 2 12-10-2007 08:38 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM

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

All times are GMT -5. The time now is 03:28 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