# Trouble compiling my own kernel [SOLVED]

## Kruppe

Hello,

I'm a fairly long time use of or archlinux, but I want to get more into gentoo to try out a compiled source distribution. Also apologies if this isn't the right part of the forums to post this.

The Problem:

My boot time is frustratingly long for a laptop.

I followed the gentoo handbook to get a basic install up and running using genkernel, and I now have it duelbooted with my archlinux setup. I'm at step 11 of the gentoo handbook "Finalizing your Gentoo Installation". But before I continue I want to solve the problem I'm having with my init sequence. The kernel generated using genkernel works great, as expected, but either the kernel or some other part of the init process is taking a very long time in comparison to my arch install for example. 

Here is a list of the things which seem to be causing unwarranted delay in the boot sequence (also if there is a way to capture that text during boot I'm sure it would help in diagnosing the problem):

1. The main delays seem to occur at the beginning of the boot sequence (from what I understand after the kernel is loaded) where the message "Loading Modules" is displayed and it shows a staggering number of modules at least some of which I know aren't necessary (I'm guessing this is because genkernel makes a giant kernel with essentially every module possible).  Is there a way to get it to load only the modules needed, either by selecting them manually or otherwise?

2. "Waiting for uevents to finish" or something similar to that seems to cause a fairly large delay (about 10-15 seconds). I'm not sure whats causing the delay here but i would definately like to reduce it.

3. "Updating modules.dep" also seems to take a long time. Again I'm not sure whats causing the delay here.

I've compiled my own kernel as an attempt to improve the boot time but the boot sequence gets stuck at "Updating modules.dep" so I've probably made some mistake during that process.

Anyways I'm looking for some direction on improving my boot speed, thanks for any help provided.Last edited by Kruppe on Tue Apr 21, 2009 12:07 am; edited 3 times in total

----------

## vaxbrat

emerge gentoo-sources to get a kernel source tree that you can customize to "bake in" your necessary hardware.  Do an lspci and lsusb to figure out what hardware you need to support.

If you don't have those commands, emerge pciutils and usbutils to get them.

I'm going to assume that you know how to configure, build and install a kernel at this point.  The gentoo handbook should have a write-up on the details as well.  I'm sure kernel.org has a howto lying around somewhere as well.

Make sure that you build your hard disk controller and the filesystems that you use as "baked in" and not just modules.  Otherwise you would need to go the initrd route that the genkernel sources take.  At a minimum you should bake in ext2 and ext3 filesystems since these are most commonly used for /boot and / mounts.

Things that udev takes care of can and should be still built as modules eg: graphics card/framebuffer, ethernet, sound, network stack, usb support, usb devices

Don't forget to update grub.conf after you have installed your built kernel.  Keep the old genkernel around in case you need to boot up after missing something crucial.

Enjoy... If you have specific questions, post them

----------

## jburns

When you build your kernel using genkernel use one of the options --menuconfig, --xconfig, or --gconfig so that you can remove unneeded features.  Read man genkernel.

If you are not using raid, then disable the kernels raid features.

In the file /etc/rc.conf select rc_parallel="YES".  There is a warning that rc_parallel="YES" may cause problems.

----------

## pappy_mcfae

If you want a kernel with zip, check out my kernel seeds. They're set for maximum performance. Just add your devices, and off you go. Or, if you want, send me the results of lspci -n and cat /proc/cpuinfo as well as your present .config and your /etc/fstab file, and I'll make a kernel that will make your computer scream...well, at least run better than it is currently.

If you decide to go with me configuring your kernel, please see the sig about pastebin. Thanks.

Blessed be!

Pappy

----------

## Kruppe

Thanks folks, some useful suggestions. I'm going to try and get a decent kernel up and running soon.

Thanks very much pappy_mcfae thats very generous! I may just take you up on that offer if only to see what your config looks like. I definately would like to be able to do it for myself but it would still be extremely useful.

----------

## Kruppe

Here is the kernel config I made by following your guide pappy, it boots fine, there seems to be a disconcerting number of /dev/ ptys and ttys if that means anything, and im not sure if I set up my wireless card correctly. 

Overall the guide was excellent and saved me an enourmous amount of work no doubt. If you could either verify that my wireless config is correct or point me in the right direction for making sure that it is that would be excellent. Thanks again for the valuable resource.

http://pastebin.com/m27c4d68

----------

## pappy_mcfae

I suppose one doesn't need that many pty devices, but that was the default value. Sixteen might work better, but that setting is only turned on as a "shut up" sort of thing. In other words, if it's not turned on, certain functions will cough up a fur ball about not having enough pty devices. With it on, no fur balls. Same goes for the using md. Without it, certain disk operations will hork up a fur ball demanding you set md. So, I set it, no whining from the kernel.

As for your work on the .config, very good. You missed a few small details, but that's only because I need to make it more plain about how I set up kernels, and what is and isn't important. I fixed those things. 

I know I did some fixing under Processor type and features, and I also set the core2 heat sensor to a module so that lm_sensors can work with it. Other than that, use a diff program to find out what other changes I made. I sometimes enter a Zen state when I work with kernels...especially the second or third one of the day. 

Click here for your new .config. Compile as is.

For the best results, please do the following:

1) Move your .config file out of your kernel source directory ( /usr/src/linux-2.6.27-gentoo-r8 ).

2) Issue the command make mrproper. This is a destructive step. It returns the source to pristine condition. Unmoved .config files will be deleted!

3) Copy my .config into your source directory.

4) Issue the command make && make modules_install.

5) Install the kernel as you normally would, and reboot.

