diff options
author | hosokawa <hosokawa@FreeBSD.org> | 2000-10-31 07:39:07 +0000 |
---|---|---|
committer | hosokawa <hosokawa@FreeBSD.org> | 2000-10-31 07:39:07 +0000 |
commit | 2c647e68e4bda7da2dd3e2a3211edb9131bd86af (patch) | |
tree | 88b3c7c9b4a7a6a43fb38918455b2aee44b876a4 /release/sysinstall | |
parent | 4bcb0e4bae6bf14bb3ca01f9e5e8914e07e309d7 (diff) | |
download | FreeBSD-src-2c647e68e4bda7da2dd3e2a3211edb9131bd86af.zip FreeBSD-src-2c647e68e4bda7da2dd3e2a3211edb9131bd86af.tar.gz |
Moved driver modules for some PCI NICs and PCCARD-only NICs to mfsroot.flp.
http://people.freebsd.org/~hosokawa/driver-floppy/ for details.
Reviewed by: current@FreeBSD.org
Diffstat (limited to 'release/sysinstall')
-rw-r--r-- | release/sysinstall/Makefile | 4 | ||||
-rw-r--r-- | release/sysinstall/main.c | 3 | ||||
-rw-r--r-- | release/sysinstall/modules.c | 91 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 3 |
4 files changed, 99 insertions, 2 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile index ee75e66..700dd04 100644 --- a/release/sysinstall/Makefile +++ b/release/sysinstall/Makefile @@ -12,8 +12,8 @@ CLEANFILES+= keymap.tmp keymap.h SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c kget.c \ disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \ ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \ - label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \ - msg.c network.c nfs.c options.c package.c pccard.c \ + label.c lndir.c main.c makedevs.c media.c menus.c misc.c modules.c \ + mouse.c msg.c network.c nfs.c options.c package.c pccard.c \ system.c tape.c tcpip.c termcap.c ufs.c usb.c user.c variable.c \ wizard.c keymap.h diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c index e48d6c5..67de905 100644 --- a/release/sysinstall/main.c +++ b/release/sysinstall/main.c @@ -101,6 +101,9 @@ main(int argc, char **argv) if (DebugFD) dup2(DebugFD, 2); + /* Initialize driver modules */ + moduleInitialize(); + /* Initialize PC-card */ pccardInitialize(); diff --git a/release/sysinstall/modules.c b/release/sysinstall/modules.c new file mode 100644 index 0000000..a61e02e --- /dev/null +++ b/release/sysinstall/modules.c @@ -0,0 +1,91 @@ +/*- + * Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "sysinstall.h" +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/param.h> +#include <sys/linker.h> +#include <fcntl.h> +#include <dirent.h> + +#define MODULESDIR "/stand/modules" + +void +moduleInitialize(void) +{ + int fd, len; + DIR *dirp; + struct dirent *dp; + char module[MAXPATHLEN], desc[MAXPATHLEN]; + char desc_str[BUFSIZ]; + + if (!RunningAsInit && !Fake) { + /* It's not my job... */ + return; + } + + dirp = opendir(MODULESDIR); + if (dirp) { + while ((dp = readdir(dirp))) { + if (dp->d_namlen < (sizeof(".ko") - 1)) continue; + if (strcmp(dp->d_name + dp->d_namlen - (sizeof(".ko") - 1), ".ko") == 0) { + strcpy(module, MODULESDIR); + strcat(module, "/"); + strcat(module, dp->d_name); + strcpy(desc, module); + len = strlen(desc); + strcpy(desc + (len - (sizeof(".ko") - 1)), ".dsc"); + fd = open(module, O_RDONLY); + if (fd < 0) continue; + close(fd); + fd = open(desc, O_RDONLY); + if (fd < 0) { + desc_str[0] = 0; + } + else { + len = read(fd, desc_str, BUFSIZ); + close(fd); + if (len < BUFSIZ) desc_str[len] = 0; + } + if (desc_str[0]) + msgDebug("Loading module %s (%s)\n", dp->d_name, desc_str); + else + msgDebug("Loading module %s\n", dp->d_name); + if (kldload(module) < 0) { + if (desc_str[0]) + msgConfirm("Loading module %s failed\n%s", dp->d_name, desc_str); + else + msgConfirm("Loading module %s failed", dp->d_name); + } + } + } + closedir(dirp); + } +} diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 8dab491..d81644a 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -670,6 +670,9 @@ extern WINDOW *savescr(void); extern void restorescr(WINDOW *w); extern char *sstrncpy(char *dst, const char *src, int size); +/* modules.c */ +extern void moduleInitialize(void); + /* mouse.c */ extern int mousedTest(dialogMenuItem *self); extern int mousedDisable(dialogMenuItem *self); |