1 diff -urN busybox-1.00-pre3.org/include/applets.h busybox-1.00-pre3/include/applets.h
2 --- busybox-1.00-pre3.org/include/applets.h 2003-09-15 20:55:05.000000000 +0200
3 +++ busybox-1.00-pre3/include/applets.h 2003-09-15 21:03:21.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-pre3.org/include/usage.h busybox-1.00-pre3/include/usage.h
15 --- busybox-1.00-pre3.org/include/usage.h 2003-09-15 20:55:05.000000000 +0200
16 +++ busybox-1.00-pre3/include/usage.h 2003-09-15 21:03:24.000000000 +0200
17 @@ -1318,6 +1318,11 @@
18 #define insmod_ng_full_usage \
19 "Loads the specified kernel modules into the kernel."
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-pre3.org/modutils/Config.in busybox-1.00-pre3/modutils/Config.in
30 --- busybox-1.00-pre3.org/modutils/Config.in 2003-09-15 20:55:05.000000000 +0200
31 +++ busybox-1.00-pre3/modutils/Config.in 2003-09-15 21:03:24.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-pre3.org/modutils/insmod.c busybox-1.00-pre3/modutils/insmod.c
49 --- busybox-1.00-pre3.org/modutils/insmod.c 2003-09-15 20:55:05.000000000 +0200
50 +++ busybox-1.00-pre3/modutils/insmod.c 2003-09-15 21:03:25.000000000 +0200
51 @@ -4141,6 +4141,14 @@
55 +#ifdef CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE
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-pre3.org/modutils/insmod_ng.c busybox-1.00-pre3/modutils/insmod_ng.c
67 --- busybox-1.00-pre3.org/modutils/insmod_ng.c 1970-01-01 01:00:00.000000000 +0100
68 +++ busybox-1.00-pre3/modutils/insmod_ng.c 2003-09-15 21:03:25.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 +/* We use error numbers in a loose translation... */
108 +static const char *moderror(int err)
112 + return "Invalid module format";
114 + return "Unknown symbol in module";
116 + return "Module has wrong symbol version";
118 + return "Invalid parameters";
120 + return strerror(err);
124 +extern int insmod_ng_main(int argc, char **argv)
132 + char *filename, *options = bb_xstrdup("");
134 + filename = argv[1];
140 + /* Rest is options */
141 + for (i = 2; i < argc; i++) {
142 + options = xrealloc(options,
143 + strlen(options) + 2 + strlen(argv[i]) + 2);
144 + /* Spaces handled by "" pairs, but no way of escaping quotes */
145 + if (strchr(argv[i], ' ')) {
146 + strcat(options, "\"");
147 + strcat(options, argv[i]);
148 + strcat(options, "\"");
150 + strcat(options, argv[i]);
152 + strcat(options, " ");
155 + if ((fd = open(filename, O_RDONLY, 0)) < 0)
156 + bb_perror_msg_and_die("cannot open module `%s'", filename);
160 + map = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
161 + if (map == MAP_FAILED)
162 + bb_perror_msg_and_die("cannot mmap `%s'", filename);
164 + ret = init_module(map, len, options);
166 + bb_perror_msg_and_die("cannot insert `%s': %s (%li)",
167 + filename, moderror(errno), ret);
174 +c-file-style: "linux"
179 diff -urN busybox-1.00-pre3.org/modutils/Makefile.in busybox-1.00-pre3/modutils/Makefile.in
180 --- busybox-1.00-pre3.org/modutils/Makefile.in 2003-09-15 20:55:05.000000000 +0200
181 +++ busybox-1.00-pre3/modutils/Makefile.in 2003-09-15 21:03:25.000000000 +0200
185 MODUTILS-$(CONFIG_INSMOD) += insmod.o
186 +MODUTILS-$(CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE) += insmod_ng.o
187 MODUTILS-$(CONFIG_LSMOD) += lsmod.o
188 MODUTILS-$(CONFIG_MODPROBE) += modprobe.o
189 MODUTILS-$(CONFIG_RMMOD) += rmmod.o