Hi guys:

For linux-2.4.31,How /dev/initrd is associated with the initrd image?
I have read some codes but some questions:

Kernel command line: root=/dev/ram0 initrd=0x01400000,1600k keepinitrd

Initrd Image is at 0x01400000,

And in the init/do_mounts.c

static int __init initrd_load(void)
{
#ifdef CONFIG_BLK_DEV_INITRD
        create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, 0), NULL);
        create_dev("/dev/initrd", MKDEV(RAMDISK_MAJOR, INITRD_MINOR),
NULL);
#endif
        return rd_load_image("/dev/initrd");
}

It create a device "/dev/initrd"...

In the following function:static int __init rd_load_image(char *from)
...
in_fd = open(from, O_RDONLY, 0);  (it open the dev/initrd)
...
nblocks = identify_ramdisk_image(in_fd, rd_image_start);   

In the identify_ramdisk_image
{
lseek(fd, start_block * BLOCK_SIZE, 0);   (it read the buf from the
/dev/initrd,actuall it is the image located at 0x01400000,right?)
        read(fd, buf, size);
}

So,how does it know /dev/initrd is related to the initrd image?


Thanks!
rui
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to