I have a code below and I need to compile it. However, I can not run the Makefile on my computer
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
int
simple_init(void)
{
printk("Loading module\n");
return 0;
}
void
simple_exit(void)
{
printk("Removing module\n");
}
module_init(simple_init);
module_exit(simple_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple Module");
Makefile:
obj-m := simple.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
The problem is that: When I type Make in the terminal the following error occurs:
make -C /lib/modules/4.4.0-75-generic/build
SUBDIRS=/home/caiquefortunato/Área de Trabalho/kernel modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-75-generic'
arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
Makefile:693: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-
protector-strong not supported by compiler
make[1]: *** No rule to make target 'de'. Pare.
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-75-generic'
Makefile:19: recipe for target 'default' failed
make: *** [default] Error 2
What do I have to do to make it work? Do I need to install something?
Thank you very much in advance
makemay mess things up when you have spaces in your folder paths. Try copying the build folder to a path with no spaces and runmakeagain.