Detecting the CD drive (or other hardware) without udev?
I'm learning how to make an initrd for a liveCD, and I'm running into a bootstrapping problem. udev is darned hard to set up, with many dependancies, and I'd like to do that later in the boot process after I've mounted the liveCD. But in order to access the liveCD in the first place, I need to detect which hardware is the CD drive, and which device is associated with it. In addition I need to know what drivers the computer may need to access this CD drive (i.e. if it's a SCSI drive on a strange host bus).
My plan is (was) to collect all the possible drivers I might need, then insmod them one by one, then rmmod the ones that failed. Once I insmod the right module, the kernel will report it has detected new CD hardware, and I can break out of the CD detection loop, and continue to prepare my root file system. I looked at Morphix's initrd, and briefly at the debian-installer's "detect-cd" script, and though it seemed like they were doing something like that, one thing kept eluding me.
How does the kernel report when it has detected new hardware, and that the hardware is a CD drive?
I'm pretty sure it has something to do with creating a /sbin/hotplug program, and once I insmod the right driver, the kernel will ...exec /sbin/hotplug? With informative device info in... environment variables? I can't find any documentation about hotplug though, except that it's important for enabling udev. I don't want to do udev though because at this stage I'm only in a temporary root, and I'll have the real root setup later, which udev can populate. One concern I have though is the possible race condition: if I insmod a module, how long do I pause the script before checking if a /dev/cdrom symlink has appeared? There seem to be programs for that waiting period related to udev, such as udevsettle. Is there any way I could make a temporary stripped down udev setup perhaps, just for detecting the cd drive?
After I've got the CD device, I was going to mount it on /static, and make a tmpfs filesystem on /dynamic, then unionfs both of them together, and use the unionfs as my real root. Then I can pull out udev, and run init, and the whole shebang to get the computer up and running, but before I have the CD device mounted on /static, all I want to do is detect the CD hardware with a minimum of auxiliary kernel modules needed to communicate with it.
Well, here's what I've got so far. When I run
Seems like a simplified udev configuration is the best way to do it, even in an initrd. Correct me if I'm wrong of course.
|All times are GMT -5. The time now is 10:41 PM.|