LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-09-2008, 05:25 PM   #1
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Rep: Reputation: 15
Kernel build, install and boot question on ram disk image


Hi,

I am using Ubuntu 8.04 on Dell D630 laptop and trying to build a barebone kernel using the tar ball from kernel.org. It's 2.6.25.9.

I did the usual things "make config, make, make modules, make module_install, make install".

Now I have read that I need to make an intermediate ram disk image. I finally got a chance to download the mkinitramfs package. It asked me to run "update-initramfs" on the local box. So when I did this I got an error about missing "/etc/modprob.conf" file. My googling didn't produce a lot of clues how I can solve this problem:

Code:
/boot$ sudo update-initramfs -c -k 2.6.25.9
update-initramfs: Generating /boot/initrd.img-2.6.25.9
cp: cannot stat `/etc/modprobe.conf': No such file or directory
------------------
Error has occured!
update-initramfs: failed for /boot/initrd.img-2.6.25.9
Any ideas or suggestions?

Thanks.

David
 
Old 10-09-2008, 06:44 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by wdli View Post
Hi,

I am using Ubuntu 8.04 on Dell D630 laptop and trying to build a barebone kernel using the tar ball from kernel.org. It's 2.6.25.9.

I did the usual things "make config, make, make modules, make module_install, make install".

Now I have read that I need to make an intermediate ram disk image. I finally got a chance to download the mkinitramfs package. It asked me to run "update-initramfs" on the local box. So when I did this I got an error about missing "/etc/modprob.conf" file. My googling didn't produce a lot of clues how I can solve this problem:

Code:
/boot$ sudo update-initramfs -c -k 2.6.25.9
update-initramfs: Generating /boot/initrd.img-2.6.25.9
cp: cannot stat `/etc/modprobe.conf': No such file or directory
------------------
Error has occured!
update-initramfs: failed for /boot/initrd.img-2.6.25.9
Any ideas or suggestions?
Code:
touch /etc/modprobe.conf
Since this is Ubuntu (a Debian derivative), you might find it easier to make and install kernels if you tried this: http://www.howtoforge.com/kernel_com...on_debian_etch

You don't have to have your kernels in /usr/src, of course.
 
Old 10-09-2008, 06:45 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
I see that they have a "ubuntu way", as well. Didn't look different:

http://www.howtoforge.com/kernel_compilation_ubuntu
 
Old 10-09-2008, 07:21 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
And I'll offer my usual observation. If you want to play with a "barebone" kernel, Ubuntu ain't the distro to use.
There is (usually) no intrinsic requirement for in initrd for a home-brewed kernel - when you build the kernel, build it for your system.

There are better environments for learning kernel hacking than Ubuntu - but if you just want to build a new Ubuntu kernel, see the link(s) referenced above.
 
Old 10-09-2008, 07:43 PM   #5
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Now new problem with ram fs

Hi,

First off thanks for the suggestion. I have a spare machine that is running Ubuntu and so I 'd like to see if I can build a barebone kernel and boot it up. You are right I am learning the kernel using this. If ubuntu is not the best what else? where do I start?

Second, followed the suggestion to touch /etc/modprob.conf and I did build a init.img-2.6.25.9 But when I tried to boot to my newly built 2.6.25.9 barebone kernel, it failed. Here are some of the last messages I can remember:

Code:
Searching for root device:************************** Failed! Halting system.
Press Enter to halt or Ctrl-Alt-Del to reboot. 
/etc/init/.functions: line21: chvt:command not found.
Any ideas?





Quote:
Originally Posted by syg00 View Post
And I'll offer my usual observation. If you want to play with a "barebone" kernel, Ubuntu ain't the distro to use.
There is (usually) no intrinsic requirement for in initrd for a home-brewed kernel - when you build the kernel, build it for your system.

There are better environments for learning kernel hacking than Ubuntu - but if you just want to build a new Ubuntu kernel, see the link(s) referenced above.
 
