diff options
-rw-r--r-- | Makefile.inc | 4 | ||||
-rw-r--r-- | isys/isys.c | 12 | ||||
-rw-r--r-- | isys/isys.py | 20 | ||||
-rw-r--r-- | isys/nfsmount.c | 4 | ||||
-rw-r--r-- | isys/smp.c | 76 | ||||
-rw-r--r-- | isys/smp.h | 1 | ||||
-rw-r--r-- | loader/Makefile | 9 | ||||
-rw-r--r-- | loader/devices.c | 6 | ||||
-rw-r--r-- | loader/dietstubs.c | 6 | ||||
-rw-r--r-- | loader/ftp.c | 2 | ||||
-rw-r--r-- | loader/lang.c | 28 | ||||
-rw-r--r-- | loader/loader.c | 199 | ||||
-rw-r--r-- | loader/mediacheck.c | 2 | ||||
-rw-r--r-- | loader/misc.c | 25 | ||||
-rw-r--r-- | loader/misc.h | 3 | ||||
-rw-r--r-- | loader/module-info | 16 | ||||
-rw-r--r-- | loader/modules.c | 6 | ||||
-rw-r--r-- | loader/net.c | 39 | ||||
-rw-r--r-- | loader/net.h | 1 | ||||
-rw-r--r-- | loader/urls.c | 27 |
20 files changed, 328 insertions, 158 deletions
diff --git a/Makefile.inc b/Makefile.inc index d236fb8d2..3489a8268 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -16,3 +16,7 @@ ARCH := $(patsubst sparc%,sparc,$(ARCH)) # JAPANESE=1 +# define product name to be imported into the loader and anywhere else +# that needs the proper name of the product +PRODUCTNAME="Red Hat Linux" + diff --git a/isys/isys.c b/isys/isys.c index 9016f0509..7705fa49c 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -62,6 +62,7 @@ static PyObject * getModuleList(PyObject * s, PyObject * args); static PyObject * makeDevInode(PyObject * s, PyObject * args); static PyObject * doMknod(PyObject * s, PyObject * args); static PyObject * smpAvailable(PyObject * s, PyObject * args); +static PyObject * htAvailable(PyObject * s, PyObject * args); static PyObject * createProbedList(PyObject * s, PyObject * args); static PyObject * doChroot(PyObject * s, PyObject * args); static PyObject * doCheckBoot(PyObject * s, PyObject * args); @@ -127,6 +128,7 @@ static PyMethodDef isysModuleMethods[] = { */ { "mount", (PyCFunction) doMount, METH_VARARGS, NULL }, { "smpavailable", (PyCFunction) smpAvailable, METH_VARARGS, NULL }, + { "htavailable", (PyCFunction) htAvailable, METH_VARARGS, NULL }, { "umount", (PyCFunction) doUMount, METH_VARARGS, NULL }, { "confignetdevice", (PyCFunction) doConfigNetDevice, METH_VARARGS, NULL }, { "pumpnetdevice", (PyCFunction) doPumpNetDevice, METH_VARARGS, NULL }, @@ -764,11 +766,17 @@ static PyObject * smpAvailable(PyObject * s, PyObject * args) { if (!PyArg_ParseTuple(args, "")) return NULL; - result = detectSMP(); - return Py_BuildValue("i", detectSMP()); } +static PyObject * htAvailable(PyObject * s, PyObject * args) { + int result; + + if (!PyArg_ParseTuple(args, "")) return NULL; + + return Py_BuildValue("i", detectHT()); +} + void init_isys(void) { PyObject * m, * d; diff --git a/isys/isys.py b/isys/isys.py index a02bd4831..6cb874901 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -51,8 +51,9 @@ def raidstop(mdDevice): os.remove("/tmp/md") try: _isys.raidstop(fd) - finally: - os.close(fd) + except: + pass + os.close(fd) def raidstart(mdDevice, aMember): if raidCount.has_key(mdDevice) and raidCount[mdDevice]: @@ -67,17 +68,20 @@ def raidstart(mdDevice, aMember): os.remove("/tmp/md") try: _isys.raidstart(fd, "/tmp/member") - finally: - os.close(fd) - os.remove("/tmp/member") + except: + pass + os.close(fd) + os.remove("/tmp/member") def raidsb(mdDevice): makeDevInode(mdDevice, "/tmp/md") fd = os.open("/tmp/md", os.O_RDONLY) + rc = 0 try: rc = _isys.getraidsb(fd) - finally: - os.close(fd) + except: + pass + os.close(fd) return rc def losetup(device, file, readOnly = 0): @@ -177,6 +181,8 @@ def umount(what, removeDir = 1): def smpAvailable(): return _isys.smpavailable() +htavailable = _isys.htavailable + def chroot (path): return _isys.chroot (path) diff --git a/isys/nfsmount.c b/isys/nfsmount.c index 9a5624032..1b2ec1cea 100644 --- a/isys/nfsmount.c +++ b/isys/nfsmount.c @@ -600,8 +600,8 @@ int nfsmount(const char *spec, const char *node, int *flags, mountport); if (pm_mnt == NULL) { - fprintf(stderr, "mount: cannot access portmapper on %s: %s\n", - hostname, strerror (errno)); + /* fprintf(stderr, "mount: cannot access portmapper on %s: %s\n", + hostname, strerror (errno));*/ goto fail; } diff --git a/isys/smp.c b/isys/smp.c index 7559ea6d4..dc6213324 100644 --- a/isys/smp.c +++ b/isys/smp.c @@ -13,6 +13,7 @@ #include <sys/mman.h> #include <string.h> #include <errno.h> +#include <sys/types.h> #ifdef DIET typedef unsigned short u_short; @@ -255,28 +256,7 @@ static int intelDetectSMP(void) mpfps_t mpfps; int rc = 0; int ncpus = 0; - FILE *f; - - f = fopen("/proc/cpuinfo", "r"); - if (f) { - char buff[1024]; - - while (fgets (buff, 1024, f) != NULL) { - if (!strncmp (buff, "flags\t\t:", 8)) { - if (strstr(buff, " ht ") || - /* buff includes \n, so back up 4 bytes from the end - and check there too to catch the end case */ - !strncmp(buff + strlen(buff) - 4, " ht", 3)) { - rc = 1; - } - break; - } - } - fclose(f); - } - if (rc) - return 1; - + /* open physical memory for access to MP structures */ if ( (pfd = open( "/dev/mem", O_RDONLY )) < 0 ) { return 0; @@ -510,6 +490,58 @@ readEntry( void* entry, int size ) } } +#endif /* __i386__ */ + +#ifdef __i386__ + +static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) +{ + __asm__("pushl %%ebx; cpuid; movl %%ebx,%1; popl %%ebx" + : "=a"(*eax), "=g"(*ebx), "=&c"(*ecx), "=&d"(*edx) + : "a" (op)); +} + +int detectHT(void) +{ + FILE *f; + int htflag = 0; + unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0; + int smp_num_siblings = 0; + + f = fopen("/proc/cpuinfo", "r"); + if (f) { + char buff[1024]; + + while (fgets (buff, 1024, f) != NULL) { + if (!strncmp (buff, "flags\t\t:", 8)) { + if (strstr(buff, " ht ") || + /* buff includes \n, so back up 4 bytes from the end + and check there too to catch the end case */ + !strncmp(buff + strlen(buff) - 4, " ht", 3)) { + htflag = 1; + } + break; + } + } + fclose(f); + } + if (!htflag) + return 0; + + cpuid(1, &eax, &ebx, &ecx, &edx); + smp_num_siblings = (ebx & 0xff0000) >> 16; + + if (smp_num_siblings == 2) + return 1; + return 0; +} + +#else /* ndef __i386__ */ + +int detectHT(void) +{ + return 0; +} #endif /* __i386__ */ diff --git a/isys/smp.h b/isys/smp.h index 3255cc489..e03726826 100644 --- a/isys/smp.h +++ b/isys/smp.h @@ -2,5 +2,6 @@ #define SMP_H int detectSMP(void); +int detectHT(void); #endif /* SMP_H */ diff --git a/loader/Makefile b/loader/Makefile index ff57dafdc..cda952618 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -4,7 +4,7 @@ VERSION = 7.2 DESTDIR = ../../trees/initrd -OBJS = log.o windows.o modules.o devices.o cdrom.o urls.o kickstart.o lang.o \ +OBJS = log.o windows.o modules.o devices.o cdrom.o kickstart.o lang.o \ misc.o ftp.o md5.o mediacheck.o moduledeps.o SLANGLIB = -lslang @@ -19,7 +19,7 @@ LOADEROBJS = loader.o loader-pcmcia.o popen.o SOURCES = $(subst .o,.c,$(OBJS)) loader.c BINS = init DIRS = -NETOBJS = net.o telnet.o telnetd.o +NETOBJS = net.o urls.o telnet.o telnetd.o PCMCIAOBJS = pcmcia.o $(NETOBJS) OPTS = -Os DEBUG = -g @@ -28,7 +28,7 @@ MODULELINKAGE :=-lmodutils -lmodutilutil -lmodutilobj COPTS = $(DEBUG) -Wall -DVERSION='"$(VERSION)"' -CFLAGS = $(COPTS) $(OPTS) -ffunction-sections -D_GNU_SOURCE=1 -I/usr/include/kudzu -I/usr/include/rpm -I.. -DHAVE_LIBIO_H -ggdb -DGZLIB=1 +CFLAGS = $(COPTS) $(OPTS) -ffunction-sections -D_GNU_SOURCE=1 -I/usr/include/kudzu -I/usr/include/rpm -I.. -DHAVE_LIBIO_H -ggdb -DPRODUCTNAME='$(PRODUCTNAME)' -DGZLIB=1 ALLOBJS = $(OBJS) $(PCMCIAOBJS) @@ -135,9 +135,6 @@ install: all done install -m 644 loader.tr $(DESTDIR)/$(RUNTIMEDIR)/loader install -m 644 module-info $(DESTDIR)/$(RUNTIMEDIR)/loader - for n in $(S390FILES); do \ - install -m 755 s390/$$n $(DESTDIR)/$(RUNTIMEDIR)/loader; \ - done install -m 644 kon.cfg $(DESTDIR)/$(RUNTIMEDIR)/loader install -m 644 minikon.fnt $(DESTDIR)/$(RUNTIMEDIR)/loader diff --git a/loader/devices.c b/loader/devices.c index fbf3d924f..01913754a 100644 --- a/loader/devices.c +++ b/loader/devices.c @@ -264,7 +264,7 @@ int devLoadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded, "/tmp/drivers", ddi)) newtWinMessage(_("Error"), _("OK"), _("The floppy disk you inserted is not a valid driver disk " - "for this release of Red Hat Linux.")); + "for this release of %s."), PRODUCTNAME); else done = 1; @@ -339,7 +339,7 @@ static int pickModule(moduleInfoSet modInfo, enum driverMajor type, newtFormAddHotKey(form, NEWT_KEY_F2); for (i = 0; i < numSorted; i++) { - char buf[80]; + char buf[1024]; int num = sortedOrder[i].index; snprintf (buf, sizeof(buf), "%s (%s)", @@ -437,7 +437,7 @@ int devDeviceMenu(enum driverMajor type, moduleInfoSet modInfo, void ddReadDriverDiskModInfo(moduleInfoSet modInfo) { int num = 0; - char fileName[80]; + char fileName[1024]; struct stat sb; FILE * f; struct driverDiskInfo * ddi; diff --git a/loader/dietstubs.c b/loader/dietstubs.c index 0c2f8cacc..008dbaef4 100644 --- a/loader/dietstubs.c +++ b/loader/dietstubs.c @@ -102,12 +102,6 @@ void __assert_fail (__const char *__assertion, __const char *__file, abort(); } -long long llseek(int fd, long long offest, int whence); - -long long lseek64(int fd, long long offset, int whence) { - return llseek(fd, offset, whence); -} - int _setjmp(jmp_buf buf) { return setjmp(buf); } diff --git a/loader/ftp.c b/loader/ftp.c index 2356f418c..728cc9db8 100644 --- a/loader/ftp.c +++ b/loader/ftp.c @@ -440,7 +440,7 @@ int httpGetFileDesc(char * hostname, int port, char * remotename) { } buf = alloca(strlen(remotename) + strlen(hostname) + 25); - sprintf(buf, "GET %s HTTP/1.1\t\nHost: %s\r\n\r\n", remotename, hostname); + sprintf(buf, "GET %s HTTP/1.0\t\nHost: %s\r\n\r\n", remotename, hostname); write(sock, buf, strlen(buf)); /* This is fun; read the response a character at a time until we: diff --git a/loader/lang.c b/loader/lang.c index f03bce727..98d6ed189 100644 --- a/loader/lang.c +++ b/loader/lang.c @@ -38,7 +38,7 @@ struct aString { struct aString * strings = NULL; int numStrings = 0, allocedStrings = 0; -static char * topLineWelcome = N_("Welcome to Red Hat Linux"); +static char * topLineWelcome = N_("Welcome to %s"); static char * bottomHelpLine = N_(" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen "); static int aStringCmp(const void * a, const void * b) { @@ -272,6 +272,7 @@ int chooseLanguage(char ** lang, int flags) { char * currentLangName = getenv("LANG"); int numLangs = 0; char * langPicked; + char * buf; if (!languages) loadLanguageList(flags); @@ -281,8 +282,6 @@ int chooseLanguage(char ** lang, int flags) { /* If we're running in kon, only offer languages which use the Kon or default8x16 fonts. Don't display languages which require Kon font if we have no way of providing it. */ - if (!haveKon && !strcmp(languages[i].font, "Kon")) - continue; if (continuing && strcmp(languages[i].font, "Kon") && continuing && strcmp(languages[i].font, "default8x16")) continue; @@ -303,8 +302,9 @@ int chooseLanguage(char ** lang, int flags) { else choice = english; - newtWinMenu(_("Choose a Language"), _("What language should be used " - "during the installation process?"), 40, 5, 5, 8, + newtWinMenu(_("Choose a Language"), + _("What language would you like to use during the " + "installation process?"), 40, 5, 5, 8, langs, &choice, _("OK"), NULL); langPicked = langs[choice]; @@ -320,6 +320,7 @@ int chooseLanguage(char ** lang, int flags) { if (i == numLanguages) abort(); if (!strncmp(languages[choice].key, "en", 2)) { + char *buf; /* stick with the default (English) */ unsetenv("LANG"); unsetenv("LANGKEY"); @@ -329,8 +330,9 @@ int chooseLanguage(char ** lang, int flags) { free(strings), strings = NULL; numStrings = allocedStrings = 0; } - - newtDrawRootText(0, 0, _(topLineWelcome)); + buf = sdupprintf(_(topLineWelcome), PRODUCTNAME); + newtDrawRootText(0, 0, buf); + free(buf); newtPushHelpLine(_(bottomHelpLine)); return 0; @@ -371,20 +373,24 @@ int chooseLanguage(char ** lang, int flags) { /* load the language only if it is displayable */ /* If we need kon and have it, or if it's not kon or none, load the lang */ - if ((strcmp(languages[choice].font, "None"))) { - loadLanguage (NULL, flags); - } else { + if ((!strcmp(languages[choice].font, "None")) || + ((!strcmp(languages[choice].font, "Kon")) && (!haveKon))) { newtWinMessage("Language Unavailable", "OK", "%s display is unavailable in text mode. The " "installation will continue in English until the " "display of %s is possible.", languages[choice].lang, languages[choice].lang); + } else { + loadLanguage (NULL, flags); } if (languages[choice].map) loadFont(languages[choice].map, flags); - newtDrawRootText(0, 0, _(topLineWelcome)); + + buf = sdupprintf(_(topLineWelcome), PRODUCTNAME); + newtDrawRootText(0, 0, buf); + free(buf); newtPushHelpLine(_(bottomHelpLine)); return 0; diff --git a/loader/loader.c b/loader/loader.c index 8371092ae..8e42b7643 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -42,6 +42,7 @@ #include <sys/utsname.h> #include <unistd.h> #include <sys/vt.h> +#include <linux/fb.h> #if defined(__i386__) || defined(__ia64__) || defined(__alpha__) #include <linux/cdrom.h> @@ -88,6 +89,7 @@ static int mountLoopback(char * fsystem, char * mntpoint, char * device); static int umountLoopback(char * mntpoint, char * device); int copyDirectory(char * from, char * to); static char * mediaCheckISODir(char *path); +static void useMntSourceUpdates(char * path); #if defined(__ia64__) static char * floppyDevice = "hda"; @@ -192,9 +194,11 @@ static int setupRamdisk(void) { void startNewt(int flags) { if (!newtRunning) { + char *buf = sdupprintf(_("Welcome to %s"), PRODUCTNAME); newtInit(); newtCls(); - newtDrawRootText(0, 0, _("Welcome to Red Hat Linux")); + newtDrawRootText(0, 0, buf); + free(buf); newtPushHelpLine(_(" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen ")); @@ -525,7 +529,7 @@ char * validIsoImages(char * dirName) { #ifdef INCLUDE_LOCAL static int loadLocalImages(char * prefix, char * dir, int flags, char * device, char * mntpoint) { - int fd, rc, fd2; + int fd, rc; char * path; /* In a kind world, this would do nothing more then mount a ramfs @@ -545,15 +549,7 @@ static int loadLocalImages(char * prefix, char * dir, int flags, /* handle updates.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/updates.img", prefix, dir ? dir : ""); - if ((fd2 = open(path, O_RDONLY)) >= 0) { - if (!setupStage2Image(fd2, "/tmp/ramfs/updates-disk.img", flags, - "loop7", "/tmp/update-disk")) { - copyDirectory("/tmp/update-disk", "/tmp/updates"); - umountLoopback("/tmp/update-disk", "loop7"); - unlink("/tmp/ramfs/updates-disk.img"); - } - close(fd2); - } + useMntSourceUpdates(path); rc = setupStage2Image(fd, "/tmp/ramfs/hdstg1.img", flags, device, mntpoint); @@ -584,6 +580,14 @@ static char * setupIsoImages(char * device, char * type, char * dirName, path = validIsoImages(filespec); if (path) { + char * updatesPath; + + /* handle updates.img now before we copy stage2 over... this allows + * us to keep our ramdisk size as small as possible */ + updatesPath = alloca(50 + strlen(filespec)); + sprintf(updatesPath, "%s/updates.img", filespec); + useMntSourceUpdates(updatesPath); + rc = mountLoopback(path, "/tmp/loopimage", "loop0"); if (!rc) { rc = loadLocalImages("/tmp/loopimage", "/", flags, "loop1", @@ -596,7 +600,7 @@ static char * setupIsoImages(char * device, char * type, char * dirName, } } - umount("/tmp/loopimage"); + umountLoopback("/tmp/loopimage", "loop0"); if (!FL_KICKSTART(flags) && FL_MEDIACHECK(flags)) mediaCheckISODir("/mnt/source"); @@ -777,16 +781,14 @@ static int totalMemory(void) { return total; } -/* try to grab an updates.img from /mnt/source/RedHat/base/ - * XXX hard coded locations suck. oh well +/* try to use the provided updates.img at path */ -static void useMntSourceUpdates() { - if (!access("/mnt/source/RedHat/base/updates.img", R_OK)) { - if (!mountLoopback("/mnt/source/RedHat/base/updates.img", +static void useMntSourceUpdates(char * path) { + if (!access(path, R_OK)) { + if (!mountLoopback(path, "/tmp/update-disk", "loop7")) { copyDirectory("/tmp/update-disk", "/tmp/updates"); umountLoopback("/tmp/update-disk", "loop7"); - unlink("/tmp/ramfs/update-disk.img"); } } } @@ -963,6 +965,7 @@ static char * mountHardDrive(struct installMethod * method, char * tmpDir; char * type; char * url = NULL; + char * buf; int numPartitions; #ifdef __sparc__ static int ufsloaded; @@ -1066,16 +1069,17 @@ static char * mountHardDrive(struct installMethod * method, #endif - text = newtTextboxReflowed(-1, -1, - _("What partition and directory on that partition hold the " - "CD (iso9660) images for Red Hat Linux? If you don't " - "see the disk drive you're using listed here, press F2 " - "to configure additional devices."), 62, 5, 5, 0); - + buf = sdupprintf(_("What partition and directory on that " + "partition hold the CD (iso9660) images " + "for %s? If you don't see the disk drive " + "you're using listed here, press F2 " + "to configure additional devices."), PRODUCTNAME); + text = newtTextboxReflowed(-1, -1, buf, 62, 5, 5, 0); + free(buf); + listbox = newtListbox(-1, -1, numPartitions > 5 ? 5 : numPartitions, NEWT_FLAG_RETURNEXIT | - (numPartitions > 5 ? NEWT_FLAG_SCROLL : 0) - ); + (numPartitions > 5 ? NEWT_FLAG_SCROLL : 0)); for (i = 0; i < numPartitions; i++) newtListboxAppendEntry(listbox, partitions[i].name, @@ -1191,10 +1195,7 @@ static char * mediaCheckCdrom(char *cddriver) { first = 1; do { - char *descr; - - descr = getReleaseDescriptorFromIso("/tmp/cdrom"); - + char *descr=NULL; /* if first time through, see if they want to eject the CD */ /* currently in the drive (most likely the CD they booted from) */ /* and test a different disk. Otherwise just test the disk in */ @@ -1208,10 +1209,13 @@ static char * mediaCheckCdrom(char *cddriver) { "insert another for testing."), _("Test"), _("Eject CD")); - if (rc == 1) + if (rc == 1) { + descr = getReleaseDescriptorFromIso("/tmp/cdrom"); mediaCheckFile("/tmp/cdrom", descr); + } } else { + descr = getReleaseDescriptorFromIso("/tmp/cdrom"); mediaCheckFile("/tmp/cdrom", descr); } @@ -1242,10 +1246,12 @@ static char * mediaCheckCdrom(char *cddriver) { } static void wrongCDMessage(void) { - newtWinMessage(_("Error"), _("OK"), - _("The Red Hat Linux CD was not found " - "in any of your CDROM drives. Please insert " - "the Red Hat Linux CD and press %s to retry."), _("OK")); + char *buf = sdupprintf(_("The %s CD was not found " + "in any of your CDROM drives. Please insert " + "the %s CD and press %s to retry."), PRODUCTNAME, + PRODUCTNAME, _("OK")); + newtWinMessage(_("Error"), _("OK"), buf, _("OK")); + free(buf); } /* put mounts back and continue */ @@ -1328,7 +1334,7 @@ static char * setupCdrom(struct installMethod * method, NULL)) { /* if probe quickly, then we're looking for a kickstart config * and should just return if we can mount it */ - if (probeQuickly) { + if (probeQuickly && !needRedHatCD) { buf = malloc(200); sprintf(buf, "cdrom://%s/mnt/source", kd->known[i].name); return buf; @@ -1338,7 +1344,7 @@ static char * setupCdrom(struct installMethod * method, !access("/mnt/source/RedHat/base/stage2.img", R_OK)) { if (!mountLoopback("/mnt/source/RedHat/base/stage2.img", "/mnt/runtime", "loop0")) { - useMntSourceUpdates(); + useMntSourceUpdates("/mnt/source/RedHat/base/updates.img"); buf = malloc(200); sprintf(buf, "cdrom://%s/mnt/source", kd->known[i].name); @@ -1354,10 +1360,12 @@ static char * setupCdrom(struct installMethod * method, if (probeQuickly) return NULL; if (hasCdrom) { - rc = newtWinChoice(_("Error"), _("OK"), _("Back"), - _("The Red Hat Linux CD was not found " - "in any of your CDROM drives. Please insert " - "the Red Hat Linux CD and press %s to retry."), _("OK")); + char *buf = sdupprintf(_("The %s CD was not found in any of your " + "CDROM drives. Please insert the %s CD " + "and press %s to retry."), PRODUCTNAME, + PRODUCTNAME, _("OK")); + rc = newtWinChoice(_("Error"), _("OK"), _("Back"), buf, _("OK")); + free(buf); if (rc == 2) return NULL; } else { rc = setupCDdevice(kd, modInfo, modLoaded, modDepsPtr, @@ -1541,12 +1549,12 @@ static char * mountNfsImage(struct installMethod * method, "/mnt/runtime", "loop0")) { rmdir("/mnt/source"); symlink("/mnt/source", "/mnt/source"); - useMntSourceUpdates(); + useMntSourceUpdates("/mnt/source/RedHat/base/updates.img"); stage = NFS_STAGE_DONE; url = "nfs://mnt/source/."; } } else if ((path = validIsoImages("/mnt/source"))) { - useMntSourceUpdates(); + useMntSourceUpdates("/mnt/source/updates.img"); if (mountLoopback(path, "/mnt/source2", "loop1")) logMessage("failed to mount iso loopback!"); @@ -1555,6 +1563,7 @@ static char * mountNfsImage(struct installMethod * method, "/mnt/runtime", "loop0")) { logMessage("failed to mount install loopback!"); } else { + useMntSourceUpdates("/mnt/source/RedHat/base/updates.img"); stage = NFS_STAGE_DONE; url = "nfsiso:/mnt/source"; if (!FL_KICKSTART(flags) && FL_MEDIACHECK(flags)) @@ -2139,7 +2148,7 @@ static char * setupKickstart(char * location, struct knownDevices * kd, char * chptr; static struct networkDeviceConfig netDev; char * host = NULL, * url = NULL, * proxy = NULL, * proxyport = NULL; - char * fullPath; + char * fullPath, *isopath; struct poptOption ksNfsOptions[] = { { "server", '\0', POPT_ARG_STRING, &host, 0 }, @@ -2259,13 +2268,37 @@ static char * setupKickstart(char * location, struct knownDevices * kd, if (count == 3) return NULL; - if (mountLoopback("/mnt/source/RedHat/base/stage2.img", - "/mnt/runtime", "loop0")) { + if (!access("/mnt/source/RedHat/base/stage2.img", R_OK)) { + if (!mountLoopback("/mnt/source/RedHat/base/stage2.img", + "/mnt/runtime", "loop0")) { + rmdir("/mnt/source"); + symlink("/mnt/source", "/mnt/source"); + useMntSourceUpdates("/mnt/source/RedHat/base/updates.img"); + imageUrl = "nfs://mnt/source/."; + } + } else if ((isopath = validIsoImages("/mnt/source"))) { + useMntSourceUpdates("/mnt/source/updates.img"); + + if (mountLoopback(isopath, "/mnt/source2", "loop1")) + logMessage("failed to mount iso loopback!"); + else { + if (mountLoopback("/mnt/source2/RedHat/base/stage2.img", + "/mnt/runtime", "loop0")) + logMessage("failed to mount install loopback!"); + else { + useMntSourceUpdates("/mnt/source2/RedHat/base/updates.img"); + imageUrl = "nfsiso:/mnt/source"; + } + } + } else { + logMessage("No valid tree or isos found in %s", fullPath); umount("/mnt/source"); return NULL; } - - imageUrl = "nfs://mnt/source/."; + + if (!imageUrl) + return NULL; + } else if (ksType == KS_CMD_URL) { memset(&ui, 0, sizeof(ui)); @@ -2323,26 +2356,42 @@ static char * setupKickstart(char * location, struct knownDevices * kd, imageUrl = setupCdrom(NULL, location, kd, modInfo, modLoaded, modDepsPtr, flags, 1, 1); } else if (ksType == KS_CMD_HD) { + char *hdfstypes[]={"ext2", "vfat", "ufs", NULL}; + int i; + if (!strncmp(partname, "/dev/", 5)) partname += 5; logMessage("partname is %s", partname); - imageUrl = setupOldHardDrive(partname, "ext2", dir, flags); - if (!imageUrl) - imageUrl = setupOldHardDrive(partname, "vfat", dir, flags); - if (!imageUrl) - imageUrl = setupOldHardDrive(partname, "ufs", dir, flags); + for (i=0; hdfstypes[i]; i++) { + logMessage("Trying to find hdtree %s %s %s", partname, hdfstypes[i], dir); + imageUrl = setupOldHardDrive(partname, hdfstypes[i], dir, flags); + if (imageUrl) + break; + } + + if (!imageUrl) { + for (i=0; hdfstypes[i]; i++) { + logMessage("Trying to find hdiso %s %s %s", partname, hdfstypes[i], dir); + imageUrl = setupIsoImages(partname, hdfstypes[i], dir, flags); + if (imageUrl) { + logMessage("returned imageUrl = %s", imageUrl); + break; + } + } + } + if (!imageUrl) logMessage ("Failed to mount hd kickstart media"); } #endif - return imageUrl; + return imageUrl; } static int parseCmdLineFlags(int flags, char * cmdLine, char ** ksSource, - char ** ksDevice, char ** instClass) { + char ** ksDevice, char ** instClass, char **xres) { int fd; char buf[500]; int len; @@ -2438,6 +2487,8 @@ static int parseCmdLineFlags(int flags, char * cmdLine, char ** ksSource, setLanguage (argv[i] + 5, flags); defaultLang = 1; #endif + } else if (!strncasecmp(argv[i], "resolution=", 11)) { + *xres = argv[i]+11; } } @@ -2658,6 +2709,7 @@ int kickstartFromHardDrive(char * location, int kickstartFromFloppy(char * location, moduleList modLoaded, moduleDeps * modDepsPtr, int flags) { + if (devMakeInode(floppyDevice, "/tmp/floppy")) return 1; @@ -2768,7 +2820,7 @@ void loadUpdates(struct knownDevices *kd, moduleList modLoaded, #if 0 _("The floppy disk you inserted is not a valid update disk " - "for this release of Red Hat Linux.") + "for this release of %s."), PRODUCTNAME #endif logMessage("UPDATES floppy device is %s", floppyDevice); @@ -2995,9 +3047,12 @@ static void ideSetup(moduleList modLoaded, moduleDeps modDeps, static void checkForRam(int flags) { if (!FL_EXPERT(flags) && (totalMemory() < MIN_RAM)) { + char *buf; + buf = sdupprintf(_("You do not have enough RAM to install %s " + "on this machine."), PRODUCTNAME); startNewt(flags); - newtWinMessage(_("Error"), _("OK"), _("You do not have enough " - "RAM to install Red Hat Linux on this machine.")); + newtWinMessage(_("Error"), _("OK"), buf); + free(buf); stopNewt(); exit(0); } @@ -3038,6 +3093,22 @@ static void verifyImagesMatched() { } } +static int checkFrameBuffer() { + int fd; + int rc = 0; + struct fb_fix_screeninfo fix; + + if ((fd = open("/dev/fb0", O_RDONLY)) == -1) { + return 0; + } + + if (ioctl(fd, FBIOGET_FSCREENINFO, &fix) >= 0) { + rc = 1; + } + close(fd); + return rc; +} + int main(int argc, char ** argv) { char ** argptr; @@ -3066,10 +3137,12 @@ int main(int argc, char ** argv) { char twelve = 12; char * ksFile = NULL, * ksSource = NULL; char * ksNetDevice = NULL; + char * xres = NULL; struct stat sb; struct poptOption optionTable[] = { { "cmdline", '\0', POPT_ARG_STRING, &cmdLine, 0 }, { "ksfile", '\0', POPT_ARG_STRING, &ksFile, 0 }, + { "resolution", '\0', POPT_ARG_STRING, &xres, 0}, { "probe", '\0', POPT_ARG_NONE, &probeOnly, 0 }, { "test", '\0', POPT_ARG_NONE, &testing, 0 }, { "mediacheck", '\0', POPT_ARG_NONE, &mediacheck, 0}, @@ -3146,13 +3219,16 @@ int main(int argc, char ** argv) { if (testing) flags |= LOADER_FLAGS_TESTING; if (mediacheck) flags |= LOADER_FLAGS_MEDIACHECK; + /* we can't do kon on fb console (#60844) */ + if (checkFrameBuffer() == 1) haveKon = 0; + #if defined (__s390__) && !defined (__s390x__) flags |= LOADER_FLAGS_NOSHELL | LOADER_FLAGS_NOUSB; #endif flags = parseCmdLineFlags(flags, cmdLine, &ksSource, &ksNetDevice, - &instClass); + &instClass, &xres); if (FL_SERIAL(flags) && !getenv("DISPLAY")) flags |= LOADER_FLAGS_TEXT; @@ -3533,6 +3609,11 @@ int main(int argc, char ** argv) { argptr++; } + if (xres) { + *argptr++ = "--resolution"; + *argptr++ = xres; + } + for (i = 0; i < modLoaded->numModules; i++) { if (!modLoaded->mods[i].path) continue; diff --git a/loader/mediacheck.c b/loader/mediacheck.c index f4be7fd2c..969299db9 100644 --- a/loader/mediacheck.c +++ b/loader/mediacheck.c @@ -20,7 +20,7 @@ #define MIN(x, y) ((x < y) ? x : y) /* number of sectors to ignore at end of iso when computing sum */ -#define SKIPSECTORS 15 +#define SKIPSECTORS 150 typedef void (*checkCallback)(void *, long long offset); diff --git a/loader/misc.c b/loader/misc.c index 059197419..242305ba3 100644 --- a/loader/misc.c +++ b/loader/misc.c @@ -2,6 +2,8 @@ #include <fcntl.h> #include <string.h> #include <unistd.h> +#include <stdarg.h> +#include <stdlib.h> #include "log.h" @@ -66,3 +68,26 @@ int simpleStringCmp(const void * a, const void * b) { return strcmp(first, second); } +char * sdupprintf(const char *format, ...) { + char *buf = NULL; + char c; + va_list args; + size_t size = 0; + + va_start(args, format); + + /* XXX requires C99 vsnprintf behavior */ + size = vsnprintf(&c, 1, format, args) + 1; + if (size == -1) { + printf("ERROR: vsnprintf behavior is not C99\n"); + abort(); + } + + buf = malloc(size); + if (buf == NULL) + return NULL; + vsnprintf(buf, size, format, args); + va_end (args); + + return buf; +} diff --git a/loader/misc.h b/loader/misc.h index 2958b4038..3e673d6e5 100644 --- a/loader/misc.h +++ b/loader/misc.h @@ -1,9 +1,12 @@ #ifndef H_LOADER_MISC_H #define H_LOADER_MISC_H +#include <stdio.h> +#include <stdarg.h> int copyFile(char * source, char * dest); int copyFileFd(int infd, char * dest); char * readLine(FILE * f); int simpleStringCmp(const void * a, const void * b); +char * sdupprintf(const char *format, ...); #endif diff --git a/loader/module-info b/loader/module-info index 6d3fc5d1b..a110251cd 100644 --- a/loader/module-info +++ b/loader/module-info @@ -433,6 +433,10 @@ sunqe eth "Sun Quad Ethernet" +tg3 + eth + "Broadcom Tigon3 ethernet driver" + tlan eth "ThunderLAN" @@ -563,6 +567,10 @@ aic7xxx_mod scsi_hostadapter "New (experimental) Adaptec 28xx, 29xx, 39xx" +aic7xxx_old + scsi_hostadapter + "Old Adaptec 28xx, 29xx, 39xx" + atp870u scsi_hostadapter "ACARD ATP870U PCI scsi controller" @@ -655,6 +663,14 @@ megaraid scsi_hostadapter "MegaRAID 418, 428, 438, 466, 762" +mptbase + scsi_hostadapter + "LSI Logic Fusion MPT Base Driver" + +mptscsih + scsi_hostadapter + "LSI Logic Fusion MPT SCSI Driver" + ncr53c8xx scsi_hostadapter "Symbios/NCR 53C8xx" diff --git a/loader/modules.c b/loader/modules.c index ffb0fc536..58671ca47 100644 --- a/loader/modules.c +++ b/loader/modules.c @@ -475,7 +475,6 @@ static struct extractedModule * extractModules (struct driverDiskInfo * ddi, free(ballPath); return NULL; } - free(ballPath); for (m = modNames, i = 0; *m; i++, m++); @@ -501,6 +500,7 @@ static struct extractedModule * extractModules (struct driverDiskInfo * ddi, /* nothing to do */ if (!numMaps) { gunzip_close(fd); + free(ballPath); return oldPaths; } @@ -526,6 +526,7 @@ static struct extractedModule * extractModules (struct driverDiskInfo * ddi, } } + free(ballPath); return oldPaths; } @@ -597,6 +598,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, i = 0; if (!paths) { logMessage("no modules found -- aborting insertion"); + return i; i++; } else { *items = '\0'; @@ -684,7 +686,7 @@ int mlModuleInList(const char * modName, moduleList list) { int mlWriteConfModules(moduleList list, int fd) { int i; struct loadedModuleInfo * lm; - char buf[16384], buf2[1024]; + char buf[16384], buf2[512]; int scsiNum; int ethNum; int trNum = 0; diff --git a/loader/net.c b/loader/net.c index e3d677616..e9d7bbde6 100644 --- a/loader/net.c +++ b/loader/net.c @@ -53,9 +53,19 @@ #include "log.h" #include "net.h" #include "windows.h" +#include "misc.h" #endif /* __STANDALONE__ */ +#ifndef __STANDALONE__ +char *netServerPrompt = \ + N_("Please enter the following information:\n" + "\n" + " o the name or IP number of your %s server\n" + " o the directory on that server containing\n" + " %s for your architecture\n"); +#endif + struct intfconfig_s { newtComponent ipEntry, nmEntry, gwEntry, nsEntry; char * ip, * nm, * gw, * ns; @@ -131,12 +141,7 @@ static void ipCallback(newtComponent co, void * dptr) { if (strlen(data->ip) && !strlen(data->nm)) { if (inet_aton(data->ip, &ipaddr)) { ipaddr.s_addr = ntohl(ipaddr.s_addr); - if (((ipaddr.s_addr & 0xFF000000) >> 24) <= 127) - ascii = "255.0.0.0"; - else if (((ipaddr.s_addr & 0xFF000000) >> 24) <= 191) - ascii = "255.255.0.0"; - else - ascii = "255.255.255.0"; + ascii = "255.255.255.0"; newtEntrySet(data->nmEntry, ascii, 1); } } @@ -163,6 +168,7 @@ static void ipCallback(newtComponent co, void * dptr) { #ifndef __STANDALONE__ int nfsGetSetup(char ** hostptr, char ** dirptr) { struct newtWinEntry entries[3]; + char * buf; char * newServer = *hostptr ? strdup(*hostptr) : NULL; char * newDir = *dirptr ? strdup(*dirptr) : NULL; int rc; @@ -175,14 +181,10 @@ int nfsGetSetup(char ** hostptr, char ** dirptr) { entries[1].flags = NEWT_FLAG_SCROLL; entries[2].text = NULL; entries[2].value = NULL; - - rc = newtWinEntries(_("NFS Setup"), - _("Please enter the following information:\n" - "\n" - " o the name or IP number of your NFS server\n" - " o the directory on that server containing\n" - " Red Hat Linux for your architecture"), 60, 5, 15, - 24, entries, _("OK"), _("Back"), NULL); + buf = sdupprintf(_(netServerPrompt), "NFS", PRODUCTNAME); + rc = newtWinEntries(_("NFS Setup"), buf, 60, 5, 15, + 24, entries, _("OK"), _("Back"), NULL); + free(buf); if (rc == 2) { if (newServer) free(newServer); @@ -206,12 +208,7 @@ static void fillInIpInfo(struct networkDeviceConfig * cfg) { if (!(cfg->dev.set & PUMP_INTFINFO_HAS_NETMASK)) { i = (int32 *) &cfg->dev.ip; - if (((*i & 0xFF000000) >> 24) <= 127) - nm = "255.0.0.0"; - else if (((*i & 0xFF000000) >> 24) <= 191) - nm = "255.255.0.0"; - else - nm = "255.255.255.0"; + nm = "255.255.255.0"; inet_aton(nm, &cfg->dev.netmask); cfg->dev.set |= PUMP_INTFINFO_HAS_NETMASK; @@ -296,7 +293,6 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) { struct in_addr addr; char dhcpChoice; char * chptr; - char * env; #if !defined(__s390__) && !defined(__s390x__) text = newtTextboxReflowed(-1, -1, @@ -440,6 +436,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) { } while (i != 2); #else /* s390 now */ + char * env; /* quick and dirty hack by opaukstadt@millenux.com for s390 */ /* ctc stores remoteip in broadcast-field until pump.h is changed */ memset(&newCfg, 0, sizeof(newCfg)); diff --git a/loader/net.h b/loader/net.h index 7b0a987d4..b4e6fd55a 100644 --- a/loader/net.h +++ b/loader/net.h @@ -22,6 +22,7 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev, int findHostAndDomain(struct networkDeviceConfig * dev, int flags); int writeResolvConf(struct networkDeviceConfig * net); #ifndef __STANDALONE__ +extern char *netServerPrompt; int nfsGetSetup(char ** hostptr, char ** dirptr); int kickstartNetwork(char ** devicePtr, struct networkDeviceConfig * netDev, char * bootProto, int flags); diff --git a/loader/urls.c b/loader/urls.c index 52ce537f2..df93dcf43 100644 --- a/loader/urls.c +++ b/loader/urls.c @@ -16,6 +16,8 @@ #include "urls.h" #include "log.h" #include "windows.h" +#include "misc.h" +#include "net.h" #if 0 static const char * urlfilter(const char * u) @@ -115,8 +117,9 @@ int urlinstFinishTransfer(struct iurlinfo * ui, int fd) { return 0; } +#if defined (__s390__) || defined (__s390x__) int setupRemote(struct iurlinfo * ui) { - char *env, *d, *e; + char *env, *d; if (!(env = getenv("RPMSERVER"))) { ui->address = ""; @@ -149,6 +152,7 @@ int setupRemote(struct iurlinfo * ui) { return 0; } +#endif /* #if defined (__s390__) || defined (__s390x__) */ char * addrToIp(char * hostname) { struct in_addr ad; @@ -176,6 +180,7 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol, int width, height; newtGrid entryGrid, buttons, grid; char * chptr; + char * buf; if (ui->address) { site = ui->address; @@ -194,22 +199,14 @@ int urlMainSetupPanel(struct iurlinfo * ui, urlprotocol protocol, switch (protocol) { case URL_METHOD_FTP: - reflowedText = newtReflowText( - _("Please enter the following information:\n" - "\n" - " o the name or IP number of your FTP server\n" - " o the directory on that server containing\n" - " Red Hat Linux for your architecture\n"), - 47, 5, 5, &width, &height); + buf = sdupprintf(_(netServerPrompt), "FTP", PRODUCTNAME); + reflowedText = newtReflowText(buf, 47, 5, 5, &width, &height); + free(buf); break; case URL_METHOD_HTTP: - reflowedText = newtReflowText( - _("Please enter the following information:\n" - "\n" - " o the name or IP number of your web server\n" - " o the directory on that server containing\n" - " Red Hat Linux for your architecure\n"), - 47, 5, 5, &width, &height); + buf = sdupprintf(_(netServerPrompt), "Web", PRODUCTNAME); + reflowedText = newtReflowText(buf, 47, 5, 5, &width, &height); + free(buf); break; } text = newtTextbox(-1, -1, width, height, NEWT_TEXTBOX_WRAP); |