SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yes, I build and install each of the 5.15.y Kernels as soon as they're released ( huge, generic and modules ).
I use Pat's kernel-modules.SlackBuild so I end up with the same 315 MB that Pat's SlackBuild produces ( yesterday's 5.15.76 modules are 380 MB on my machine ).
I was wondering whether Arrabiata had a 'secret recipe' script to automatically pare the default 300+ MB 5.15.y modules down to 31 MB.
Yes, I build and install each of the 5.15.y Kernels as soon as they're released ( huge, generic and modules ).
I use Pat's kernel-modules.SlackBuild so I end up with the same 315 MB that Pat's SlackBuild produces ( yesterday's 5.15.76 modules are 380 MB on my machine ).
I was wondering whether Arrabiata had a 'secret recipe' script to automatically pare the default 300+ MB 5.15.y modules down to 31 MB.
You're missing main advantage of compiling the kernel if you don't touch the configuration. You could just proceed by step, there are obvious features that you won't need when looking into it
How did you trim /lib/modules/5.15.76/ from 315 MB down to 31 MB ?
Thanks
-- kjh
With localemodconfig you already get a lot of unnecessary balast removed. However, it is not 100% accurate and you can use menuconfig to improve it. Another 100-200 modules can be safely removed. Some important modules you should better keep, but that depends on the hardware you want to use.
Over time, you will get the optimal configuration.
Since I've beern building custom kernels for over 20 years I came from the time when it was both possible as well as bragging rights to get a kernel that would fit on a floppy. Obviously those days are long gone now but thanks to on-demand loadable modules the importance of miniscule kernels is far less valuable that it was before. Within mere miutes of any fresh install I build a custom kernel and these days it doesn't take most of a day like it used to. I just use the generic config as a template, modify the options I want for performance, and remove the most obvious ones I don't. My "/lib/modules/linux-foo" tends to hover around 100MB, much larger than the 27-40MB that some get but comparing performance I don't see a substantial return on investment, so I don't bother any more to take it any further. The benefits I seek are performance, elimination of initrd, and long term service.
With new hardware I will upgrade kernels regularly but once mobos get a year or more on them, upgrades slow to a crawl. I don't bother with encryption and don't pay much attention to security patches because I limit access both physically and networking by a multi-level firewall and disabling network interfaces when not in use. Wifi is always off until I absolutely need it and then off immediately when finished.
I suppose some get a sense of peace and security by bothering with encryption and that's perfectly valid but IMHO the first line of defense is minimizing access and keeping my systems simple.
P.S. Thanks Arrabiata, localmodconfig was one of the F-Words I was looking for.
But it seems I saw a tool of some sort some where, maybe on the ArchWinki ?
P.P.S. found it: Is there anything like Arch Modprobed-db for Slackware ?
I know the tool. You will most likely have a laptop, and there the hardware is very limited. Localemodconfig & menuconfig is all you need for this. For example, if you have a laptop with Intel hardware, then of course you don't need modules for Nvidia, AMD, or Mediatek. The advantage is, for the build of bzImage and modules, max. 20-25 minutes pass. And the Skylake is not exactly the fastest CPU. Generating the initrd is also not necessary, if the kernel is configured accordingly. Theoretically you don't need to run grub anymore. It is enough if you adjust the version number in grub.cfg.
I know the tool. You will most likely have a laptop, and there the hardware is very limited. Localemodconfig & menuconfig is all you need for this. For example, if you have a laptop with Intel hardware, then of course you don't need modules for Nvidia, AMD, or Mediatek. The advantage is, for the build of bzImage and modules, max. 20-25 minutes pass. And the Skylake is not exactly the fastest CPU. Generating the initrd is also not necessary, if the kernel is configured accordingly. Theoretically you don't need to run grub anymore. It is enough if you adjust the version number in grub.cfg.
Thanks again Arrabiata
I have been running script wrappers that execute Pat's standard SlackBuilds including `make oldconfig` for years and years.
Last Saturday Morning, Linux 5.15.76 took ~18 minutes to build huge, generic and modules:
Code:
[root@kjhlt7 log]# head -1 package-kernel-5.15.76.kjh.log && tail -1 package-kernel-5.15.76.kjh.log
/dld/15.0/slackware/kjh-kernel/.make-SlackBuilds 5.15.76 startup at Sat Oct 29 04:03:26 CDT 2022
/dld/15.0/slackware/kjh-kernel/.make-SlackBuilds 5.15.76 complete at Sat Oct 29 04:21:29 CDT 2022 # delta_t = 18m 03s
The generic Kernel is MUCH faster by invoking `make localmodconfig` rather than `make oldconfig`
And the /lib/modules/ directory is 33 MB -vs- 380 MB ( nice )
Got some research and testing ahead of me ...
-- kjh
Code:
[root@kjhlt7 linux-5.15.76.kjh_2]# pwd
/usr/src/linux-5.15.76.kjh_2
[root@kjhlt7 linux-5.15.76.kjh_2]# make localmodconfig
<<snip>>
[root@kjhlt7 linux-5.15.76.kjh_2]# vim .config # edited CONFIG_LOCALVERSION=".kjh_2"
[root@kjhlt7 linux-5.15.76.kjh_2]# time make -j17 bzImage modules
<<snip>>
Kernel: arch/x86/boot/bzImage is ready (#1)
real 2m19.835s
user 30m16.029s
sys 2m43.091s
[root@kjhlt7 linux-5.15.76.kjh_2]# make modules_install
<<snip>>
[root@kjhlt7 boot]# du -sh /lib/modules/*
315M /lib/modules/5.15.63
315M /lib/modules/5.15.67.kjh
315M /lib/modules/5.15.68.kjh
315M /lib/modules/5.15.69.kjh
315M /lib/modules/5.15.70.kjh
315M /lib/modules/5.15.71.kjh
315M /lib/modules/5.15.72.kjh
315M /lib/modules/5.15.73.kjh
315M /lib/modules/5.15.74.kjh
315M /lib/modules/5.15.75.kjh
380M /lib/modules/5.15.76.kjh # make oldconfig size
33M /lib/modules/5.15.76.kjh_2 # make localmodconfig ( nice )
Hi All,
As my first post to the forum I guess this is as good a place as any. I started out with Linux using Vector Linux and since it is (was) a Slackware derivative I changed to Slackware. That was version 13.37 and since then Slackware has been my exclusive OS. In the late 90s also I played around with Minix for awhile.
In common with others here I also compile my own kernels and have done so for years. Haven't got my module count as low as some but fairly low. Although memory and disk space is cheap I'd rather not compile hundreds of modules that I will never use. If I get a new piece of hardware then I'll reconfigure and compile a new kernel. The 5.10 kernel is from the original installation.
Only problem with localmodconfig is that it won't pick up anything that's not a module.
And if the module's not loaded but used for some software at some point, it won't get picked either.
A lot of manual work is needed to use localmodconfig effectively.
It helps a lot to automatically reduce the number of modules, but from experience, this is where it usually breaks stuff:
If you're using iptables/ebtables/nftables and all of your chains aren't loaded when you run localmodconfig, there will be no firewall modules.
If you have hardware which requires modules and it's not connected when localmodconfig is used, there will be no modules for that hardware.
I apologize for contributing to derailment of this thread without providing any pictures..
But I'll share this local output, where for example my 5.15.72 and 5.15.73 had nouveau compiled-in for testing purposes.
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,018
Rep:
Quote:
Originally Posted by kjhambrick
Thanks Arrabiata, keefaz and slac
I was looking for some good ole PFM(*) that didn't require messing with make *config
But as always, There is No Such Thing as a Free Lunch
-- kjh
(*) - the first word is PURE and the last word is MAGIC, the middle word is an F-Word
P.S. Thanks Arrabiata, localmodconfig was one of the F-Words I was looking for.
But it seems I saw a tool of some sort some where, maybe on the ArchWinki ?
P.P.S. found it: Is there anything like Arch Modprobed-db for Slackware ?
This is nice but a bit cumbersome (link to Arch).
What you need is to load all modules that you may need. e.g. you have external usb drive firmatted with ntfs, your external cd, music player, tun module and so on. Next run (as mentioned above)
Quote:
make localmodconfig
This is not perfect, but works. Not perfect because you may forget to load something
Anyway:
Quote:
localyesconfig
builds static kernel from loaded modules.
Quote:
allmodconfig
will compile most things as modules.
Arch db works as
Quote:
localmodconfig
collecting all information regarding modules loaded over time, so more time you let it go before compiling kernel more complete db will be.
Of course once you start customizing your kernel, you can go much further than modules only.
Obvious issues: iptables modules. You would have to correct generated kernel config to adjust for iptables modules,also tun module and some custom stuff of course. You will have to remove modules that you don't want e.g ipv6 (examples only).
Manual adjustment of your config will determine safety and performance of your kernel.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.