Old 10-09-2008, 08:05 PM   #6
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
If there's no root device, then chances are you didn't enable the module for your disk controller. Where did you get your .config file from? Normally you should copy that from /boot/config-`uname -r` (note the backquotes) and then run "make oldconfig" before you make the kernel. This ensures you have at least the modules compiled in that the kernel you're booting from does.
Code:
cp /boot/config-`uname-r` .config
 
Old 10-09-2008, 09:12 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by wdli View Post
I am learning the kernel using this. If ubuntu is not the best what else? where do I start?
Personally I don't like any of the "mega" distros for playing with the kernel - still leaves lots of choice. I started with Gentoo, but the usual suspects would include Debian and Slackware.
I find myself predominantly using Arch these days. The whole environment is built for i686 (not just the kernel) - it's small, fast and has a good package management system.

If you are just starting out, a visit to kernelnewbies would be worthwhile, as would getting a copy of something like "Linux Kernel in a Nutshell". It's available online - search LQ for other recommendations.
 
Old 10-09-2008, 09:20 PM   #8
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
What the hell difference does it make? The man has ubuntu. He has an interest in ubuntu. It would be a good project and learning experience. Why all the negativism? It doesn't make that much difference.
 
Old 10-09-2008, 09:48 PM   #9
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Before I try the new command here is my answer to your question:

I think the .config was generated from make or make modules. After "make install" I can see the file in my boot dir. Here is a snapshot of my current /boot:

Code:
drwxr-xr-x 2 root root    4096 2008-10-09 17:26 grub
-rw-r--r-- 1 root root 9400845 2008-10-09 17:24 initrd.img-2.6.25.9
lrwxrwxrwx 1 root root      15 2008-10-06 17:22 config -> config-2.6.25.9
-rw-r--r-- 1 root root   86851 2008-10-06 17:22 config-2.6.25.9
lrwxrwxrwx 1 root root      19 2008-10-06 17:22 System.map -> System.map-2.6.25.9
-rw-r--r-- 1 root root  910916 2008-10-06 17:22 System.map-2.6.25.9
lrwxrwxrwx 1 root root      16 2008-10-06 17:22 vmlinuz -> vmlinuz-2.6.25.9
-rw-r--r-- 1 root root 1945344 2008-10-06 17:22 vmlinuz-2.6.25.9
Also here is a snapshot of my menu.lst for the GRUB loader:


Code:
title           Bare kernel 2.6.25.9
root            (hd0,4)
kernel          /boot/vmlinuz root=UUID=fe10c020-b90c-48d5-9ed3-c4dce4b78a34 ro quite splash
initrd          /boot/initrd.img-2.6.25.9
quite
The only difference between the above and my regular Ubuntu boot are the vmlinuz and initrd.img versions. Everything else was copied over.


Quote:
Originally Posted by Quakeboy02 View Post
If there's no root device, then chances are you didn't enable the module for your disk controller. Where did you get your .config file from? Normally you should copy that from /boot/config-`uname -r` (note the backquotes) and then run "make oldconfig" before you make the kernel. This ensures you have at least the modules compiled in that the kernel you're booting from does.
Code:
cp /boot/config-`uname-r` .config
 
Old 10-09-2008, 09:54 PM   #10
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
I guess I didn't address the ".config" question directly in my last reply. I don't see a ".config" in my /boot dir. This is weird. How can my Ubuntu bootup without this if it's necessary? Here is the entire snapshot of my /boot:

Code:
total 47428
drwxr-xr-x 2 root root    4096 2008-10-09 17:26 grub
-rw-r--r-- 1 root root 9400845 2008-10-09 17:24 initrd.img-2.6.25.9
lrwxrwxrwx 1 root root      15 2008-10-06 17:22 config -> config-2.6.25.9
-rw-r--r-- 1 root root   86851 2008-10-06 17:22 config-2.6.25.9
lrwxrwxrwx 1 root root      19 2008-10-06 17:22 System.map -> System.map-2.6.25.9
-rw-r--r-- 1 root root  910916 2008-10-06 17:22 System.map-2.6.25.9
lrwxrwxrwx 1 root root      16 2008-10-06 17:22 vmlinuz -> vmlinuz-2.6.25.9
-rw-r--r-- 1 root root 1945344 2008-10-06 17:22 vmlinuz-2.6.25.9
-rw-r--r-- 1 root root 7460974 2008-06-24 21:03 initrd.img-2.6.24-16-generic
-rw-r--r-- 1 root root 7460852 2008-06-24 21:00 initrd.img-2.6.24-16-generic.bak
-rw-r--r-- 1 root root  422607 2008-04-10 09:51 abi-2.6.24-16-generic
-rw-r--r-- 1 root root   79964 2008-04-10 09:51 config-2.6.24-16-generic
-rw-r--r-- 1 root root  899892 2008-04-10 09:51 System.map-2.6.24-16-generic
-rw-r--r-- 1 root root 1904248 2008-04-10 09:51 vmlinuz-2.6.24-16-generic
-rw-r--r-- 1 root root 7521796 2008-02-04 00:39 initrd.img-2.6.22-14-generic
-rw-r--r-- 1 root root 7124250 2007-10-15 16:26 initrd.img-2.6.22-14-generic.bak
-rw-r--r-- 1 root root  424317 2007-10-14 18:39 abi-2.6.22-14-generic
-rw-r--r-- 1 root root   75311 2007-10-14 18:39 config-2.6.22-14-generic
-rw-r--r-- 1 root root  823535 2007-10-14 18:39 System.map-2.6.22-14-generic
-rw-r--r-- 1 root root 1764280 2007-10-14 18:39 vmlinuz-2.6.22-14-generic
-rw-r--r-- 1 root root  103204 2007-09-28 03:06 memtest86+.bin
Quote:
Originally Posted by wdli View Post
Before I try the new command here is my answer to your question:

I think the .config was generated from make or make modules. After "make install" I can see the file in my boot dir. Here is a snapshot of my current /boot:

Code:
drwxr-xr-x 2 root root    4096 2008-10-09 17:26 grub
-rw-r--r-- 1 root root 9400845 2008-10-09 17:24 initrd.img-2.6.25.9
lrwxrwxrwx 1 root root      15 2008-10-06 17:22 config -> config-2.6.25.9
-rw-r--r-- 1 root root   86851 2008-10-06 17:22 config-2.6.25.9
lrwxrwxrwx 1 root root      19 2008-10-06 17:22 System.map -> System.map-2.6.25.9
-rw-r--r-- 1 root root  910916 2008-10-06 17:22 System.map-2.6.25.9
lrwxrwxrwx 1 root root      16 2008-10-06 17:22 vmlinuz -> vmlinuz-2.6.25.9
-rw-r--r-- 1 root root 1945344 2008-10-06 17:22 vmlinuz-2.6.25.9
Also here is a snapshot of my menu.lst for the GRUB loader:


Code:
title           Bare kernel 2.6.25.9
root            (hd0,4)
kernel          /boot/vmlinuz root=UUID=fe10c020-b90c-48d5-9ed3-c4dce4b78a34 ro quite splash
initrd          /boot/initrd.img-2.6.25.9
quite
The only difference between the above and my regular Ubuntu boot are the vmlinuz and initrd.img versions. Everything else was copied over.
 
Old 10-09-2008, 10:05 PM   #11
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
There are three configs there.

config-2.6.25.9
config-2.6.24-16-generic
config-2.6.22-14-generic

Oh, I see what's confusing you. The compiler uses a ".config" file, but it exports it as "config-kernelversion" for booting. Each kernel needs its own config file, and it's named accordingly. When I told you to run "cp /boot/config-`uname -r` .config", that copies the config for the running kernel to the .config to use to compile the next one.
 
Old 10-09-2008, 10:08 PM   #12
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
BTW, when you install a kernel with "dpkg -i" it updates grub and runs update-initramfs for you. When you remove one with "dpkg -r" it removes them for you. Much tidier than having to do it all yourself, but I suppose that you might be at a loss if you went to a different distro and tried it. Still, that's what google is for.
 
Old 10-09-2008, 10:57 PM   #13
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Ok, let me try to understand this:

