Initrd or Cdrom as root
Is there any way to dynamically load initrd or cdrom permanently as the root fs when booting from cdrom?
My problem is that I need a reliable way to ALWAYS find the correct device to mount. Is there any way to make the kernel automagically mount the cdrom it booted from?
I believe that for example SuSE installer cd does this, but I cannot figure out how they do it.
If on initrd, I need about 300MB space on the root fs.
If this is not possible, what do I need to modify in the kernel?
-HKR
Quoted 6 lines · Hans K. Rosbach
Is there any way to dynamically load initrd or cdrom permanently as the root fs when booting from cdrom?
My problem is that I need a reliable way to ALWAYS find the correct device to mount. Is there any way to make the kernel automagically mount the cdrom it booted from?
yes, just pass rootcd=1 as a boot command line option with the hack below applied. Make sure that cdrom support is always compiled statically, otherwise it will break.
drivers/cdrom/cdrom.c +5 -0
@@ -2480,6 +2480,11 @@return proc_dostring (ctl, write, filp, buffer, lenp); } +kdev_t get_cdrom_dev (void ) +{ +return topCdromPtr ? topCdromPtr->dev :0 ; +} +/* Unfortunately, per device settings are not implemented through procfs/sysctl yet. When they are, this will naturally disappear. For now just update all drives. Later this will become the template on which
init/main.c +14 -0
@@ -311,6 +311,16 @@__setup ("root=" , root_dev_setup); +static int rootcd_enable__initdata =0 ; + +static int __init rootcd_setup (char *str) +{ +get_option (&str, &rootcd_enable); +return 1 ; +} + +__setup ("rootcd=" , rootcd_setup); +static int __init checksetup (char *line) {struct kernel_param *p;
@@ -772,6 +782,10 @@rd_load ();#endif +if (rootcd_enable) { +extern kdev_t get_cdrom_dev (void ); +ROOT_DEV =get_cdrom_dev (); + }/* Mount the root filesystem.. */ mount_root ();