LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-30-2011, 11:01 AM   #1
Bindestreck
Member
 
Registered: Jul 2011
Location: Sweden
Distribution: Slackware
Posts: 312

Rep: Reputation: 59
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.

Last edited by Bindestreck; 07-30-2011 at 11:06 AM.
 
Old 07-30-2011, 11:33 AM   #2
Bindestreck
Member
 
Registered: Jul 2011
Location: Sweden
Distribution: Slackware
Posts: 312

Original Poster
Rep: Reputation: 59
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!
 
Old 07-30-2011, 11:45 AM   #3
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,380

Rep: Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557Reputation: 557
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)
 
Old 08-01-2011, 10:28 AM   #4
kevmccor
Member
 
Registered: Aug 2004
Location: Tyler TX
Distribution: slackware, mandrake
Posts: 58

Rep: Reputation: 17
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
 
Old 08-01-2011, 11:16 AM   #5
Bindestreck
Member
 
Registered: Jul 2011
Location: Sweden
Distribution: Slackware
Posts: 312

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by kevmccor View Post
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?

Last edited by Bindestreck; 08-01-2011 at 11:18 AM.
 
Old 08-01-2011, 11:49 AM   #6
kevmccor
Member
 
Registered: Aug 2004
Location: Tyler TX
Distribution: slackware, mandrake
Posts: 58

Rep: Reputation: 17
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.
 
Old 08-01-2011, 12:33 PM   #7
GazL
Senior Member
 
Registered: May 2008
Posts: 3,392

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
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
 
Old 08-01-2011, 01:04 PM   #8
Bindestreck
Member
 
Registered: Jul 2011
Location: Sweden
Distribution: Slackware
Posts: 312

Original Poster
Rep: Reputation: 59
Aha! Ok, thank you all!
 
Old 08-02-2011, 04:57 PM   #9
Bindestreck
Member
 
Registered: Jul 2011
Location: Sweden
Distribution: Slackware
Posts: 312

Original Poster
Rep: Reputation: 59
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?
 
Old 08-02-2011, 05:29 PM   #10
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
make menuconfig
add options
compile

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Building a Custom repo... pacman -S fails to sync Alexvader Arch 2 05-24-2010 09:21 AM
kernel panic after building custom kernel for macbook sparrott Linux - Laptop and Netbook 1 06-29-2007 05:06 PM
after building a custom kernel h/w Debian 5 08-21-2003 10:13 PM
Building a custom kernel eastj1974 Linux - Newbie 7 07-01-2003 12:59 AM
building a custom kernel...aic7xxx problem landonmkelsey Linux - Newbie 5 07-24-2001 12:43 AM


All times are GMT -5. The time now is 09:25 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration