Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-13-2004, 12:14 PM   #1
LQ Newbie
Registered: Dec 2004
Posts: 3

Rep: Reputation: 0
Problems building a simple kernel module for kernel 2.6.7

I'm a newbie to Linux and I'm trying to build a simple kernel module with some problems. I'm calling an external C function in the kernel source and I'm getting "implicit declaration" warnings in the first pass and undefined symbols in the MODPOST pass. I don't understand why I'm getting these.

The module will not even load due to these errors. Here is the error I get when I do "insmod mcf25.ko":

insmod: error inserting 'mcf25.ko': -1 Unknown symbol in module

Which is interesting that if I take out the "CardServices" function call, building and insmoding work just fine.

I've pasted my source (which is small) and the Makefile also.

This is Slackware 10. I'm sure there is something extremely simple that I didn't do, I just don't know what the heck it is.


---- Source ----

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/ioport.h>
#include <asm/io.h>
#include <asm/system.h>

#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/ioport.h>
#include <linux/config.h>

#include <pcmcia/version.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/ds.h>
//#include <pcmcia/bus_ops.h>
#include "mcf25.h"


static int __init init_mcf25_cs(void)
servinfo_t serv;

printk(KERN_ALERT"TEST: (test2) in module MCF25!\n");

CardServices(GetCardServicesInfo, &serv);

return 0;

static void __exit exit_mcf25_cs(void)
printk(KERN_ALERT"TEST: (test2) exiting module MCF25!\n");


---- Makefile ----

CFLAGS += -Wall

obj-m += mcf25.o

mcf25-objs := mcf25_cs.o

---- Build output ----

make: Entering directory `/usr/src/linux-2.6.7'
CC [M] /home/john/test2/mcf25_cs.o
/home/john/test2/mcf25_cs.c: In function `init_mcf25_cs':
/home/john/test2/mcf25_cs.c:37: warning: implicit declaration of function `CardServices'
LD [M] /home/john/test2/mcf25.o
Building modules, stage 2.
*** Warning: "CardServices" [/home/john/test2/mcf25.ko] undefined!
CC /home/john/test2/mcf25.mod.o
LD [M] /home/john/test2/mcf25.ko
make: Leaving directory `/usr/src/linux-2.6.7'

Old 12-13-2004, 03:23 PM   #2
Senior Member
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Old 12-13-2004, 03:35 PM   #3
LQ Newbie
Registered: Dec 2004
Posts: 3

Original Poster
Rep: Reputation: 0
I have that already. I just stripped down my code for example purposes. My problem is getting the external references correct so I can build this against kernel 2.6.x. The second pass, MODPOST warnings are preventing the module from loading properly with the error:

insmod: error inserting 'mcf25.ko': -1 Unknown symbol in module

any help would be greatly appreciated!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
error building nvidia kernel module beeblequix Debian 1 10-07-2005 05:21 PM
a simple kernel module hari_sasidharan Programming 3 01-15-2005 01:11 AM
Building kernel module from multiple source file in 2.6 kernel yogeshwar_s Programming 1 12-20-2004 09:31 AM
Building a module within a kernel brianvdc Linux - General 1 12-11-2003 08:13 PM
VMware module building kernel error ^^ ZoNicONE Linux - Newbie 3 09-09-2003 01:52 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration