--- modutils-2.4.18/insmod/insmod.c.loader	2002-07-23 15:15:21.000000000 -0400
+++ modutils-2.4.18/insmod/insmod.c	2002-07-23 15:16:40.000000000 -0400
@@ -360,6 +360,7 @@
 			sym->info = ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info));
 }
 
+#ifndef __LOADER__
 static void print_load_map(struct obj_file *f)
 {
 	struct obj_symbol *sym;
@@ -457,6 +458,7 @@
 			type, sym->name);
 	}
 }
+#endif
 
 /************************************************************************/
 /* begin compat */
@@ -760,6 +762,7 @@
 	}
 	free(absolute_filename);
 
+#ifndef __LOADER__
 	/* record where the persistent data is going, same address as previous symbol */
 
 	if (f->persist) {
@@ -776,6 +779,7 @@
 		if (use_ksymtab)
 			add_ksymtab(f, sym);
 	}
+#endif
 
 	/* tag the desired sections if size is non-zero */
 
@@ -1189,8 +1193,10 @@
 	image = xmalloc(m_size);
 	obj_create_image(f, image);
 
+#ifndef __LOADER__
 	if (flag_load_map)
 		print_load_map(f);
+#endif
 
 	if (blob_name) {
 		int fd, l;
@@ -1389,6 +1395,7 @@
 		return(1);
 	}
 	switch (*++p) {
+#ifndef __LOADER__
 	case 'p':
 		if (*(p-1) == 's') {
 			error("parameter %s is invalid persistent string", key);
@@ -1396,6 +1403,7 @@
 		}
 		*persist_flag = 1;
 		break;
+#endif
 	case '\0':
 		break;
 	default:
@@ -1574,7 +1582,9 @@
 		{"help", 0, 0, 'h'},
 		{"autoclean", 0, 0, 'k'},
 		{"lock", 0, 0, 'L'},
+#ifndef __LOADER__
 		{"map", 0, 0, 'm'},
+#endif
 		{"noload", 0, 0, 'n'},
 		{"probe", 0, 0, 'p'},
 		{"poll", 0, 0, 'p'},	/* poll is deprecated, remove in 2.5 */
@@ -1584,11 +1594,13 @@
 		{"kallsyms", 0, 0, 'S'},
 		{"verbose", 0, 0, 'v'},
 		{"version", 0, 0, 'V'},
+#ifndef __LOADER__
 		{"noexport", 0, 0, 'x'},
 		{"export", 0, 0, 'X'},
 		{"noksymoops", 0, 0, 'y'},
 		{"ksymoops", 0, 0, 'Y'},
 		{"persist", 1, 0, 'e'},
+#endif
 		{"numeric-only", 1, 0, 'N'},
 		{"name", 1, 0, 'o'},
 		{"blob", 1, 0, 'O'},
@@ -1638,9 +1650,11 @@
 		case 'L':	/* protect against recursion.  */
 			dolock = 1;
 			break;
+#ifndef __LOADER__
 		case 'm':	/* generate load map */
 			flag_load_map = 1;
 			break;
+#endif
 		case 'n':	/* don't load, just check */
 			noload = 1;
 			break;
@@ -1665,6 +1679,7 @@
 		case 'V':
 			fputs("insmod version " MODUTILS_VERSION "\n", stderr);
 			break;
+#ifndef __LOADER__
 		case 'x':	/* do not export externs */
 			flag_export = 0;
 			break;
@@ -1680,11 +1695,11 @@
 		case 'N':	/* only check numeric part of kernel version */
 			flag_numeric_only = 1;
 			break;
-
 		case 'e':	/* persistent data filename */
 			free(persist_name);
 			persist_name = xstrdup(optarg);
 			break;
+#endif
 		case 'o':	/* name the output module */
 			m_name = optarg;
 			break;
@@ -1709,6 +1724,7 @@
 		error("Failed handle configuration");
 	}
 
+#ifndef __LOADER__
 	if (persist_name && !*persist_name &&
 	    (!persistdir || !*persistdir)) {
 		free(persist_name);
@@ -1718,6 +1734,7 @@
 			++warnings;
 		}
 	}
+#endif
 
 	if (m_name == NULL) {
 		size_t len;
@@ -1869,6 +1886,7 @@
 	}
 	hide_special_symbols(f);
 
