I have just started with linux kernel development and I am having issue with compiling make file.
It is the tutorial of hello world.
My hello-1.c file
*
* hello−1.c − The simplest kernel module.
*/
#include <linux/module.h>
/* Needed by all modules */
#include <linux/kernel.h>
/* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
My Makefile
obj−m += hello−1.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
Both of this file are in folder /home/kkr/Documents/HelloWorld
When i run the make command I am getting below output.
uname: extra operand `−r'
Try `uname --help' for more information.
make −C /lib/modules//build M=/home/kkr/Documents/HelloWorld modules
make[1]: Entering directory `/home/kkr/Documents/HelloWorld'
make[1]: *** No rule to make target `−C'. Stop.
make[1]: Leaving directory `/home/kkr/Documents/HelloWorld'
make: *** [all] Error 2
Can any body have any idea what is the root cause ? I know it is very simple still I am not able to come out from this ?
Thanks
$(shell uname −r)
^
This is not a - (dash , minus) character.
You want
$(shell uname -r)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With