[PATCH 6/7] Use the updated DriverDisc code in loader

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

 



- enable dlabel on RHEL by default
- use glib's linked lists to traverse through available DDs
- run depmod if the .rundepmod trigger file is present
---
 loader/loader.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 loader/loader.h |    2 ++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index 4ef03b5..637af6e 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -956,6 +956,10 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
         else if (!strcasecmp(argv[i], "dd") || 
                  !strcasecmp(argv[i], "driverdisk"))
             flags |= LOADER_FLAGS_MODDISK;
+        else if (!strcasecmp(argv[i], "dlabel=on"))
+            flags |= LOADER_FLAGS_AUTOMODDISK;
+        else if (!strcasecmp(argv[i], "dlabel=off"))
+            flags &= ~LOADER_FLAGS_AUTOMODDISK;
         else if (!strcasecmp(argv[i], "rescue"))
             flags |= LOADER_FLAGS_RESCUE;
         else if (!strcasecmp(argv[i], "nopass"))
@@ -1781,6 +1785,7 @@ int main(int argc, char ** argv) {
     struct loaderData_s loaderData;
 
     char *path, *fmt;
+    GSList *dd, *dditer;
 
     gchar *cmdLine = NULL, *ksFile = NULL, *virtpcon = NULL;
     gboolean mediacheck = FALSE;
@@ -1878,6 +1883,12 @@ int main(int argc, char ** argv) {
 
     openLog();
     openlog("loader", 0, LOG_LOCAL0);
+    
+    /* XXX if RHEL, enable the AUTODD feature by default,
+     * but we should come with more general way how to control this */
+    if (!strncmp(getProductName(), "Red Hat", 7)) {
+        flags |= LOADER_FLAGS_AUTOMODDISK;
+    }
 
     memset(&loaderData, 0, sizeof(loaderData));
     loaderData.method = -1;
@@ -1939,6 +1950,34 @@ int main(int argc, char ** argv) {
     /* FIXME: this is a bit of a hack */
     loaderData.modInfo = modInfo;
 
+    /* Setup depmod & modprobe so we can load multiple DDs */
+    modprobeDDmode();
+
+    /* If there is /.rundepmod file present, rerun depmod */
+    if (!access("/.rundepmod", R_OK)){
+        if (system("depmod -a")) {
+            /* this is not really fatal error, it might still work, log it */
+            logMessage(ERROR, "Error running depmod -a for initrd overlay");
+        }
+    }
+
+    if (FL_AUTOMODDISK(flags)) {
+        /* Load all autodetected DDs */
+        logMessage(INFO, "Trying to detect vendor driver discs");
+        dd = findDriverDiskByLabel();
+        dditer = dd;
+        while(dditer) {
+            if (loadDriverDiskFromPartition(&loaderData, (char*)(dditer->data))) {
+                logMessage(ERROR, "Automatic driver disk loader failed for %s.", (char*)(dditer->data));
+            }
+            else {
+                logMessage(INFO, "Automatic driver disk loader succeeded for %s.", (char*)(dditer->data));
+            }
+            dditer = g_slist_next(dditer);
+        }
+        g_slist_free(dd);
+    }
+
     if (FL_MODDISK(flags)) {
         startNewt();
         loadDriverDisks(DEVICE_ANY, &loaderData);
@@ -1948,6 +1987,9 @@ int main(int argc, char ** argv) {
         logMessage(INFO, "found /dd.img, loading drivers");
         getDDFromSource(&loaderData, "path:/dd.img");
     }
+    
+    /* Reset depmod & modprobe to normal mode and get the rest of drivers*/
+    modprobeNormalmode();
 
     /* this allows us to do an early load of modules specified on the
      * command line to allow automating the load order of modules so that
@@ -2128,6 +2170,9 @@ int main(int argc, char ** argv) {
         tmparg++;
     }
 
+    if (FL_AUTOMODDISK(flags))
+        *argptr++ = "--dlabel";
+
     if (FL_NOIPV4(flags))
         *argptr++ = "--noipv4";
 
diff --git a/loader/loader.h b/loader/loader.h
index a0d706c..1121b20 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -70,6 +70,7 @@
 #define LOADER_FLAGS_HAVE_CMSCONF       (((uint64_t) 1) << 37)
 #define LOADER_FLAGS_NOKILL		(((uint64_t) 1) << 38)
 #define LOADER_FLAGS_KICKSTART_SEND_SERIAL   (((uint64_t) 1) << 39)
+#define LOADER_FLAGS_AUTOMODDISK        (((uint64_t) 1) << 40)
 
 #define FL_TEXT(a)               ((a) & LOADER_FLAGS_TEXT)
 #define FL_RESCUE(a)             ((a) & LOADER_FLAGS_RESCUE)
@@ -106,6 +107,7 @@
 #define FL_HAVE_CMSCONF(a)       ((a) & LOADER_FLAGS_HAVE_CMSCONF)
 #define FL_NOKILL(a)		 ((a) & LOADER_FLAGS_NOKILL)
 #define FL_KICKSTART_SEND_SERIAL(a) ((a) & LOADER_FLAGS_KICKSTART_SEND_SERIAL)
+#define FL_AUTOMODDISK(a)        ((a) & LOADER_FLAGS_AUTOMODDISK)
 
 void startNewt(void);
 void stopNewt(void);
-- 
1.6.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux