tan*_*ect 5 linux-device-driver linux-kernel
我正在尝试使用 Yocto SDK 构建 Linux 内核模块。但是,我遇到了编译错误,它抱怨
./include/uapi/asm-generic/int-ll64.h:12:10: fatal error: asm/bitsperlong.h: No such file or directory
#include <asm/bitsperlong.h>
Run Code Online (Sandbox Code Playgroud)
这是我的 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
Run Code Online (Sandbox Code Playgroud)
在调用 make 之前,我要设置源环境。
$source /opt/poky/2.7.3/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi
$make
Run Code Online (Sandbox Code Playgroud)
由于现在编译的“@tannoy connect”的注释,树外内核模块也遇到了类似的问题。以下是基本步骤:
TOOLCHAIN_TARGET_TASK += "kernel-devsrc"
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
export KERNEL_SRC=path/to/sdk/sysroots/aarch64-linux/usr/src/kernel/
make
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5948 次 |
| 最近记录: |