summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--loader/devices.c29
-rw-r--r--loader/devices.h2
-rw-r--r--loader/kickstart.c1
-rw-r--r--loader/kickstart.h19
-rw-r--r--loader/loader.c49
5 files changed, 71 insertions, 29 deletions
diff --git a/loader/devices.c b/loader/devices.c
index 2e660c3b0..157068828 100644
--- a/loader/devices.c
+++ b/loader/devices.c
@@ -117,10 +117,8 @@ static int getModuleArgs(struct moduleInfo * mod, char *** argPtr) {
return 0;
}
-#define CDD_MOUNT_FAILED 1
-#define CDD_BAD_DISK 2
-static int copyDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
- moduleDeps modDeps, int flags) {
+int devCopyDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
+ moduleDeps modDeps, int flags, char * mntPoint) {
char * files[] = { "modules.cgz", "modinfo", "modules.dep", NULL };
char * dirName;
char ** file;
@@ -128,21 +126,15 @@ static int copyDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
static int diskNum = 0;
char from[200], to[200];
- mlLoadModule("vfat", NULL, modLoaded, modDeps, NULL, flags);
-
- devMakeInode("fd0", "/tmp/fd0");
-
- if (doPwMount("/tmp/fd0", "/tmp/drivers", "vfat", 1, 0, NULL, NULL))
- return CDD_BAD_DISK;
-
- if (access("/tmp/drivers/rhdd-6.1", R_OK))
+ sprintf(from, "%s/rhdd-6.1", mntPoint);
+ if (access(from, R_OK))
badDisk = 1;
dirName = malloc(80);
sprintf(dirName, "/tmp/DD-%d", diskNum);
mkdir(dirName, 0755);
for (file = files; *file; file++) {
- sprintf(from, "/tmp/drivers/%s", *file);
+ sprintf(from, "%s/%s", mntPoint, *file);
sprintf(to, "%s/%s", dirName, *file);
if (copyFile(from, to))
@@ -152,7 +144,7 @@ static int copyDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
umount("/tmp/drivers");
if (badDisk) {
- return CDD_BAD_DISK;
+ return 1;
}
sprintf(from, "%s/modinfo", dirName);
@@ -175,11 +167,14 @@ int devLoadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
if (rc == 2) return LOADER_BACK;
- rc = copyDriverDisk(modInfo, modLoaded, modDeps, flags);
+ mlLoadModule("vfat", NULL, modLoaded, modDeps, NULL, flags);
+
+ devMakeInode("fd0", "/tmp/fd0");
- if (rc == CDD_MOUNT_FAILED)
+ if (doPwMount("/tmp/fd0", "/tmp/drivers", "vfat", 1, 0, NULL, NULL))
newtWinMessage(_("Error"), _("OK"), _("Failed to mount floppy disk."));
- else if (rc)
+
+ if (devCopyDriverDisk(modInfo, modLoaded, modDeps, flags, "/tmp/drivers"))
newtWinMessage(_("Error"), _("OK"),
_("The floppy disk you inserted is not a valid driver disk "
"for this release of Red Hat Linux."));
diff --git a/loader/devices.h b/loader/devices.h
index bb426be25..b70ca9873 100644
--- a/loader/devices.h
+++ b/loader/devices.h
@@ -9,5 +9,7 @@ int devDeviceMenu(enum driverMajor type, moduleInfoSet modInfo,
char ** moduleName);
int devLoadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
moduleDeps modDeps, int flags, int cancelNotBack);
+int devCopyDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
+ moduleDeps modDeps, int flags, char * mntPoint);
#endif
diff --git a/loader/kickstart.c b/loader/kickstart.c
index 741e96a95..7daa0d445 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -34,6 +34,7 @@ struct ksCommandNames ksTable[] = {
{ KS_CMD_NETWORK, "network" },
{ KS_CMD_DEVICE, "device" },
{ KS_CMD_XDISPLAY, "xdisplay" },
+ { KS_CMD_DRIVERDISK, "driverdisk" },
{ KS_CMD_NONE, NULL }
};
diff --git a/loader/kickstart.h b/loader/kickstart.h
index 88f6c044e..a3e724338 100644
--- a/loader/kickstart.h
+++ b/loader/kickstart.h
@@ -1,14 +1,15 @@
#ifndef H_KICKSTART
-#define KS_CMD_NONE 0
-#define KS_CMD_NFS 1
-#define KS_CMD_CDROM 2
-#define KS_CMD_HD 3
-#define KS_CMD_URL 4
-#define KS_CMD_NETWORK 5
-#define KS_CMD_DEVICE 6
-#define KS_CMD_XDISPLAY 7
-#define KS_CMD_TEXT 8
+#define KS_CMD_NONE 0
+#define KS_CMD_NFS 1
+#define KS_CMD_CDROM 2
+#define KS_CMD_HD 3
+#define KS_CMD_URL 4
+#define KS_CMD_NETWORK 5
+#define KS_CMD_DEVICE 6
+#define KS_CMD_XDISPLAY 7
+#define KS_CMD_TEXT 8
+#define KS_CMD_DRIVERDISK 9
int ksReadCommands(char * cmdFile);
int ksGetCommand(int cmd, char ** last, int * argc, char *** argv);
diff --git a/loader/loader.c b/loader/loader.c
index ff6422f8a..06c496737 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1102,6 +1102,12 @@ static int kickstartDevices(struct knownDevices * kd, moduleInfoSet modInfo,
char ** optv;
poptContext optCon;
int doContinue, missingOkay; /* obsolete */
+ char * fsType = "ext2";
+ char * fs;
+ struct poptOption diskTable[] = {
+ { "type", 't', POPT_ARG_STRING, &fsType, 0 },
+ { 0, 0, 0, 0, 0 }
+ };
struct poptOption table[] = {
{ "continue", '\0', POPT_ARG_STRING, &doContinue, 0 },
{ "missingok", '\0', POPT_ARG_STRING, &missingOkay, 0 },
@@ -1109,13 +1115,50 @@ static int kickstartDevices(struct knownDevices * kd, moduleInfoSet modInfo,
{ 0, 0, 0, 0, 0 }
};
-logMessage("looking for device commands");
+ if (!ksGetCommand(KS_CMD_DRIVERDISK, NULL, &ksArgc, &ksArgv)) {
+ optCon = poptGetContext(NULL, ksArgc, ksArgv, diskTable, 0);
+
+ do {
+ if ((rc = poptGetNextOpt(optCon)) < -1) {
+ logMessage("bad argument to kickstart driverdisk command "
+ "%s: %s",
+ poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
+ poptStrerror(rc));
+ break;
+ }
+
+ fs = poptGetArg(optCon);
+
+ if (!fs || poptGetArg(optCon)) {
+ logMessage("bad arguments to kickstart driverdisk command");
+ break;
+ }
+
+ if (strcmp(fsType, "nfs")) {
+ devMakeInode(fs, "/tmp/disk");
+ fs = "/tmp/disk";
+ }
+
+ if (!strcmp(fsType, "vfat"))
+ mlLoadModule("vfat", NULL, modLoaded, modDeps, NULL, flags);
+
+ if (doPwMount(fs, "/tmp/drivers", fsType, 1, 0, NULL, NULL)) {
+ logMessage("failed to mount %s", fs);
+ break;
+ }
+
+ if (devCopyDriverDisk(modInfo, modLoaded, modDeps, flags,
+ "/tmp/drivers")) {
+ logMessage("driver information missing!");
+ }
+
+ umount("/tmp/drivers");
+ } while (0);
+ }
while (!ksGetCommand(KS_CMD_DEVICE, ksArgv, &ksArgc, &ksArgv)) {
opts = NULL;
-logMessage("got device command");
-
optCon = poptGetContext(NULL, ksArgc, ksArgv, table, 0);
if ((rc = poptGetNextOpt(optCon)) < -1) {