you are asking me to copy the current Ubuntu config file from /boot to my new linux source code dir as .config and recompile the source using "make oldconfig"?

So the config-2.6.25.9 from my previous compile is wrong?


Quote:
Originally Posted by Quakeboy02 View Post
There are three configs there.

config-2.6.25.9
config-2.6.24-16-generic
config-2.6.22-14-generic

Oh, I see what's confusing you. The compiler uses a ".config" file, but it exports it as "config-kernelversion" for booting. Each kernel needs its own config file, and it's named accordingly. When I told you to run "cp /boot/config-`uname -r` .config", that copies the config for the running kernel to the .config to use to compile the next one.
 
Old 10-09-2008, 11:21 PM   #14
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by wdli View Post
Ok, let me try to understand this:

you are asking me to copy the current Ubuntu config file from /boot to my new linux source code dir as .config and recompile the source using "make oldconfig"?

So the config-2.6.25.9 from my previous compile is wrong?
I guess that was confusing. Let's start from the beginning. You download your kernel. THEN you copy the .config for the currently running kernel; not the one you are trying to make but the one that is running before you do the download. Then you do the "make oldconfig". This step checks to see if there are any new kernel options that have been added since the one you are currently running. If there are, it asks you whether you want to add them or not, and gives you a default: usually N. After that, you run the make-kpkg or whatever command set you choose to use to make your kernel.

The reason you do them in this order is so that you don't start with some random kernel config that doesn't have your device driver enabled. Having said that, it's true that make oldconfig is automatically run if there isn't a .config file found using the ubuntu way. I can't say what happens when you go through all the makes etc using the manual way, as I've never bothered even learning how. If it pestered you with a bunch of questions when you compiled it, then yes, it did run make oldconfig.

OTOH, if you are actually running from 2.6.25.9, remind me what the problem is.

What you may not understand is that those back-quotes in `uname -r` actually run the command "uname -r" and append the version of the running kernel to /boot/config in the copy command I gave you. The back-quote is not a single quote. It is the key to the left of the "1" key which is above and to the left of the "q" key.
 
Old 10-10-2008, 04:12 PM   #15
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Ok, I copied the existing config files, did make oldconfig, did make and make modules. At the end of make modules, there is a warning:

Code:
Building modules, stage 2.
  MODPOST 1910 modules
WARNING: modpost: Found 15 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
What does this mean? Something wrong?

Quote:
Originally Posted by Quakeboy02 View Post
I guess that was confusing. Let's start from the beginning. You download your kernel. THEN you copy the .config for the currently running kernel; not the one you are trying to make but the one that is running before you do the download. Then you do the "make oldconfig". This step checks to see if there are any new kernel options that have been added since the one you are currently running. If there are, it asks you whether you want to add them or not, and gives you a default: usually N. After that, you run the make-kpkg or whatever command set you choose to use to make your kernel.

The reason you do them in this order is so that you don't start with some random kernel config that doesn't have your device driver enabled. Having said that, it's true that make oldconfig is automatically run if there isn't a .config file found using the ubuntu way. I can't say what happens when you go through all the makes etc using the manual way, as I've never bothered even learning how. If it pestered you with a bunch of questions when you compiled it, then yes, it did run make oldconfig.

OTOH, if you are actually running from 2.6.25.9, remind me what the problem is.

What you may not understand is that those back-quotes in `uname -r` actually run the command "uname -r" and append the version of the running kernel to /boot/config in the copy command I gave you. The back-quote is not a single quote. It is the key to the left of the "1" key which is above and to the left of the "q" key.
 
  


Reply



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
initial ram disk image support for UUID query aus9 Linux - Kernel 9 02-03-2008 10:31 PM
how do i Install test26.s kernel image in /boot Dachy Slackware 14 02-16-2006 03:47 AM
Help Building a Ram disk image travisk Fedora 4 07-19-2005 09:44 PM
bootsplash ram disk image error huntermix Slackware 2 07-27-2004 11:53 AM
mkinitrd ram disk image reed Linux - General 4 09-26-2002 03:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration