usb root filesystem and devfs
ok. here's a problem Iím having and Iím hoping someone can help?
I'm building a little ucLibc/busybox system that boots off a usb flash drive (flash and a floppy at the moí).
/ is mounted read-only off a cramfs partition on the flash (why bother with a ramdisk - seems inelegant). the intention is to build a ramdisk for /tmp and /var.
In order to avoid having to faff about populating a /dev dir on a ramdisk (again, inelegant) I thought Iíd use devfs.
I have an initrd that loads the necessary modules (cramfs, usb-storage etc).
When i boot the kernel I pass root=/dev/scsi/host0/bus0/target0/lun0/part1 from grub (the cramfs partition on the usb device). However, the node/devfs entry is not made by devfs until after the kernel has started booting, apparently when the usb-storage module loads. This appears to confuse the kernel when it tries to mount root=/dev/scsi/host0/bus0/target0/lun0/part1. It can't find /dev/scsi0/bus0/target0/lun0/part1 and even refers to it as 00:00 (as in the device node major and minor), just before it panics.
It seems to be a devfs thing as Iíve produced the system with an near identical kernel, just without devfs (this time passing root=/dev/sda1 from grub) and it works fine.
Here are a few things Iíve tried:
no devfs kernel, root=/dev/sda1 (works)
devfs kernel but passing root=/dev/sda1 from grub. I believe this should work, but it doesn't...
devfs kernel, monolithic (ie, no modules, no initrd), pass root=/dev/scsi/host0/bus0/target0/lun0/part1. doesn't work ("unable to mount root on 00:00 as before")
no devfs, monolithic (as above), root=/dev/sda1. works fine
As far as i can work out the problem stems form the kernel needing to decipher the location of the rootfs passed from the bootloader at some point before the information is made available to it by the usb-storage code initialising and devfs creating the device node (am i right?). Can anyone think of a way round this? Does anyone have any more info on the process the kernel goes though when passed a root= parameter by a bootloader? Obviously it canít examine a /dev/node as the root is not mounted so how does it work out the root device from the parameter?
Incidentally I have inserted code into domounts.c in the kernel sources to delay the mounting of root to allow for USB device initialisation, which works without devfs but makes no difference with it. usb-storage has plenty of time to initialise as the non devfs kernel mounts root but the devfs one still falls down.
I forgot to mention, 2.4.22 kernel
Last edited by sam cadby; 09-02-2003 at 06:45 PM.