diff --git a/index.html b/index.html index b5e4eaa..2d0973d 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@ - - + +
1obj-m += hello-1.o 2 3all: -4 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules +4 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules 5 6clean: -7 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean+7 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
And finally just:
1make@@ -433,10 +433,10 @@ is as simple as this: 2obj-m += hello-2.o 3 4all: -5 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules +5 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules 6 7clean: -8 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean +8 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Now have a look at linux/drivers/char/Makefile for a real world example. As you can see, some things get hardwired into the kernel (obj-y) but where are all those obj-m gone? Those familiar with shell scripts will easily be able to spot them. @@ -729,10 +729,10 @@ files. 7startstop-objs := start.o stop.o 8 9all: -10 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules +10 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules 11 12clean: -13 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean +13 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
This is the complete makefile for all the examples we have seen so far. The first five lines are nothing special, but for the last example we will need two lines. First we invent an object name for our combined module, second we tell make what object @@ -1192,10 +1192,10 @@ new way of assigning to the structure looks like:
1struct file_operations fops = { -2 read: device_read, -3 write: device_write, -4 open: device_open, -5 release: device_release +2 read: device_read, +3 write: device_write, +4 open: device_open, +5 release: device_release 6};
However, there is also a C99 way of assigning to elements of a structure, designated initializers, and this is definitely preferred over using the GNU extension. @@ -1204,10 +1204,10 @@ with compatibility:
1struct file_operations fops = { -2 .read = device_read, -3 .write = device_write, -4 .open = device_open, -5 .release = device_release +2 .read = device_read, +3 .write = device_write, +4 .open = device_open, +5 .release = device_release 6};
The meaning is clear, and you should be aware that any member of the
structure which you do not explicitly assign will be initialized to NULL by
@@ -1491,7 +1491,7 @@ multiple kernel versions, you will find yourself having to code conditional comp
directives. The way to do this to compare the macro LINUX_VERSION_CODE to the
macro KERNEL_VERSION. In version a.b.c of the kernel, the value of this macro would
be .
+2 a + 2 b+ c ' class='math' src='lkmpg-for-ht0x.svg' />.
While previous versions of this guide showed how you can write backward
compatible code with such constructs in great detail, we decided to break with this
tradition for the better. People interested in doing such might now use a LKMPG
@@ -1942,7 +1942,7 @@ Figure 1 And finally just:
Now have a look at linux/drivers/char/Makefile for a real world example. As
you can see, some things get hardwired into the kernel (obj-y) but where are all
those obj-m gone? Those familiar with shell scripts will easily be able to spot them.
@@ -729,10 +729,10 @@ files.
7startstop-objs := start.o stop.o
8
9all:
-10 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+10 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
11
12clean:
-13 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
+13 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
This is the complete makefile for all the examples we have seen so far. The first
five lines are nothing special, but for the last example we will need two lines. First we
invent an object name for our combined module, second we tell make what object
@@ -1192,10 +1192,10 @@ new way of assigning to the structure looks like:
However, there is also a C99 way of assigning to elements of a structure,
designated initializers, and this is definitely preferred over using the GNU extension.
@@ -1204,10 +1204,10 @@ with compatibility:
The meaning is clear, and you should be aware that any member of the
structure which you do not explicitly assign will be initialized to NULL by
@@ -1491,7 +1491,7 @@ multiple kernel versions, you will find yourself having to code conditional comp
directives. The way to do this to compare the macro LINUX_VERSION_CODE to the
macro KERNEL_VERSION. In version a.b.c of the kernel, the value of this macro would
be While previous versions of this guide showed how you can write backward
compatible code with such constructs in great detail, we decided to break with this
tradition for the better. People interested in doing such might now use a LKMPG
@@ -1942,7 +1942,7 @@ Figure 1
+
1obj-m += hello-1.o
2
3all:
-4 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+4 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
5
6clean:
-7 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
+7 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
1make
@@ -433,10 +433,10 @@ is as simple as this:
2obj-m += hello-2.o
3
4all:
-5 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+5 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
6
7clean:
-8 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
+8 make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
1struct file_operations fops = {
-2 read: device_read,
-3 write: device_write,
-4 open: device_open,
-5 release: device_release
+2 read: device_read,
+3 write: device_write,
+4 open: device_open,
+5 release: device_release
6};
1struct file_operations fops = {
-2 .read = device_read,
-3 .write = device_write,
-4 .open = device_open,
-5 .release = device_release
+2 .read = device_read,
+3 .write = device_write,
+4 .open = device_open,
+5 .release = device_release
6};
.
+2 a + 2 b+ c ' class='math' src='lkmpg-for-ht0x.svg' />.
+