simple module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i am trying to compile a simple module hello-1.c

#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);




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




on make i get the following:

[root@localhost Desktop]# make
uname: extra operand `−r'
Try `uname --help' for more information.
uname: extra operand `−r'
Try `uname --help' for more information.
make: Nothing to be done for `all'.



i just want hello world printed and when i do lsmod i want to see my module








[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux