12-23-04 11:00 PM
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.
------------------------------------------------
[ Post a follow-up to this message ]
|