On Fri, 30 Nov 2007, Mikkel L. Ellertson wrote:
I don't believe the kernel is ever told the location of the file
on
the disk. The initrd option tells grub the file to load. Grub then
loads the file into system memory. I am not sure, but I believe the
address that Grub loaded it to in memory is passed in a register.
But it may be in a fixed place in the block of data passed to the
kernel, along with the options in the kernel line. I suspect that
this is covered in the Grub info page if you want to know exactly
how it is managed. I have never cared enough about the exact method
to dig into it. It is also possible to boot a kernel without using
an initrd file if you build all the drivers needed to access the
root file system into the kernel.
You may also want to take a look at the initrd.txt file in the
kernel documentation tree.
i've learned the hard way not to trust the in-kernel documentation,
but i did eventually track down what i was after.
for interested parties, in the kernel source tree,
include/asm-x86/bootparam.h:
/* The so-called "zeropage" */
struct boot_params {
...
struct setup_header hdr; /* setup header */
...
}
and at the top of that very same file, we have:
struct setup_header {
...
__u32 ramdisk_image;
__u32 ramdisk_size;
...
}
in the 32-bit case, that info is extracted during system boot in
arch/x86/kernel/setup_32.c thusly:
#ifdef CONFIG_BLK_DEV_INITRD
if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
...
etc, etc.
so i'm good.
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://crashcourse.ca
========================================================================