All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuan ChunYang <cyyuanml@sonata.iscas.ac.cn>
To: lartc@vger.kernel.org
Subject: [LARTC] Difference of building modules between kernel 2.4.XX and 2.5.XX ???
Date: Mon, 07 Jul 2003 12:46:49 +0000	[thread overview]
Message-ID: <marc-lartc-105758229002301@msgid-missing> (raw)

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/

                 reply	other threads:[~2003-07-07 12:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-105758229002301@msgid-missing \
    --to=cyyuanml@sonata.iscas.ac.cn \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.