+#ifndef __LOADER__
 	if (persist_parms && persist_name && *persist_name) {
 		f->persist = persist_name;
 		persist_name = NULL;
@@ -1981,6 +1999,7 @@
 				free(pargv[pargc]);
 		}
 	}
+#endif
 
 	if (flag_ksymoops)
 		add_ksymoops_symbols(f, filename, m_name);
@@ -2042,6 +2061,7 @@
 		}
 	}
 
+#ifndef __LOADER__
 	/* module is already built, complete with ksymoops symbols for the
 	 * persistent filename.  If the kernel does not support persistent data
 	 * then give an error but continue.  It is too difficult to clean up at
@@ -2064,6 +2084,7 @@
 			errors = old_errors;
 		}
 	}
+#endif
 
 	if (!obj_relocate(f, m_addr)) {	/* DEPMOD */
 		if (!noload)
@@ -2100,8 +2121,10 @@
 	if (dolock)
 		flock(fp, LOCK_UN);
 	close(fp);
+#ifndef __LOADER__
 	if (!noload)
 		snap_shot(NULL, 0);
+#endif
 
 	return exit_status;
 }
--- modutils-2.4.18/insmod/modprobe.c.loader	2002-07-23 15:15:21.000000000 -0400
+++ modutils-2.4.18/insmod/modprobe.c	2002-07-23 15:15:37.000000000 -0400
@@ -697,10 +697,11 @@
 			printf("%s %s\n", execs[i].module, execs[i].cmd);
 		}
 	}
-
+#ifndef __LOADER__
 	puts("# Miscellaneous file and directory names");
 	for (i = 0; i < gen_file_count; ++i)
 		printf("%sfile=%s\n", gen_file[i].base, gen_file[i].name);
+#endif
 	printf("persistdir=%s\n", persistdir);
 }
 
@@ -777,7 +778,11 @@
 	int ret = 0;
 	int line_no;
 	char buf[3000];
+#ifdef __LOADER__
+	const char *depfile = "/dev/null";
+#else
 	const char *depfile = gen_file[GEN_DEPFILE].name;
+#endif
 
 	if ((fin = fopen(depfile, "r")) == NULL) {
 		error("Can't open dependencies file %s (%s)",
--- modutils-2.4.18/insmod/rmmod.c.loader	2002-04-28 05:39:21.000000000 -0400
+++ modutils-2.4.18/insmod/rmmod.c	2002-07-23 15:15:37.000000000 -0400
@@ -164,6 +164,8 @@
 	return(0);
 }
 
+#ifndef __LOADER__
+
 /* Check if a module parameter supports persistent data. */
 static int spd_parm(const char *pname, const char *type,
 		    const char *obj_name, struct obj_file *f,
@@ -585,6 +587,8 @@
 	return;
 }
 
+#endif
+
 int main(int argc, char **argv)
 {
 	struct module_stat *m;
@@ -598,7 +602,9 @@
 
 	struct option long_opts[] = {
 		{"all", 0, 0, 'a'},
+#ifndef __LOADER__
 		{"persist", 0, 0, 'e'},
+#endif
 		{"help", 0, 0, 'h'},
 		{"stacks", 0, 0, 'r'},
 		{"syslog", 0, 0, 's'},
@@ -623,23 +629,29 @@
 				&long_opts[0], NULL)) != EOF)
 		switch (i) {
 		case 'a':
+#ifndef __LOADER__
 			/* Remove all unused modules and stacks. */
 			save_persistent_data(NULL);
+#endif
 			if (delete_module(NULL)) {
 				perror("rmmod");
+#ifndef __LOADER__
 				snap_shot(module_names, n_module_names);
+#endif
 				free(module_names);
 				return 1;
 			}
+#ifndef __LOADER__
 			snap_shot(module_names, n_module_names);
+#endif
 			free(module_names);
 			return 0;
-
+#ifndef __LOADER__
 		case 'e':
 			/* Save persistent data, do not unload module */
 			persistent = 1;
 			break;
-
+#endif
 		case 'h':
 			rmmod_usage();
 			return 0;
@@ -668,7 +680,7 @@
 			rmmod_usage();
 			return 1;
 		}
