speedy boot from usb devices
PATCH 1/1 speedy boot from usb devices
[ Please CC replies to me - thanks! ]
Hi,
I gather that there isn't much interest in this idea on behalf of the 'mainstream', because initrd is a far more flexible solution, but I happen to like the idea of booting quickly from a USB device, without wasting a bunch of time and space for an initrd, and we're using this in a product as well, so without further ado, I'll point you at
http://dedasys.com/freesoftware/patches/
where you can get blkdev_wakeup.patch
Works like so: whenever a block device comes on line, it signals this fact to a wait queue, so that the init process can stop and wait for slow devices, in particular things such as USB storage devices, which are much slower than IDE devices. The init process checks the list of available devices and compares it with the desired root device, and if there is a match, proceeds with the initialization process, secure in the knowledge that the device in question has been brought up. This is useful if one wants to boot quickly from a USB storage device without a trimmed-down kernel, and without going through the whole initrd slog.
Comments, critiques, suggestions and ideas are all welcome.
Thankyou for your time,
Signature · 5 lines
David N. Welton
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/
Photos: http://www.dedasys.com/photos/Quoted 26 lines · David N. Welton
[ Please CC replies to me - thanks! ]
Hi,
I gather that there isn't much interest in this idea on behalf of the 'mainstream', because initrd is a far more flexible solution, but I happen to like the idea of booting quickly from a USB device, without wasting a bunch of time and space for an initrd, and we're using this in a product as well, so without further ado, I'll point you at
http://dedasys.com/freesoftware/patches/
where you can get blkdev_wakeup.patch
Works like so: whenever a block device comes on line, it signals this fact to a wait queue, so that the init process can stop and wait for slow devices, in particular things such as USB storage devices, which are much slower than IDE devices. The init process checks the list of available devices and compares it with the desired root device, and if there is a match, proceeds with the initialization process, secure in the knowledge that the device in question has been brought up. This is useful if one wants to boot quickly from a USB storage device without a trimmed-down kernel, and without going through the whole initrd slog.
Quoted 1 line
Comments, critiques, suggestions and ideas are all welcome.
I find this to be very useful. I always found the "sleep for a while until the device we want appears" approach very cumbersome.
However, after looking at your patch, it seems that having a get_blkdevs() function that alloc's an array of strings, and return it to a function that only compares the strings against the name it is looking for and drops the array altogether, is a little overkill.
Why not have a simple blkdev_exists(char *name) function in genhd.c, call it directly, and drop the match_root_name() function completely?
Maybe I'm missing something, but it seems much simpler...
Signature · 2 lines
Paulo Marques - www.grupopie.com "In a world without walls and fences who needs windows and gates?"
Quoted 15 lines · Paulo Marques
Quoted 4 lines · David N. Welton
Works like so: whenever a block device comes on line, it signals this fact to a wait queue, so that the init process can stop and wait for slow devices, in particular things such as USB storage devices, which are much slower
Quoted 8 lines
than IDE devices. The init process checks the list of available devices and compares it with the desired root device, and if there is a match, proceeds with the initialization process, secure in the knowledge that the device in question has been brought up. This is useful if one wants to boot quickly from a USB storage device without a trimmed-down kernel, and without going through the whole initrd slog.
Quoted 2 lines
I find this to be very useful. I always found the "sleep for a while until the device we want appears" approach very cumbersome.
Glad to hear someone likes it.
Quoted 8 lines
However, after looking at your patch, it seems that having a
get_blkdevs()function that alloc's an array of strings, and return it to a function that only compares the strings against the name it is looking for and drops the array altogether, is a little overkill.Why not have a simple
blkdev_exists(char *name)function ingenhd.c, call it directly, and drop thematch_root_name()function completely?
Sure, that's probably better. Maybe "blkdev_is_online"? I'll see if I can do it tommorow.
I'm also a bit dubious of having the wait queue floating around as a global, but don't know the kernel well enough to find it a better home.
Thanks!
Signature · 5 lines
David N. Welton
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/
Photos: http://www.dedasys.com/photos/Quoted 18 lines · David N. Welton
Quoted 15 lines · Paulo Marques
Quoted 12 lines · David N. Welton
Works like so: whenever a block device comes on line, it signals this fact to a wait queue, so that the init process can stop and wait for slow devices, in particular things such as USB storage devices, which are much slower than IDE devices. The init process checks the list of available devices and compares it with the desired root device, and if there is a match, proceeds with the initialization process, secure in the knowledge that the device in question has been brought up. This is useful if one wants to boot quickly from a USB storage device without a trimmed-down kernel, and without going through the whole initrd slog.
Quoted 2 lines
Quoted 2 lines
I find this to be very useful. I always found the "sleep for a while until the device we want appears" approach very cumbersome.
I hope it works. I tried to hack some delay on my own, but without success :-( Will try this patch.
Quoted 12 lines
Glad to hear someone likes it.
Quoted 7 lines
However, after looking at your patch, it seems that having a
get_blkdevs()function that alloc's an array of strings, and return it to a function that only compares the strings against the name it is looking for and drops the array altogether, is a little overkill. Why not have a simpleblkdev_exists(char *name)function ingenhd.c, call it directly, and drop thematch_root_name()function completely?
Quoted 2 lines
Sure, that's probably better. Maybe "
blkdev_is_online"? I'll see if I can do it tommorow.
Waiting :-)
I am planing to run a Gentoo-based small dist off a 128MB USB flash.
Quoted 3 lines
I'm also a bit dubious of having the wait queue floating around as a global, but don't know the kernel well enough to find it a better home.
Thumbs up!
Kalin.
Signature · 3 lines
|| ~~~~~~~~~~~~~~~~~~~~~~ || ( ) http://ThinRope.net/ ( ) || ______________________ ||