简体   繁体   English

如何在内核模块Makefile中提供包含目录路径

[英]How to provide include directory path in kernel module Makefile

I was learning kernel interrupt using a small demo kernel module which use these two header include 我正在使用一个小的演示内核模块来学习内核中断,该模块使用这两个标头包括

asm/exception.h asm / exception.h
asm/mach/irq.h asm / mach / irq.h

My Makefile is 我的Makefile是

ifeq (${KERNELRELEASE},)

    KERNEL_SOURCE := /lib/modules/$(shell uname -r)/build

    PWD := $(shell pwd)


default:
    make    -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules 

clean:
    make    -C ${KERNEL_SOURCE} SUBDIRS=${PWD} clean



else

obj-m := irq_demo.o

endif

The error I am getting 我得到的错误

irq_demo.c:9:27: fatal error: asm/exception.h: No such file or directory
 #include <asm/exception.h>

I found asm/exception.h in my system in /usr/src/linux-headers-3.16.0-30-generic/arch/arm/include/ 我在/usr/src/linux-headers-3.16.0-30-generic/arch/arm/include/中的系统中找到了asm / exception.h

  • [1]But how to include this path in Makefile [1]但是如何在Makefile中包含此路径

  • [2]Is /usr/src/linux-headers-3.16.0-30-generic/include/asm-generic/ linked with arch/arm/include/asm/ ? [2] /usr/src/linux-headers-3.16.0-30-generic/include/asm-generic/是否与arch / arm / include / asm /链接? if yes , than How ? 如果是,那怎么办?

First try adding ARCH=arm after make ie 首先尝试在make ie之后添加ARCH = arm

make ARCH=arm -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules 

============================= OR ============================= ===========================或===================== =========

Can you try adding line before make 你可以尝试在添加之前添加行

CARGS = -I /lib/modules/$(shell uname -r)/arch/arm/include/
make  $(CARGS) -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM