public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* boot from usb flash - wake boot process when disk is ready?
@ 2004-05-28  9:05 David N. Welton
  2004-05-28  9:28 ` Kalin KOZHUHAROV
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David N. Welton @ 2004-05-28  9:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: davidwnwelton

[ Please CC replies to me - thanks! ]

Hi,

We're toying around with the idea of booting an embedded system off of 
USB flash (pros, cons, and advice about this would be appreciated, by 
the way), and I had a look at several of the existing patches to do this 
without going through the process of creating an initrd image.  That 
adds complexity and time to the boot process that we would prefer to 
avoid, although it appears that the kernel folks in the first thread 
cited are in favor of initrd....

http://www.uwsg.iu.edu/hypermail/linux/kernel/0301.3/1182.html

This mentions a couple of patches, both the "keep looping until it 
works" one, which I couldn't get working with 2.6.6, and Willy Tarreu's 
"wait a given period of time before continuing" patch:

http://www.uwsg.iu.edu/hypermail/linux/kernel/0405.0/0224.html

I don't think either of those approaches are particularly elegant... 
although I'm sure my own efforts are good for a snort as well.

In genhd.c I wake up a waitqueue when the disk comes on line.    The 
init process waits on this before going on with prepare_namespace(). 
Ideally, this would look and make sure it's the right disk, that 
selected for the root fs:-)  Not being very familiar with the 'lay of 
the land' in the kernel, I declared the wait queue as a global in 
genhd.c.  The thing I don't like about this approach is that it builds a 
connection between two bits of the kernel that seem separate... maybe 
(ok, quite probably) there is a better/cleaner way of doing this?

Patch is at: http://dedasys.com/freesoftware/files/usb-wakeup.patch

Thanks for comments/constructive criticism, and thanks for reading,
-- 
David N. Welton
davidw@eidetix.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: boot from usb flash - wake boot process when disk is ready?
  2004-05-28  9:05 boot from usb flash - wake boot process when disk is ready? David N. Welton
@ 2004-05-28  9:28 ` Kalin KOZHUHAROV
  2004-05-28  9:33 ` Kalin KOZHUHAROV
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kalin KOZHUHAROV @ 2004-05-28  9:28 UTC (permalink / raw)
  To: David N. Welton; +Cc: linux-kernel

David N. Welton wrote:
> [ Please CC replies to me - thanks! ]
> 
> Hi,
> 
> We're toying around with the idea of booting an embedded system off of 
> USB flash (pros, cons, and advice about this would be appreciated, by 
> the way), and I had a look at several of the existing patches to do this 
> without going through the process of creating an initrd image.  That 
> adds complexity and time to the boot process that we would prefer to 
> avoid, although it appears that the kernel folks in the first thread 
> cited are in favor of initrd....
> 
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0301.3/1182.html
> 
> This mentions a couple of patches, both the "keep looping until it 
> works" one, which I couldn't get working with 2.6.6, and Willy Tarreu's 
> "wait a given period of time before continuing" patch:
> 
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0405.0/0224.html
> 
> I don't think either of those approaches are particularly elegant... 
> although I'm sure my own efforts are good for a snort as well.
I tried this with 2.6.6 and modified it a bit, but to no avail.
It seems that the sd driver initializes the disk long before the wait
and does not bother anymore.

> In genhd.c I wake up a waitqueue when the disk comes on line.    The 
> init process waits on this before going on with prepare_namespace(). 
> Ideally, this would look and make sure it's the right disk, that 
> selected for the root fs:-)  Not being very familiar with the 'lay of 
> the land' in the kernel, I declared the wait queue as a global in 
> genhd.c.  The thing I don't like about this approach is that it builds a 
> connection between two bits of the kernel that seem separate... maybe 
> (ok, quite probably) there is a better/cleaner way of doing this?
> 
> Patch is at: http://dedasys.com/freesoftware/files/usb-wakeup.patch

Looks OK to me to try, but I am far from expert here.
Unfortunately I cannot test it in the next few days :-(
May be later.

I am in a search for non-initrd USB-booting as well...

Keep the discussion on LKML as well.

Kalin.

-- 
||///_ o  *****************************
||//'_/>     WWW: http://ThinRope.net/
|||\/<" 
|||\\ ' 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: boot from usb flash - wake boot process when disk is ready?
  2004-05-28  9:05 boot from usb flash - wake boot process when disk is ready? David N. Welton
  2004-05-28  9:28 ` Kalin KOZHUHAROV
