LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-15-2011, 07:35 PM   #16
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15

Quote:
Originally Posted by theNbomr View Post
Your bootloader is the thing that needs to know about the initrd. I use pxelinux, and on the 'append=' line, I have the clause 'initrd=my/initrd/myInitrd-stable.gz'. The bootloader will then load the initrd, and using some system involving 'atags', tell the kernel where to find the initrd. The exact reference to the initrd is with respect to the filesystem on the boot host, relative to the tftp server root.

--- rod.
That's exactly what I did in PXEboot. My bootloader (pxelinux.0) was able to find the kernel and initrd and downloaded them. The crash happened when the kernel started and was looking for root filesystem to mount.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-15-2011, 10:34 PM   #17
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by wdli View Post
That's exactly what I did in PXEboot. My bootloader (pxelinux.0) was able to find the kernel and initrd and downloaded them. The crash happened when the kernel started and was looking for root filesystem to mount.
Then you have something wrong in your initrd (it is at this stage not the kernel that is searching for the /-partition), a system that runs from RAM shouldn't actually search for it. Try it with an unmodified kernel and initrd to see if that works.
 
Old 12-16-2011, 12:58 AM   #18
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
What messages did you get as the boot progressed? do you see the kernel starting and initializing drivers? The kernel shouldn't have to 'find' the root filesystem, per se.

--- rod.
 
Old 12-16-2011, 01:19 PM   #19
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by theNbomr View Post
What messages did you get as the boot progressed? do you see the kernel starting and initializing drivers? The kernel shouldn't have to 'find' the root filesystem, per se.

--- rod.


I dug into the init code and lookslike this is what happened:

During the uncompression of my ramdisk (gzip format), there was an error. The total uncompressed length was 32768. But sys_write could only write 21079 to the file descriptor pointing to /dev/ram. So the error was "write error".

However I haven't found out why this could happen. Is there a hard limit somewhere? My ramdisk.img.gz file is about 395MB. Is it too big?

David
 
Old 12-17-2011, 11:52 AM   #20
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I don't know if there is a 'too big' size. I am curious how you will get that 395MB file on your boot host that has only 250MB of storage. Doesn't that make it a moot point? Can you try to remove a lot of stuff, until you get the initrd size down to something more manageable? How much memory does your target host have? Don't forget that the initrd is compressed, and it will be larger, maybe a lot larger, when uncompressed. It also takes some memory for the bootloader to actually perform the de-compression. I forget what type of compression is implied by '.gz', but some types of compression can require up to 2 times the size of the final uncompressed image to actually perform the de-compression. Some other methods are more thrifty.

--- rod.
 
Old 12-17-2011, 12:08 PM   #21
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by theNbomr View Post
I don't know if there is a 'too big' size. I am curious how you will get that 395MB file on your boot host that has only 250MB of storage. Doesn't that make it a moot point? Can you try to remove a lot of stuff, until you get the initrd size down to something more manageable? How much memory does your target host have? Don't forget that the initrd is compressed, and it will be larger, maybe a lot larger, when uncompressed. It also takes some memory for the bootloader to actually perform the de-compression. I forget what type of compression is implied by '.gz', but some types of compression can require up to 2 times the size of the final uncompressed image to actually perform the de-compression. Some other methods are more thrifty.

--- rod.
Rod,

Good question! I do need to cut it down significantly. But as a starter, I just use whatever RHEL6 gives me to make the initrd. Obviously I can't use it on the real boot host. But I can test it using a regular server host which has a big HD. If this works, then I will think about removing stuff. So far I don't even know how this big initrd would work. I am digging into my kernel's init code to understand more about this beast.
 
Old 12-17-2011, 12:58 PM   #22
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
IMHO, you are going about the process backward (been there, done that). Start with a minimal system, and build up by adding what you know you need. Much less reverse-engineering required, and the end result will be closer to optimal.

--- rod.
 
Old 12-17-2011, 05:25 PM   #23
wdli
Member
 
Registered: Sep 2008
Location: California
Posts: 105

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by theNbomr View Post
IMHO, you are going about the process backward (been there, done that). Start with a minimal system, and build up by adding what you know you need. Much less reverse-engineering required, and the end result will be closer to optimal.

--- rod.
That sounds reasonable. So if the end goal is a RHEL6-based initrd, where should I start? Any suggestions?
 
Old 12-17-2011, 09:37 PM   #24
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
What does RHEL have that you can't get from other sources? Start with a micro distribution, then replace those components that don't meet your spec, and add the components that are required. If you need the whole kit and kaboodle, then perhaps a fully initrd-based system is unrealistic.
Another approach might be to use one RAM disk to boot the system, and then another that can be populated post-boot from your TFTP server. I've never instantiated a RAM disk filesystem after boot time, but I imagine it can't be that much different from a conventional spinning-media filesystem.
If I recall correctly, Redhat systems use an initrd to boot, by default. Have you unrolled one of those to see how you could build up from that?

--- rod.
 
  


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
RAMDISK: couldn't find valid ramdisk image starting at 0. iotc247 Slackware 10 12-10-2010 03:08 PM
diskless environment vishnuvijayan Linux - Newbie 3 06-19-2009 07:09 AM
Diskless Environment bharatlalgupta Linux - Software 0 02-09-2009 06:22 AM
diskless router, using ramdisk? acpi Linux - General 2 08-17-2006 02:04 PM
About Diskless boot fongkakit Linux - Networking 1 07-19-2004 06:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:53 PM.

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