diff options
author | Erik Troan <ewt@redhat.com> | 2001-11-13 21:22:50 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2001-11-13 21:22:50 +0000 |
commit | 0bba92fc0070eb0e1096f29d84c4d33ad95b2fa3 (patch) | |
tree | 60d87ed42d2395dc2c439db327fb2244a1d3983f | |
parent | 59c4affa31e8a69352a29f1e327e86bed3e606be (diff) | |
download | anaconda-0bba92fc0070eb0e1096f29d84c4d33ad95b2fa3.tar.gz anaconda-0bba92fc0070eb0e1096f29d84c4d33ad95b2fa3.tar.xz anaconda-0bba92fc0070eb0e1096f29d84c4d33ad95b2fa3.zip |
changes for dietlibc
-rw-r--r-- | loader/Makefile | 97 | ||||
-rw-r--r-- | loader/devices.c | 14 | ||||
-rw-r--r-- | loader/dietstubs.c | 162 | ||||
-rw-r--r-- | loader/ftp.c | 4 | ||||
-rw-r--r-- | loader/lang.c | 33 | ||||
-rw-r--r-- | loader/loader.c | 31 | ||||
-rw-r--r-- | loader/mkctype.c | 47 | ||||
-rw-r--r-- | loader/modules.c | 12 | ||||
-rw-r--r-- | loader/net.c | 8 |
9 files changed, 321 insertions, 87 deletions
diff --git a/loader/Makefile b/loader/Makefile index fbe74785c..6adab74e4 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -4,16 +4,15 @@ VERSION = 7.2 DESTDIR = ../../trees/initrd -ARCH := $(patsubst i%86,i386,$(shell uname -m)) -ARCH := $(patsubst sparc%,sparc,$(ARCH)) - OBJS = log.o windows.o modules.o devices.o cdrom.o urls.o kickstart.o lang.o \ misc.o ftp.o + +SLANGLIB = -lslang ifneq (ia64, $(ARCH)) +ifneq (i386, $(ARCH)) OBJS += fnmatch-stub.o printf-stub.o pwd-stub.o dl-stub.o SLANGLIB = ../minislang/libslang.a -else -SLANGLIB = -lslang +endif endif LOADEROBJS = loader.o loader-pcmcia.o popen.o @@ -22,16 +21,23 @@ BINS = init DIRS = NETOBJS = net.o PCMCIAOBJS = pcmcia.o $(NETOBJS) -OPTS = -Os -g +OPTS = -Os +DEBUG = -g MODULELINKAGE :=../isys/modutils/insmod/libmodutils.a \ ../isys/modutils/util/libutil.a \ ../isys/modutils/obj/libobj.a + +COPTS = $(DEBUG) -Wall -DVERSION='"$(VERSION)"' -CFLAGS = $(DEBUG) $(OPTS) -ffunction-sections -Wall -D_GNU_SOURCE=1 -I/usr/include/kudzu -I/usr/include/rpm -I.. -DUSE_ALT_DNS=1 -DVERSION='"$(VERSION)"' -DHAVE_LIBIO_H -ggdb +CFLAGS = $(COPTS) $(OPTS) -ffunction-sections -D_GNU_SOURCE=1 -I/usr/include/kudzu -I/usr/include/rpm -I.. -DHAVE_LIBIO_H -ggdb ALLOBJS = $(OBJS) $(PCMCIAOBJS) +ISYS = ../isys/libisys.a +GUNZIP = ../isys/gzlib/libgunzip.a +LOADERLIBS = -lpci + # XXX Japanese is i386 only at the moment ifeq (i386, $(ARCH)) BINS += loader-local loader-network loader-pcmcia @@ -40,7 +46,7 @@ BINS += loader-local loader-network loader-pcmcia KONOBJS = ./kon2/src/libkon.a ./kon2/src/display.a ./kon2/lib/libgon.a endif DIRS += pcmcia-install kon2 -OBJS += stubs.o +OBJS += dietstubs.o ctype.o endif ifeq (ia64, $(ARCH)) @@ -77,8 +83,15 @@ STATIC = -static ifeq (i386, $(ARCH)) MINILIBC=minilibc.o -CFLAGS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV +COPTS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV LDFLAGS = -nostdlib /usr/lib/crt1.o +LOADERLIBS += -lrpc +ISYS = ../isys/libisys-diet.a +SLANGLIB = ../minislang/libslang-diet.a +GUNZIP = ../isys/gzlib/libgunzip-diet.a +DIET=diet +REALCC=gcc +CC=$(DIET) $(REALCC) STATIC=-static else ifeq (sparc, $(ARCH)) @@ -130,55 +143,56 @@ install: all install -m 644 minikon.fnt $(DESTDIR)/$(RUNTIMEDIR)/loader urltest: urltest.o ftp.o urls.o lang.o log.o windows.o - $(CC) -g -o urltest urltest.o -lnewt ftp.o urls.o lang.o log.o windows.o -lz ../isys/libisys.a -lresolv + $(CC) -g -o urltest urltest.o -lnewt ftp.o urls.o lang.o log.o windows.o -lz $(ISYS) -lresolv loader: loader.o $(OBJS) $(NETOBJS) $(CC) -g $(STATIC) -o $@ $^ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -lpump -lz -lresolv -lnewt $(SLANGLIB) -lpci + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -lpump -lz -lnewt $(SLANGLIB) $(LOADERLIBS) loader-local: loader-local.o $(OBJS) $(CC) -g $(STATIC) -o $@ $^ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -L ../stubs -lz -lresolv -lnewt $(SLANGLIB) -lpci + -L /home/ewt/rpmdir/BUILD/kudzu-0.99.23 \ + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -L ../stubs -lz -lnewt $(SLANGLIB) $(LOADERLIBS) loader-local-kon: loader-local-kon.o $(OBJS) $(CC) -g $(STATIC) -o $@ $^ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -L ../stubs -lz -lresolv -lnewt $(SLANGLIB) -lpci \ + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -L ../stubs -lz -lresolv -lnewt $(SLANGLIB) $(LOADERLIBS) \ $(KONOBJS) loader-network: loader-net.o $(OBJS) $(NETOBJS) $(CC) -g $(STATIC) -o $@ $^ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -lpump -lz -lresolv -lnewt $(SLANGLIB) -lpci -lutil + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -lpump -L ../stubs -lnewt $(SLANGLIB) $(LOADERLIBS) loader-network-kon: loader-net-kon.o $(OBJS) $(NETOBJS) $(CC) -g $(STATIC) -o $@ $^ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -lpump -lz -lresolv -lnewt $(SLANGLIB) -lpci -lutil \ + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -lpump -lz -lresolv -lnewt $(SLANGLIB) $(LOADERLIBS) \ $(KONOBJS) loader-pcmcia: loader-pcmcia.o pcmcia.o popen.o $(OBJS) $(PCMCIAOBJS) $(CC) -g $(STATIC) -o $@ loader-pcmcia.o $(OBJS) \ $(PCMCIAOBJS) -L pcmcia-install/cardmgr -lcardmgr -lprobe popen.o \ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -lpump -lz -lresolv -lnewt $(SLANGLIB) -lpci -lutil + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -lpump -lz -lresolv -lnewt $(SLANGLIB) $(LOADERLIBS) loader-pcmcia-kon: loader-pcmcia-kon.o pcmcia.o popen.o $(OBJS) $(PCMCIAOBJS) $(CC) -g $(STATIC) -o $@ loader-pcmcia-kon.o $(OBJS) \ $(PCMCIAOBJS) -L pcmcia-install/cardmgr -lcardmgr -lprobe popen.o \ -lpopt \ - -lkudzu_loader ../isys/libisys.a ../balkan/libbalkan.a \ - $(MODULELINKAGE) \ - -lpump -lz -lresolv -lnewt $(SLANGLIB) -lpci -lutil \ + -lkudzu_loader $(ISYS) ../balkan/libbalkan.a \ + $(MODULELINKAGE) $(GUNZIP) \ + -lpump -lz -lresolv -lnewt $(SLANGLIB) $(LOADERLIBS) \ $(KONOBJS) loader.o: loader.c @@ -205,12 +219,25 @@ loader-pcmcia-kon.o: loader.c -DINCLUDE_KON $(CFLAGS) -o $@ -c $< init: init.o $(MINILIBC) - $(CC) $(STATIC) -g $(LDFLAGS) -o $@ init.o $(MINILIBC) + $(REALCC) $(STATIC) $(COPTS) $(LDFLAGS) -o $@ init.o $(MINILIBC) + +init.o: init.c + $(REALCC) -O2 $(COPTS) -c -o init.o init.c + +minilibc.o: minilibc.c + $(REALCC) -O2 $(COPTS) -c -o minilibc.o minilibc.c + +mkctype: mkctype.c + $(REALCC) $(COPTS) -o mkctype mkctype.c + +ctype.c: mkctype + ./mkctype > ctype.c clean: - rm -f *.o .depend *~ loader-local loader-network loader.old loader-pcmcia probe modprobe \ - loader.po loader.tr tr/*.tr loader init loader-local-kon loader-network-kon \ - loader-pcmcia-kon + rm -f *.o .depend *~ loader-local loader-network loader.old \ + loader-pcmcia probe modprobe loader.po loader.tr tr/*.tr \ + loader init loader-local-kon loader-network-kon \ + loader-pcmcia-kon ctype.c mkctype for n in $(DIRS); do \ (cd $$n; make clean) \ done diff --git a/loader/devices.c b/loader/devices.c index 1856a5a46..cdc06a5dc 100644 --- a/loader/devices.c +++ b/loader/devices.c @@ -7,9 +7,9 @@ #include <stdio.h> #include <string.h> #include <unistd.h> +#include <sys/ioctl.h> #include <sys/stat.h> #include <sys/utsname.h> -#include <zlib.h> #include <linux/fd.h> #include "devices.h" @@ -505,12 +505,12 @@ static char * filterDriverModules(struct driverDiskInfo * ddi, } if (!failed) { - from = gzopen("/tmp/drivers/modules.cgz", "r"); + from = gunzip_open("/tmp/drivers/modules.cgz"); toPath = malloc(strlen(modNames[0]) + 30); sprintf(toPath, "/tmp/modules/%s", modNames[0]); mkdirChain(toPath); strcat(toPath, "/modules.cgz"); - to = gzopen(toPath, "w"); + to = gunzip_open(toPath); /* This message isn't good, but it'll do. */ winStatus(50, 3, _("Loading"), _("Loading %s driver..."), @@ -520,8 +520,8 @@ static char * filterDriverModules(struct driverDiskInfo * ddi, newtPopWindow(); - gzclose(from); - gzclose(to); + gunzip_close(from); + gunzip_close(to); umount("/tmp/drivers"); return toPath; @@ -560,7 +560,7 @@ char ** extractModules(struct driverDiskInfo * ddi, ballPath = strdup("/modules/modules.cgz"); } - fd = gzopen(ballPath, "r"); + fd = gunzip_open(ballPath); if (!fd) { logMessage("failed to open %s", ballPath); free(ballPath); @@ -594,6 +594,8 @@ char ** extractModules(struct driverDiskInfo * ddi, qsort(map, numMaps, sizeof(*map), myCpioFileMapCmp); rc = myCpioInstallArchive(fd, map, numMaps, NULL, NULL, &failedFile); + gunzip_close(fd); + for (m = modNames, i = 0, numMaps = 0; *m; m++, i++) { if (!oldPaths[i]) { /* can't trust map; the order changed thanks to qsort */ diff --git a/loader/dietstubs.c b/loader/dietstubs.c new file mode 100644 index 000000000..385afecf2 --- /dev/null +++ b/loader/dietstubs.c @@ -0,0 +1,162 @@ +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <setjmp.h> +#include <ctype.h> +#include <stdarg.h> + +struct glibc_stat { + long long st_dev; + unsigned short int __pad1; + long st_ino; + int st_mode; + int st_nlink; + int st_uid; + int st_gid; + long long st_rdev; + unsigned short int __pad2; + long st_size; + long st_blksize; + long st_blocks; + long st_atime; + unsigned long int __unused1; + long st_mtime; + unsigned long int __unused2; + long st_ctime; + unsigned long int __unused3; + unsigned long int __unused4; + unsigned long int __unused5; +}; + +static void stat_copy(struct stat * from, struct glibc_stat * to) { + to->st_dev = from->st_dev; + to->st_ino = from->st_ino; + to->st_mode = from->st_mode; + to->st_nlink = from->st_nlink; + to->st_uid = from->st_uid; + to->st_gid = from->st_gid; + to->st_rdev = from->st_rdev; + to->st_size = from->st_size; + to->st_blksize = from->st_blksize; + to->st_blocks = from->st_blocks; + to->st_atime = from->st_atime; + to->st_mtime = from->st_mtime; + to->st_ctime = from->st_ctime; +} + +int __xstat (int __ver, __const char *__filename, struct glibc_stat * sb) { + struct stat s; + int rc = stat(__filename, &s); + + if (!rc) stat_copy(&s, sb); + + return rc; +} + +int __lxstat (int __ver, __const char *__filename, struct glibc_stat * sb) { + struct stat s; + int rc = lstat(__filename, &s); + + if (!rc) stat_copy(&s, sb); + + return rc; +} + +int __fxstat (int __ver, int fd, struct glibc_stat * sb) { + struct stat s; + int rc = fstat(fd, &s); + + if (!rc) stat_copy(&s, sb); + + return rc; +} + +extern double strtod (__const char * __nptr, char ** __endptr); + +double __strtod_internal (__const char *__restrict __nptr, + char **__restrict __endptr, int __group) { + return strtod(__nptr, __endptr); +} + + +long int __strtol_internal(const char * nptr, char ** endptr, + int base, int group) { + return strtol(nptr, endptr, base); +} + +unsigned long int __strtoul_internal (__const char *__restrict __nptr, + char **__restrict __endptr, + int __base, int __group) __THROW { + return strtoul(__nptr, __endptr, __base); +} + +char * __strdup(const char * s) { + return strdup(s); +} + +void __assert_fail (__const char *__assertion, __const char *__file, + unsigned int __line, __const char *__function) { + fprintf(stderr, "%s:%d assertion failed in %s()\n", + __file, __line, __function); + 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); +} + +char * strcasestr(char * haystack1, char * needle1) { + char * haystack = strdup(haystack1); + char * needle = strdup(needle1); + char * chptr; + + for (chptr = haystack; *chptr; chptr++) *chptr = toupper(*chptr); + for (chptr = needle; *chptr; chptr++) *chptr = toupper(*chptr); + + chptr = strstr(needle, haystack); + if (!chptr) return NULL; + + return (chptr - haystack) + haystack1; +} + +int _IO_putc(char c, void * f) { + return putc(c, f); +} + +int _IO_getc(void * f) { + return getc(f); +} + +int __xmknod (int __ver, const char * path, unsigned int mode, + long long * dev) { + return mknod(path, mode, *dev); +} + + +/* this should print the name of the app, but how? probably in a global + somewhere (like env is) */ +void warn(char * format, ...) { + va_list args; + int err = errno; + + va_start(args, format); + + fprintf(stderr, "warning: "); + vfprintf(stderr, format, args); + fprintf(stderr, ": %s\n", strerror(err)); + + va_end(args); + + errno = err; +} + +int pwrite(int fd, const void *buf, size_t count, off_t offset) { + return __pwrite(fd, buf, count, offset); +} diff --git a/loader/ftp.c b/loader/ftp.c index 7f0286f2d..2356f418c 100644 --- a/loader/ftp.c +++ b/loader/ftp.c @@ -185,8 +185,7 @@ int ftpCommand(int sock, char * command, ...) { return 0; } -#if !defined(USE_ALT_DNS) || !USE_ALT_DNS -static int mygethostbyname(const char * host, struct in_addr * address) { +int mygethostbyname(char * host, struct in_addr * address) { struct hostent * hostinfo; hostinfo = gethostbyname(host); @@ -195,7 +194,6 @@ static int mygethostbyname(const char * host, struct in_addr * address) { memcpy(address, hostinfo->h_addr_list[0], hostinfo->h_length); return 0; } -#endif static int getHostAddress(const char * host, struct in_addr * address) { if (isdigit(host[0])) { diff --git a/loader/lang.c b/loader/lang.c index dabceb33e..6ca35c694 100644 --- a/loader/lang.c +++ b/loader/lang.c @@ -6,10 +6,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/kd.h> #include <sys/ioctl.h> #include <unistd.h> -#include <zlib.h> #include <glob.h> /* XXX rpmlib.h */ #include <dirent.h> /* XXX rpmlib.h */ @@ -23,6 +21,7 @@ #include "log.h" #include "misc.h" #include "windows.h" +#include "isys/gzlib/gzlib.h" #define errorWindow(String) \ newtWinMessage(_("Error"), _("OK"), String, strerror (errno)); @@ -138,7 +137,7 @@ void loadLanguage (char * file, int flags) { sprintf(filename, "/etc/loader.tr"); } - stream = gzopen(file, "r"); + stream = gunzip_open(file); if (!stream) { newtWinMessage("Error", "OK", "Translation for %s is not available. " @@ -149,7 +148,7 @@ void loadLanguage (char * file, int flags) { sprintf(filename, "%s.tr", key); rc = installCpioFile(stream, filename, "/tmp/translation", 1); - gzclose(stream); + gunzip_close(stream); if (rc || access("/tmp/translation", R_OK)) { newtWinMessage("Error", "OK", "Cannot get translation file %s.\n", @@ -199,7 +198,7 @@ static int loadFont(char * fontFile, int flags) { #if 0 if (!FL_TESTING(flags)) { #endif - stream = gzopen("/etc/fonts.cgz", "r"); + stream = gunzip_open("/etc/fonts.cgz"); if (!stream) { newtWinMessage("Error", "OK", "Cannot open fonts: %s", strerror(errno)); @@ -207,7 +206,7 @@ static int loadFont(char * fontFile, int flags) { } rc = installCpioFile(stream, fontFile, "/tmp/font", 1); - gzclose(stream); + gunzip_close(stream); if (rc || access("/tmp/font", R_OK)) { return LOADER_ERROR; } @@ -386,7 +385,7 @@ static int loadKeymap(gzFile stream) { int magic; short keymap[NR_KEYS]; - if (gzread(stream, &magic, sizeof(magic)) != sizeof(magic)) { + if (gunzip_read(stream, &magic, sizeof(magic)) != sizeof(magic)) { logMessage("failed to read kmap magic: %s", strerror(errno)); return LOADER_ERROR; } @@ -396,7 +395,7 @@ static int loadKeymap(gzFile stream) { return LOADER_ERROR; } - if (gzread(stream, keymaps, sizeof(keymaps)) != sizeof(keymaps)) { + if (gunzip_read(stream, keymaps, sizeof(keymaps)) != sizeof(keymaps)) { logMessage("failed to read keymap header: %s", strerror(errno)); return LOADER_ERROR; } @@ -411,7 +410,7 @@ static int loadKeymap(gzFile stream) { for (kmap = 0; kmap < MAX_NR_KEYMAPS; kmap++) { if (!keymaps[kmap]) continue; - if (gzread(stream, keymap, sizeof(keymap)) != sizeof(keymap)) { + if (gunzip_read(stream, keymap, sizeof(keymap)) != sizeof(keymap)) { logMessage("failed to read keymap data: %s", strerror(errno)); close(console); return LOADER_ERROR; @@ -525,15 +524,15 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { #endif defkbd = "us"; - f = gzopen("/etc/keymaps.gz", "r"); + f = gunzip_open("/etc/keymaps.gz"); if (!f) { errorWindow("cannot open /etc/keymaps.gz: %s"); return LOADER_ERROR; } - if (gzread(f, &hdr, sizeof(hdr)) != sizeof(hdr)) { + if (gunzip_read(f, &hdr, sizeof(hdr)) != sizeof(hdr)) { errorWindow("failed to read keymaps header: %s"); - gzclose(f); + gunzip_close(f); return LOADER_ERROR; } @@ -541,9 +540,9 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { i = hdr.numEntries * sizeof(*infoTable); infoTable = alloca(i); - if (gzread(f, infoTable, i) != i) { + if (gunzip_read(f, infoTable, i) != i) { errorWindow("failed to read keymap information: %s"); - gzclose(f); + gunzip_close(f); return LOADER_ERROR; } @@ -628,17 +627,17 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { #endif for (i = 0; i < num; i++) { - if (gzread(f, buf, infoTable[i].size) != infoTable[i].size) { + if (gunzip_read(f, buf, infoTable[i].size) != infoTable[i].size) { logMessage("error reading %d bytes from file: %s", infoTable[i].size, strerror(errno)); - gzclose(f); + gunzip_close(f); rc = LOADER_ERROR; } } if (!rc) rc = loadKeymap(f); - gzclose(f); + gunzip_close(f); if (keymap) *keymap = strdup(infoTable[num].name); diff --git a/loader/loader.c b/loader/loader.c index 50e55396a..7d1a44e3a 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -29,6 +29,7 @@ #include <net/if.h> #include <newt.h> #include <popt.h> +#include <syslog.h> #include <stdlib.h> #include <string.h> @@ -38,7 +39,6 @@ #include <sys/sysmacros.h> #include <sys/utsname.h> #include <unistd.h> -#include <zlib.h> #include <sys/vt.h> #include <popt.h> @@ -149,14 +149,14 @@ void doSuspend(void) { } static int setupRamdisk(void) { - gzFile f; + int f; static int done = 0; if (done) return 0; done = 1; - f = gzopen("/etc/ramfs.img", "r"); + f = open("/etc/ramfs.img", 0); if (f) { char buf[10240]; int i, j = 0; @@ -165,13 +165,13 @@ static int setupRamdisk(void) { fd = open("/dev/ram", O_RDWR); logMessage("copying file to fd %d", fd); - while ((i = gzread(f, buf, sizeof(buf))) > 0) { + while ((i = read(f, buf, sizeof(buf))) > 0) { j += write(fd, buf, i); } logMessage("wrote %d bytes", j); close(fd); - gzclose(f); + close(f); } doPwMount("/dev/ram", "/tmp/ramfs", "ext2", 0, 0, NULL, NULL); @@ -1072,6 +1072,9 @@ static char * mountNfsImage(struct installMethod * method, char * fullPath; int stage = NFS_STAGE_IP; +/*XXX + mlLoadModuleSet("nfs", modLoaded, *modDepsPtr, modInfo, flags);*/ + initLoopback(); memset(&netDev, 0, sizeof(netDev)); @@ -1099,12 +1102,13 @@ static char * mountNfsImage(struct installMethod * method, break; case NFS_STAGE_MOUNT: + mlLoadModuleSet("nfs", modLoaded, *modDepsPtr, modInfo, flags); + if (FL_TESTING(flags)) { stage = NFS_STAGE_DONE; break; } - mlLoadModuleSet("nfs", modLoaded, *modDepsPtr, modInfo, flags); fullPath = alloca(strlen(host) + strlen(dir) + 2); sprintf(fullPath, "%s:%s", host, dir); @@ -2345,13 +2349,8 @@ void loadUfs(struct knownDevices *kd, moduleList modLoaded, void setFloppyDevice(int flags) { #if defined(__i386__) || defined(__ia64__) struct device ** devices; - char line[256]; - const char * match = "Floppy drive(s): "; int foundFd0 = 0; int i = 0; - FILE * f; - - /*if (FL_TESTING(flags)) return;*/ logMessage("probing for floppy devices"); @@ -2382,8 +2381,6 @@ static int usbInitialize(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags) { struct device ** devices; - if (FL_TESTING(flags)) return 0; - if (FL_NOUSB(flags)) return 0; logMessage("looking for usb controllers"); @@ -2396,12 +2393,15 @@ static int usbInitialize(moduleList modLoaded, moduleDeps modDeps, } logMessage("found USB controller %s", devices[0]->driver); + if (mlLoadModuleSet(devices[0]->driver, modLoaded, modDeps, modInfo, flags)) { logMessage("failed to insert usb module"); return 1; } + if (FL_TESTING(flags)) return 0; + if (doPwMount("/proc/bus/usb", "/proc/bus/usb", "usbdevfs", 0, 0, NULL, NULL)) logMessage("failed to mount device usbdevfs: %s", strerror(errno)); @@ -2616,6 +2616,8 @@ int main(int argc, char ** argv) { } openLog(FL_TESTING(flags)); + if (!FL_TESTING(flags)) + openlog("loader", 0, LOG_LOCAL0); checkForRam(flags); @@ -2845,7 +2847,8 @@ int main(int argc, char ** argv) { agpgartInitialize(modLoaded, modDeps, modInfo, flags); mlLoadModuleSet("raid0:raid1:raid5:msdos:ext3:reiserfs", - modLoaded, modDeps, modInfo, flags); + modLoaded, modDeps, modInfo, flags); + usbInitializeMouse(modLoaded, modDeps, modInfo, flags); diff --git a/loader/mkctype.c b/loader/mkctype.c new file mode 100644 index 000000000..c8d34b9c3 --- /dev/null +++ b/loader/mkctype.c @@ -0,0 +1,47 @@ +#include <ctype.h> +#include <stdio.h> + +int main(int argc, char ** argv) { + int i; + + printf("#include <sys/types.h>\n\n"); + + printf("static const unsigned short int __ctype_b_internal[] = {"); + + for (i = -128; i < 256; i++) { + if (!(i % 8)) { + printf("\n"); + } + + printf("\t0x%x,", __ctype_b[i]); + } + + printf("\n};\n\n"); + printf("const unsigned short int * __ctype_b = __ctype_b_internal + 128;\n\n"); + + printf("const int __ctype_toupper_internal[] = {"); + for (i = -128; i < 256; i++) { + if (!(i % 8)) { + printf("\n"); + } + + printf("\t0x%x,", __ctype_toupper[i]); + } + + printf("\n};\n\n"); + printf("const int * __ctype_toupper = __ctype_toupper_internal + 128;\n\n"); + + printf("const int __ctype_tolower_internal[] = {"); + for (i = -128; i < 256; i++) { + if (!(i % 8)) { + printf("\n"); + } + + printf("\t0x%x,", __ctype_tolower[i]); + } + + printf("\n};\n\n"); + printf("const int * __ctype_tolower = __ctype_tolower_internal + 128;\n\n"); + + return 0; +}; diff --git a/loader/modules.c b/loader/modules.c index 036a7b03d..dbf3e7601 100644 --- a/loader/modules.c +++ b/loader/modules.c @@ -102,7 +102,7 @@ int mlReadLoadedList(moduleList * mlp) { ml->mods[ml->numModules].path = NULL; ml->mods[ml->numModules].weLoaded = 0; *end = ' '; - ml->numModules++; + /*ml->numModules++;*/ start = strchr(end, '\n'); if (start) start++; } @@ -458,7 +458,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, paths = extractModules(NULL, list, paths); i = 0; if (!paths) { - logMessage("no modules found -- aborting insertion\n"); + logMessage("no modules found -- aborting insertion"); i++; } else { *items = '\0'; @@ -476,11 +476,13 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, } /* insert the modules now */ - for (l = list, p = paths; *l; l++, p++) { + for (l = list, p = paths; paths && *l; l++, p++) { if (*p && loadModule(*l, *p, modLoaded, (argModule && !strcmp(argModule, *l)) ? args : NULL, modInfo, flags)) { - logMessage("failed to insert %s\n", *p); + logMessage("failed to insert %s", *p); + } else { + logMessage("inserted %s", *p); } } @@ -498,7 +500,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, } } - for (p = paths; *p; p++) { + for (p = paths; p && *p; p++) { unlink(*p); free(*p); } diff --git a/loader/net.c b/loader/net.c index 08d037cc1..79fa4d17b 100644 --- a/loader/net.c +++ b/loader/net.c @@ -28,8 +28,8 @@ #include <stdlib.h> #include <string.h> -#ifdef __STANDALONE__ #include <netdb.h> +#ifdef __STANDALONE__ #include <libintl.h> #include <locale.h> @@ -598,9 +598,7 @@ int writeResolvConf(struct networkDeviceConfig * net) { int findHostAndDomain(struct networkDeviceConfig * dev, int flags) { char * name, * chptr; -#ifdef __STANDALONE__ struct hostent * he; -#endif if (!FL_TESTING(flags)) { writeResolvConf(dev); @@ -609,12 +607,8 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) { if (!(dev->dev.set & PUMP_NETINFO_HAS_HOSTNAME)) { winStatus(40, 3, _("Hostname"), _("Determining host name and domain...")); -#ifdef __STANDALONE__ he = gethostbyaddr( (char *) &dev->dev.ip, sizeof (dev->dev.ip), AF_INET); name = he ? he->h_name : 0; -#else - name = mygethostbyaddr(inet_ntoa(dev->dev.ip)); -#endif newtPopWindow(); if (!name) { |