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

Re: Patch:method=bd:<biospart>:/path/to/install/tree



After looking through the Anaconda code some more, the source of the
problem appears to be the following:

1. The usb-storage module is loaded.

2. The loader sleeps for some amount of time because the usbWasLoaded
variable's value is 0 and the scsiDiskCount() > deviceCount.

3. The usbWasLoaded (which is a static variable in the loadModule()
function) is set to 1.

4. The usb-storage module is rmmod'ed because a SCSI driver is to be loaded.

5. The SCSI driver is loaded.

6. The usb-storage module is insmod'ed. This time around, however, there
is no sleeping because the value usbWasLoaded is 1.

7. Since there is no sleeping the second time around, the loader runs
along and tries to do other tasks that look for data on the USB device
(e.g. look for a kickstart file, an iso, or in our case, the device
corresponding to the BIOS disk 80) but these tasks fail because the
device node for the USB device has not been created yet.

This issue is addressed in the attached usbwasloaded.patch. The patch
makes usbWasLoaded a "global" static variable, so that it can be changed
to 0 when the usb-storage module is rmmod'ed. This ensures that the
loader sleeps until the scsiDiskCount() returns a value greater than the
deviceCount (look at the loadModule() function in modules.c for more
details).

In addition, I have attached a separate methodbd.patch which adds the
"method=bd" option to the command line as before.

The next issues to address are that anaconda 1) adds the USB boot
device's partitions to the list of partitions to use while building the
logical volume and 2) writes the MBR to the USB device.  These weren't
issues before Anaconda version #11.1.0.48-1 because before then all
removable devices were filtered out.  Currently only devices without
media are filtered out. Perhaps, the answer is to re-insert the
removable devices filter?

Let me know what you think.

Thanks much,
Uday.


diff -Naur --exclude=CVS anaconda.orig/loader2/modules.c anaconda/loader2/modules.c
--- anaconda-11.2.0.26.orig/loader2/modules.c	2007-02-28 16:08:50.000000000 -0800
+++ anaconda-11.2.0.26/loader2/modules.c	2007-02-28 16:51:13.000000000 -0800
@@ -48,6 +48,8 @@
                                                 struct extractedModule * oldPaths,
                                                 struct moduleBallLocation * location);
 
+static int usbWasLoaded = 0;
+
 /* pass in the type of device (eth or tr) that you're looking for */
 static int ethCount(const char * type) {
     int fd;
@@ -267,7 +269,6 @@
     int deviceCount = -1;
     int popWindow = 0;
     int rc, child, i, status;
-    static int usbWasLoaded = 0;
  
     /* don't need to load a module that's already loaded */
     if (mlModuleInList(modName, modLoaded))
@@ -560,7 +561,7 @@
 
         /* here we need to save the state of stage2 */
         removeLoadedModule("usb-storage", modLoaded);
-
+        usbWasLoaded = 0;
         
         /* JKFIXME: here are the big hacks... for now, just described.
          * 1) figure out which scsi devs are claimed by usb-storage.

diff -Naur --exclude=CVS anaconda.orig/loader2/loader.c anaconda/loader2/loader.c
--- anaconda-11.2.0.26.orig/loader2/loader.c	2007-03-01 10:37:38.000000000 -0800
+++ anaconda-11.2.0.26/loader2/loader.c	2007-03-01 10:37:46.000000000 -0800
@@ -713,7 +713,7 @@
             loaderData->kbd_set = 1;
         }
         else if (!strncasecmp(argv[i], "method=", 7))
-            setMethodFromCmdline(argv[i] + 7, loaderData);
+            loaderData->cmdLineMethod = strdup(argv[i] + 7);
         else if (!strncasecmp(argv[i], "ip=", 3))
             parseCmdLineIp(loaderData, argv[i]);
         else if (!strncasecmp(argv[i], "ipv6=", 5))
@@ -1529,6 +1529,10 @@
         getDDFromSource(&loaderData, loaderData.ddsrc);
     }
 
+    if (loaderData.cmdLineMethod) {
+        setMethodFromCmdline(loaderData.cmdLineMethod, &loaderData);
+    }
+
     /* JKFIXME: loaderData->ksFile is set to the arg from the command line,
      * and then getKickstartFile() changes it and sets FL_KICKSTART.  
      * kind of weird. */
diff -Naur --exclude=CVS anaconda.orig/loader2/loader.h anaconda/loader2/loader.h
--- anaconda-11.2.0.26.orig/loader2/loader.h	2007-03-01 10:37:38.000000000 -0800
+++ anaconda-11.2.0.26/loader2/loader.h	2007-03-01 10:37:46.000000000 -0800
@@ -106,6 +106,7 @@
     int ipv6info_set;
     int noipv4, noipv6;
     char * ksFile;
+    char * cmdLineMethod;
     int method;
     char * ddsrc;
     void * methodData;
diff -Naur --exclude=CVS anaconda.orig/loader2/method.c anaconda/loader2/method.c
--- anaconda-11.2.0.26.orig/loader2/method.c	2007-03-01 10:37:38.000000000 -0800
+++ anaconda-11.2.0.26/loader2/method.c	2007-03-01 10:37:46.000000000 -0800
@@ -38,6 +38,7 @@
 #include "mediacheck.h"
 #include "method.h"
 
+#include "../isys/eddsupport.c"
 #include "../isys/imount.h"
 #include "../isys/isys.h"
 #include "../isys/cpio.h"
@@ -741,10 +742,40 @@
             ld->method = METHOD_CDROM;
 #endif
         } else if (!strncmp(arg, "harddrive:", 10) ||
-                   !strncmp(arg, "hd:", 3)) {
+                   !strncmp(arg, "hd:", 3) ||
+                   !strncmp(arg, "bd:", 3)) {
             ld->method = METHOD_HD;
             ld->methodData = calloc(sizeof(struct hdInstallData *), 1);
-            ((struct hdInstallData *)ld->methodData)->partition = strdup(c);
+            if (!strncmp(arg, "bd:", 3)) {
+                char * dev;
+                char * tmp = strdup(c);
+                char * partition;
+                char * p = strchr(tmp, 'p');
+                if (!p) {
+                    startNewt();
+                    newtWinMessage(_("Error"), _("OK"),
+                                   _("Format of biosdisk is 80p1"));
+                    return;
+                } else {
+                    *p = '\0';
+                    dev = getBiosDisk(tmp);
+                    if (dev == NULL) {
+                        startNewt();
+                        newtWinMessage(_("Error"), _("OK"),
+                                       _("Cannot find hard drive for BIOS disk %s"),
+                                       tmp);
+                        return;
+                    }
+                    logMessage(INFO, "The device for biospart %s is %s", tmp, dev);
+                    partition = malloc(strlen(dev) + strlen(p+1) + 2);
+                    sprintf(partition, "%s%s", dev, p+1);
+                    ((struct hdInstallData *)ld->methodData)->partition = partition;
+                }
+                free(dev);
+                free(tmp);                
+            } else {
+                ((struct hdInstallData *)ld->methodData)->partition = strdup(c);
+            }
             if ((c = strtok(NULL, ":"))) {
                 ((struct hdInstallData *)ld->methodData)->directory = strdup(c);
             }


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