Re: Best way to configure Linux kernel for a machine

2013-01-17 Thread Valdis . Kletnieks
On Wed, 16 Jan 2013 17:47:08 +0530, Shraddha Kamat said:
> I normally do the kernel configuration on my machine like this -
>
> * copy the distro configuration file  to the kernel dir
> * make menuconfig (answer Y's/N's/M's) Normally keep return key pressed
> for default answers
> * then do the actual kernel compilation
>
>
> Now, I know that this is not a clean way to do the kernel compilation
> (although it has worked for me for thousands of times that I have
> compiled and successfully booted up with the kernel - without any issues
> - whatsoever !)
>
> But this time , I am bent upon coming up with a configuration
> specifically targeted to my machine. What is the best way to do this ?

Take your distro kernel, boot it up.  Make sure to insert any USB storage,
webcams, etc, at least long enough for udev to recognize them and load
their driver modules.

Then cd to your kernel source tree and 'make localmodconfig'.

That will build a stripped-down kernel that only builds those modules that
are currently listed in 'lsmod' (which on my laptop is on the order of
1/3 the size of the full Fedora 'allmodconfig').  Which is why it's important
you get all the modules probed - if you don't plug in that USB storage,
the module won't be loaded, so it won't be in lsmod, and won't be included
in your new kernel - at which point you'll use some bad language as you
try to debug why it doesn't work. :)

Also, see the other reply that points at Greg HK's talk.

> Also, while creating a initrd image
>
> # mkinitrd /boot/initramfs.img 3.8.0-rc3+ -f
> ERROR: modinfo: could not find module ipt_MASQUERADE
> ERROR: modinfo: could not find module iptable_nat
> ERROR: modinfo: could not find module nf_nat
> ERROR: modinfo: could not find module snd_hda_codec_intelhdmi
> ERROR: modinfo: could not find module joydev
>
> I got the above errors - I know how to resolve these errors , but want
> to understand why in the first place mkinitrd should complain in the
> first place ??

Because if the module was for your keyboard or hard drive or video,
and you got an unbootable kernel as a result, you *really* want to
know at mkinitrd time, not at boot time... :)


pgpErktqN8pyb.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Best way to configure Linux kernel for a machine

2013-01-16 Thread Simon
On Wed, Jan 16, 2013 at 7:17 AM, Shraddha Kamat  wrote:
> I normally do the kernel configuration on my machine like this -
>
> * copy the distro configuration file  to the kernel dir
> * make menuconfig (answer Y's/N's/M's) Normally keep return key pressed
> for default answers
> * then do the actual kernel compilation
>
>
> Now, I know that this is not a clean way to do the kernel compilation
> (although it has worked for me for thousands of times that I have
> compiled and successfully booted up with the kernel - without any issues
> - whatsoever !)
>
> But this time , I am bent upon coming up with a configuration
> specifically targeted to my machine. What is the best way to do this ?

Hi Shraddha,
   your story is almost identical to mine.  Although, I successfully
moved to the next chapter and I can surely share what I learned and
how I worked.  I do not believe this is the best way, after all I'm
still just a noob.  ;)

  Oh and... I hope the contents of my email can be a sufficient excuse
for its length!  I'm giving my experience, my method and the reasons
behind my choices and moves.  I just hope reading this wont cause a
buffer overflow somewhere in your frontal cortex! ;)

  I started very very long ago with Redhat (before year 2000), then I
moved to slackware and stayed there for a longer while.  All this time
I was using the defaults provided by the distros.  Then, perhaps
around 2008, I tried Slax and became very avid for fine tuning and
customizing everything.  During my research I found the Gentoo
distribution, switched over, loved it and migrated all my computers
over to it.  In the process I copied the ".config" file from my
previous stable install (I think it came from slackware) to all my
machines (at the time, they were all intel, single core).  Soon after,
I added a quad-core, then an old AMD athlon, and later (and last) I
bought a AMD 64bit dual-core laptop.  I used my 32bit distribution and
the same old 32bit kernel on that 64bit machine, until I decided this
whole situation was no longer tenable.  I needed 64bit, I needed
better that 386, I needed SMP, I wanted to get rid of all those device
drivers I will never ever use...  and more...

If I read your post right, this is where you stand now.  So here's what I did:

  The first thing was to start doing the same old way, but now using
git to get kernel updates.  Once I got used to it, the next step was
to setup a new branch in my git repository on each machine and
configured it to update that branch from one of my computer that I
dedicated as the "authoritative" repository.  Then I noticed it
doesn't quite work to take the 32bit config I had and simply switch it
to a 64bit architecture using menuconfig (really, don't even try,
there's lots of options to change, none of which are evident to the
newbie).  So, on each machine I did a "make i386_defconfig" on the
32bit systems and "make x86_64_defconfig" on the 64bit one.  I made a
commit of those .config files on each machine as the starting point of
my new configuration and I started compiling.  Then I rebooted and
gave it a try.

  Of course it didn't work and couldn't even boot up to init!  So on
