All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Difference of building modules between kernel 2.4.XX and 2.5.XX ???
@ 2003-07-07 12:46 Yuan ChunYang
  0 siblings, 0 replies; only message in thread
From: Yuan ChunYang @ 2003-07-07 12:46 UTC (permalink / raw)
  To: lartc

In kernel 2.5, the implementation of building modules  must be changed.
As fellow, i programed a test .
In kernel 2.4.20 ,it's OK! 
But in kenel 2.5.72,you can see:

# insmod testdemo.o
Error inserting 'testdemo.o': -1 Unknown symbol in module

demo: no version magic, tainting kernel.
demo: Unknown symbol myprintk

Now i already installed module_init_tools 0.9.12.

can somebody tell me why?
how to resolve this problem.
thanx firstly. :)
                                                        yuan
                                        


#################################################################################
# Makefile:
#
LINUX_DIR = /usr/src/lsm-2.5
#LINUX_DIR = /usr/src/linux-2.4.20-8
CC=gcc

MODCFLAGS       = -D__KERNEL__ -I$(LINUX_DIR)/include
-I$(LINUX_DIR)/include/asm-i386/mach-default -Wall -DMODULE -O2 
-DKBUILD_MODNAME=$* -DKBUILD_BASENAME=$*  -Wstrict-prototypes -o $*.o

testdemo.o:	demo.o myprintk.o
	ld -m elf_i386 -r -o testdemo.o demo.o myprintk.o
demo.o:		demo.c myprintkp.c $(LINUX_DIR)/include/linux/version.h
	$(CC) $(MODCFLAGS) -c demo.c 
myprintk.o:	myprintk.c myprintk.h $(LINUX_DIR)/include/linux/version.h
	$(CC) $(MODCFLAGS) -c myprintk.c

clean:
	rm -f *.o  *.o.d

#######################################################################
/*
 * demo.c
 */


#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>


extern int myprintk (void);

static int __init demo_init(void) {
        printk("initializing..\n");
	myprintk();
        return 0;
}

static void __exit demo_exit(void) {
        printk("goodbye!\n");
}

module_init(demo_init);
module_exit(demo_exit);
MODULE_LICENSE("GPL");
###################################################################################
/*
* myprintk.c
*/

#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

#include "myprintk.h"

static int myprintk (void)
{
	printk(KERN_INFO "This is my printk!\n");				

	return 0;
}

##################################################################################
/*
* myprintk.h
*/
#define MODULE_NAME   "HELLO"
static int myprintk (void);


###########################################################################

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-07 12:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-07 12:46 [LARTC] Difference of building modules between kernel 2.4.XX and 2.5.XX ??? Yuan ChunYang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.