5

I am trying to build a demo kernel module, but when I do make, I get following,

make[1]: Entering directory '/usr/src/linux-headers-4.4.0-47-generic'
make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h'. Stop.
arch/x86/Makefile:199: recipe for target 'archheaders' failed                                                                                      
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-47-generic'
Makefile:4: recipe for target 'all' failed

I am building module across linux kernel - 4.4.0-47 version - 64 bit OS. Can anyone please help me to understand why I am facing this Error.Thank you in advance.

Sagar
  • 2,315
  • 7
  • 25
  • 34
  • Have you tried to google? Error `No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl'` is quite popular and may have several underline problems. **How exactly** do you compile kernel module (which makefile or which command line do you use)? – Tsyvarev Nov 23 '16 at 05:26

1 Answers1

3

Make sure you have proper make file. this is a very common issue. or you could use below statement in makefile also.

 obj-m += your_module_name.o

 all:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
 clean:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

it should work.

Sagar
  • 2,315
  • 7
  • 25
  • 34