6) Once it boots, please post /var/log/dmesg so I can see how things loaded.

Once again, good work with the kernel. It's good to know the strengths and weaknesses of my documentation.

Blessed be!

Pappy

----------

## Kruppe

Here is my /var/log/dmesg:

http://pastebin.com/m268a7a20

There is one problem I see right now, and that is I cant activate my wireless interface wlan0. I get the message "SCIOCSIFFLAGS: No such file or directory" which I understand is a missing firmware problem. Would that be a problem on the kernel config side or do I need to hunt it down using emerge?

Thanks again, you've been very helpful.

----------

## pappy_mcfae

Search for "iwl3945 firmware" either in the forum search, or in Google. I believe there is a firmware package in portage, but I'm not sure.

Blessed be!

Pappy

----------

## wswartzendruber

Dump the file you download in /lib/firmware/.

----------

## Kruppe

Found the firmware in portage, don't know why I missed it before. Everything is working now, thanks!

----------

## pappy_mcfae

Awesome! I love happy customers.

Blessed be!

Pappy

----------

## Kruppe

On my arch boot I've written a few scripts based on system status displayed in the /sys/class/power_supply and related files. I've noticed that these aren't present on my gentoo install. Does this have anything to do with my kernel config or am I missing something else?

----------

## Kruppe

Nevermind I found the options by searching menuconfig for sysfs. All my scripts are back up and running!

----------

## jaideep_jdof

 *pappy_mcfae wrote:*   

> If you want a kernel with zip, check out my kernel seeds. They're set for maximum performance. Just add your devices, and off you go. Or, if you want, send me the results of lspci -n and cat /proc/cpuinfo as well as your present .config and your /etc/fstab file, and I'll make a kernel that will make your computer scream...well, at least run better than it is currently.
> 
> If you decide to go with me configuring your kernel, please see the sig about pastebin. Thanks.
> 
> Blessed be!
> ...

 

pappy_mcfae could you please help me out with my kernel config, I tried to compile a kernel following instruction on you site but the compiled kernel didn't work. This is the link to the pastebin post containing my laptop's comfiguration http://pastebin.com/m615d499d, i am currently using a kernel compiled using genkernel's default config file. I am using funtoo intel core2 stage3 and my gentoo-sources version is 2.6.28-r5.

----------

## pappy_mcfae

Are you running as x86 or x86_64? That is unclear from this since I don't have your .config as well.

Blessed be!

Pappy

----------

## jaideep_jdof

 *pappy_mcfae wrote:*   

> Are you running as x86 or x86_64? That is unclear from this since I don't have your .config as well.
> 
> Blessed be!
> 
> Pappy

 

i am using x86_64. This is my updated pastbin entry containing my system's configs and kernel config file http://pastebin.com/m6a57c93

----------

## pappy_mcfae

I decided to start fresh. There were too many things that gave me pause. This .config starts you on a stable base. If you wish to experiment with the other settings you were messing with in your kernel, it's best to start with stability.

Click here for your new .config. Compile as is.

For the best results, please do the following:

1) Move your .config file out of your kernel source directory ( /usr/src/linux-2.6.28-gentoo-r5 ).

2) Issue the command make mrproper. This is a destructive step. It returns the source to pristine condition. Unmoved .config files will be deleted!

3) Copy my .config into your source directory.

4) Issue the command make && make modules_install.

5) Install the kernel as you normally would, and reboot.

6) Once it boots, please post /var/log/dmesg so I can see how things loaded.

Blessed be!

Pappy

----------

## jaideep_jdof

I am getting a kernel panic with an error something like:

```

VFS: unable to detect rootfs (hd2,0)
```

I what I did was I passed the config file path to the genkernel all command.

----------

## jaideep_jdof

of the kernel panics and gives the following error:

```
Unable to mount rootfs on unknown block (2,0)
```

I guess the cause of this problem is that I am using UUID in my /etc/fstab and the kernel is unable to identify the partition. But I am using root=/dev/sda2 in grub.conf. One more thing the cpu freq scaling isn't enable in the config file.

----------

## pappy_mcfae

Yes, good guess. I should have told you to drop the fancy stuff from your /etc/fstab, and only go for a simple line like:

```
/dev/sda3 / reiserfs  noatime,notail  1 1
```

 instead of including all the extra UUID voodoo. Once we get simple going, complex tends to work, too. 

My bad.

Blessed be!

Pappy

----------

## jaideep_jdof

i changed my fstab but still i am getting kernel panic, the strange part is the kernel panic error shows rootfs (2,0) shouldn't it be (0,1) as /dev/sda2 is my root partition and /dev/sda1 is /boot. 

This could be a clue but when i try to boot with new kernel I see 2 linux logos on the top part of the screen but the images are not clear they are broken and hazy, I guess this issue is caused by the intel framebuffer. I am using vga=773 in my grub.conf.

----------

## jaideep_jdof

could it be that some required controllers are not includes i the kernel.

----------

## Kruppe

Could you post your grub.conf and new fstab? I'll see if I can help any  :Smile: 

----------

## jaideep_jdof

thanks kruppe i managed to get a good working kernel. I used sabayon linux kernel config  file.

----------

## Kruppe

Pappy I would be delighted if you could assist me again. I have the opportunity to play around with a mac pro, and the first thing I did with it was install gentoo, here is the kernel config I came up with following your guide. I know you're out there showing some kernels who's boss but if you have time to double check my config that would be great  :Smile: .

Thanks again for your awesome guide!

http://pastebin.com/m13e19112

----------

