LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Building custom kernel fails (http://www.linuxquestions.org/questions/slackware-14/building-custom-kernel-fails-894654/)

Bindestreck 07-30-2011 12:01 PM

Building custom kernel fails
 
Hello,

I try to build my own kernel from source by using the tutorial from http://alien.slackbook.org/dokuwiki/...kernelbuilding.

I have executed the following commands and steps:

Code:

echo $DISPLAY                 
sudo -i                     
xauth merge ~expander/.Xauthority
export DISPLAY=:0.0
wget http://www.us.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.6.tar.bz2
tar -C /usr/src -jxvf linux-2.6.37.6.tar.bz2
cd /usr/src
rm linux                   
ln -s linux-2.6.37.6 linux
wget http://slackware.mirrors.tds.net/pub/slackware/slackware-13.37/source/k/config-generic-smp-2.6.37.6-smp
cp config-generic-smp-2.6.37.6-smp /usr/src/linux/.config
cd /usr/src/linux
make oldconfig
make xconfig

Well, pretty straightforward from the tutorial. In the X-based configurator, I use and change the options described in the tutorial, enable "low-latency", enable ext3, ext4 filesystems, using P4 as CPU e.t.c. Then i build the kernel:

Code:

make bzImage modules           
make modules_install           
cp arch/x86/boot/bzImage /boot/vmlinuz-custom-2.6.37.6
cp System.map /boot/System.map-custom-2.6.37.6       
cp .config /boot/config-custom-2.6.37.6               
cd /boot
rm System.map                                       
ln -s System.map-custom-2.6.37.6 System.map

Then modifying /etc/lilo.conf:

Code:

image = /boot/vmlinuz-custom-2.6.37.6
    root = /dev/sda2
    label = expander_kernel
    read-only

then i execute "lilo".

I reboot, then choosing my new kernel as boot, but i get this error:

Code:

VFS: Cannot open root device "802" or unknown-block (8,2)
Please append a correct "root=" boot option
Kernel Panic-not syncing: VFS: unable to mount root fs on unknown block(8,2)

Ok, fine. I dont understand why i get that because I enabled ext4 filesystems in the kernel e.t.c. Well, to solve that I created initrd:

Code:

cd /boot
mkinitrd -c -k 2.6.37.6 -m ext4

then added initrd = /boot/initrd.gz in lilo.conf and then execute lilo:
Code:

image = /boot/vmlinuz-custom-2.6.37.6
  root = /dev/sda2
  initrd = /boot/initrd.gz
  label = expander_kernel
  read-only

Now, i reboot again, choosing my new kernel, but I get a new error which I dont clearly understand:

Code:

No kernel modules found for Linux 2.6.37.6-eXpander.
mount: mounting /dev/sda2 on /mnt failed: No such device
ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahed.
      You can try to fix it. Type 'exit' when things are done.

/bin/sh: can't acess tty; job control turned off
/ #
/ # _

Why cannot there be found any kernel modules, and why cannot sda2 be mounted? Im pretty lost here cause this is my first time I try to build my own kernel.

/eXpander

*Edit: sda2 is my root-partition, and sda2 can be mounted without any problem with the slackware prebuild kernel.

Bindestreck 07-30-2011 12:33 PM

Ok, i solved it by using those steps:

cp -a rc.modules-2.6.37.6-smp rc.modules-2.6.37.6-eXpander
mkinitrd -c -k 2.6.27.7-eXpander -m ext4 -r /dev/sda2

I dont know which one of them did the trick, but i think the last line with mkinitrd in fact solved the problem (or maybe both). Anyway, sorry for making this topic cause i found the answer from google... Gah, i should google more! :)

business_kid 07-30-2011 12:45 PM

Quote:

VFS: Cannot open root device "802" or unknown-block (8,2)
Please append a correct "root=" boot option
Kernel Panic-not syncing: VFS: unable to mount root fs on unknown block(8,2)
That seems very plain. It doesn't like your root drive setting. Change this line
Quote:

image = /boot/vmlinuz-custom-2.6.37.6
to Something like
Quote:

image = /boot/vmlinuz-custom-2.6.37.6 ro root=/dev/YourRootDrive
Quote:

