aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/kbuild
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2006-09-21 09:39:41 -0400
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-25 04:41:04 -0400
commit2e99f3190f274c6783758ff511edb64e60753c9f (patch)
tree55a172d8f538ebbe82c84776af72cf7b7e118224 /Documentation/kbuild
parentda7c04083c113c67800f1e13fe92a186e1f9084e (diff)
kbuild: fixup Documentation/kbuild/modules.txt
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Documentation/kbuild')
-rw-r--r--Documentation/kbuild/modules.txt46
1 files changed, 23 insertions, 23 deletions
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt
index a2a178da02ff..2e7702e94a78 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.txt
@@ -24,7 +24,7 @@ In this document you will find information about:
24 --- 6.1 INSTALL_MOD_PATH 24 --- 6.1 INSTALL_MOD_PATH
25 --- 6.2 INSTALL_MOD_DIR 25 --- 6.2 INSTALL_MOD_DIR
26 === 7. Module versioning & Module.symvers 26 === 7. Module versioning & Module.symvers
27 --- 7.1 Symbols fron the kernel (vmlinux + modules) 27 --- 7.1 Symbols from the kernel (vmlinux + modules)
28 --- 7.2 Symbols and external modules 28 --- 7.2 Symbols and external modules
29 --- 7.3 Symbols from another external module 29 --- 7.3 Symbols from another external module
30 === 8. Tips & Tricks 30 === 8. Tips & Tricks
@@ -63,14 +63,15 @@ when building an external module.
63 For the running kernel use: 63 For the running kernel use:
64 make -C /lib/modules/`uname -r`/build M=`pwd` 64 make -C /lib/modules/`uname -r`/build M=`pwd`
65 65
66 For the above command to succeed the kernel must have been built with 66 For the above command to succeed, the kernel must have been
67 modules enabled. 67 built with modules enabled.
68 68
69 To install the modules that were just built: 69 To install the modules that were just built:
70 70
71 make -C <path-to-kernel> M=`pwd` modules_install 71 make -C <path-to-kernel> M=`pwd` modules_install
72 72
73 More complex examples later, the above should get you going. 73 More complex examples will be shown later, the above should
74 be enough to get you started.
74 75
75--- 2.2 Available targets 76--- 2.2 Available targets
76 77
@@ -89,13 +90,13 @@ when building an external module.
89 Same functionality as if no target was specified. 90 Same functionality as if no target was specified.
90 See description above. 91 See description above.
91 92
92 make -C $KDIR M=$PWD modules_install 93 make -C $KDIR M=`pwd` modules_install
93 Install the external module(s). 94 Install the external module(s).
94 Installation default is in /lib/modules/<kernel-version>/extra, 95 Installation default is in /lib/modules/<kernel-version>/extra,
95 but may be prefixed with INSTALL_MOD_PATH - see separate 96 but may be prefixed with INSTALL_MOD_PATH - see separate
96 chapter. 97 chapter.
97 98
98 make -C $KDIR M=$PWD clean 99 make -C $KDIR M=`pwd` clean
99 Remove all generated files for the module - the kernel 100 Remove all generated files for the module - the kernel
100 source directory is not modified. 101 source directory is not modified.
101 102
@@ -129,23 +130,22 @@ when building an external module.
129 130
130 To make sure the kernel contains the information required to 131 To make sure the kernel contains the information required to
131 build external modules the target 'modules_prepare' must be used. 132 build external modules the target 'modules_prepare' must be used.
132 'module_prepare' solely exists as a simple way to prepare 133 'module_prepare' exists solely as a simple way to prepare
133 a kernel for building external modules. 134 a kernel source tree for building external modules.
134 Note: modules_prepare will not build Module.symvers even if 135 Note: modules_prepare will not build Module.symvers even if
135 CONFIG_MODULEVERSIONING is set. 136 CONFIG_MODULEVERSIONING is set. Therefore a full kernel build
136 Therefore a full kernel build needs to be executed to make 137 needs to be executed to make module versioning work.
137 module versioning work.
138 138
139--- 2.5 Building separate files for a module 139--- 2.5 Building separate files for a module
140 It is possible to build single files which are part of a module. 140 It is possible to build single files which are part of a module.
141 This works equal for the kernel, a module and even for external 141 This works equally well for the kernel, a module and even for
142 modules. 142 external modules.
143 Examples (module foo.ko, consist of bar.o, baz.o): 143 Examples (module foo.ko, consist of bar.o, baz.o):
144 make -C $KDIR M=`pwd` bar.lst 144 make -C $KDIR M=`pwd` bar.lst
145 make -C $KDIR M=`pwd` bar.o 145 make -C $KDIR M=`pwd` bar.o
146 make -C $KDIR M=`pwd` foo.ko 146 make -C $KDIR M=`pwd` foo.ko
147 make -C $KDIR M=`pwd` / 147 make -C $KDIR M=`pwd` /
148 148
149 149
150=== 3. Example commands 150=== 3. Example commands
151 151
@@ -177,7 +177,7 @@ Then, to install the module use the following command:
177 M=`pwd` \ 177 M=`pwd` \
178 modules_install 178 modules_install
179 179
180If one looks closely you will see that this is the same commands as 180If you look closely you will see that this is the same command as
181listed before - with the directories spelled out. 181listed before - with the directories spelled out.
182 182
183The above are rather long commands, and the following chapter 183The above are rather long commands, and the following chapter
@@ -311,7 +311,7 @@ following files:
311Include files are a necessity when a .c file uses something from other .c 311Include files are a necessity when a .c file uses something from other .c
312files (not strictly in the sense of C, but if good programming practice is 312files (not strictly in the sense of C, but if good programming practice is
313used). Any module that consists of more than one .c file will have a .h file 313used). Any module that consists of more than one .c file will have a .h file
314for one of the .c files. 314for one of the .c files.
315 315
316- If the .h file only describes a module internal interface, then the .h file 316- If the .h file only describes a module internal interface, then the .h file
317 shall be placed in the same directory as the .c files. 317 shall be placed in the same directory as the .c files.
@@ -368,13 +368,13 @@ directory and therefore need to deal with this in their kbuild file.
368 handle this too. 368 handle this too.
369 369
370 Consider the following example: 370 Consider the following example:
371 371
372 | 372 |
373 +- src/complex_main.c 373 +- src/complex_main.c
374 | +- hal/hardwareif.c 374 | +- hal/hardwareif.c
375 | +- hal/include/hardwareif.h 375 | +- hal/include/hardwareif.h
376 +- include/complex.h 376 +- include/complex.h
377 377
378 To build a single module named complex.ko, we then need the following 378 To build a single module named complex.ko, we then need the following
379 kbuild file: 379 kbuild file:
380 380
@@ -462,12 +462,12 @@ Module.symvers contains a list of all exported symbols from a kernel build.
462 Sample: 462 Sample:
463 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod 463 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod
464 464
465 For a kernel build without CONFIG_MODVERSIONING enabled, the crc 465 For a kernel build without CONFIG_MODVERSIONS enabled, the crc
466 would read: 0x00000000 466 would read: 0x00000000
467 467
468 Module.symvers serves two purposes: 468 Module.symvers serves two purposes:
469 1) It lists all exported symbols both from vmlinux and all modules 469 1) It lists all exported symbols both from vmlinux and all modules
470 2) It lists the CRC if CONFIG_MODVERSION is enabled 470 2) It lists the CRC if CONFIG_MODVERSIONS is enabled
471 471
472--- 7.2 Symbols and external modules 472--- 7.2 Symbols and external modules
473 473
@@ -479,7 +479,7 @@ Module.symvers contains a list of all exported symbols from a kernel build.
479 the external module is being built, this file will be read too. 479 the external module is being built, this file will be read too.
480 During the MODPOST step, a new Module.symvers file will be written 480 During the MODPOST step, a new Module.symvers file will be written
481 containing all exported symbols that were not defined in the kernel. 481 containing all exported symbols that were not defined in the kernel.
482 482
483--- 7.3 Symbols from another external module 483--- 7.3 Symbols from another external module
484 484
485 Sometimes, an external module uses exported symbols from another 485 Sometimes, an external module uses exported symbols from another
@@ -499,7 +499,7 @@ Module.symvers contains a list of all exported symbols from a kernel build.
499 ./foo/ <= contains the foo module 499 ./foo/ <= contains the foo module
500 ./bar/ <= contains the bar module 500 ./bar/ <= contains the bar module
501 The top-level Kbuild file would then look like: 501 The top-level Kbuild file would then look like:
502 502
503 #./Kbuild: (this file may also be named Makefile) 503 #./Kbuild: (this file may also be named Makefile)
504 obj-y := foo/ bar/ 504 obj-y := foo/ bar/
505 505
@@ -521,7 +521,7 @@ Module.symvers contains a list of all exported symbols from a kernel build.
521 build is finished, a new Module.symvers file is created 521 build is finished, a new Module.symvers file is created
522 containing the sum of all symbols defined and not part of the 522 containing the sum of all symbols defined and not part of the
523 kernel. 523 kernel.
524 524
525=== 8. Tips & Tricks 525=== 8. Tips & Tricks
526 526
527--- 8.1 Testing for CONFIG_FOO_BAR 527--- 8.1 Testing for CONFIG_FOO_BAR