1 diff -urN busybox-1.00-pre2.org/include/applets.h busybox-1.00-pre2/include/applets.h
2 --- busybox-1.00-pre2.org/include/applets.h 2003-08-02 23:46:48.000000000 +0200
3 +++ busybox-1.00-pre2/include/applets.h 2003-08-03 00:08:29.000000000 +0200
6 APPLET(insmod, insmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
8 +#ifdef CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE
9 + APPLET(insmod_ng, insmod_ng_main, __BB_DIR_SBIN, _BB_SUID_NEVER)
12 APPLET(ip, ip_main, _BB_DIR_BIN, _BB_SUID_NEVER)
14 diff -urN busybox-1.00-pre2.org/include/usage.h busybox-1.00-pre2/include/usage.h
15 --- busybox-1.00-pre2.org/include/usage.h 2003-08-02 23:46:48.000000000 +0200
16 +++ busybox-1.00-pre2/include/usage.h 2003-08-03 00:01:40.000000000 +0200
17 @@ -1312,6 +1312,11 @@
18 " [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n" \
19 " [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev PHYS_DEV ]\n"
21 +#define insmod_ng_trivial_usage \
22 + "MODULE [symbol=value]..."
23 +#define insmod_ng_full_usage \
24 + "Loads the specified kernel modules into the kernel."
26 #define kill_trivial_usage \
27 "[-signal] process-id [process-id ...]"
28 #define kill_full_usage \
29 diff -urN busybox-1.00-pre2.org/modutils/Config.in busybox-1.00-pre2/modutils/Config.in
30 --- busybox-1.00-pre2.org/modutils/Config.in 2003-08-02 23:46:49.000000000 +0200
31 +++ busybox-1.00-pre2/modutils/Config.in 2003-08-03 00:06:09.000000000 +0200
33 Support module loading for newer (post 2.1) Linux kernels.
36 +if CONFIG_FEATURE_NEW_MODULE_INTERFACE
37 +config CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE
38 + bool " Support new (port 2.5) Linux kernels"
40 + depends on CONFIG_INSMOD
42 + Support module loading for newer (port 2.5) Linux kernels.
45 config CONFIG_FEATURE_INSMOD_VERSION_CHECKING
46 bool " Module version checking"
48 diff -urN busybox-1.00-pre2.org/modutils/insmod.c busybox-1.00-pre2/modutils/insmod.c
49 --- busybox-1.00-pre2.org/modutils/insmod.c 2003-08-02 23:46:49.000000000 +0200
50 +++ busybox-1.00-pre2/modutils/insmod.c 2003-08-03 00:01:35.000000000 +0200
51 @@ -4049,6 +4049,14 @@
53 printf("Using %s\n", m_filename);
56 + if (create_module(NULL, 0) < 0 && errno == ENOSYS) {
58 + argv[optind] = m_filename;
59 + return insmod_ng_main(argc - optind, argv + optind);
63 if ((f = obj_load(fp, LOADBITS)) == NULL)
64 bb_perror_msg_and_die("Could not load the module");
66 diff -urN busybox-1.00-pre2.org/modutils/insmod_ng.c busybox-1.00-pre2/modutils/insmod_ng.c
67 --- busybox-1.00-pre2.org/modutils/insmod_ng.c 1970-01-01 01:00:00.000000000 +0100
68 +++ busybox-1.00-pre2/modutils/insmod_ng.c 2003-08-03 00:01:35.000000000 +0200
70 +/* vi: set sw=4 ts=4: */
72 + * insmod for 2.5 kernels implementation for busybox
73 + * busybox version by Michal Moskal <malekith@pld-linux.org>
75 + * Copyright (C) 2001 Rusty Russell.
76 + * Copyright (C) 2002 Rusty Russell, IBM Corporation.
78 + * This program is free software; you can redistribute it and/or modify
79 + * it under the terms of the GNU General Public License as published by
80 + * the Free Software Foundation; either version 2 of the License, or
81 + * (at your option) any later version.
83 + * This program is distributed in the hope that it will be useful,
84 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
85 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86 + * GNU General Public License for more details.
88 + * You should have received a copy of the GNU General Public License
89 + * along with this program; if not, write to the Free Software
90 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
97 +#include <sys/mman.h>
98 +#include <sys/types.h>
99 +#include <sys/stat.h>
102 +#include <asm/unistd.h>
103 +#include <sys/syscall.h>
105 +#include "busybox.h"
107 +#define __NR_init_module_25 __NR_init_module
108 +static _syscall3(long, init_module_25, void *, map, size_t, len, char *, options)
110 +/* We use error numbers in a loose translation... */
111 +static const char *moderror(int err)
115 + return "Invalid module format";
117 + return "Unknown symbol in module";
119 + return "Module has wrong symbol version";
121 + return "Invalid parameters";
123 + return strerror(err);
127 +extern int insmod_ng_main(int argc, char **argv)
135 + char *filename, *options = xstrdup("");
137 + filename = argv[1];
141 + /* Rest is options */
142 + for (i = 2; i < argc; i++) {
143 + options = xrealloc(options,
144 + strlen(options) + 2 + strlen(argv[i]) + 2);
145 + /* Spaces handled by "" pairs, but no way of escaping quotes */
146 + if (strchr(argv[i], ' ')) {
147 + strcat(options, "\"");
148 + strcat(options, argv[i]);
149 + strcat(options, "\"");
151 + strcat(options, argv[i]);
153 + strcat(options, " ");
156 + if ((fd = open(filename, O_RDONLY, 0)) < 0)
157 + perror_msg_and_die("cannot open module `%s'", filename);
161 + map = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
162 + if (map == MAP_FAILED)
163 + perror_msg_and_die("cannot mmap `%s'", filename);
165 + ret = init_module_25(map, len, options);
167 + perror_msg_and_die("cannot insert `%s': %s (%li)",
168 + filename, moderror(errno), ret);
175 +c-file-style: "linux"
180 diff -urN busybox-1.00-pre2.org/modutils/Makefile.in busybox-1.00-pre2/modutils/Makefile.in
181 --- busybox-1.00-pre2.org/modutils/Makefile.in 2003-08-02 23:46:49.000000000 +0200
182 +++ busybox-1.00-pre2/modutils/Makefile.in 2003-08-03 00:06:59.000000000 +0200
186 MODUTILS-$(CONFIG_INSMOD) += insmod.o
187 +MODUTILS-$(CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE) += insmod_ng.o
188 MODUTILS-$(CONFIG_LSMOD) += lsmod.o
189 MODUTILS-$(CONFIG_MODPROBE) += modprobe.o
190 MODUTILS-$(CONFIG_RMMOD) += rmmod.o