No kernel modules found for Linux 2.6.37.6-eXpander.
mount: mounting /dev/sda2 on /mnt failed: No such device
That implies your kernel is not capable of reading your root drive without modules You need your root file system & motherboard chipset drivers either
1. Compiled in(preferably)
2. As a modules and in initrd.

try 'grep EXT /usr/src/linux/.config. =m is not good enopugh unless it's in initrd. You can add modules to initrd (man mkinitrd)

kevmccor 08-01-2011 11:28 AM

You are possibly not getting all the modules you need into the initrd. Also, give your new initrd a new name in /boot so your lilo.conf section will point to that instead of the standard initrd.gz

Have a look at /usr/share/mkinitrd/mkinitrd_command_generator.sh
Also /etc/mkinitrd.conf.sample

Create a mkinitrd.conf named /etc/eXpander_mkinitrd.conf and pass that to mkinitrd -F /etc/eXpander_mkinitrd.conf

Bindestreck 08-01-2011 12:16 PM

Quote:

Originally Posted by kevmccor (Post 4430758)
You are possibly not getting all the modules you need into the initrd. Also, give your new initrd a new name in /boot so your lilo.conf section will point to that instead of the standard initrd.gz

Have a look at /usr/share/mkinitrd/mkinitrd_command_generator.sh
Also /etc/mkinitrd.conf.sample

Create a mkinitrd.conf named /etc/eXpander_mkinitrd.conf and pass that to mkinitrd -F /etc/eXpander_mkinitrd.conf

Hello, thanks for all your answers,

I used "mkinitrd -c -k 2.6.27.7-eXpander -m ext4 -r /dev/sda2", and now it seems that modules are loaded, or do I need more options? And what would the advantage be of renaming initrd instead of using initrd.gz?

kevmccor 08-01-2011 12:49 PM

I have had problems with new kernels and initrd in the past. I use the mkinitrd_command_generator.sh script because I found it identifies some modules I would have missed otherwise and it generates a useful config file. Also, the config file lets you look at your options and think about them before running any commands. As far as the advantage of renaming the /boot/initrd.gz -- honestly I don't know. I think the initrd manages to keep track of which modules go with which kernel. I believe the initrd.gz is actually a directory tree of files to load at initial boot. I just give a new name to my initrd's out of paranoia. If your new kernel is booting, then I would think you did things correctly.

GazL 08-01-2011 01:33 PM

if you needed to add kernel modules to your initrd then it will be kernel specific. Renaming it to something sensible helps you not to get a kernel/modules mismatch. It also means you can keep more than one kernel installed at once.

Here's what mine looks like currently as an example...
Code:

gazl@slack:~$ ls -lt /boot/*custom*
-rw-r--r-- 1 root root 4259204 Jul 22 18:58 /boot/initrd-3.0.0-custom.gz
-rw-r--r-- 1 root root 3638944 Jul 22 18:35 /boot/vmlinuz-3.0.0-custom
-rw-r--r-- 1 root root 4259183 Jul  9 18:36 /boot/initrd-2.6.39.3-custom.gz
-rw-r--r-- 1 root root 3611136 Jul  9 18:35 /boot/vmlinuz-2.6.39.3-custom


Bindestreck 08-01-2011 02:04 PM

Aha! Ok, thank you all!

Bindestreck 08-02-2011 05:57 PM

I was stupid enough to not enable (I think) "Real Time Clock" when I compiled my kernel. Now I cant execute hwclock, it says:

Code:

bash-4.1# hwclock
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.

bash-4.1# hwclock --debug
hwclock from util-linux 2.19
hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
No usable clock interface found.
Cannot access the Hardware Clock via any known method.

Trying to modprobe rtc-cmos gives this:

Code:

bash-4.1# modprobe rtc-cmos
FATAL: Module rtc_cmos not found.

Now, is there any way to enable RTC without recompiling whole kernel again? Maybe edit the /usr/src/linux/.config and add something there?

dive 08-02-2011 06:29 PM

make menuconfig
add options
compile

There's no way out but it ought to faster depending on what you enable.


All times are GMT -5. The time now is 04:37 AM.