Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix : No rule to make target?

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.

like image 452
Sagar Avatar asked Oct 17 '22 22:10

Sagar


1 Answers

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.

like image 115
Suchandan Dey Avatar answered Oct 20 '22 19:10

Suchandan Dey