each machine I checked what the immediate problem was and applied the
most minimal correction to my .config (using menuconfig) and making a
new commit after the change.  Some of the changes could be shared
among some of my machines so I pulled (aka merged) those commits onto
the other systems' config.  Each commit or small group of commits
would represent one feature I needed to add on a machine.  The commit
messages were like "Adding support for USB 1 and 2", then the next
would be "Fixing support for USB block devices (usbkeys)", etc...
This process was long and difficult but I got excellent help on
irc.freenode.net (in ##linux and #gentoo, thanks guys!).  The reason
it was difficult was my lack of knowledge of the complex
interdependencies of various things I needed.  But fortunately, the
needs that I had were very precise, the errors I got were very clear,
therefore my questions were very well stated, and the answers came
easilly and clearly (oh and pretty quickly too, except on Friday and
Saturday nights, hehe).  Within about week, it was done.  Everything
was supported on each machine (and nothing more), everything was very
stable (the video card was the only thing that kept giving me
trouble).

  This led to a totally different configuration on each machine, with
a single way of handling them all in the exact same way (with git).
The kernel bzImage shrunk to around 50% what it was before (I dropped
support for so many unused network cards and other stuff)!  I also
decided to make all these "features" built into the kernel (as opposed
to modules).  And left the very minimum as module (actually only 1 or
2 modules I seldom used and were not needed at boot time).  The result
was a kernel that no longer required an initrd to boot, which made the
whole process even simpler.

Keeping it up-

Re: Best way to configure Linux kernel for a machine

2013-01-16 Thread Leo
Sorry, my email client somewhat broke...

On 16 January 2013 21:22, Leonid V. Fedorenchik wrote:

> On Wed, 16 Jan 2013 17:47:08 +0530
> Shraddha Kamat  wrote:
>
> > I normally do the kernel configuration on my machine like this -
> >
> > * copy the distro configuration file  to the kernel dir
> > * make menuconfig (answer Y's/N's/M's) Normally keep return key
> > pressed for default answers
> > * then do the actual kernel compilation
> >
> >
> > Now, I know that this is not a clean way to do the kernel compilation
> > (although it has worked for me for thousands of times that I have
> > compiled and successfully booted up with the kernel - without any
> > issues
> > - whatsoever !)
> >
> > But this time , I am bent upon coming up with a configuration
> > specifically targeted to my machine. What is the best way to do this ?
> >
>
> Although I am not professional in this, I would suggest to read Linux
> Kernel in a Nutshell by Greg Kroah-Hartman which is available online
> at http://www.kroah.com/lkn/ . Specifically, Chapter 8 provides good
> details about custom configurations.
>
> Hope this helps.
>
> >
> > Also, while creating a initrd image
> >
> > # mkinitrd /boot/initramfs.img 3.8.0-rc3+ -f
> > ERROR: modinfo: could not find module ipt_MASQUERADE
> > ERROR: modinfo: could not find module iptable_nat
> > ERROR: modinfo: could not find module nf_nat
> > ERROR: modinfo: could not find module snd_hda_codec_intelhdmi
> > ERROR: modinfo: could not find module joydev
> >
> > I got the above errors - I know how to resolve these errors , but want
> > to understand why in the first place mkinitrd should complain in the
> > first place ??
> >
> > Thanks list for help for all these years.
> >
> > -- Shraddha
> >
> >
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> Leonid V. Fedorenchik
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Best way to configure Linux kernel for a machine

2013-01-16 Thread Shraddha Kamat
I normally do the kernel configuration on my machine like this - 

* copy the distro configuration file  to the kernel dir 
* make menuconfig (answer Y's/N's/M's) Normally keep return key pressed
for default answers
* then do the actual kernel compilation


Now, I know that this is not a clean way to do the kernel compilation
(although it has worked for me for thousands of times that I have
compiled and successfully booted up with the kernel - without any issues
- whatsoever !)

But this time , I am bent upon coming up with a configuration
specifically targeted to my machine. What is the best way to do this ?


Also, while creating a initrd image 

# mkinitrd /boot/initramfs.img 3.8.0-rc3+ -f 
ERROR: modinfo: could not find module ipt_MASQUERADE
ERROR: modinfo: could not find module iptable_nat
ERROR: modinfo: could not find module nf_nat
ERROR: modinfo: could not find module snd_hda_codec_intelhdmi
ERROR: modinfo: could not find module joydev

I got the above errors - I know how to resolve these errors , but want
to understand why in the first place mkinitrd should complain in the
first place ??

Thanks list for help for all these years.

-- Shraddha



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies