summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-07-08 03:00:53 +0000
committerJeremy Katz <katzj@redhat.com>2003-07-08 03:00:53 +0000
commit459119c94529602d08de465b7ebfa4871d328081 (patch)
tree369a7eb643938d6d51ef6f2d0c46561e61dcc0ae /loader2
parent390977d3ee0ebc010168ce04573f63ae15458718 (diff)
downloadanaconda-459119c94529602d08de465b7ebfa4871d328081.tar.gz
anaconda-459119c94529602d08de465b7ebfa4871d328081.tar.xz
anaconda-459119c94529602d08de465b7ebfa4871d328081.zip
massive merge from taroon branch. changes are all over the place, but a
summary of looking through the diff is * clean up warnings, we build with -Wall -Werror here too * product.img stuff * max logical partitions enforcement * 1 TB max fs size * ethtool stuff * autopart in kickstart * driver disk fixes * RHEL upgrade stuff * network driver disks * variant pkgorder/tree splitting
Diffstat (limited to 'loader2')
-rw-r--r--loader2/Makefile2
-rw-r--r--loader2/cdinstall.c3
-rw-r--r--loader2/cdinstall.h3
-rw-r--r--loader2/dietstubs.c7
-rw-r--r--loader2/driverdisk.c87
-rw-r--r--loader2/driverdisk.h7
-rw-r--r--loader2/driverselect.c6
-rw-r--r--loader2/hardware.c23
-rw-r--r--loader2/hdinstall.c10
-rw-r--r--loader2/hdinstall.h3
-rw-r--r--loader2/init.c1
-rw-r--r--loader2/kbd.c3
-rw-r--r--loader2/kbd.h3
-rw-r--r--loader2/kickstart.c61
-rw-r--r--loader2/kickstart.h3
-rw-r--r--loader2/lang.c3
-rw-r--r--loader2/lang.h4
-rw-r--r--loader2/linuxrc.s39028
-rw-r--r--loader2/loader.c46
-rw-r--r--loader2/loader.h12
-rw-r--r--loader2/loadermisc.c1
-rw-r--r--loader2/log.h3
-rw-r--r--loader2/method.c54
-rw-r--r--loader2/method.h2
-rw-r--r--loader2/modules.c37
-rw-r--r--loader2/net.c92
-rw-r--r--loader2/net.h3
-rw-r--r--loader2/nfsinstall.c32
-rw-r--r--loader2/nfsinstall.h6
-rw-r--r--loader2/shutdown.c11
-rw-r--r--loader2/urlinstall.c33
-rw-r--r--loader2/urlinstall.h5
-rw-r--r--loader2/urls.c21
33 files changed, 424 insertions, 191 deletions
diff --git a/loader2/Makefile b/loader2/Makefile
index d222a6832..399536338 100644
--- a/loader2/Makefile
+++ b/loader2/Makefile
@@ -30,7 +30,7 @@ SOURCES = $(subst .o,.c,$(OBJS)) loader.c
HWLIBS = -lkudzu_loader -lpci
DEBUG = -ggdb
-COPTS = $(DEBUG) -Os -Wall -DUSE_LOGDEV -DVERSION='"$(VERSION)"'
+COPTS = $(DEBUG) -Os -Wall -DUSE_LOGDEV -DVERSION='"$(VERSION)"' -Werror
CFLAGS = $(COPTS) -ffunction-sections -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBIO_H
STATIC = -static
REALCC=gcc
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 7d1f4c9f2..44eb19273 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -387,7 +387,8 @@ char * mountCdromImage(struct installMethod * method,
return setupCdrom(location, kd, loaderData, modInfo, modLoaded, *modDepsPtr, flags, 1, 1);
}
-void setKickstartCD(struct loaderData_s * loaderData, int argc,
+void setKickstartCD(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
logMessage("kickstartFromCD");
diff --git a/loader2/cdinstall.h b/loader2/cdinstall.h
index 51fb4ee03..2585deca0 100644
--- a/loader2/cdinstall.h
+++ b/loader2/cdinstall.h
@@ -18,7 +18,8 @@ char * findRedHatCD(char * location,
int requirepkgs);
-void setKickstartCD(struct loaderData_s * loaderData, int argc,
+void setKickstartCD(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
int kickstartFromCD(char *kssrc, struct knownDevices * kd, int flags);
diff --git a/loader2/dietstubs.c b/loader2/dietstubs.c
index ae0a3bf73..5d319bc61 100644
--- a/loader2/dietstubs.c
+++ b/loader2/dietstubs.c
@@ -5,6 +5,7 @@
#include <setjmp.h>
#include <ctype.h>
#include <stdarg.h>
+#include <unistd.h>
#ifdef GZLIB
#include "../isys/gzlib/gzlib.h"
#endif
@@ -158,10 +159,6 @@ void warn(char * format, ...) {
errno = err;
}
-int pwrite(int fd, const void *buf, size_t count, off_t offset) {
- return __pwrite(fd, buf, count, offset);
-}
-
void * __rawmemchr (void* s, int c) {
while (*(char *)s != c)
s++;
@@ -169,7 +166,7 @@ void * __rawmemchr (void* s, int c) {
}
char * dcgettext (const char *domainname, const char *msgid, int category) {
- return msgid;
+ return (char *) msgid;
}
int wcwidth (wchar_t c) {
diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c
index 7258a3ba8..5589b6ca3 100644
--- a/loader2/driverdisk.c
+++ b/loader2/driverdisk.c
@@ -27,6 +27,7 @@
#include "log.h"
#include "loadermisc.h"
#include "lang.h"
+#include "method.h"
#include "modules.h"
#include "moduledeps.h"
#include "moduleinfo.h"
@@ -34,6 +35,9 @@
#include "hardware.h"
#include "driverdisk.h"
+#include "nfsinstall.h"
+#include "urlinstall.h"
+
#include "../isys/isys.h"
#include "../isys/imount.h"
#include "../isys/probe.h"
@@ -111,6 +115,7 @@ static int loadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded,
sprintf(file, "/tmp/ramfs/DD-%d", disknum);
mkdirChain(file);
+ startNewt(flags);
winStatus(40, 3, _("Loading"), _("Reading driver disk..."));
for (fnPtr = driverDiskFiles; *fnPtr; fnPtr++) {
@@ -398,23 +403,71 @@ int loadDriverDisks(int class, moduleList modLoaded,
return LOADER_OK;
}
-void useKickstartDD(struct loaderData_s * loaderData, int argc,
- char ** argv, int * flagsPtr) {
+static void loadFromLocation(struct knownDevices * kd,
+ struct loaderData_s * loaderData,
+ char * dir, int flags) {
+ if (verifyDriverDisk(dir, flags) == LOADER_BACK) {
+ logMessage("not a valid driver disk");
+ return;
+ }
+
+ loadDriverDisk(loaderData->modInfo, loaderData->modLoaded,
+ loaderData->modDepsPtr, dir, flags);
+ busProbe(loaderData->modInfo, loaderData->modLoaded, *
+ loaderData->modDepsPtr, 0, kd, flags);
+}
+
+void getDDFromSource(struct knownDevices * kd,
+ struct loaderData_s * loaderData,
+ char * src, int flags) {
+ if (!strncmp(src, "nfs:", 4)) {
+ if (getFileFromNfs(src + 4, "/tmp/dd.img", kd, loaderData,
+ flags)) {
+ logMessage("unable to retrieve driver disk: %s", src);
+ return;
+ }
+ } else if (!strncmp(src, "ftp://", 6) || !strncmp(src, "http://", 7)) {
+ if (getFileFromUrl(src, "/tmp/dd.img", kd, loaderData, flags)) {
+ logMessage("unable to retrieve driver disk: %s", src);
+ return;
+ }
+ } else {
+ newtWinMessage(_("Kickstart Error"), _("OK"),
+ _("Unknown driver disk kickstart source: %s"), src);
+ return;
+ }
+ if (!mountLoopback("/tmp/dd.img", "/tmp/drivers", "loop6")) {
+ loadFromLocation(kd, loaderData, "/tmp/drivers", flags);
+ umountLoopback("/tmp/drivers", "loop6");
+ unlink("/tmp/drivers");
+ unlink("/tmp/dd.img");
+ }
+
+}
+
+static void getDDFromDev(struct knownDevices * kd,
+ struct loaderData_s * loaderData, char * dev,
+ char * fstype, int flags);
+
+void useKickstartDD(struct knownDevices * kd, struct loaderData_s * loaderData,
+ int argc, char ** argv, int * flagsPtr) {
char * fstype = NULL;
char * dev = NULL;
+ char * src;
poptContext optCon;
int rc;
int flags = *flagsPtr;
struct poptOption ksDDOptions[] = {
{ "type", '\0', POPT_ARG_STRING, &fstype, 0 },
+ { "source", '\0', POPT_ARG_STRING, &src, 0 },
{ 0, 0, 0, 0, 0 }
};
optCon = poptGetContext(NULL, argc, (const char **) argv, ksDDOptions, 0);
if ((rc = poptGetNextOpt(optCon)) < -1) {
newtWinMessage(_("Kickstart Error"), _("OK"),
- _("Bad argument to driver disk kickstart method "
- "command %s: %s"),
+ _("The following invalid argument was specified for "
+ "the kickstart driver disk command: %s:%s"),
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(rc));
return;
@@ -422,13 +475,21 @@ void useKickstartDD(struct loaderData_s * loaderData, int argc,
dev = (char *) poptGetArg(optCon);
- if (!dev) {
+ if (!dev && !src) {
logMessage("bad arguments to kickstart driver disk command");
return;
}
- /* JKFIXME: this duplicated a bit more code than I'd like but I don't
- * want to change the main driver disk code at this point */
+ if (dev) {
+ return getDDFromDev(kd, loaderData, dev, fstype, flags);
+ } else {
+ return getDDFromSource(kd, loaderData, src, flags);
+ }
+}
+
+static void getDDFromDev(struct knownDevices * kd,
+ struct loaderData_s * loaderData, char * dev,
+ char * fstype, int flags) {
devMakeInode(dev, "/tmp/dddev");
if (fstype) {
if (!doPwMount("/tmp/dddev", "/tmp/drivers", fstype, 1, 0,
@@ -447,14 +508,8 @@ void useKickstartDD(struct loaderData_s * loaderData, int argc,
}
}
- rc = verifyDriverDisk("/tmp/drivers", flags);
- if (rc == LOADER_BACK) {
- logMessage("not a valid driver disk");
- umount("/tmp/drivers");
- return;
- }
-
- rc = loadDriverDisk(loaderData->modInfo, loaderData->modLoaded,
- loaderData->modDepsPtr, "/tmp/drivers", flags);
+ loadFromLocation(kd, loaderData, "/tmp/drivers", flags);
umount("/tmp/drivers");
+ unlink("/tmp/drivers");
+ unlink("/tmp/dddev");
}
diff --git a/loader2/driverdisk.h b/loader2/driverdisk.h
index 58d6d72bc..2f376b2c6 100644
--- a/loader2/driverdisk.h
+++ b/loader2/driverdisk.h
@@ -21,7 +21,12 @@ int getRemovableDevices(char *** devNames);
int chooseManualDriver(int class, moduleList modLoaded,
moduleDeps * modDepsPtr, moduleInfoSet modInfo,
struct knownDevices * kd, int flags);
-void useKickstartDD(struct loaderData_s * loaderData, int argc,
+void useKickstartDD(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
+void getDDFromSource(struct knownDevices * kd,
+ struct loaderData_s * loaderData,
+ char * src, int flags);
+
#endif
diff --git a/loader2/driverselect.c b/loader2/driverselect.c
index f71d85618..ba9adaa3a 100644
--- a/loader2/driverselect.c
+++ b/loader2/driverselect.c
@@ -64,7 +64,7 @@ static int getManualModuleArgs(struct moduleInfo * mod, char *** moduleArgs) {
"options can be obtained by pressing the F1 key."),
mod->moduleName);
text = newtTextboxReflowed(-1, -1, buf, 60, 0, 10, 0);
- entry = newtEntry(-1, -1, argsEntry, 50, &argsEntry,
+ entry = newtEntry(-1, -1, argsEntry, 50, (const char **) &argsEntry,
NEWT_ENTRY_SCROLL);
newtFormAddHotKey(f, NEWT_KEY_F1);
@@ -220,7 +220,7 @@ int chooseManualDriver(int class, moduleList modLoaded,
for (i = 0; i < numSorted; i++) {
newtListboxAppendEntry(listbox, sdupprintf("%s (%s)",
modInfo->moduleList[sortedOrder[i].index].description,
- modInfo->moduleList[sortedOrder[i].index].moduleName), (void *) sortedOrder[i].index);
+ modInfo->moduleList[sortedOrder[i].index].moduleName), INT_TO_POINTER(sortedOrder[i].index));
}
grid = newtCreateGrid(1, 4);
@@ -238,7 +238,7 @@ int chooseManualDriver(int class, moduleList modLoaded,
do {
newtFormRun(f, &es);
- num = (int) newtListboxGetCurrent(listbox);
+ num = POINTER_TO_INT(newtListboxGetCurrent(listbox));
if (es.reason == NEWT_EXIT_COMPONENT && es.u.co == back) {
done = -1;
diff --git a/loader2/hardware.c b/loader2/hardware.c
index 24e6d2381..633baf346 100644
--- a/loader2/hardware.c
+++ b/loader2/hardware.c
@@ -285,7 +285,7 @@ void dasdSetup(moduleList modLoaded, moduleDeps modDeps,
return;
#else
char **dasd_parms;
- char *line, *ports = NULL;
+ char *line;
char *parms = NULL, *parms_end;
FILE *fd;
@@ -322,24 +322,11 @@ void dasdSetup(moduleList modLoaded, moduleDeps modDeps,
return;
}
if(!parms) {
- mlLoadModuleSet("dasd_mod:dasd_diag_mod:dasd_fba_mod:dasd_eckd_mod",
+ dasd_parms[0] = "dasd=autodetect";
+ mlLoadModule("dasd_mod", modLoaded, modDeps, modInfo, dasd_parms, flags);
+ mlLoadModuleSet("dasd_diag_mod:dasd_fba_mod:dasd_eckd_mod",
modLoaded, modDeps, modInfo, flags);
- if((ports = getDasdPorts())) {
- parms = (char *)malloc(strlen("dasd=") + strlen(ports) + 1);
- strcpy(parms,"dasd=");
- strcat(parms, ports);
- dasd_parms[0] = parms;
- removeLoadedModule("dasd_eckd_mod", modLoaded, flags);
- removeLoadedModule("dasd_fba_mod", modLoaded, flags);
- removeLoadedModule("dasd_diag_mod", modLoaded, flags);
- removeLoadedModule("dasd_mod", modLoaded, flags);
- mlLoadModule("dasd_mod", modLoaded, modDeps, modInfo,
- dasd_parms, flags);
- mlLoadModuleSet("dasd_diag_mod:dasd_fba_mod:dasd_eckd_mod",
- modLoaded, modDeps, modInfo, flags);
- free(dasd_parms);
- free(ports);
- }
+ free(dasd_parms);
}
#endif
}
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c
index 4882ce00a..08e399905 100644
--- a/loader2/hdinstall.c
+++ b/loader2/hdinstall.c
@@ -224,6 +224,11 @@ static int loadHDImages(char * prefix, char * dir, int flags,
sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : "");
copyUpdatesImg(path);
+ /* handle product.img now before we copy stage2 over... this allows
+ * us to keep our ramdisk size as small as possible */
+ sprintf(path, "%s/%s/RedHat/base/product.img", prefix, dir ? dir : "");
+ copyProductImg(path);
+
dest = alloca(strlen(target) + 50);
sprintf(dest,"/tmp/ramfs/%s", target);
rc = copyFileAndLoopbackMount(fd, dest, flags, device, mntpoint);
@@ -243,6 +248,7 @@ static int loadHDImages(char * prefix, char * dir, int flags,
return rc;
}
+#if 0 /* Unused now */
/* mount loopback second stage image for hard drive install */
static int mountHDImages(char * prefix, char * dir, int flags,
char * device, char * mntpoint,
@@ -301,6 +307,7 @@ static int mountHDImages(char * prefix, char * dir, int flags,
return rc;
}
+#endif
/* given a partition device and directory, tries to mount hd install image */
static char * setupIsoImages(char * device, char * dirName, int flags) {
@@ -576,7 +583,8 @@ char * mountHardDrive(struct installMethod * method,
return url;
}
-void setKickstartHD(struct loaderData_s * loaderData, int argc,
+void setKickstartHD(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
char *partition, *dir;
poptContext optCon;
diff --git a/loader2/hdinstall.h b/loader2/hdinstall.h
index 8706304be..be7047bbc 100644
--- a/loader2/hdinstall.h
+++ b/loader2/hdinstall.h
@@ -9,7 +9,8 @@ struct hdInstallData {
};
-void setKickstartHD(struct loaderData_s * loaderData, int argc,
+void setKickstartHD(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
char * mountHardDrive(struct installMethod * method,
char * location, struct knownDevices * kd,
diff --git a/loader2/init.c b/loader2/init.c
index 8b572baba..7e8b47914 100644
--- a/loader2/init.c
+++ b/loader2/init.c
@@ -97,6 +97,7 @@ char * env[] = {
int testing=0;
void unmountFilesystems(void);
void disableSwap(void);
+void shutDown(int noKill, int doReboot);
struct termios ts;
int mystrstr(char *str1, char *str2) {
diff --git a/loader2/kbd.c b/loader2/kbd.c
index 5c4d05f7f..f0de1472f 100644
--- a/loader2/kbd.c
+++ b/loader2/kbd.c
@@ -162,7 +162,8 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) {
return rc;
}
-void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
+void setKickstartKeyboard(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
if (argc < 2) {
logMessage("no argument passed to keyboard kickstart command");
diff --git a/loader2/kbd.h b/loader2/kbd.h
index 90a4f88b1..b18d8dfa0 100644
--- a/loader2/kbd.h
+++ b/loader2/kbd.h
@@ -2,7 +2,8 @@
#define H_KBD
int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags);
-void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
+void setKickstartKeyboard(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
#endif
diff --git a/loader2/kickstart.c b/loader2/kickstart.c
index 8b5971ce2..8c630fe7e 100644
--- a/loader2/kickstart.c
+++ b/loader2/kickstart.c
@@ -52,7 +52,8 @@
struct ksCommandNames {
int code;
char * name;
- void (*setupData) (struct loaderData_s *loaderData,
+ void (*setupData) (struct knownDevices * kd,
+ struct loaderData_s *loaderData,
int argc, char ** argv, int * flagsPtr);
} ;
@@ -61,13 +62,17 @@ struct ksCommand {
char ** argv;
};
-static void setTextMode(struct loaderData_s * loaderData, int argc,
+static void setTextMode(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
-static void setGraphicalMode(struct loaderData_s * loaderData, int argc,
- char ** argv, int * flagsPtr);
-static void setCmdlineMode(struct loaderData_s * loaderData, int argc,
+static void setGraphicalMode(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
+ char ** argv, int * flagsPtr);
+static void setCmdlineMode(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
-void loadKickstartModule(struct loaderData_s * loaderData, int argc,
+void loadKickstartModule(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
struct ksCommandNames ksTable[] = {
@@ -274,35 +279,7 @@ int kickstartFromFloppy(char *kssrc, int flags) {
3 - kickstart file named path not there
*/
int getKickstartFromBlockDevice(char *device, char *path) {
- int rc;
- char ksfile[4096];
-
- logMessage("getKickstartFromBlockDevice(%s, %s)", device, path);
-
- if (devMakeInode(device, "/tmp/kssrcdev"))
- return 1;
-
- if ((doPwMount("/tmp/kssrcdev", "/tmp/ks", "vfat", 1, 0, NULL, NULL, 0, 0)) &&
- doPwMount("/tmp/kssrcdev", "/tmp/ks", "ext2", 1, 0, NULL, NULL, 0, 0) &&
- doPwMount("/tmp/kssrcdev", "/tmp/ks", "iso9660", 1, 0, NULL, NULL, 0, 0)) {
- logMessage("failed to mount /dev/%s: %s", device, strerror(errno));
- return 2;
- }
-
- snprintf(ksfile, sizeof(ksfile), "/tmp/ks/%s", path);
- logMessage("Searching for ks file on path %s", ksfile);
-
- if (access(ksfile, R_OK)) {
- rc = 3;
- } else {
- copyFile(ksfile, "/tmp/ks.cfg");
- rc = 0;
- logMessage("kickstart file copied to /tmp/ks.cfg");
- }
-
- umount("/tmp/ks");
- unlink("/tmp/kssrcdev");
- return rc;
+ return getFileFromBlockDevice(device, path, "/tmp/ks.cfg");
}
void getHostandPath(char * ksSource, char **host, char ** file, char * ip) {
@@ -365,25 +342,29 @@ void getKickstartFile(struct knownDevices * kd,
return;
}
-static void setTextMode(struct loaderData_s * loaderData, int argc,
+static void setTextMode(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
(*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_TEXT;
return;
}
-static void setGraphicalMode(struct loaderData_s * loaderData, int argc,
+static void setGraphicalMode(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
(*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_GRAPHICAL;
return;
}
-static void setCmdlineMode(struct loaderData_s * loaderData, int argc,
+static void setCmdlineMode(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
(*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_CMDLINE;
return;
}
-void setupKickstart(struct loaderData_s * loaderData, int * flagsPtr) {
+void runKickstart(struct knownDevices * kd, struct loaderData_s * loaderData,
+ int * flagsPtr) {
struct ksCommandNames * cmd;
int argc;
char ** argv;
@@ -391,7 +372,7 @@ void setupKickstart(struct loaderData_s * loaderData, int * flagsPtr) {
logMessage("setting up kickstart");
for (cmd = ksTable; cmd->name; cmd++) {
if ((!ksGetCommand(cmd->code, NULL, &argc, &argv)) && cmd->setupData) {
- cmd->setupData(loaderData, argc, argv, flagsPtr);
+ cmd->setupData(kd, loaderData, argc, argv, flagsPtr);
}
}
}
diff --git a/loader2/kickstart.h b/loader2/kickstart.h
index 4cfe1bc00..ab941a595 100644
--- a/loader2/kickstart.h
+++ b/loader2/kickstart.h
@@ -23,7 +23,8 @@ int ksHasCommand(int cmd);
void getKickstartFile(struct knownDevices * kd,
struct loaderData_s * loaderData, int * flagsPtr);
-void setupKickstart(struct loaderData_s * loaderData, int * flagsPtr);
+void runKickstart(struct knownDevices * kd, struct loaderData_s * loaderData,
+ int * flagsPtr);
int getKickstartFromBlockDevice(char *device, char *path);
void getHostandPath(char * ksSource, char **host, char ** file, char * ip);
diff --git a/loader2/lang.c b/loader2/lang.c
index 44c6c82a4..38c1588cd 100644
--- a/loader2/lang.c
+++ b/loader2/lang.c
@@ -388,7 +388,8 @@ int chooseLanguage(char ** lang, int flags) {
return setupLanguage(choice, flags);
}
-void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
+void setKickstartLanguage(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
if (argc < 2) {
logMessage("no argument passed to lang kickstart command");
diff --git a/loader2/lang.h b/loader2/lang.h
index e2517934e..68e9a048b 100644
--- a/loader2/lang.h
+++ b/loader2/lang.h
@@ -2,6 +2,7 @@
#define _LANG_H_
#include "loader.h"
+#include "../isys/probe.h"
#define _(x) translateString (x)
#define N_(foo) (foo)
@@ -16,7 +17,8 @@ char * translateString(char * str);
int setLanguage (char * key, int flags);
int getLangInfo(struct langInfo **langs, int flags);
-void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
+void setKickstartLanguage(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
#endif /* _LANG_H_ */
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
index 56c1513a6..239a58842 100644
--- a/loader2/linuxrc.s390
+++ b/loader2/linuxrc.s390
@@ -52,7 +52,7 @@ startinetd()
/sbin/sshd
if [ -z "$RUNKS" ]; then
echo
- echo $"Please connect now to $IPADDR to start the installation."
+ echo $"Connect now to $IPADDR to start the installation."
read
while : ; do
/bin/sh --login
@@ -107,18 +107,18 @@ LO=""
# Parse configuration
# Check for missing parameters, prompt for them if necessary
while [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; do
- echo $"Please enter the FQDN of your new Linux guest (e.g. s390.redhat.com):"
+ echo $"Enter the FQDN of your new Linux guest (e.g. s390.redhat.com):"
read HOSTNAME
done
while [ -z "$NETTYPE" ]; do
- echo $"Please enter which kind of network device do you intend to use"
+ echo $"Enter which kind of network device do you intend to use"
echo " (e.g. ctc, escon, iucv, eth, hsi, tr):"
read NETTYPE
done
DEVICE=${NETTYPE}0
if [ ":$NETTYPE" != ":iucv" ]; then # iucv is the only interface without chandev config
while [ -z "$CHANDEV" ]; do
- echo $"Please enter parameters you need to pass to the channel device layer."
+ echo $"Enter parameters you need to pass to the channel device layer."
echo $"This includes the I/O ports of your ctc, escon, qeth, hsi and lcs devices."
echo $"Additional parameters for QETH devices such as the portname"
echo $"should be entered at the next prompt, not here !"
@@ -130,7 +130,7 @@ if [ ":$NETTYPE" != ":iucv" ]; then # iucv is the only interface without chand
if [ "$?" = "0" ]; then
if [ -z "$QETHPARM" ]; then
echo $"Each OSA-Express feature in QDIO mode must be associated with a port name"
- echo $"Please enter additional parameters for your QETH device"
+ echo $"Enter additional parameters for your QETH device"
echo $"(e.g. \"add_parms,0x10,{lo_devno,hi_devno},portname:port_name\")"
echo $"Press enter if you don't want to enter additional parameters"
read QETHPARM
@@ -142,7 +142,7 @@ if [ ":$NETTYPE" != ":iucv" ]; then # iucv is the only interface without chand
echo "$CHANDEV" |grep -q "hsi"
if [ "$?" = "0" ]; then
if [ -z "$QETHPARM" ]; then
- echo $"Please enter additional parameters for your HSI device"
+ echo $"Enter additional parameters for your HSI device"
echo $"(e.g. \"add_parms,0x10,{lo_devno,hi_devno},portname:port_name\")"
echo $"Press enter if you don't want to enter additional parameters"
read QETHPARM
@@ -153,7 +153,7 @@ if [ ":$NETTYPE" != ":iucv" ]; then # iucv is the only interface without chand
[ -n "$CHANDEV" ] && echo "reprobe" >/proc/chandev
fi
while [ -z "$IPADDR" ]; do
- echo $"Please enter the IP address of your new Linux guest:"
+ echo $"Enter the IP address of your new Linux guest:"
read IPADDR
done
while [ -z "$NETWORK" ]; do
@@ -170,7 +170,7 @@ if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ] || [ ":$NETTYPE" = ":hsi"
read BROADCAST
done
while [ -z "$GATEWAY" ]; do
- echo $"Please enter your default gateway:"
+ echo $"Enter your default gateway:"
read GATEWAY
done
if echo "$CHANDEV" |grep -q "lcs"; then
@@ -189,6 +189,11 @@ if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ] || [ ":$NETTYPE" = ":hsi"
fi
fi
else # ctc0, escon0, iucv0
+ if [ -z "$NETMASK" ]; then
+ # If the user did not supply netmask, we add the right one.
+ # Netmask MUST be present, or pumpSetupInterface() blows routes.
+ NETMASK="255.255.255.255"
+ fi
while [ -z "$GATEWAY" ]; do
echo $"Enter the IP of your ctc/escon/iucv point-to-point partner:"
read GATEWAY
@@ -227,6 +232,9 @@ elif [ ":$NETTYPE" = ":iucv" ]; then
insmod netiucv$LO $IUCV
ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY
route add -host $IPADDR dev $DEVICE 2>/dev/null
+ if [ -n "$IUCV" ]; then
+ echo "options netiucv $IUCV" >> /tmp/modules.conf
+ fi
elif [ -n "$LCS" -o -n "$TR" ]; then
insmod lcs$LO
ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST
@@ -247,7 +255,7 @@ fi
route add default gw $GATEWAY dev $DEVICE 2>/dev/null
if [ -z "$DNS" ]; then
- echo $"Please enter your DNS server(s), separated by colons (:):"
+ echo $"Enter your DNS server(s), separated by colons (:):"
read DNS
fi
if [ -z "$DNS" ]; then
@@ -256,7 +264,7 @@ if [ -z "$DNS" ]; then
fi
if [ -n "$DNS" -a -z "$SEARCHDNS" ]; then
- echo $"Please enter your DNS search domain(s) (if any), separated by colons (:):"
+ echo $"Enter your DNS search domain(s) (if any), separated by colons (:):"
read SEARCHDNS
fi
diff --git a/loader2/loader.c b/loader2/loader.c
index 19f93d2ff..37931a959 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -422,7 +422,7 @@ static void readNetInfo(int flags, struct loaderData_s ** ld) {
static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
char * cmdLine) {
int fd;
- char buf[500];
+ char buf[1024];
int len;
char ** argv;
int argc;
@@ -480,9 +480,12 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
flags |= LOADER_FLAGS_UPDATES;
else if (!strcasecmp(argv[i], "isa"))
flags |= LOADER_FLAGS_ISA;
- else if (!strcasecmp(argv[i], "dd"))
- flags |= LOADER_FLAGS_MODDISK;
- else if (!strcasecmp(argv[i], "driverdisk"))
+ else if (!strncasecmp(argv[i], "dd=", 3) ||
+ !strncasecmp(argv[i], "driverdisk=", 11)) {
+ loaderData->ddsrc = strdup(argv[i] +
+ (argv[i][1] == 'r' ? 11 : 3));
+ } else if (!strcasecmp(argv[i], "dd") ||
+ !strcasecmp(argv[i], "driverdisk"))
flags |= LOADER_FLAGS_MODDISK;
else if (!strcasecmp(argv[i], "rescue"))
flags |= LOADER_FLAGS_RESCUE;
@@ -523,6 +526,8 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
loaderData->gateway = strdup(argv[i] + 8);
else if (!strncasecmp(argv[i], "dns=", 4))
loaderData->dns = strdup(argv[i] + 4);
+ else if (!strncasecmp(argv[i], "ethtool=", 8))
+ loaderData->ethtool = strdup(argv[i] + 8);
else if (numExtraArgs < (MAX_EXTRA_ARGS - 1)) {
/* go through and append args we just want to pass on to */
/* the anaconda script, but don't want to represent as a */
@@ -1119,35 +1124,38 @@ int main(int argc, char ** argv) {
if (!canProbeDevices() || FL_MODDISK(flags)) {
startNewt(flags);
-
+
loadDriverDisks(CLASS_UNSPEC, modLoaded, &modDeps,
modInfo, &kd, flags);
}
busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags);
+ /* JKFIXME: should probably not be doing this, but ... */
+ loaderData.modLoaded = modLoaded;
+ loaderData.modDepsPtr = &modDeps;
+ loaderData.modInfo = modInfo;
+
+ /* JKFIXME: we'd really like to do this before the busprobe, but then
+ * we won't have network devices available (and that's the only thing
+ * we support with this right now */
+ if (loaderData.ddsrc != NULL) {
+ getDDFromSource(&kd, &loaderData, loaderData.ddsrc, flags);
+ }
+
/* JKFIXME: loaderData->ksFile is set to the arg from the command line,
* and then getKickstartFile() changes it and sets FL_KICKSTART.
* kind of weird. */
if (loaderData.ksFile || ksFile) {
logMessage("getting kickstart file");
- /* JKFIXME: should probably not be doing this, but ... */
- loaderData.modLoaded = modLoaded;
- loaderData.modDepsPtr = &modDeps;
- loaderData.modInfo = modInfo;
if (!ksFile)
getKickstartFile(&kd, &loaderData, &flags);
if (FL_KICKSTART(flags) &&
(ksReadCommands((ksFile) ? ksFile : loaderData.ksFile,
flags) != LOADER_ERROR)) {
- setupKickstart(&loaderData, &flags);
+ runKickstart(&kd, &loaderData, &flags);
}
-
- /* JKFIXME: this is kind of gross, but we need to do it in case
- * a driver disk was loaded. but we should really load them earlier
- * but we have a nice chicken and the egg problem. ick */
- busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags);
}
if (FL_TELNETD(flags))
@@ -1224,14 +1232,14 @@ int main(int argc, char ** argv) {
}
if (useRHupdates) {
- setenv("PYTHONPATH", "/tmp/updates:/mnt/source/RHupdates", 1);
+ setenv("PYTHONPATH", "/tmp/updates:/tmp/product:/mnt/source/RHupdates", 1);
setenv("LD_LIBRARY_PATH",
- sdupprintf("/tmp/updates:/mnt/source/RHupdates:%s",
+ sdupprintf("/tmp/updates:/tmp/product:/mnt/source/RHupdates:%s",
getenv("LD_LIBRARY_PATH")), 1);
} else {
- setenv("PYTHONPATH", "/tmp/updates", 1);
+ setenv("PYTHONPATH", "/tmp/updates:/tmp/product", 1);
setenv("LD_LIBRARY_PATH",
- sdupprintf("/tmp/updates:%s", getenv("LD_LIBRARY_PATH")), 1);
+ sdupprintf("/tmp/updates:/tmp/product:%s", getenv("LD_LIBRARY_PATH")), 1);
}
diff --git a/loader2/loader.h b/loader2/loader.h
index 397a7b6fd..e0f524078 100644
--- a/loader2/loader.h
+++ b/loader2/loader.h
@@ -79,12 +79,13 @@ struct loaderData_s {
int kbd_set;
char * netDev;
int netDev_set;
- char * ip, * netmask, *gateway, *dns, *hostname, *ptpaddr;
+ char * ip, * netmask, *gateway, *dns, *hostname, *ptpaddr, *ethtool;
int mtu;
int noDns;
int ipinfo_set;
char * ksFile;
char * method;
+ char * ddsrc;
void * methodData;
moduleList modLoaded;
@@ -92,4 +93,13 @@ struct loaderData_s {
moduleInfoSet modInfo;
};
+/* 64 bit platforms, definitions courtesy of glib */
+#if defined (__x86_64__) || defined(__ia64__) || defined(__alpha__) || defined(__powerpc64__) || defined(__sparc64__) || defined(__s390x__)
+#define POINTER_TO_INT(p) ((int) (long) (p))
+#define INT_TO_POINTER(i) ((void *) (long) (i))
+#else
+#define POINTER_TO_INT(p) ((int) (p))
+#define INT_TO_POINTER(i) ((void *) (i))
+#endif
+
#endif
diff --git a/loader2/loadermisc.c b/loader2/loadermisc.c
index cc88cda11..513b607d4 100644
--- a/loader2/loadermisc.c
+++ b/loader2/loadermisc.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
diff --git a/loader2/log.h b/loader2/log.h
index 6a7da0d77..4a6876f35 100644
--- a/loader2/log.h
+++ b/loader2/log.h
@@ -3,9 +3,6 @@
#include <stdio.h>
-extern FILE * log;
-extern int logfd;
-
void logMessage(const char * s, ...) __attribute__ ((format (printf, 1, 2)));;
void openLog(int useLocal);
void closeLog(void);
diff --git a/loader2/method.c b/loader2/method.c
index 49639fa4b..f9ca9cbf9 100644
--- a/loader2/method.c
+++ b/loader2/method.c
@@ -501,6 +501,15 @@ void copyUpdatesImg(char * path) {
}
}
+void copyProductImg(char * path) {
+ if (!access(path, R_OK)) {
+ if (!mountLoopback(path, "/tmp/product-disk", "loop7")) {
+ copyDirectory("/tmp/product-disk", "/tmp/product");
+ umountLoopback("/tmp/product-disk", "loop7");
+ }
+ }
+}
+
/* verify that the stamp files in / of the initrd and the stage2 match */
int verifyStamp(char * path) {
@@ -571,6 +580,10 @@ int mountStage2(char * path) {
/* JKFIXME: this is kind of silly.. /mnt/source is hardcoded :/ */
copyUpdatesImg("/mnt/source/RedHat/base/updates.img");
+
+ /* more hard coding */
+ copyProductImg("/mnt/source/RedHat/base/product.img");
+
return 0;
}
@@ -583,7 +596,7 @@ int copyFileAndLoopbackMount(int fd, char * dest, int flags,
rc = copyFileFd(fd, dest);
stat(dest, &sb);
- logMessage("copied %lld bytes to %s (%s)", sb.st_size, dest,
+ logMessage("copied %jd bytes to %s (%s)", sb.st_size, dest,
((rc) ? " incomplete" : "complete"));
if (rc) {
@@ -603,6 +616,45 @@ int copyFileAndLoopbackMount(int fd, char * dest, int flags,
return 0;
}
+/* given a device name (w/o '/dev' on it), try to get a file */
+/* Error codes:
+ 1 - could not create device node
+ 2 - could not mount device as ext2, vfat, or iso9660
+ 3 - file named path not there
+*/
+int getFileFromBlockDevice(char *device, char *path, char * dest) {
+ int rc;
+ char file[4096];
+
+ logMessage("getFileFromBlockDevice(%s, %s)", device, path);
+
+ if (devMakeInode(device, "/tmp/srcdev"))
+ return 1;
+
+ if ((doPwMount("/tmp/srcdev", "/tmp/mnt", "vfat", 1, 0, NULL, NULL, 0, 0)) &&
+ doPwMount("/tmp/srcdev", "/tmp/mnt", "ext2", 1, 0, NULL, NULL, 0, 0) &&
+ doPwMount("/tmp/srcdev", "/tmp/mnt", "iso9660", 1, 0, NULL, NULL, 0, 0)) {
+ logMessage("failed to mount /dev/%s: %s", device, strerror(errno));
+ return 2;
+ }
+
+ snprintf(file, sizeof(file), "/tmp/mnt/%s", path);
+ logMessage("Searching for file on path %s", file);
+
+ if (access(file, R_OK)) {
+ rc = 3;
+ } else {
+ copyFile(file, dest);
+ rc = 0;
+ logMessage("file copied to %s", dest);
+ }
+
+ umount("/tmp/mnt");
+ unlink("/tmp/mnt");
+ unlink("/tmp/srcdev");
+ return rc;
+}
+
void setMethodFromCmdline(char * arg, struct loaderData_s * ld) {
char * c;
ld->method = strdup(arg);
diff --git a/loader2/method.h b/loader2/method.h
index 0c2ba81d3..3cfce30d6 100644
--- a/loader2/method.h
+++ b/loader2/method.h
@@ -32,8 +32,10 @@ void umountStage2(void);
int mountStage2(char * path);
int copyFileAndLoopbackMount(int fd, char * dest, int flags,
char * device, char * mntpoint);
+int getFileFromBlockDevice(char *device, char *path, char * dest);
void copyUpdatesImg(char * path);
+void copyProductImg(char * path);
int copyDirectory(char * from, char * to);
void setMethodFromCmdline(char * arg, struct loaderData_s * ld);
diff --git a/loader2/modules.c b/loader2/modules.c
index 3c343066a..dbe9e8c98 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -94,13 +94,13 @@ static int scsiDiskCount(void) {
devices = probeDevices(CLASS_HD, BUS_SCSI, PROBE_ALL);
if (devices) {
- for (i; devices[i]; i++);
+ for (; devices[i]; i++);
free(devices);
}
/* have to probe for usb floppies too */
devices = probeDevices(CLASS_FLOPPY, BUS_SCSI, PROBE_ALL);
if (devices) {
- for (i; devices[i]; i++);
+ for (; devices[i]; i++);
free(devices);
}
@@ -660,8 +660,6 @@ static int writeModulesConf(moduleList list, int fd) {
}
}
- /* JKFIXME: used to have special casing for iucv stuff on s390 */
-
return 0;
}
@@ -711,22 +709,23 @@ char * getModuleLocation(int version) {
uname(&u);
- if (!arch) {
+ if (!arch && !access(archfile, R_OK)) {
struct stat sb;
int fd;
- if (!stat(archfile, &sb)) {
- arch = malloc(sb.st_size + 1);
+ stat(archfile, &sb);
+ arch = malloc(sb.st_size + 1);
- fd = open(archfile, O_RDONLY);
- read(fd, arch, sb.st_size);
- if (arch[sb.st_size -1 ] == '\n')
- sb.st_size--;
- arch[sb.st_size] = '\0';
- close(fd);
- } else {
- arch = strdup(u.machine);
- }
+ fd = open(archfile, O_RDONLY);
+ read(fd, arch, sb.st_size);
+ if (arch[sb.st_size -1 ] == '\n')
+ sb.st_size--;
+ arch[sb.st_size] = '\0';
+ close(fd);
+ } else if (!arch) {
+ logMessage("can't find arch file %s, defaulting to %s", archfile,
+ u.machine);
+ arch = strdup(u.machine);
}
if (version == 1) {
@@ -895,8 +894,9 @@ int removeLoadedModule(const char * modName, moduleList modLoaded,
return rc;
}
-void loadKickstartModule(struct loaderData_s * loaderData, int argc,
- char ** argv, int * flagsPtr) {
+void loadKickstartModule(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
+ char ** argv, int * flagsPtr) {
char * opts = NULL;
char * module = NULL;
char * type = NULL;
@@ -912,6 +912,7 @@ void loadKickstartModule(struct loaderData_s * loaderData, int argc,
optCon = poptGetContext(NULL, argc, (const char **) argv,
ksDeviceOptions, 0);
if ((rc = poptGetNextOpt(optCon)) < -1) {
+ startNewt(flags);
newtWinMessage(_("Kickstart Error"), _("OK"),
_("Bad argument to device kickstart method "
"command %s: %s"),
diff --git a/loader2/net.c b/loader2/net.c
index 9a2dd2c9f..b874204f5 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -31,6 +31,7 @@
#include "../isys/dns.h"
#include "../isys/isys.h"
+#include "../isys/net.h"
#include "lang.h"
#include "loader.h"
@@ -115,7 +116,7 @@ static void fillInIpInfo(struct networkDeviceConfig * cfg) {
}
}
-static void waitForLink(char * dev) {
+static int waitForLink(char * dev) {
int tries = 0;
/* try to wait for a valid link -- if the status is unknown or
@@ -129,7 +130,9 @@ static void waitForLink(char * dev) {
tries++;
}
logMessage("%d seconds.", tries);
- /* JKFIXME: arguably, we shouldn't let you use nics without link */
+ if (tries < 5)
+ return 0;
+ return 1;
}
void initLoopback(void) {
@@ -290,6 +293,43 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
cfg->dev.set |= PUMP_INTFINFO_HAS_PTPADDR;
}
+ if (loaderData->ethtool) {
+ char * option, * buf;
+ ethtool_duplex duplex = ETHTOOL_DUPLEX_UNSPEC;
+ ethtool_speed speed = ETHTOOL_SPEED_UNSPEC;
+
+ buf = strdup(loaderData->ethtool);
+ option = strtok(buf, " ");
+ while (option) {
+ if (option[strlen(option) - 1] == '\"')
+ option[strlen(option) - 1] = '\0';
+ if (option[0] == '\"')
+ option++;
+ if (!strncmp(option, "duplex=", 7)) {
+ if (!strncmp(option + 7, "full", 4))
+ duplex = ETHTOOL_DUPLEX_FULL;
+ else if (!strncmp(option + 7, "half", 4))
+ duplex = ETHTOOL_DUPLEX_HALF;
+ else
+ logMessage("Unknown duplex setting: %s", option + 7);
+ } else if (!strncmp("speed=", option, 6)) {
+ if (!strncmp(option + 6, "1000", 4))
+ speed = ETHTOOL_SPEED_1000;
+ else if (!strncmp(option + 6, "100", 3))
+ speed = ETHTOOL_SPEED_100;
+ else if (!strncmp(option + 6, "10", 4))
+ speed = ETHTOOL_SPEED_10;
+ else
+ logMessage("Unknown speed setting: %s", option + 6);
+ } else {
+ logMessage("Unknown ethtool setting: %s", option);
+ }
+ option = strtok(NULL, " ");
+ }
+ setEthtoolSettings(loaderData->netDev, speed, duplex);
+ free(buf);
+ }
+
cfg->noDns = loaderData->noDns;
}
@@ -540,7 +580,7 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev,
fprintf(f, "MTU=%d\n", dev->dev.mtu);
if (dev->dev.set & PUMP_INTFINFO_HAS_PTPADDR)
fprintf(f, "REMIP=%s\n", inet_ntoa(dev->dev.ptpaddr));
-
+
fclose(f);
return 0;
@@ -614,9 +654,10 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) {
return 0;
}
-void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
+void setKickstartNetwork(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
- char * arg, * bootProto = NULL, * device = NULL;;
+ char * arg, * bootProto = NULL, * device = NULL, *ethtool = NULL;
int noDns = 0, rc;
poptContext optCon;
@@ -629,6 +670,7 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
{ "netmask", '\0', POPT_ARG_STRING, NULL, 'm' },
{ "nodns", '\0', POPT_ARG_NONE, &noDns, 0 },
{ "hostname", '\0', POPT_ARG_STRING, NULL, 'h'},
+ { "ethtool", '\0', POPT_ARG_STRING, &ethtool, 0 },
{ 0, 0, 0, 0, 0 }
};
@@ -657,7 +699,7 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
break;
}
}
-
+
if (rc < -1) {
newtWinMessage(_("Kickstart Error"), _("OK"),
_("Bad argument to kickstart network command %s: %s"),
@@ -692,6 +734,13 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
loaderData->netDev_set = 1;
}
+ if (ethtool) {
+ if (loaderData->ethtool)
+ free(loaderData->ethtool);
+ loaderData->ethtool = strdup(ethtool);
+ free(ethtool);
+ }
+
if (noDns) {
loaderData->noDns = 1;
}
@@ -715,7 +764,6 @@ int chooseNetworkInterface(struct knownDevices * kd,
for (i = 0; i < kd->numKnown; i++) {
if (kd->known[i].class != CLASS_NETWORK)
continue;
-
if (kd->known[i].model) {
deviceNames[deviceNums] = alloca(strlen(kd->known[i].name) +
strlen(kd->known[i].model) + 4);
@@ -729,9 +777,6 @@ int chooseNetworkInterface(struct knownDevices * kd,
deviceNames[deviceNums++] = kd->known[i].name;
}
- /* make sure that this device is disabled */
- pumpDisableInterface(kd->known[i].name);
-
/* this device has been set and we don't really need to ask
* about it again... */
if (loaderData->netDev && (loaderData->netDev_set == 1) &&
@@ -757,8 +802,27 @@ int chooseNetworkInterface(struct knownDevices * kd,
return LOADER_NOOP;
}
+ if ((loaderData->netDev && (loaderData->netDev_set) == 1) &&
+ !strcmp(loaderData->netDev, "link")) {
+ logMessage("looking for first netDev with link");
+ for (rc = 0; rc < 5; rc++) {
+ for (i = 0; i < deviceNums; i++) {
+ if (get_link_status(devices[i]) == 1) {
+ loaderData->netDev = devices[i];
+ logMessage("%s has link, using it", devices[i]);
+ return LOADER_NOOP;
+ }
+ }
+ sleep(1);
+ }
+ logMessage("wanted netdev with link, but none present. prompting");
+ }
+
startNewt(flags);
+ if (max > 70)
+ max = 70;
+
/* JKFIXME: should display link status */
deviceNum = 0;
rc = newtWinMenu(_("Networking Device"),
@@ -771,6 +835,14 @@ int chooseNetworkInterface(struct knownDevices * kd,
loaderData->netDev = devices[deviceNum];
+ /* turn off the non-active interface. this should keep things from
+ * breaking when we need the interface to do the install as long as
+ * you keep using that device */
+ for (i = 0; i < deviceNums; i++) {
+ if (strcmp(loaderData->netDev, devices[i]))
+ pumpDisableInterface(kd->known[i].name);
+ }
+
return LOADER_OK;
}
diff --git a/loader2/net.h b/loader2/net.h
index 282f1bf80..57de28f9e 100644
--- a/loader2/net.h
+++ b/loader2/net.h
@@ -29,7 +29,8 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
struct loaderData_s * loaderData,
int flags);
-void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
+void setKickstartNetwork(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
int kickstartNetworkUp(struct knownDevices * kd,
diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c
index aa3324688..1a29a9239 100644
--- a/loader2/nfsinstall.c
+++ b/loader2/nfsinstall.c
@@ -42,10 +42,10 @@ int nfsGetSetup(char ** hostptr, char ** dirptr) {
int rc;
entries[0].text = _("NFS server name:");
- entries[0].value = &newServer;
+ entries[0].value = (const char **) &newServer;
entries[0].flags = NEWT_FLAG_SCROLL;
entries[1].text = _("Red Hat directory:");
- entries[1].value = &newDir;
+ entries[1].value = (const char **) &newDir;
entries[1].flags = NEWT_FLAG_SCROLL;
entries[2].text = NULL;
entries[2].value = NULL;
@@ -209,7 +209,8 @@ char * mountNfsImage(struct installMethod * method,
}
-void setKickstartNfs(struct loaderData_s * loaderData, int argc,
+void setKickstartNfs(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
char * host, * dir;
poptContext optCon;
@@ -243,14 +244,12 @@ void setKickstartNfs(struct loaderData_s * loaderData, int argc,
}
-int kickstartFromNfs(char * url, struct knownDevices * kd,
- struct loaderData_s * loaderData, int flags) {
+int getFileFromNfs(char * url, char * dest, struct knownDevices * kd,
+ struct loaderData_s * loaderData, int flags) {
char * host = NULL, *path = NULL, * file = NULL;
int failed = 0;
struct networkDeviceConfig netCfg;
- logMessage("going to get ks from nfs");
-
if (kickstartNetworkUp(kd, loaderData, &netCfg, flags)) {
logMessage("unable to bring up network");
return 1;
@@ -289,15 +288,15 @@ int kickstartFromNfs(char * url, struct knownDevices * kd,
host = sdupprintf("%s/%s", host, path);
}
- logMessage("ks location: nfs://%s/%s", host, file);
+ logMessage("file location: nfs://%s/%s", host, file);
- if (!doPwMount(host, "/tmp/ks", "nfs", 1, 0, NULL, NULL, 0, 0)) {
+ if (!doPwMount(host, "/tmp/mnt", "nfs", 1, 0, NULL, NULL, 0, 0)) {
char * buf;
buf = alloca(strlen(file) + 10);
- sprintf(buf, "/tmp/ks/%s", file);
- if (copyFile(buf, "/tmp/ks.cfg")) {
- logMessage("failed to copy ks.cfg to /tmp/ks.cfg");
+ sprintf(buf, "/tmp/mnt/%s", file);
+ if (copyFile(buf, dest)) {
+ logMessage("failed to copy file to %s", dest);
failed = 1;
}
@@ -306,8 +305,13 @@ int kickstartFromNfs(char * url, struct knownDevices * kd,
failed = 1;
}
- umount("/tmp/ks");
- unlink("/tmp/ks");
+ umount("/tmp/mnt");
+ unlink("/tmp/mnt");
return failed;
}
+
+int kickstartFromNfs(char * url, struct knownDevices * kd,
+ struct loaderData_s * loaderData, int flags) {
+ return getFileFromNfs(url, "/tmp/ks.cfg", kd, loaderData, flags);
+}
diff --git a/loader2/nfsinstall.h b/loader2/nfsinstall.h
index 45d76b4f7..a2820403a 100644
--- a/loader2/nfsinstall.h
+++ b/loader2/nfsinstall.h
@@ -9,7 +9,8 @@ struct nfsInstallData {
};
-void setKickstartNfs(struct loaderData_s * loaderData, int argc,
+void setKickstartNfs(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
int kickstartFromNfs(char * url, struct knownDevices * kd,
struct loaderData_s * loaderData, int flags);
@@ -18,6 +19,7 @@ char * mountNfsImage(struct installMethod * method,
struct loaderData_s * loaderData,
moduleInfoSet modInfo, moduleList modLoaded,
moduleDeps * modDepsPtr, int flags);
-
+int getFileFromNfs(char * url, char * dest, struct knownDevices * kd,
+ struct loaderData_s * loaderData, int flags);
#endif
diff --git a/loader2/shutdown.c b/loader2/shutdown.c
index f6ade0ae0..2f6456d17 100644
--- a/loader2/shutdown.c
+++ b/loader2/shutdown.c
@@ -32,6 +32,14 @@ extern int testing;
void disableSwap(void);
void unmountFilesystems(void);
+void rebootHandler(int signum) {
+ printf("rebooting system\n");
+#if USE_MINILIBC
+ reboot(0xfee1dead, 672274793, 0x1234567);
+#else
+ reboot(RB_AUTOBOOT);
+#endif
+}
void shutDown(int noKill, int doReboot) {
sync(); sync();
@@ -65,7 +73,8 @@ void shutDown(int noKill, int doReboot) {
#endif
} else {
printf("you may safely reboot your system\n");
- reboot(RB_HALT_SYSTEM);
+ signal(SIGINT, rebootHandler);
+ while (1);
}
exit(0);
diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c
index fcfe7c5e4..e372e3377 100644
--- a/loader2/urlinstall.c
+++ b/loader2/urlinstall.c
@@ -99,6 +99,16 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) {
unlink("/tmp/ramfs/updates-disk.img");
}
+ /* grab the product.img before netstg1.img so that we minimize our
+ * ramdisk usage */
+ if (!loadSingleUrlImage(ui, "RedHat/base/product.img", flags,
+ "/tmp/ramfs/product-disk.img", "/tmp/product-disk",
+ "loop7", 1)) {
+ copyDirectory("/tmp/product-disk", "/tmp/product");
+ umountLoopback("/tmp/product-disk", "loop7");
+ unlink("/tmp/ramfs/product-disk.img");
+ }
+
/* require 128MB for use of graphical stage 2 due to size of image */
if (FL_TEXT(flags) || totalMemory() < 128000) {
stage2img = "netstg2.img";
@@ -297,16 +307,15 @@ char * mountUrlImage(struct installMethod * method,
return url;
}
-/* pull kickstart configuration file via http */
-int kickstartFromUrl(char * url, struct knownDevices * kd,
- struct loaderData_s * loaderData, int flags) {
+int getFileFromUrl(char * url, char * dest, struct knownDevices * kd,
+ struct loaderData_s * loaderData, int flags) {
struct iurlinfo ui;
enum urlprotocol_t proto =
!strncmp(url, "ftp://", 6) ? URL_METHOD_FTP : URL_METHOD_HTTP;
char * host = NULL, * file = NULL, * chptr = NULL;
int fd, rc;
struct networkDeviceConfig netCfg;
- char *ehdrs;
+ char * ehdrs;
if (kickstartNetworkUp(kd, loaderData, &netCfg, flags)) {
logMessage("unable to bring up network");
@@ -367,15 +376,16 @@ int kickstartFromUrl(char * url, struct knownDevices * kd,
}
fd = urlinstStartTransfer(&ui, file, ehdrs, 1);
+
if (fd < 0) {
logMessage("failed to retrieve http://%s/%s/%s", ui.address, ui.prefix, file);
return 1;
}
- rc = copyFileFd(fd, "/tmp/ks.cfg");
+ rc = copyFileFd(fd, dest);
if (rc) {
- unlink ("/tmp/ks.cfg");
- logMessage("failed to copy ks.cfg to /tmp/ks.cfg");
+ unlink (dest);
+ logMessage("failed to copy file to %s", dest);
return 1;
}
@@ -384,7 +394,14 @@ int kickstartFromUrl(char * url, struct knownDevices * kd,
return 0;
}
-void setKickstartUrl(struct loaderData_s * loaderData, int argc,
+/* pull kickstart configuration file via http */
+int kickstartFromUrl(char * url, struct knownDevices * kd,
+ struct loaderData_s * loaderData, int flags) {
+ return getFileFromUrl(url, "/tmp/ks.cfg", kd, loaderData, flags);
+}
+
+void setKickstartUrl(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
char *url;
diff --git a/loader2/urlinstall.h b/loader2/urlinstall.h
index def23df91..c03961cb9 100644
--- a/loader2/urlinstall.h
+++ b/loader2/urlinstall.h
@@ -8,7 +8,8 @@ struct urlInstallData {
};
-void setKickstartUrl(struct loaderData_s * loaderData, int argc,
+void setKickstartUrl(struct knownDevices * kd,
+ struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr);
int kickstartFromUrl(char * url, struct knownDevices * kd,
struct loaderData_s * loaderData, int flags);
@@ -17,6 +18,8 @@ char * mountUrlImage(struct installMethod * method,
struct loaderData_s * loaderData,
moduleInfoSet modInfo, moduleList modLoaded,
moduleDeps * modDepsPtr, int flags);
+int getFileFromUrl(char * url, char * dest, struct knownDevices * kd,
+ struct loaderData_s * loaderData, int flags);
#endif
diff --git a/loader2/urls.c b/loader2/urls.c
index 23bce718f..03acda76e 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -143,8 +143,8 @@ char *convertUIToURL(struct iurlinfo *ui) {
/* extraHeaders only applicable for http and used for pulling ks from http */
/* see ftp.c:httpGetFileDesc() for details */
/* set to NULL if not needed */
-int urlinstStartTransfer(struct iurlinfo * ui, char * filename, char *extraHeaders,
- int silentErrors) {
+int urlinstStartTransfer(struct iurlinfo * ui, char * filename,
+ char *extraHeaders, int silentErrors) {
char * buf;
int fd;
char * finalPrefix;
@@ -265,8 +265,10 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol,
newtTextboxSetText(text, reflowedText);
free(reflowedText);
- siteEntry = newtEntry(22, 8, site, 24, &site, NEWT_ENTRY_SCROLL);
- dirEntry = newtEntry(22, 9, dir, 24, &dir, NEWT_ENTRY_SCROLL);
+ siteEntry = newtEntry(22, 8, site, 24, (const char **) &site,
+ NEWT_ENTRY_SCROLL);
+ dirEntry = newtEntry(22, 9, dir, 24, (const char **) &dir,
+ NEWT_ENTRY_SCROLL);
entryGrid = newtCreateGrid(2, 2);
newtGridSetField(entryGrid, 0, 0, NEWT_GRID_COMPONENT,
@@ -407,14 +409,15 @@ int urlSecondarySetupPanel(struct iurlinfo * ui, urlprotocol protocol) {
free(reflowedText);
if (protocol == URL_METHOD_FTP) {
- accountEntry = newtEntry(-1, -1, NULL, 24, &account,
+ accountEntry = newtEntry(-1, -1, NULL, 24, (const char **) &account,
NEWT_FLAG_SCROLL);
- passwordEntry = newtEntry(-1, -1, NULL, 24, &password,
+ passwordEntry = newtEntry(-1, -1, NULL, 24, (const char **) &password,
NEWT_FLAG_SCROLL | NEWT_FLAG_PASSWORD);
}
- proxyEntry = newtEntry(-1, -1, ui->proxy, 24, &proxy, NEWT_ENTRY_SCROLL);
- proxyPortEntry = newtEntry(-1, -1, ui->proxyPort, 6, &proxyPort,
- NEWT_FLAG_SCROLL);
+ proxyEntry = newtEntry(-1, -1, ui->proxy, 24, (const char **) &proxy,
+ NEWT_ENTRY_SCROLL);
+ proxyPortEntry = newtEntry(-1, -1, ui->proxyPort, 6,
+ (const char **) &proxyPort, NEWT_FLAG_SCROLL);
entryGrid = newtCreateGrid(2, 4);
if (protocol == URL_METHOD_FTP) {