LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-08-2014, 10:47 AM   #16
haziz
Member
 
Registered: Jan 2012
Location: /dev/null
Distribution: Slackware, Fedora, Debian, Arch, Ubuntu
Posts: 101

Rep: Reputation: 4

Quote:
Originally Posted by bormant View Post
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?
 
Old 12-08-2014, 11:07 AM   #17
cynwulf
Senior Member
 
Registered: Apr 2005
Posts: 2,727

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
Quote:
Originally Posted by Didier Spaier View Post
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
 
Old 12-10-2014, 09:33 AM   #18
haziz
Member
 
Registered: Jan 2012
Location: /dev/null
Distribution: Slackware, Fedora, Debian, Arch, Ubuntu
Posts: 101

Rep: Reputation: 4
Quote:
Originally Posted by Didier Spaier View Post
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:
  1. 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.
  2. Boot on your -generic kernel
  3. 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.
  4. 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
  5. Run "make oldconfig" just to make sure you start next step from a clean workable basis.
  6. 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.
  7. 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.
  8. Compile and install the new kernel and modules as usual.
  9. Make an initrd for your new kernel, with a specific name.
  10. Write a lilo stanza in /etc/lilo.conf for your new kernel, referencing it as well as the new initrd.
  11. Run "lilo -t -v" then if all goes well "lilo".
  12. Cross fingers (this step is optional).
  13. 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.
 
Old 12-10-2014, 05:28 PM   #19
Qury
Member
 
Registered: Feb 2004
Location: Naas,IE
Distribution: Slackware
Posts: 212

Rep: Reputation: 184Reputation: 184
compiling kernel 3.14.2 with slackware 14.1

use localyesconfig
 
1 members found this post helpful.
Old 12-10-2014, 07:11 PM   #20
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
2 members found this post helpful.
  


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
compiling kernel 2.6.38.6 on Slackware 13.37 dimm0k Slackware 15 05-12-2011 01:44 PM
slackware 10.2 compiling kernel sharathg786 Slackware 3 07-31-2006 04:08 PM
Errors Compiling Kernel 2.6 on Slackware 10.2 - Old kernel headers required? Dave S. Slackware 8 03-04-2006 12:15 AM
Compiling new kernel with Slackware 10 madhatter2 Linux - Newbie 2 07-29-2004 04:08 PM
Compiling kernel 2.6.4 on Slackware 9.1 ProtoformX Linux - General 1 03-13-2004 10:41 AM

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

All times are GMT -5. The time now is 05:53 AM.

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