Make file error when compiling kernel module

programmer25

Hello i am trying to compile my first kernel module but i am receiving an error message. The hello.c program for my module is shown below:

#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void){
printk(KERN_ALERT "Hello, world\n");
return 0;
}

static void hello_exit(void){
printk(KERN_ALERT "Goodbye, cruel world\n");
}

module_init(hello_init);
module_exit(hello_exit);

My makefile is the following:

obj-m := hello.o
KDIR := /lib/modules/4.19.94-ti-r42/build
PWD := $(shell pwd)

default:
        $(MAKE) -C $(KDIR) M=$(PWD)

I also want to mention that i tried to replace M=$(PWD) with SUBDIRS=$(PWD) but i still received the same error. When i run my make file i receive the following error message:

debian@beaglebone:~/LDD-3$ make
make -C /lib/modules/4.19.94-ti-r42/build M=/home/debian/LDD-3
make[1]: Entering directory '/usr/src/linux-headers-4.19.94-ti-r42'
scripts/Makefile.build:45: /home/debian/LDD-3/Makefile: No such file or directory
make[2]: *** No rule to make target '/home/debian/LDD-3/Makefile'.  Stop.
make[1]: *** [Makefile:1522: _module_/home/debian/LDD-3] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.19.94-ti-r42'
make: *** [makefile:6: default] Error 2

Does anyone know what i may be doing wrong? Thank you.

MadScientist

You named your makefile makefile, as we can see from this message:

make: *** [makefile:6: default] Error 2

The kernel build system expects your makefile to be named Makefile, as can be seen in this message:

scripts/Makefile.build:45: /home/debian/LDD-3/Makefile: No such file or directory

So I suggest you use:

mv makefile Makefile

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Simple ubuntu kernel module make file error

From Dev

make - fatal error when compiling modowa (apache-module)

From Dev

Error compiling kernel module with two source files

From Dev

Issue while compiling make file for linux kernel?

From Dev

"__aeabi_ldivmod" undefined when compiling kernel module

From Dev

No module named utils error on compiling py file

From Dev

typescript error when compiling node module

From Dev

can we install kernel module with make file

From Dev

When compiling the Linux Kernel, what is the purpose of `make randconfig`?

From Dev

Android kernel compiling error

From Dev

make install error when compiling a program with cuda

From Dev

alias for cross compiling kernel module

From Dev

Cross compiling a kernel module ARM

From Dev

How to use alternate config file when compiling the Kernel?

From Dev

Getting error when compiling kernel for page table walk

From Dev

When compiling a custom kernel modules_install results in an error

From Dev

"Bad command or file name" error when compiling with g++ using Make

From Dev

Assembler error when using 'dccmvac' in a kernel module

From Dev

Error when compiling a Java file with an "Aux" class in it

From Dev

error when compiling java file script

From Dev

error when compiling - linking .cpp & header file

From Dev

Eslint error when compiling vue file with loop

From Java

error compiling: linux/module.h: No such file or directory

From Dev

TypeScript is compiling into this failing JS file when importing a module. Why?

From Dev

Error when compiling a Numba module with function using other functions inline

From Dev

error in loadable kernel module as make: nothing to be done for all?

From Dev

Make: error compiling .o

From Dev

'make' compiling error in ubuntu

From Dev

Compiling a loadable kernel module(Debian/Ubuntu)

Related Related

  1. 1

    Simple ubuntu kernel module make file error

  2. 2

    make - fatal error when compiling modowa (apache-module)

  3. 3

    Error compiling kernel module with two source files

  4. 4

    Issue while compiling make file for linux kernel?

  5. 5

    "__aeabi_ldivmod" undefined when compiling kernel module

  6. 6

    No module named utils error on compiling py file

  7. 7

    typescript error when compiling node module

  8. 8

    can we install kernel module with make file

  9. 9

    When compiling the Linux Kernel, what is the purpose of `make randconfig`?

  10. 10

    Android kernel compiling error

  11. 11

    make install error when compiling a program with cuda

  12. 12

    alias for cross compiling kernel module

  13. 13

    Cross compiling a kernel module ARM

  14. 14

    How to use alternate config file when compiling the Kernel?

  15. 15

    Getting error when compiling kernel for page table walk

  16. 16

    When compiling a custom kernel modules_install results in an error

  17. 17

    "Bad command or file name" error when compiling with g++ using Make

  18. 18

    Assembler error when using 'dccmvac' in a kernel module

  19. 19

    Error when compiling a Java file with an "Aux" class in it

  20. 20

    error when compiling java file script

  21. 21

    error when compiling - linking .cpp & header file

  22. 22

    Eslint error when compiling vue file with loop

  23. 23

    error compiling: linux/module.h: No such file or directory

  24. 24

    TypeScript is compiling into this failing JS file when importing a module. Why?

  25. 25

    Error when compiling a Numba module with function using other functions inline

  26. 26

    error in loadable kernel module as make: nothing to be done for all?

  27. 27

    Make: error compiling .o

  28. 28

    'make' compiling error in ubuntu

  29. 29

    Compiling a loadable kernel module(Debian/Ubuntu)

HotTag

Archive