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.
One large initrd with modules for each kernel version (don't use "-c" option of mkinitrd after first call) or number of separate initrds for each kernel on your choice.
Actually I am not sure I set up the initrd for my generic kernel correctly. Will redo it when I get home. How do I set up an initrd for a kernel different from the running kernel?
You know that stripping down your kernel is usually useless, do you?
Nevertheless, doing useless things is not forbidden by law. So, here is a simple recipe:
[...]
Run "make localmodconfig" in your kernel tree. This is the important step. The new kernel will be modular and the
This will not build a smaller bzImage, just that only modules for the current system will be built - all this achieves is cutting down on (a lot of) build time and bit of disk space. By default the Linux kernel is mostly modules anyway, which means that what is not required does not get loaded.
Still I'd be interested to see the size difference of a kernel built using this method vs Slackware's generic kernel image.
Last edited by cynwulf; 12-08-2014 at 11:11 AM.
Reason: typos
You know that stripping down your kernel is usually useless, do you?
Nevertheless, doing useless things is not forbidden by law. So, here is a simple recipe:
If not already done, install the -generic kernel shipped with Slackware (of course you'll need to use an initrd for that). Keep the huge one and a lilo stanza for it, just in case.
Boot on your -generic kernel
Plug in (one at a time a few seconds then remove, else you won't have enough USB slots) all the removable devices that you have (USB hard disks, USB sticks, USB cameras, SD cards, whatever), so that all needed kernel modules be loaded. Else you'll loose support for these devices in the new kernel.
Run "zcat /proc/config.gz > <path_to_your_kernel_tree>/.config to copy your currently in use config file in your kernel tree, named .config
Run "make oldconfig" just to make sure you start next step from a clean workable basis.
Run "make localmodconfig" in your kernel tree. This is the important step. The new kernel will be modular and the kernel modules built will be only those currently loaded.
Run "make xconfig" or "make menuconfig" in your kernel tree just to set "Local version -append to kernel release" in the "General Setup" menu. "strip" could be a good "Local version" name. This will allow you to distinguish the new kernel and modules from existing ones.
Compile and install the new kernel and modules as usual.
Make an initrd for your new kernel, with a specific name.
Write a lilo stanza in /etc/lilo.conf for your new kernel, referencing it as well as the new initrd.
Run "lilo -t -v" then if all goes well "lilo".
Cross fingers (this step is optional).
Reboot with your new kernel.
PS there are 13 steps, but only for superstitious people. This is intentional.
Is it possible to use make localmodconfig to compile the modules into the kernel rather than load them dynamically? I seem to have issues with creating a usable initrd, even though I believe I am following the instructions correctly. I realize the kernel will be a bit larger.
make olddefconfig works well also when going from one kernel version to another. If keeps everything as-is, but auto defaults to the recommended yes|no|modules|internal options where given, or the default values if provided.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.