本文使用的交叉编译工具为arm-none-linux-gnueabi-gcc
其目录在 /pkg/asw/compilers/gnu/codesourcery/arm-2006q3-27/bin
内核树目录在/home/sein/work/router/lct_kernel/kernel
输出文件:hello.ko
先export交叉编译工具的位置
export PATH=/pkg/asw/compilers/gnu/codesourcery/arm-2006q3-27/bin:$PATH
以下是Makefile的内容
*****************************************************************************
ifeq ($(KERNELRELEASE),)
KERNELDIR ?=/home/sein/work/router/lct_kernel/kernel
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=./mod modules_install
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
else
obj-m := hello.o
endif
*****************************************************************************
阅读(1409) | 评论(0) | 转发(0) |