Using udev to boot off a USB device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I was hoping to get some design feedback on my use of udev. Please feel free to point me to other forums. I couldn't think of a better place for "booting off a USB device using a custom bootloader".

I have an embedded system with a bootloader that I'm writing. The bootloader will look for and boot a Linux system stored on a USB device. There will be multiple USB storage devices connected, but only one of them will the primary boot device.

I managed to find the primary boot device by labelling it with a ext2 filesystem label and using udev to match against the correct device. Okay, that seems to work.

Now, the question is, when I boot the Linux kernel on the primary boot device, how does it find its root partition?

Normally, when I boot Linux, I'd pass in say "root=/dev/sda1". But with USB devices, /dev/sda1 could mean any of the various devices, depending on how they enumerate. Is that correct?

My solution was launch the Linux kernel with a ramdisk. Instead of passing in root=/dev/sda1, I pass in the UUID of the primary boot device. In my ramdisk, I run udev. I find the usb device that corresponds to the given UUID and then switch_root to it.

How does this approach sound? Are there any obvious alternative approaches that I missed?

Thanks,
-James

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux