linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Hanson <cph@zurich.ai.mit.edu>
To: mdharm-kernel@one-eyed-alien.net
Cc: linux-kernel@vger.kernel.org
Subject: Booting from USB floppy?
Date: Thu, 16 Aug 2001 23:30:25 -0400	[thread overview]
Message-ID: <E15XaL3-00039X-00@trixia.ai.mit.edu> (raw)
In-Reply-To: <20010811222936.A13150@one-eyed-alien.net> (mdharm-kernel@one-eyed-alien.net)

   Date: Sat, 11 Aug 2001 22:29:36 -0700
   From: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>

   Some people have reported limited success by placing a multi-second delay
   just before the root fs is mounted, to give the USB system time to identify
   and properly attach the scsi devices.

Thanks for the information.

I've made some small changes that seem to work OK.  I've attached them
to this message, not to be submitted for inclusion in the kernel, but
just to have a public record of something that works, should someone
else be interested in this problem.

Chris

----------------------------------------------------------------------
diff -ruN linux-2.4.8-orig/drivers/block/rd.c linux-2.4.8/drivers/block/rd.c
--- linux-2.4.8-orig/drivers/block/rd.c	Sun Jul 15 19:15:44 2001
+++ linux-2.4.8/drivers/block/rd.c	Wed Aug 15 13:34:53 2001
@@ -704,11 +704,29 @@
 int swim3_fd_eject(int devnum);
 #endif
 
+#ifdef CONFIG_USB_STORAGE
+static void __init wait_for_usb_root_floppy(void)
+{
+	extern int blkdev_ops_exist(unsigned int);
+	long t;
+
+	while (!blkdev_ops_exist(MAJOR(ROOT_DEV)))
+		schedule_timeout(HZ);
+	/* Extra timeout for remaining messages.  */
+	t = 5*HZ;
+	while (t > 0)
+		t = schedule_timeout(t);
+}
+#endif
+
 static void __init rd_load_disk(int n)
 {
 #ifdef CONFIG_BLK_DEV_INITRD
 	extern kdev_t real_root_dev;
 #endif
+#ifdef CONFIG_USB_STORAGE
+	extern int usb_root_floppy_p;
+#endif
 
 	if (rd_doload == 0)
 		return;
@@ -717,6 +735,9 @@
 #ifdef CONFIG_BLK_DEV_INITRD
 		&& MAJOR(real_root_dev) != FLOPPY_MAJOR
 #endif
+#ifdef CONFIG_USB_STORAGE
+		&& !usb_root_floppy_p
+#endif
 	)
 		return;
 
@@ -729,6 +750,10 @@
 			swim3_fd_eject(MINOR(ROOT_DEV));
 		else if(MAJOR(real_root_dev) == FLOPPY_MAJOR)
 			swim3_fd_eject(MINOR(real_root_dev));
+#endif
+#ifdef CONFIG_USB_STORAGE
+		if (usb_root_floppy_p)
+			wait_for_usb_root_floppy();
 #endif
 		printk(KERN_NOTICE
 		       "VFS: Insert root floppy disk to be loaded into RAM disk and press ENTER\n");
diff -ruN linux-2.4.8-orig/fs/block_dev.c linux-2.4.8/fs/block_dev.c
--- linux-2.4.8-orig/fs/block_dev.c	Thu Aug  9 19:41:36 2001
+++ linux-2.4.8/fs/block_dev.c	Sun Aug 12 23:05:13 2001
@@ -517,6 +517,14 @@
 	return ret;
 }
 
+int blkdev_ops_exist(unsigned int major)
+{
+	/* major 0 is used for non-device mounts */
+	if (major && major < MAX_BLKDEV)
+		return (blkdevs[major].bdops != 0);
+	return 0;
+}
+
 int register_blkdev(unsigned int major, const char * name, struct block_device_operations *bdops)
 {
 	if (major == 0) {
diff -ruN linux-2.4.8-orig/init/main.c linux-2.4.8/init/main.c
--- linux-2.4.8-orig/init/main.c	Thu Jul  5 14:31:58 2001
+++ linux-2.4.8/init/main.c	Sun Aug 12 23:05:13 2001
@@ -124,6 +124,10 @@
 kdev_t real_root_dev;
 #endif
 
+#ifdef CONFIG_USB_STORAGE
+int usb_root_floppy_p = 0;
+#endif
+
 int root_mountflags = MS_RDONLY;
 char *execute_command;
 char root_device_name[64];
@@ -303,6 +307,20 @@
 }
 
 __setup("root=", root_dev_setup);
+
+#ifdef CONFIG_USB_STORAGE
+
+static int __init usb_root_floppy_setup(char *line)
+{
+	extern int usb_root_floppy_p;
+	root_dev_setup (line);
+	usb_root_floppy_p = 1;
+	return 1;
+}
+
+__setup("usb_root_floppy=", usb_root_floppy_setup);
+
+#endif
 
 static int __init checksetup(char *line)
 {

  reply	other threads:[~2001-08-17  3:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-12  3:12 Booting from USB floppy? Chris Hanson
2001-08-12  5:19 ` H. Peter Anvin
2001-08-12  5:29 ` Matthew Dharm
2001-08-17  3:30   ` Chris Hanson [this message]
2001-08-15  2:50 John Sheahan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E15XaL3-00039X-00@trixia.ai.mit.edu \
    --to=cph@zurich.ai.mit.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdharm-kernel@one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).