更新时间:2023-11-10 17:36:34
外壳使用uname -r
意味着这个Makefile将建立你的主机(x86)的系统模块不是ARM。
shell uname -r
means that this Makefile will build the module for you host(x86) system and not for ARM.
您需要指定ARM内核的源目录。您可以使用下面的Makefile交叉编译的模块。
You need to specify the source directory of your ARM Kernel. You may use following Makefile to cross-compile your module.
的Makefile:
CC=$(CROSS_COMPILE)gcc
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := modulename.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /path/to/kernel/linux
PWD := $(shell pwd)
default:
${MAKE} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules
clean:
${MAKE} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} clean
endif