我正在尝试使用Yocto构建一个linux内核模块。但是,我遇到编译错误,它抱怨
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
#include <asm/bitsperlong.h>这是我的Makefile
ARCH ?= arm
CROSS_COMPILE ?= arm-poky-linux-gnueabi-
KERNELDIR ?= /opt/poky/2.7.3/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/src/kernel/
PWD := $(shell pwd)
.PHONY: build clean
build:
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c modules.order Module.symvers
# Incorporate modules into a multi-part driver
my-objs := hello.o
$(info Building with KERNELRELEASE = ${KERNELRELEASE})
EXTRA_CFLAGS+=-I$(PWD)/../include
obj-m := hello.o在调用make之前,我正在设置源环境。
$source /opt/poky/2.7.3/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi
$make发布于 2021-04-30 13:57:06
由于"@tannoy“的注释,它现在编译了,所以它的树外内核模块也出现了类似的问题。以下是基本步骤:
TOOLCHAIN_TARGET_TASK += "kernel-devsrc" source path/to/sdk/environment-setup-aarch64-linux
cd -P path/to/sdk/sysroots/aarch64-linux/usr/src/kernel
# Note the -P argument: kernel is a symlink, in my case:
# path/to/sdk/sysroots/aarch64-linux/lib/modules/5.4.0-xilinx-v2020.1/build
make scripts
make prepare export KERNEL_SRC=path/to/sdk/sysroots/aarch64-linux/usr/src/kernel/
makehttps://stackoverflow.com/questions/60923890
复制相似问题