@ 2004-05-28  9:33 ` Kalin KOZHUHAROV
  2004-05-28  9:37 ` Kalin KOZHUHAROV
  2004-05-28 12:12 ` Ben Collins
  3 siblings, 0 replies; 5+ messages in thread
From: Kalin KOZHUHAROV @ 2004-05-28  9:33 UTC (permalink / raw)
  To: David N. Welton; +Cc: linux-kernel

David N. Welton wrote:
> [ Please CC replies to me - thanks! ]
> 
> Hi,
> 
> We're toying around with the idea of booting an embedded system off of 
> USB flash (pros, cons, and advice about this would be appreciated, by 
> the way), and I had a look at several of the existing patches to do this 
> without going through the process of creating an initrd image.  That 
> adds complexity and time to the boot process that we would prefer to 
> avoid, although it appears that the kernel folks in the first thread 
> cited are in favor of initrd....
> 
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0301.3/1182.html
> 
> This mentions a couple of patches, both the "keep looping until it 
> works" one, which I couldn't get working with 2.6.6, and Willy Tarreu's 
> "wait a given period of time before continuing" patch:
> 
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0405.0/0224.html
> 
> I don't think either of those approaches are particularly elegant... 
> although I'm sure my own efforts are good for a snort as well.
I tried this with 2.6.6 and modified it a bit, but to no avail.
It seems that the sd driver initializes the disk long before the wait
and does not bother anymore.

> In genhd.c I wake up a waitqueue when the disk comes on line.    The 
> init process waits on this before going on with prepare_namespace(). 
> Ideally, this would look and make sure it's the right disk, that 
> selected for the root fs:-)  Not being very familiar with the 'lay of 
> the land' in the kernel, I declared the wait queue as a global in 
> genhd.c.  The thing I don't like about this approach is that it builds a 
> connection between two bits of the kernel that seem separate... maybe 
> (ok, quite probably) there is a better/cleaner way of doing this?
> 
> Patch is at: http://dedasys.com/freesoftware/files/usb-wakeup.patch

Looks OK to me to try, but I am far from expert here.
Unfortunately I cannot test it in the next few days :-(
May be later.

I am in a search for non-initrd USB-booting as well...

Keep the discussion on LKML as well.

Kalin.

-- 
||///_ o  *****************************
||//'_/>     WWW: http://ThinRope.net/
|||\/<" 
|||\\ ' 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: boot from usb flash - wake boot process when disk is ready?
  2004-05-28  9:05 boot from usb flash - wake boot process when disk is ready? David N. Welton
  2004-05-28  9:28 ` Kalin KOZHUHAROV
  2004-05-28  9:33 ` Kalin KOZHUHAROV
@ 2004-05-28  9:37 ` Kalin KOZHUHAROV
  2004-05-28 12:12 ` Ben Collins
  3 siblings, 0 replies; 5+ messages in thread
From: Kalin KOZHUHAROV @ 2004-05-28  9:37 UTC (permalink / raw)
  To: David N. Welton; +Cc: linux-kernel

David N. Welton wrote:
> [ Please CC replies to me - thanks! ]
> 
> Hi,
> 
> We're toying around with the idea of booting an embedded system off of 
> USB flash (pros, cons, and advice about this would be appreciated, by 
> the way), and I had a look at several of the existing patches to do this 
> without going through the process of creating an initrd image.  That 
> adds complexity and time to the boot process that we would prefer to 
> avoid, although it appears that the kernel folks in the first thread 
> cited are in favor of initrd....
> 
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0301.3/1182.html
> 
> This mentions a couple of patches, both the "keep looping until it 
> works" one, which I couldn't get working with 2.6.6, and Willy Tarreu's 
> "wait a given period of time before continuing" patch:
> 
> http://www.uwsg.iu.edu/hypermail/linux/kernel/0405.0/0224.html
> 
> I don't think either of those approaches are particularly elegant... 
> although I'm sure my own efforts are good for a snort as well.
I tried this with 2.6.6 and modified it a bit, but to no avail.
It seems that the sd driver initializes the disk long before the wait
and does not bother anymore.

> In genhd.c I wake up a waitqueue when the disk comes on line.    The 
> init process waits on this before going on with prepare_namespace(). 
> Ideally, this would look and make sure it's the right disk, that 
> selected for the root fs:-)  Not being very familiar with the 'lay of 
> the land' in the kernel, I declared the wait queue as a global in 
> genhd.c.  The thing I don't like about this approach is that it builds a 
> connection between two bits of the kernel that seem separate... maybe 
> (ok, quite probably) there is a better/cleaner way of doing this?
> 
> Patch is at: http://dedasys.com/freesoftware/files/usb-wakeup.patch

Looks OK to me to try, but I am far from expert here.
Unfortunately I cannot test it in the next few days :-(
May be later.

I am in a search for non-initrd USB-booting as well...

Keep the discussion on LKML as well.

Kalin.

-- 
||///_ o  *****************************
||//'_/>     WWW: http://ThinRope.net/
|||\/<" 
|||\\ ' 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: boot from usb flash - wake boot process when disk is ready?
  2004-05-28  9:05 boot from usb flash - wake boot process when disk is ready? David N. Welton
                   ` (2 preceding siblings ...)
  2004-05-28  9:37 ` Kalin KOZHUHAROV
@ 2004-05-28 12:12 ` Ben Collins
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Collins @ 2004-05-28 12:12 UTC (permalink / raw)
  To: David N. Welton; +Cc: linux-kernel, davidwnwelton

