diff options
-rw-r--r-- | collage/Makefile | 2 | ||||
-rw-r--r-- | isys/Makefile | 6 | ||||
-rw-r--r-- | isys/isys.c | 15 | ||||
-rw-r--r-- | isys/probe.c | 30 | ||||
-rw-r--r-- | isys/probe.h | 10 | ||||
-rw-r--r-- | lilo.py | 5 | ||||
-rw-r--r-- | loader/Makefile | 10 | ||||
-rw-r--r-- | loader/cdrom.c | 2 | ||||
-rw-r--r-- | loader/loader.c | 86 | ||||
-rw-r--r-- | rpmmodule/Makefile | 2 | ||||
-rw-r--r-- | text.py | 3 | ||||
-rw-r--r-- | utils/Makefile | 2 |
12 files changed, 84 insertions, 89 deletions
diff --git a/collage/Makefile b/collage/Makefile index 359ce501d..8229c60a0 100644 --- a/collage/Makefile +++ b/collage/Makefile @@ -1,6 +1,6 @@ CFLAGS = -Wall -g LDFLAGS = -g -LOADLIBES = -L../isys -lpopt -lz -lisys -lresolv -lrpm +LOADLIBES = -L../isys -lpopt -lz -lisys -lresolv -lrpm -lbz2 all: collage diff --git a/isys/Makefile b/isys/Makefile index a3ead4a8c..a60ae8d9b 100644 --- a/isys/Makefile +++ b/isys/Makefile @@ -1,9 +1,9 @@ -CFLAGS = -I/usr/include/python1.5 -g +CFLAGS = -I/usr/include/python1.5 -I.. -g OBJECTS = isys.o nfsmount.o dns.o mount_clnt.o mount_xdr.o imount.o \ smp.o moduleinfo.o devnodes.o cpio.o probe.o STATICOBJS = otherinsmod.o -STATICLIBS = pci/libpciprobe.a -LOADLIBES = -lrpm -lresolv -lz -lpci -lpopt +STATICLIBS = ../kudzu/libkudzu.a +LOADLIBES = -lrpm -lbz2 -lresolv -lz -lpci -lpopt SUBDIRS = modutils pci PYTHONLIBDIR = $(DESTDIR)/usr/lib/python1.5/site-packages diff --git a/isys/isys.c b/isys/isys.c index dc93baa4f..b80945da0 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -9,7 +9,6 @@ #include "imount.h" #include "isys.h" -#include "pci/pciprobe.h" #include "probe.h" #include "smp.h" @@ -455,16 +454,13 @@ static PyObject * doReadModInfo(PyObject * s, PyObject * args) { } static PyObject * doPciProbe(PyObject * s, PyObject * args) { - struct pciDevice ** matches, ** item; + struct device ** matches, ** item; PyObject * list; if (!PyArg_ParseTuple(args, "")) return NULL; - /* may as well try <shrug> */ - probePciReadDrivers("isys/pci/pcitable"); - probePciReadDrivers("/etc/pcitable"); + matches = probeDevices(CLASS_UNSPEC,BUS_PCI|BUS_SBUS,PROBE_ALL); - matches = probePci(0, 1); if (!matches) { Py_INCREF(Py_None); return Py_None; @@ -473,6 +469,7 @@ static PyObject * doPciProbe(PyObject * s, PyObject * args) { list = PyList_New(0); for (item = matches; *item; item++) { PyList_Append(list, Py_BuildValue("s", (*item)->driver)); + freeDevice (*item); } free(matches); @@ -682,11 +679,11 @@ static PyObject * probedListSubscript(probedListObject * o, int item) { if (po->list.known[item].model) model = po->list.known[item].model; switch (po->list.known[item].class) { - case DEVICE_CDROM: + case CLASS_CDROM: class = "cdrom"; break; - case DEVICE_DISK: + case CLASS_HD: class = "disk"; break; - case DEVICE_NET: + case CLASS_NETWORK: class = "net"; break; } diff --git a/isys/probe.c b/isys/probe.c index 4b0a9d7ae..567c4afeb 100644 --- a/isys/probe.c +++ b/isys/probe.c @@ -10,8 +10,8 @@ #include "probe.h" static int sortDevices(const void * a, const void * b) { - const struct device * one = a; - const struct device * two = b; + const struct kddevice * one = a; + const struct kddevice * two = b; return strcmp(one->name, two->name); } @@ -25,7 +25,7 @@ static int deviceKnown(struct knownDevices * devices, char * dev) { return 0; } -static void addDevice(struct knownDevices * devices, struct device dev) { +static void addDevice(struct knownDevices * devices, struct kddevice dev) { if (devices->numKnown == devices->numKnownAlloced) { devices->numKnownAlloced += 5; devices->known = realloc(devices->known, @@ -37,7 +37,7 @@ static void addDevice(struct knownDevices * devices, struct device dev) { void kdAddDevice(struct knownDevices * devices, enum deviceClass devClass, char * devName, char * devModel) { - struct device new; + struct kddevice new; new.class = devClass; new.name = devName; @@ -56,7 +56,7 @@ int kdFindNetList(struct knownDevices * devices) { int fd; char buf[1024]; char * start, * end; - struct device newDevice; + struct kddevice newDevice; if ((fd = open("/proc/net/dev", O_RDONLY)) < 0) { fprintf(stderr, "failed to open /proc/net/dev!\n"); @@ -84,7 +84,7 @@ int kdFindNetList(struct knownDevices * devices) { newDevice.name = strdup(start); newDevice.model = NULL; - newDevice.class = DEVICE_NET; + newDevice.class = CLASS_NETWORK; addDevice(devices, newDevice); } @@ -103,7 +103,7 @@ int kdFindIdeList(struct knownDevices * devices) { char path[80]; int fd, i; struct dirent * ent; - struct device device; + struct kddevice device; if (access("/proc/ide", R_OK)) return 0; @@ -121,13 +121,13 @@ int kdFindIdeList(struct knownDevices * devices) { close(fd); path[i - 1] = '\0'; /* chop off trailing \n */ - device.class = DEVICE_UNKNOWN; + device.class = CLASS_UNSPEC; if (!strcmp(path, "cdrom")) - device.class = DEVICE_CDROM; + device.class = CLASS_CDROM; else if (!strcmp(path, "disk")) - device.class = DEVICE_DISK; + device.class = CLASS_HD; - if (device.class != DEVICE_UNKNOWN) { + if (device.class != CLASS_UNSPEC) { device.name = strdup(ent->d_name); sprintf(path, "/proc/ide/%s/model", ent->d_name); @@ -169,7 +169,7 @@ int kdFindScsiList(struct knownDevices * devices) { char driveName = 'a'; char cdromNum = '0'; char tapeNum = '0'; - struct device device; + struct kddevice device; if (access("/proc/scsi/scsi", R_OK)) return 0; @@ -269,13 +269,13 @@ int kdFindScsiList(struct knownDevices * devices) { *typebuf = '\0'; if (strstr(start, "Direct-Access")) { sprintf(typebuf, "sd%c", driveName++); - device.class = DEVICE_DISK; + device.class = CLASS_HD; } else if (strstr(start, "Sequential-Access")) { sprintf(typebuf, "st%c", tapeNum++); - device.class = DEVICE_TAPE; + device.class = CLASS_TAPE; } else if (strstr(start, "CD-ROM")) { sprintf(typebuf, "scd%c", cdromNum++); - device.class = DEVICE_CDROM; + device.class = CLASS_CDROM; } if (*typebuf && !deviceKnown(devices, typebuf)) { diff --git a/isys/probe.h b/isys/probe.h index 4c4c29556..f236a9845 100644 --- a/isys/probe.h +++ b/isys/probe.h @@ -1,16 +1,16 @@ #ifndef H_PROBE #define H_PROBE -struct device { +#include "kudzu/kudzu.h" + +struct kddevice { char * name; /* malloced */ char * model; - enum deviceClass { DEVICE_UNKNOWN, DEVICE_DISK, DEVICE_CDROM, DEVICE_NET, - DEVICE_TAPE } - class; + enum deviceClass class; }; struct knownDevices { - struct device * known; + struct kddevice * known; int numKnown; int numKnownAlloced; }; @@ -2,8 +2,7 @@ import string import os class LiloConfiguration: - - def __repr__(self, tab = 0): + def __repr__ (self, tab = 0): s = "" for n in self.order: if (tab): @@ -44,7 +43,7 @@ class LiloConfiguration: f.close() os.chmod(file, 0644) - def read(self, file): + def read (self, file): f = open(file, "r") image = None for l in f.readlines(): diff --git a/loader/Makefile b/loader/Makefile index 614eba337..7748b07e7 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -52,25 +52,25 @@ install: all #rm -f $(DESTDIR)/sbin/init #install -s loader $(DESTDIR)/sbin/loader #install -s init $(DESTDIR)/sbin/init - #install -m 755 ../isys/pci/pcitable $(DESTDIR)/etc + #install -m 755 ../kudzu/pcitable $(DESTDIR)/etc loader: loader.o $(OBJS) $(CC) -g $(STATIC) -o $@ $^ -lpopt \ - ../isys/pci/libpciprobe.a ../isys/libisys.a ../balkan/libbalkan.a \ + ../kudzu/libkudzu.a ../isys/libisys.a ../balkan/libbalkan.a \ ../isys/modutils/insmod/libmodutils.a \ ../isys/modutils/util/libutil.a \ ../isys/modutils/obj/libobj.a \ - -L../pump -lpump -lrpm -lz -lresolv -lnewt -lslang -lpci + -L../pump -lpump -lrpm -lbz2 -lz -lresolv -lnewt -lslang -lpci loader-pcmcia: loader-pcmcia.o pcmcia.o popen.o $(OBJS) $(CC) -g $(STATIC) -o $@ loader-pcmcia.o pcmcia.o $(OBJS) \ -L pcmcia-install/cardmgr -lcardmgr -lprobe popen.o \ -lpopt \ - ../isys/pci/libpciprobe.a ../isys/libisys.a ../balkan/libbalkan.a \ + ../kudzu/libkudzu.a ../isys/libisys.a ../balkan/libbalkan.a \ ../isys/modutils/insmod/libmodutils.a \ ../isys/modutils/util/libutil.a \ ../isys/modutils/obj/libobj.a \ - -L../pump -lpump -lrpm -lz -lresolv -lnewt -lslang -lpci + -L../pump -lpump -lrpm -lbz2 -lz -lresolv -lnewt -lslang -lpci loader-pcmcia.o: loader.c $(CC) -DINCLUDE_PCMCIA $(CFLAGS) -o $@ -c $^ diff --git a/loader/cdrom.c b/loader/cdrom.c index 151dcd843..d8d557e5f 100644 --- a/loader/cdrom.c +++ b/loader/cdrom.c @@ -77,7 +77,7 @@ int setupCDdevice(struct knownDevices * kd, moduleInfoSet modInfo, } } - kdAddDevice(kd, DEVICE_CDROM, devName, NULL); + kdAddDevice(kd, CLASS_CDROM, devName, NULL); done = 1; } diff --git a/loader/loader.c b/loader/loader.c index ec04629a3..d6bf6f83a 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -40,7 +40,7 @@ #include "isys/imount.h" #include "isys/isys.h" #include "isys/probe.h" -#include "isys/pci/pciprobe.h" +#include "kudzu/kudzu.h" #include "cdrom.h" #include "devices.h" @@ -89,11 +89,11 @@ static char * mountUrlImage(struct installMethod * method, moduleDeps modDeps, int flags); static struct installMethod installMethods[] = { - { N_("Local CDROM"), 0, DEVICE_CDROM, mountCdromImage }, - { N_("NFS image"), 1, DEVICE_NET, mountNfsImage }, - { "FTP", 1, DEVICE_NET, mountUrlImage }, - { "HTTP", 1, DEVICE_NET, mountUrlImage }, - { N_("Hard drive"), 0, DEVICE_DISK, mountHardDrive }, + { N_("Local CDROM"), 0, CLASS_CDROM, mountCdromImage }, + { N_("NFS image"), 1, CLASS_NETWORK, mountNfsImage }, + { "FTP", 1, CLASS_NETWORK, mountUrlImage }, + { "HTTP", 1, CLASS_NETWORK, mountUrlImage }, + { N_("Hard drive"), 0, CLASS_HD, mountHardDrive }, }; static int numMethods = sizeof(installMethods) / sizeof(struct installMethod); @@ -160,39 +160,40 @@ static void spawnShell(int flags) { static int detectHardware(moduleInfoSet modInfo, struct moduleInfo *** modules, int flags) { - struct pciDevice **devices, **device; + struct device ** devices, ** device; struct moduleInfo * mod, ** modList; int numMods, i; + char *driver; - probePciFreeDrivers(); - if (probePciReadDrivers(FL_TESTING(flags) ? "../isys/pci/pcitable" : - "/modules/pcitable")) { - logMessage("An error occured while reading the PCI ID table"); - return LOADER_ERROR; - } + initializeDeviceList(); + + logMessage("probing buses"); + + devices = probeDevices(CLASS_UNSPEC,BUS_PCI|BUS_SBUS,PROBE_ALL); + + logMessage("finished bus probing"); - logMessage("looking for devices on pci bus"); - - devices = probePci(0, 0); if (devices == NULL) { *modules = NULL; return LOADER_OK; } - logMessage("returned from probePci"); - modList = malloc(sizeof(*modList) * 50); /* should be enough */ numMods = 0; for (device = devices; *device; device++) { - logMessage("found suggestion of %s", (*device)->driver); - if ((mod = isysFindModuleInfo(modInfo, (*device)->driver))) { - logMessage("found %s device", (*device)->driver); - for (i = 0; i < numMods; i++) - if (modList[i] == mod) break; - if (i == numMods) - modList[numMods++] = mod; + driver = (*device)->driver; + if (strcmp (driver, "ignore") && strcmp (driver, "unknown")) { + logMessage("found suggestion of %s", driver); + if ((mod = isysFindModuleInfo(modInfo, driver))) { + logMessage("found %s device", driver); + for (i = 0; i < numMods; i++) + if (modList[i] == mod) break; + if (i == numMods) + modList[numMods++] = mod; + } } + freeDevice (*device); } if (numMods) { @@ -309,12 +310,13 @@ int manualDeviceCheck(moduleInfoSet modInfo, moduleList modLoaded, return 0; } -int pciProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, +int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, int justProbe, struct knownDevices * kd, int flags) { int i; struct moduleInfo ** modList; - if (!access("/proc/bus/pci/devices", R_OK)) { + if (!access("/proc/bus/pci/devices", R_OK) || + !access("/proc/openprom", R_OK)) { /* autodetect whatever we can */ if (detectHardware(modInfo, &modList, flags)) { logMessage("failed to scan pci bus!"); @@ -521,7 +523,7 @@ static char * mountHardDrive(struct installMethod * method, while (!done) { numPartitions = 0; for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class == DEVICE_DISK) { + if (kd->known[i].class == CLASS_HD) { devMakeInode(kd->known[i].name, "/tmp/hddevice"); if ((fd = open("/tmp/hddevice", O_RDONLY)) >= 0) { if ((rc = balkanReadTable(fd, &table))) { @@ -668,7 +670,7 @@ static char * setupCdrom(struct installMethod * method, do { for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class != DEVICE_CDROM) continue; + if (kd->known[i].class != CLASS_CDROM) continue; hasCdrom = 1; @@ -720,7 +722,7 @@ static int ensureNetDevice(struct knownDevices * kd, let them specify multiple ones here?? */ for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class == DEVICE_NET) { + if (kd->known[i].class == CLASS_NETWORK) { devName = kd->known[i].name; break; } @@ -736,7 +738,7 @@ static int ensureNetDevice(struct knownDevices * kd, if (!devName) { for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class == DEVICE_NET) { + if (kd->known[i].class == CLASS_NETWORK) { devName = kd->known[i].name; break; } @@ -1051,19 +1053,19 @@ static char * setupKickstart(char * location, struct knownDevices * kd, /* XXX kickstartDevices(modInfo, modLoaded, modDeps); */ if (ksHasCommand(KS_CMD_NFS)) { - ksDeviceType = DEVICE_NET; + ksDeviceType = CLASS_NETWORK; ksType = KS_CMD_NFS; table = ksNfsOptions; } else if (ksHasCommand(KS_CMD_CDROM)) { - ksDeviceType = DEVICE_CDROM; + ksDeviceType = CLASS_CDROM; ksType = KS_CMD_CDROM; table = NULL; } else if (ksHasCommand(KS_CMD_HD)) { - ksDeviceType = DEVICE_UNKNOWN; + ksDeviceType = CLASS_UNSPEC; ksType = KS_CMD_HD; table = ksHDOptions; } else if (ksHasCommand(KS_CMD_URL)) { - ksDeviceType = DEVICE_NET; + ksDeviceType = CLASS_NETWORK; ksType = KS_CMD_URL; table = ksUrlOptions; } else { @@ -1071,7 +1073,7 @@ static char * setupKickstart(char * location, struct knownDevices * kd, return NULL; } - if (ksDeviceType != DEVICE_UNKNOWN) { + if (ksDeviceType != CLASS_UNSPEC) { for (i = 0; i < kd->numKnown; i++) if (kd->known[i].class == ksDeviceType) break; @@ -1131,7 +1133,7 @@ static char * setupKickstart(char * location, struct knownDevices * kd, logMessage("partname is %s", partname); for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class != DEVICE_DISK) continue; + if (kd->known[i].class != CLASS_HD) continue; if (!strncmp(kd->known[i].name, partname, strlen(partname) - 1)) break; } @@ -1400,7 +1402,7 @@ logMessage("Flags are 0x%x\n", flags); kdFindScsiList(&kd); kdFindNetList(&kd); - pciProbe(modInfo, modLoaded, modDeps, probeOnly, &kd, flags); + busProbe(modInfo, modLoaded, modDeps, probeOnly, &kd, flags); if (probeOnly) exit(0); if (FL_KSHD(flags)) { @@ -1452,7 +1454,7 @@ logMessage("Flags are 0x%x\n", flags); sleep(5); exit(1); } - pciProbe(modInfo, modLoaded, modDeps, 0, &kd, flags); + busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags); if (access("/proc/pci", X_OK) || FL_EXPERT(flags)) { manualDeviceCheck(modInfo, modLoaded, modDeps, &kd, flags); @@ -1476,11 +1478,11 @@ logMessage("Flags are 0x%x\n", flags); for (i = 0; i < kd.numKnown; i++) { printf("%-5s ", kd.known[i].name); - if (kd.known[i].class == DEVICE_CDROM) + if (kd.known[i].class == CLASS_CDROM) printf("cdrom"); - else if (kd.known[i].class == DEVICE_DISK) + else if (kd.known[i].class == CLASS_HD) printf("disk "); - else if (kd.known[i].class == DEVICE_NET) + else if (kd.known[i].class == CLASS_NETWORK) printf("net "); if (kd.known[i].model) printf(" %s\n", kd.known[i].model); diff --git a/rpmmodule/Makefile b/rpmmodule/Makefile index 87cb73c6a..1eac6277e 100644 --- a/rpmmodule/Makefile +++ b/rpmmodule/Makefile @@ -10,7 +10,7 @@ CC = gcc INCLUDES = -I/usr/include/rpm -I/usr/include/python1.5 CFLAGS = -Wall -fPIC -g $(INCLUDES) -LIBS = -lrpm -lz -ldb1 +LIBS = -lrpm -lbz2 -lz -ldb1 LDFLAGS = -shared -Wl,-soname,$(TARGET) $(LIBS) # what are we building here? @@ -1561,11 +1561,8 @@ class Flag: class InstallInterface: def messageWindow(self, title, text): - self.screen.drawRootText(0 - len(title), 0, title) ButtonChoiceWindow(self.screen, title, text, buttons = [ _("OK") ]) - self.screen.drawRootText(0 - len(title), 0, - (self.screen.width - len(title)) * " ") def exceptionWindow(self, title, text): rc = ButtonChoiceWindow(self.screen, title, text, diff --git a/utils/Makefile b/utils/Makefile index 101134009..64d9f3c74 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -8,7 +8,7 @@ moddeps: moddeps.o $(CC) $(LDFLAGS) -o moddeps moddeps.o ../loader/modules.o $(LOADLIBES) \ ../isys/modutils/insmod/libmodutils.a \ ../isys/modutils/util/libutil.a \ - ../isys/modutils/obj/libobj.a -lrpm -lz + ../isys/modutils/obj/libobj.a -lrpm -lbz2 -lz clean: rm -f modlist |