Skip to content

Commit 15201f6

Browse files
author
Frank Maker
committed
Built and inserted on Ubuntu 10.04
0 parents  commit 15201f6

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# If KERNELRELEASE is defined, we've been invoked from the
2+
# kernel build system and can use its language
3+
ifneq ($(KERNELRELEASE),)
4+
obj-m := hello.o
5+
6+
# Otherwise we were called directly from the command
7+
# line; invoke the kernel build system
8+
else
9+
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
10+
PWD := $(shell pwd)
11+
12+
all:
13+
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
14+
15+
endif
16+
17+
.PHONY: clean.
18+
clean:
19+
rm -rf *.o *.~ *.ko *.mod.c *.order *.symvers

hello.c

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <linux/init.h>
2+
#include <linux/module.h>
3+
MODULE_LICENSE("BSD");
4+
5+
static int hello_init(void)
6+
{
7+
printk(KERN_ALERT "Hello world!\n");
8+
return 0;
9+
}
10+
11+
static void hello_exit(void)
12+
{
13+
printk(KERN_ALERT "Goodbye, cruel world!\n");
14+
}
15+
16+
module_init(hello_init);
17+
module_exit(hello_exit);
18+

0 commit comments

Comments
 (0)