On Fri, May 28, 2004 at 11:05:54AM +0200, David N. Welton wrote:
> [ Please CC replies to me - thanks! ]
> 
> Hi,
> 
> We're toying around with the idea of booting an embedded system off of 
> USB flash (pros, cons, and advice about this would be appreciated, by 
> the way), and I had a look at several of the existing patches to do this 
> without going through the process of creating an initrd image.  That 
> adds complexity and time to the boot process that we would prefer to 
> avoid, although it appears that the kernel folks in the first thread 
> cited are in favor of initrd....

We have the same problem for firewire and sbp2 disks. I've often thought
of adding a CONFIG_IEEE1394_BOOT_SUPPORT config option where the
ieee1394 subsystem, if compiled with this option and built into the
kernel, would block it's init until the bus scan and device probes were
complete.

It gets kind of complicated, mainly because this should only be done
when a new host is added, and not for normal bus resets, and ideally
only at boot (e.g. not when a PCMCIA card is inserted sometime after
boot).

The complicated part is that the host controllers are seperate drivers
from the core. So the core can't block in it's init, since there are no
controllers at that point. The logic needs to be in the host-add
callbacks (same for USB and firewire). Since there's the possibility
(especially with USB) that there is more than one host controller, you
would have to do this for all of them, since the disk device may be on a
later controller in the PCI detection process.

Question is, is there a variable that can be looked at to see if init
has been started yet? If there is, then the logic could be invoked in
host-add whenever we are in pre-init state (IOW, no userspace is running
yet).

That would make it work more like standard SCSI hosts. USB could do the
same.

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
WatchGuard - http://www.watchguard.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-05-28 12:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-28  9:05 boot from usb flash - wake boot process when disk is ready? David N. Welton
2004-05-28  9:28 ` Kalin KOZHUHAROV
2004-05-28  9:33 ` Kalin KOZHUHAROV
2004-05-28  9:37 ` Kalin KOZHUHAROV
2004-05-28 12:12 ` Ben Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox