[lfs-support] LFS-BOOK-7.0:Section 8.3: Linux 3.1 Compilation.

William Harrington berzerkula at cox.net
Mon Aug 13 13:08:19 PDT 2012

On Aug 13, 2012, at 13:41 PM, Emerson Yesupatham wrote:

> Hi Team,
> I am currently working on Section 8.3 of Book 7.0. Section is about  
> Linux 3.1 compilation.
> I am new to kernel compilation from Scratch. Book recommends to do  
> the kernel compilation from Scratch, is there any online material  
> to go through or I should go through the README present in Linux  
> tar ball?
> I spent sometime to figure out the options shown in make menuconfig  
> GUI but it was difficul to understand each and every options.
> I also copied .config (/usr/src/kernels/ 
>  from host system and gave "make  
> menuconfig" but it was asking for so many questions one-by-one in  
> the command line.
> Not sure whether I should give "make oldconfig" in this scenario  
> ( that is copying .config from host PC). I went through the README  
> and found there is something called  "allyesconfig", can I try that?
> Kindly suggest.
> My Host PC details:
>  [root at cag73 ~]# cat /proc/version
> Linux version  
> (mockbuild at x86-16.phx2.fedoraproject.org) (gcc version 4.5.1  
> 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP Mon Oct 18 23:56:17 UTC 2010
> [root at cag73 ~]# uname -a
> Linux cag73 #1 SMP Mon Oct 18 23:56:17 UTC  
> 2010 i686 i686 i386 GNU/Linux
> Thanks,
> Emerson

Hello Emerson,

Configuration a kernel can be daunting. The best way to start with a  
config is use the defconfig:

DO NOT do allyesconfig  That will be bad and will most likely keep  
your system from booting... it used to in the past, and that's if it  
even builds!

make mrproper    < can read help about the different targets by  
running: make help>
make defconfig

 From there, do not worry about options other than what you need to  
get your rootfs mounted.
Make sure these are in your kernel:

- Hard drive controller driver <will be in sata and pata support or  
- SCSI block device driver <drivers should automatically select this,  
it's in the scsi device driver section this won't matter if your   
hard drive is sata or pata when using the sata and pata drivers>
- Filesystem driver <some ext filesystems are disabled, some aren't.  
enable the one you used for your LFS filesystem>

That will get your rootfs mounted and you can get into LFS.

The rest of the drivers like graphics, device input, ethernet, sound,  
you'll need to find out which devices is with your hardware  
(example... ATI radeon graphics, usb mouse/keyboard or some other  
input devices, intel hda audio in the sound device drivers section of  

Frankly explore the device drivers section and enable what you need  
and disable what you don't need. Lots of device drivers are enabled  
by default.

Once you get a working kernel, then you can start trimming what you  
don't need. When you read the help of some drivers, there may be some  
text stating whether users should normally say Y or N.

What can really help, especially when the host system you used to  
build LFS with has most drivers loaded as modules, is to look through  
the list of loaded modules and enable those in your kernel.

Better yet, if you do a kernel config with your running host you used  
to build LFS and it has most modules loaded, there is a make target  
with the kernel that will configure all local modules into core. It is:

  localyesconfig  - Update current config converting local mods to core

Then you can move that config to the 3.1 kernel you are building.  
With make oldconfig, you should just press enter all the way through  
and let it select defaults then go through there and sift out what  
you don't need later on.

Many people have different views on how to configure their own  
kernel. I'm sure you will get many ideas.

I will leave you with this. Once you get a working kernel, remove  
what you do not need. Read through the help for each kernel option if  
you don't understand it and select what is suggested Y or N. If no  
suggestion is provided, leave it alone until you get more information  
about what it does or what it may do if you enable or disable it.

I hope this helps a bit.


William Harrington

More information about the lfs-support mailing list