2.1.19 patches to get some modules working better

Chris Faylor (cgf@bbc.com)
Thu, 2 Jan 1997 03:04:09 GMT


I've found that modules in 2.1.19 worked much better after I installed
the patches below. YMMV.

This fixes the following problems:

1) esp.o parameters were not properly identified

2) kernel ksyms.c variables (and others) were not exported for modules

3) netsyms.o was not loaded into the kernel which disallowed use of
network card modules

4) modularized ip tunneling required a symbol from ip_output.c

There are undoubtedly many more problems of this nature in the kernel,
but from the small amount of studying that I've done it seems that
the changes to module handling are well worth it.

diff -u -r linux-2.1.19/drivers/char/esp.c linux/drivers/char/esp.c
--- linux-2.1.19/drivers/char/esp.c Fri Dec 27 05:03:21 1996
+++ linux/drivers/char/esp.c Wed Jan 1 12:49:00 1997
@@ -75,6 +75,10 @@
/* custom divisor for each port */
static unsigned int dma = CONFIG_ESPSERIAL_DMA_CHANNEL; /* DMA channel */
static unsigned int trigger = CONFIG_ESPSERIAL_TRIGGER_LEVEL;
+MODULE_PARM(irq, "1-" __MODULE_STRING(NR_PRIMARY) "i");
+MODULE_PARM(divisor, "1-" __MODULE_STRING(NR_PRIMARY) "i");
+MODULE_PARM(dma, "i");
+MODULE_PARM(trigger, "i");
/* FIFO trigger level */
/* END */

diff -u -r linux-2.1.19/include/linux/module.h linux/include/linux/module.h
--- linux-2.1.19/include/linux/module.h Sun Dec 29 04:34:23 1996
+++ linux/include/linux/module.h Tue Dec 31 23:16:21 1996
@@ -7,6 +7,8 @@
#ifndef _LINUX_MODULE_H
#define _LINUX_MODULE_H

+#include <linux/config.h>
+
#ifdef __GENKSYMS__
# undef MODVERSIONS
# define MODVERSIONS
diff -u -r linux-2.1.19/kernel/ksyms.c linux/kernel/ksyms.c
--- linux-2.1.19/kernel/ksyms.c Fri Dec 27 05:04:48 1996
+++ linux/kernel/ksyms.c Tue Dec 31 23:27:07 1996
@@ -330,7 +330,7 @@
EXPORT_SYMBOL(___strtok);
EXPORT_SYMBOL(init_fifo);
EXPORT_SYMBOL(super_blocks);
-EXPORT_SYMBOL(reuse_list);
+/*EXPORT_SYMBOL(reuse_list);*/
EXPORT_SYMBOL(fifo_inode_operations);
EXPORT_SYMBOL(chrdev_inode_operations);
EXPORT_SYMBOL(blkdev_inode_operations);
diff -u -r linux-2.1.19/net/Makefile linux/net/Makefile
--- linux-2.1.19/net/Makefile Wed Dec 18 05:07:55 1996
+++ linux/net/Makefile Wed Jan 1 12:07:11 1997
@@ -83,11 +83,6 @@

L_TARGET := network.a
L_OBJS := socket.o protocols.o sysctl_net.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
-ifeq ($(CONFIG_NET),y)
-ifeq ($(CONFIG_MODULES),y)
-LX_OBJS = netsyms.o
-endif
-endif

M_OBJS :=

@@ -119,3 +114,12 @@
endif

include $(TOPDIR)/Rules.make
+
+ifeq ($(CONFIG_NET),y)
+ifeq ($(CONFIG_MODULES),y)
+protocols.o: protocols.c netsyms.o
+ $(CC) $(CFLAGS) -c -o prot$$.o protocols.c;\
+ ld -r -o $@ prot$$.o netsyms.o; \
+ rm -f prot$$.o
+endif
+endif
diff -u -r linux-2.1.19/net/ipv4/ip_output.c linux/net/ipv4/ip_output.c
--- linux-2.1.19/net/ipv4/ip_output.c Thu Dec 12 09:54:24 1996
+++ linux/net/ipv4/ip_output.c Wed Jan 1 15:15:43 1997
@@ -38,6 +38,7 @@
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/config.h>
+#include <linux/module.h>

#include <linux/socket.h>
#include <linux/sockios.h>
@@ -303,6 +304,7 @@
}

#ifdef CONFIG_IP_ACCT
+EXPORT_SYMBOL(ip_acct_output);
int ip_acct_output(struct sk_buff *skb)
{
/*

-- 
http://www.bbc.com/	cgf@bbc.com			"Strange how unreal
VMS=>UNIX Solutions	Boston Business Computing	 the real can be."