- 论坛徽章:
- 0
|
向各位请教一个编译内核模块的问题:
我现在有一个交叉编译环境,powerpc-linux-gcc,试验过用它编译一个简单的程序放到ppc平台运行的linux中可以运行。我现在想编译一个最简单的模块文件加载到ppc linux内核中,源文件是很多网上都提过的hello.c,Makefile文件是这样的:
KERNELDIR = /home/davidwx/control-project/daq-module/kernel/linux-2.6.11.8
CROSS_COMPILE = powerpc-linux-
ARCH := ppc
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
CFLAGS = -O2 -D__KERNEL__ -DLINUX -DMODULE -DEXPORT_SYMTAB -O3 -Wall -I$(KERNELDIR) -O
obj-m := hello.o
PWD := $(shell pwd)
all:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
编译总是报这样的错误:
make -C /home/davidwx/control-project/daq-module/kernel/linux-2.6.11.8 M=/home/davidwx/control-project/daq-module/tmp modules
make[1]: Entering directory `/home/davidwx/control-project/daq-module/kernel/linux-2.6.11.8'
CC [M] /home/davidwx/control-project/daq-module/tmp/hello.o
Building modules, stage 2.
MODPOST
CC /home/davidwx/control-project/daq-module/tmp/hello.mod.o
In file included from include/linux/wait.h:27,
from include/asm/semaphore.h:21,
from include/linux/sched.h:19,
from include/linux/module.h:10,
from /home/davidwx/control-project/daq-module/tmp/hello.mod.c:1:
include/asm/current.h:12: error: invalid register name for 'current'
{standard input}: Assembler messages:
{standard input}:3: Warning: setting incorrect section type for .plt
{standard input}:3: Error: alignment not a power of 2
{standard input}:4: Error: alignment not a power of 2
主要是说无效的寄存器名,我查了很多资料都不能解决,希望得到大家的帮助,不甚感激! |
|