How to fix : No rule to make target?

10,016

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.

Share:
10,016

Related videos on Youtube

Sagar
Author by

Sagar

Updated on June 04, 2022

Comments

  • Sagar
    Sagar almost 2 years

    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.

    • Tsyvarev
      Tsyvarev over 7 years
      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)?
  • Gomtesh Hatgine
    Gomtesh Hatgine over 3 years
    I am using the same code above still getting error a mentioned in question
  • Suchandan Dey
    Suchandan Dey over 3 years
    @GomteshHatgine can you please post the makefile content in case you are still facing the issue.