0
votes

I was learning kernel interrupt using a small demo kernel module which use these two header include

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

My Makefile is

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/

  • [1]But how to include this path in Makefile

  • [2]Is /usr/src/linux-headers-3.16.0-30-generic/include/asm-generic/ linked with arch/arm/include/asm/ ? if yes , than How ?

1
The headers under arch/ are architecture-specific. If you compile kernel for ARM architecture, directory arch/arm/include is included automatically. Looks like you don't compile for ARM, or /usr/src/linux-headers-3.16.0-30-generic is not your kernel build directory. You may find current kernel directory with ls -l /lib/modules/$(uname -r)/build.Tsyvarev

1 Answers

0
votes

First try adding ARCH=arm after make i.e.

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