Install via USB
> I tried to install Debian with an USB-Floppy a few days ago. The rescue
> disk booted but the installer couldn't find the root-disk after changing.
> Are there special boot-disks? Or is it possible to make an install on
> reiserfs or xfs partitions with the usual set of CDs?
The standard kernel can't do this. I've attached a patch you can
apply to a recent 2.4 kernel that implements a method to read from USB
floppy at boot time.
In order to use this, you need to apply the patch and make sure that
CONFIG_USB_STORAGE is enabled. Additionally, when you boot the
kernel, you need to specify "root=/dev/sda" on the boot line, as in
"linux root=/dev/sda". If you have SCSI disks on your machine, you
will need to use a different path, e.g. "/dev/sdb" rather than
"/dev/sda".
Chris
diff -ruN linux-2.4.15-orig/drivers/block/rd.c linux-2.4.15/drivers/block/rd.c
--- linux-2.4.15-orig/drivers/block/rd.c Fri Nov 9 17:15:00 2001
+++ linux-2.4.15/drivers/block/rd.c Sat Nov 24 20:49:27 2001
@@ -807,6 +807,23 @@
int swim3_fd_eject(int devnum);
#endif
+#ifdef CONFIG_USB_STORAGE
+extern int usb_root_floppy_p;
+
+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)
{
@@ -817,6 +834,9 @@
#ifdef CONFIG_BLK_DEV_INITRD
&& MAJOR(real_root_dev) != FLOPPY_MAJOR
#endif
+#ifdef CONFIG_USB_STORAGE
+ && !usb_root_floppy_p
+#endif
)
return;
@@ -829,6 +849,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.15-orig/fs/block_dev.c linux-2.4.15/fs/block_dev.c
--- linux-2.4.15-orig/fs/block_dev.c Wed Nov 21 17:07:25 2001
+++ linux-2.4.15/fs/block_dev.c Sat Nov 24 20:47:12 2001
@@ -442,6 +442,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.15-orig/init/main.c linux-2.4.15/init/main.c
--- linux-2.4.15-orig/init/main.c Fri Nov 9 17:15:00 2001
+++ linux-2.4.15/init/main.c Sat Nov 24 20:47:12 2001
@@ -122,6 +122,10 @@
unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
#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];
@@ -307,6 +311,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 to: