Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Kernel 2.6.x User Module Compiling?
Whenever I make a major update in my installed kernel I usually try to
get this sample program to work ... just out of pure curiosity right
now.  It has gone through a few changes over the years.

I've included below:
- The source code
- the error display
- the Makefile

I resolved several of the original include errors just by fixing
symbolic links in /usr/include/ BUT in this last one (or so) I'm not
sure which of the several "mach" directories should be used.

Could someone point out the proper modification(s) that should be made
to this simple user space module to get it to work?  Assuming of
course that its not some kind of major re-write, I am expecting a
sympolic link or 2 must be fixed or an include.

Thanks in advance!

PS No, this is not a school project, I just have some time on my hands
and I'm trying out some LJ code!   :-)

---------------<Cut Here>---------------
/* 010831 - Linux Journal Sept 2001 Pg 24 - Loadable Module Hello.c
- compile with
gcc -c -DMODULE -D__KERNEL__ hello.c
- Use with
insmod ./hello.o
lsmod
rmmod hello.o
*/

#define MODULE
#define __KERNEL__

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

int init_module() {
printk("<1> Hello, kernel!\n");
return 0;
}

void cleanup_module() {
printk("<1> I'm not offended that you "
"unloaded me.  Have a pleasant day!\n");
}

MODULE_LICENSE("GPL");
---------------<Cut Here>---------------
In file included from /usr/include/asm/smp.h:18,
from /usr/include/linux/smp.h:17,
from /usr/include/linux/sched.h:23,
from /usr/include/linux/module.h:10,
from hello.c:14:
/usr/include/asm/mpspec.h:6:25: mach_mpspec.h: No such file or
directory
In file included from /usr/include/asm/smp.h:18,
from /usr/include/linux/smp.h:17,
from /usr/include/linux/sched.h:23,
from /usr/include/linux/module.h:10,
from hello.c:14:
/usr/include/asm/mpspec.h:8: `MAX_MP_BUSSES' undeclared here (not in a
function)
/usr/include/asm/mpspec.h:9: `MAX_MP_BUSSES' undeclared here (not in a
function)
/usr/include/asm/mpspec.h:10: `MAX_MP_BUSSES' undeclared here (not in
a function)
/usr/include/asm/mpspec.h:12: `MAX_MP_BUSSES' undeclared here (not in
a function)
/usr/include/asm/mpspec.h:20: `MAX_MP_BUSSES' undeclared here (not in
a function)
/usr/include/asm/mpspec.h:20: conflicting types for
`mp_bus_id_to_type'
/usr/include/asm/mpspec.h:8: previous declaration of
`mp_bus_id_to_type'
/usr/include/asm/mpspec.h:22: `MAX_IRQ_SOURCES' undeclared here (not
in a function)
/usr/include/asm/mpspec.h:24: `MAX_MP_BUSSES' undeclared here (not in
a function)
/usr/include/asm/mpspec.h:24: conflicting types for
`mp_bus_id_to_pci_bus'
/usr/include/asm/mpspec.h:12: previous declaration of
`mp_bus_id_to_pci_bus'
In file included from /usr/include/asm/smp.h:20,
from /usr/include/linux/smp.h:17,
from /usr/include/linux/sched.h:23,
from /usr/include/linux/module.h:10,
from hello.c:14:
/usr/include/asm/io_apic.h:160: `MAX_IRQ_SOURCES' undeclared here (not
in a function)
/usr/include/asm/io_apic.h:160: conflicting types for `mp_irqs'
/usr/include/asm/mpspec.h:22: previous declaration of `mp_irqs'
In file included from /usr/include/linux/smp.h:17,
from /usr/include/linux/sched.h:23,
from /usr/include/linux/module.h:10,
from hello.c:14:
/usr/include/asm/smp.h:72:26: mach_apicdef.h: No such file or
directory
make: *** [x] Error 1
---------------<Cut Here>---------------
# Makefile for modules.

CC = gcc
CPPFLAGS =
# CFLAGS = -c -DMODULE -D__KERNEL__
CFLAGS = -c
LDFLAGS =
SRCFILES = hello.c
LIBS =

x: $(SRCFILES)
$(CC) $(CFLAGS) $(SRCFILES)
---------------<Cut Here>---------------
--
------------------------------------------------
http://www3.sympatico.ca/dmitton
SPAM Reduction: Remove "x." from my domain.
------------------------------------------------

Report this thread to moderator Post Follow-up to this message
Old Post
Doug Mitton
12-23-04 09:07 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:16 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.