-
+#ifndef __LOADER__
 	if (persistent) {
 		if (optind < argc) {
 			for (i = optind; i < argc; ++i)
@@ -678,13 +690,15 @@
 			save_persistent_data(NULL);
 		return 0;
 	}
-
+#endif
 	if (optind >= argc)
 		goto usage;
 
 	if (!recursive) {
 		for (i = optind; i < argc; ++i) {
+#ifndef __LOADER__
 			save_persistent_data(argv[i]);
+#endif
 			if (delete_module(argv[i]) < 0) {
 				++ret;
 				if (errno == ENOENT)
@@ -693,7 +707,9 @@
 					perror(argv[i]);
 			}
 		}
+#ifndef __LOADER__
 		snap_shot(module_names, n_module_names);
+#endif
 		free(module_names);
 		return ret ? 1 : 0;
 	}
@@ -745,7 +761,9 @@
 		switch (m->status) {
 		case CAN_REMOVE:
 		case WANT_TO_REMOVE | CAN_REMOVE:
+#ifndef __LOADER__
 			save_persistent_data(m->name);
+#endif
 			if (delete_module(m->name) < 0) {
 				error("%s: %m", m->name);
 				ret = 1;
@@ -759,7 +777,9 @@
 		}
 	}
 
+#ifndef __LOADER__
 	snap_shot(module_names, n_module_names);
+#endif
 	free(module_names);
 	return ret;
 }
--- modutils-2.4.18/util/config.c.loader	2002-07-23 15:15:21.000000000 -0400
+++ modutils-2.4.18/util/config.c	2002-07-23 15:15:37.000000000 -0400
@@ -109,6 +109,7 @@
 static char *config_version;	/* Hack for config_add */
 int quick = 0;			/* Option -A */
 
+#ifndef __LOADER__
 /* The initialization order must match the gen_file_enum order in config.h */
 struct gen_files gen_file[] = {
 	{"generic_string", NULL, 0},
@@ -122,6 +123,7 @@
 };
 
 const int gen_file_count = sizeof(gen_file)/sizeof(gen_file[0]);
+#endif
 
 int flag_verbose;
 
@@ -138,7 +140,7 @@
 	}
 }
 
-
+#ifndef __LOADER__
 /*
  *	Check to see if the existing modules.xxx files need updating,
  *	based on the timestamps of the modules and the config file.
@@ -199,7 +201,7 @@
 	snprintf (dep, sizeof(dep), "%s/lib/modules/%s", base_dir, force_ver);
 	return xftw (dep, check_update);
 }
-
+#endif
 
 /*
  *	Strip white char at the end of a string.
@@ -407,6 +409,7 @@
 	return i;
 }
 
+#ifndef __LOADER__
 /* Environment variables can override defaults, testing only */
 static void gen_file_env(struct gen_files *gf)
 {
@@ -473,6 +476,7 @@
 	}
 	return(ret);
 }
+#endif
 
 /*
  *	Read the configuration file.
@@ -788,13 +792,17 @@
 				}
 			}
 		}
-
+#ifndef __LOADER__
 		/* Environment overrides for testing only, undocumented */
 		for (i = 0; i < gen_file_count; ++i)
 			gen_file_env(gen_file+i);
+#endif
 
 	}	/* End of depth == 0 */
 
+#ifdef __LOADER__
+	return 0;
+#else
 	if (conf_file ||
 	    ((conf_file = getenv("MODULECONFIG")) != NULL && *conf_file && !safemode)) {
 		if (!(fin = fopen(conf_file, "r"))) {
@@ -1372,6 +1380,7 @@
 	}
 
 	return ret;
+#endif
 }
 
 int config_read(int all, char *force_ver, char *base_dir, char *conf_file)
@@ -1387,10 +1396,14 @@
 
 	r = do_read(all, force_ver, base_dir, conf_file, 0);
 
+#ifdef __LOADER__
+	return r;
+#else
 	if (quick && !r && !need_update (force_ver, base_dir))
 		exit (0);
 
 	return r;
+#endif
 }
 
 /****************************************************************************/
--- modutils-2.4.18/util/Makefile.in.loader	2002-02-28 19:39:06.000000000 -0500
+++ modutils-2.4.18/util/Makefile.in	2002-07-23 15:15:37.000000000 -0400
@@ -12,7 +12,7 @@
 
 all: .depend libutil.a
 
-OBJS = xmalloc.o xrealloc.o xstrcat.o xstrdup.o xsystem.o \
+OBJS = xsystem.o \
 	logger.o modstat.o \
 	meta_expand.o config.o snap_shot.o arch64.o gzfiles.o sys_nim.o sys_oim.o \
 	xftw.o
