diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:48:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:48:48 -0500 |
commit | 2e1ca21d46aaef95101723fa402f39d3a95aba59 (patch) | |
tree | cd95efefb9ccb6ab4ac0589d01c06cdfc22cc989 /Documentation | |
parent | 315ab19a6d12d6af7b6957090822f3057ab7e80f (diff) | |
parent | eae0f536f640bb95f2ad437a57c40c7d5683d1ac (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
* master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild: (46 commits)
kbuild: remove obsoleted scripts/reference_* files
kbuild: fix make help & make *pkg
kconfig: fix time ordering of writes to .kconfig.d and include/linux/autoconf.h
Kconfig: remove the CONFIG_CC_ALIGN_* options
kbuild: add -fverbose-asm to i386 Makefile
kbuild: clean-up genksyms
kbuild: Lindent genksyms.c
kbuild: fix genksyms build error
kbuild: in makefile.txt note that Makefile is preferred name for kbuild files
kbuild: replace PHONY with FORCE
kbuild: Fix bug in crc symbol generating of kernel and modules
kbuild: change kbuild to not rely on incorrect GNU make behavior
kbuild: when warning symbols exported twice now tell user this is the problem
kbuild: fix make dir/file.xx when asm symlink is missing
kbuild: in the section mismatch check try harder to find symbols
kbuild: fix section mismatch check for unwind on IA64
kbuild: kill false positives from section mismatch warnings for powerpc
kbuild: kill trailing whitespace in modpost & friends
kbuild: small update of allnoconfig description
kbuild: make namespace.pl CROSS_COMPILE happy
...
Trivial conflict in arch/ppc/boot/Makefile manually fixed up
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/Makefile | 8 | ||||
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 172 | ||||
-rw-r--r-- | Documentation/kbuild/modules.txt | 98 | ||||
-rw-r--r-- | Documentation/smart-config.txt | 4 |
4 files changed, 198 insertions, 84 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 2975291e296a..7d87dd73cbe4 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -28,7 +28,7 @@ PS_METHOD = $(prefer-db2x) | |||
28 | 28 | ||
29 | ### | 29 | ### |
30 | # The targets that may be used. | 30 | # The targets that may be used. |
31 | .PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs | 31 | PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs |
32 | 32 | ||
33 | BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) | 33 | BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) |
34 | xmldocs: $(BOOKS) | 34 | xmldocs: $(BOOKS) |
@@ -211,3 +211,9 @@ clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) | |||
211 | 211 | ||
212 | #man put files in man subdir - traverse down | 212 | #man put files in man subdir - traverse down |
213 | subdir- := man/ | 213 | subdir- := man/ |
214 | |||
215 | |||
216 | # Declare the contents of the .PHONY variable as phony. We keep that | ||
217 | # information in a variable se we can use it in if_changed and friends. | ||
218 | |||
219 | .PHONY: $(PHONY) | ||
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 443230b43e09..a9c00facdf40 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -17,6 +17,7 @@ This document describes the Linux kernel Makefiles. | |||
17 | --- 3.8 Command line dependency | 17 | --- 3.8 Command line dependency |
18 | --- 3.9 Dependency tracking | 18 | --- 3.9 Dependency tracking |
19 | --- 3.10 Special Rules | 19 | --- 3.10 Special Rules |
20 | --- 3.11 $(CC) support functions | ||
20 | 21 | ||
21 | === 4 Host Program support | 22 | === 4 Host Program support |
22 | --- 4.1 Simple Host Program | 23 | --- 4.1 Simple Host Program |
@@ -38,7 +39,6 @@ This document describes the Linux kernel Makefiles. | |||
38 | --- 6.6 Commands useful for building a boot image | 39 | --- 6.6 Commands useful for building a boot image |
39 | --- 6.7 Custom kbuild commands | 40 | --- 6.7 Custom kbuild commands |
40 | --- 6.8 Preprocessing linker scripts | 41 | --- 6.8 Preprocessing linker scripts |
41 | --- 6.9 $(CC) support functions | ||
42 | 42 | ||
43 | === 7 Kbuild Variables | 43 | === 7 Kbuild Variables |
44 | === 8 Makefile language | 44 | === 8 Makefile language |
@@ -106,9 +106,9 @@ This document is aimed towards normal developers and arch developers. | |||
106 | Most Makefiles within the kernel are kbuild Makefiles that use the | 106 | Most Makefiles within the kernel are kbuild Makefiles that use the |
107 | kbuild infrastructure. This chapter introduce the syntax used in the | 107 | kbuild infrastructure. This chapter introduce the syntax used in the |
108 | kbuild makefiles. | 108 | kbuild makefiles. |
109 | The preferred name for the kbuild files is 'Kbuild' but 'Makefile' will | 109 | The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can |
110 | continue to be supported. All new developmen is expected to use the | 110 | be used and if both a 'Makefile' and a 'Kbuild' file exists then the 'Kbuild' |
111 | Kbuild filename. | 111 | file will be used. |
112 | 112 | ||
113 | Section 3.1 "Goal definitions" is a quick intro, further chapters provide | 113 | Section 3.1 "Goal definitions" is a quick intro, further chapters provide |
114 | more details, with real examples. | 114 | more details, with real examples. |
@@ -385,6 +385,102 @@ more details, with real examples. | |||
385 | to prerequisites are referenced with $(src) (because they are not | 385 | to prerequisites are referenced with $(src) (because they are not |
386 | generated files). | 386 | generated files). |
387 | 387 | ||
388 | --- 3.11 $(CC) support functions | ||
389 | |||
390 | The kernel may be build with several different versions of | ||
391 | $(CC), each supporting a unique set of features and options. | ||
392 | kbuild provide basic support to check for valid options for $(CC). | ||
393 | $(CC) is useally the gcc compiler, but other alternatives are | ||
394 | available. | ||
395 | |||
396 | as-option | ||
397 | as-option is used to check if $(CC) when used to compile | ||
398 | assembler (*.S) files supports the given option. An optional | ||
399 | second option may be specified if first option are not supported. | ||
400 | |||
401 | Example: | ||
402 | #arch/sh/Makefile | ||
403 | cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) | ||
404 | |||
405 | In the above example cflags-y will be assinged the the option | ||
406 | -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC). | ||
407 | The second argument is optional, and if supplied will be used | ||
408 | if first argument is not supported. | ||
409 | |||
410 | cc-option | ||
411 | cc-option is used to check if $(CC) support a given option, and not | ||
412 | supported to use an optional second option. | ||
413 | |||
414 | Example: | ||
415 | #arch/i386/Makefile | ||
416 | cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) | ||
417 | |||
418 | In the above example cflags-y will be assigned the option | ||
419 | -march=pentium-mmx if supported by $(CC), otherwise -march-i586. | ||
420 | The second argument to cc-option is optional, and if omitted | ||
421 | cflags-y will be assigned no value if first option is not supported. | ||
422 | |||
423 | cc-option-yn | ||
424 | cc-option-yn is used to check if gcc supports a given option | ||
425 | and return 'y' if supported, otherwise 'n'. | ||
426 | |||
427 | Example: | ||
428 | #arch/ppc/Makefile | ||
429 | biarch := $(call cc-option-yn, -m32) | ||
430 | aflags-$(biarch) += -a32 | ||
431 | cflags-$(biarch) += -m32 | ||
432 | |||
433 | In the above example $(biarch) is set to y if $(CC) supports the -m32 | ||
434 | option. When $(biarch) equals to y the expanded variables $(aflags-y) | ||
435 | and $(cflags-y) will be assigned the values -a32 and -m32. | ||
436 | |||
437 | cc-option-align | ||
438 | gcc version >= 3.0 shifted type of options used to speify | ||
439 | alignment of functions, loops etc. $(cc-option-align) whrn used | ||
440 | as prefix to the align options will select the right prefix: | ||
441 | gcc < 3.00 | ||
442 | cc-option-align = -malign | ||
443 | gcc >= 3.00 | ||
444 | cc-option-align = -falign | ||
445 | |||
446 | Example: | ||
447 | CFLAGS += $(cc-option-align)-functions=4 | ||
448 | |||
449 | In the above example the option -falign-functions=4 is used for | ||
450 | gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used. | ||
451 | |||
452 | cc-version | ||
453 | cc-version return a numerical version of the $(CC) compiler version. | ||
454 | The format is <major><minor> where both are two digits. So for example | ||
455 | gcc 3.41 would return 0341. | ||
456 | cc-version is useful when a specific $(CC) version is faulty in one | ||
457 | area, for example the -mregparm=3 were broken in some gcc version | ||
458 | even though the option was accepted by gcc. | ||
459 | |||
460 | Example: | ||
461 | #arch/i386/Makefile | ||
462 | cflags-y += $(shell \ | ||
463 | if [ $(call cc-version) -ge 0300 ] ; then \ | ||
464 | echo "-mregparm=3"; fi ;) | ||
465 | |||
466 | In the above example -mregparm=3 is only used for gcc version greater | ||
467 | than or equal to gcc 3.0. | ||
468 | |||
469 | cc-ifversion | ||
470 | cc-ifversion test the version of $(CC) and equals last argument if | ||
471 | version expression is true. | ||
472 | |||
473 | Example: | ||
474 | #fs/reiserfs/Makefile | ||
475 | EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0402, -O1) | ||
476 | |||
477 | In this example EXTRA_CFLAGS will be assigned the value -O1 if the | ||
478 | $(CC) version is less than 4.2. | ||
479 | cc-ifversion takes all the shell operators: | ||
480 | -eq, -ne, -lt, -le, -gt, and -ge | ||
481 | The third parameter may be a text as in this example, but it may also | ||
482 | be an expanded variable or a macro. | ||
483 | |||
388 | 484 | ||
389 | === 4 Host Program support | 485 | === 4 Host Program support |
390 | 486 | ||
@@ -973,74 +1069,6 @@ When kbuild executes the following steps are followed (roughly): | |||
973 | architecture specific files. | 1069 | architecture specific files. |
974 | 1070 | ||
975 | 1071 | ||
976 | --- 6.9 $(CC) support functions | ||
977 | |||
978 | The kernel may be build with several different versions of | ||
979 | $(CC), each supporting a unique set of features and options. | ||
980 | kbuild provide basic support to check for valid options for $(CC). | ||
981 | $(CC) is useally the gcc compiler, but other alternatives are | ||
982 | available. | ||
983 | |||
984 | cc-option | ||
985 | cc-option is used to check if $(CC) support a given option, and not | ||
986 | supported to use an optional second option. | ||
987 | |||
988 | Example: | ||
989 | #arch/i386/Makefile | ||
990 | cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) | ||
991 | |||
992 | In the above example cflags-y will be assigned the option | ||
993 | -march=pentium-mmx if supported by $(CC), otherwise -march-i586. | ||
994 | The second argument to cc-option is optional, and if omitted | ||
995 | cflags-y will be assigned no value if first option is not supported. | ||
996 | |||
997 | cc-option-yn | ||
998 | cc-option-yn is used to check if gcc supports a given option | ||
999 | and return 'y' if supported, otherwise 'n'. | ||
1000 | |||
1001 | Example: | ||
1002 | #arch/ppc/Makefile | ||
1003 | biarch := $(call cc-option-yn, -m32) | ||
1004 | aflags-$(biarch) += -a32 | ||
1005 | cflags-$(biarch) += -m32 | ||
1006 | |||
1007 | In the above example $(biarch) is set to y if $(CC) supports the -m32 | ||
1008 | option. When $(biarch) equals to y the expanded variables $(aflags-y) | ||
1009 | and $(cflags-y) will be assigned the values -a32 and -m32. | ||
1010 | |||
1011 | cc-option-align | ||
1012 | gcc version >= 3.0 shifted type of options used to speify | ||
1013 | alignment of functions, loops etc. $(cc-option-align) whrn used | ||
1014 | as prefix to the align options will select the right prefix: | ||
1015 | gcc < 3.00 | ||
1016 | cc-option-align = -malign | ||
1017 | gcc >= 3.00 | ||
1018 | cc-option-align = -falign | ||
1019 | |||
1020 | Example: | ||
1021 | CFLAGS += $(cc-option-align)-functions=4 | ||
1022 | |||
1023 | In the above example the option -falign-functions=4 is used for | ||
1024 | gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used. | ||
1025 | |||
1026 | cc-version | ||
1027 | cc-version return a numerical version of the $(CC) compiler version. | ||
1028 | The format is <major><minor> where both are two digits. So for example | ||
1029 | gcc 3.41 would return 0341. | ||
1030 | cc-version is useful when a specific $(CC) version is faulty in one | ||
1031 | area, for example the -mregparm=3 were broken in some gcc version | ||
1032 | even though the option was accepted by gcc. | ||
1033 | |||
1034 | Example: | ||
1035 | #arch/i386/Makefile | ||
1036 | cflags-y += $(shell \ | ||
1037 | if [ $(call cc-version) -ge 0300 ] ; then \ | ||
1038 | echo "-mregparm=3"; fi ;) | ||
1039 | |||
1040 | In the above example -mregparm=3 is only used for gcc version greater | ||
1041 | than or equal to gcc 3.0. | ||
1042 | |||
1043 | |||
1044 | === 7 Kbuild Variables | 1072 | === 7 Kbuild Variables |
1045 | 1073 | ||
1046 | The top Makefile exports the following variables: | 1074 | The top Makefile exports the following variables: |
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt index 7e77f93634ea..fcccf2432f98 100644 --- a/Documentation/kbuild/modules.txt +++ b/Documentation/kbuild/modules.txt | |||
@@ -13,6 +13,7 @@ In this document you will find information about: | |||
13 | --- 2.2 Available targets | 13 | --- 2.2 Available targets |
14 | --- 2.3 Available options | 14 | --- 2.3 Available options |
15 | --- 2.4 Preparing the kernel tree for module build | 15 | --- 2.4 Preparing the kernel tree for module build |
16 | --- 2.5 Building separate files for a module | ||
16 | === 3. Example commands | 17 | === 3. Example commands |
17 | === 4. Creating a kbuild file for an external module | 18 | === 4. Creating a kbuild file for an external module |
18 | === 5. Include files | 19 | === 5. Include files |
@@ -22,7 +23,10 @@ In this document you will find information about: | |||
22 | === 6. Module installation | 23 | === 6. Module installation |
23 | --- 6.1 INSTALL_MOD_PATH | 24 | --- 6.1 INSTALL_MOD_PATH |
24 | --- 6.2 INSTALL_MOD_DIR | 25 | --- 6.2 INSTALL_MOD_DIR |
25 | === 7. Module versioning | 26 | === 7. Module versioning & Module.symvers |
27 | --- 7.1 Symbols fron the kernel (vmlinux + modules) | ||
28 | --- 7.2 Symbols and external modules | ||
29 | --- 7.3 Symbols from another external module | ||
26 | === 8. Tips & Tricks | 30 | === 8. Tips & Tricks |
27 | --- 8.1 Testing for CONFIG_FOO_BAR | 31 | --- 8.1 Testing for CONFIG_FOO_BAR |
28 | 32 | ||
@@ -88,7 +92,8 @@ when building an external module. | |||
88 | make -C $KDIR M=$PWD modules_install | 92 | make -C $KDIR M=$PWD modules_install |
89 | Install the external module(s). | 93 | Install the external module(s). |
90 | Installation default is in /lib/modules/<kernel-version>/extra, | 94 | Installation default is in /lib/modules/<kernel-version>/extra, |
91 | but may be prefixed with INSTALL_MOD_PATH - see separate chapter. | 95 | but may be prefixed with INSTALL_MOD_PATH - see separate |
96 | chapter. | ||
92 | 97 | ||
93 | make -C $KDIR M=$PWD clean | 98 | make -C $KDIR M=$PWD clean |
94 | Remove all generated files for the module - the kernel | 99 | Remove all generated files for the module - the kernel |
@@ -131,6 +136,16 @@ when building an external module. | |||
131 | Therefore a full kernel build needs to be executed to make | 136 | Therefore a full kernel build needs to be executed to make |
132 | module versioning work. | 137 | module versioning work. |
133 | 138 | ||
139 | --- 2.5 Building separate files for a module | ||
140 | It is possible to build single files which is part of a module. | ||
141 | This works equal for the kernel, a module and even for external | ||
142 | modules. | ||
143 | Examples (module foo.ko, consist of bar.o, baz.o): | ||
144 | make -C $KDIR M=`pwd` bar.lst | ||
145 | make -C $KDIR M=`pwd` bar.o | ||
146 | make -C $KDIR M=`pwd` foo.ko | ||
147 | make -C $KDIR M=`pwd` / | ||
148 | |||
134 | 149 | ||
135 | === 3. Example commands | 150 | === 3. Example commands |
136 | 151 | ||
@@ -422,7 +437,7 @@ External modules are installed in the directory: | |||
422 | => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf | 437 | => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf |
423 | 438 | ||
424 | 439 | ||
425 | === 7. Module versioning | 440 | === 7. Module versioning & Module.symvers |
426 | 441 | ||
427 | Module versioning is enabled by the CONFIG_MODVERSIONS tag. | 442 | Module versioning is enabled by the CONFIG_MODVERSIONS tag. |
428 | 443 | ||
@@ -432,11 +447,80 @@ when a module is loaded/used then the CRC values contained in the kernel are | |||
432 | compared with similar values in the module. If they are not equal then the | 447 | compared with similar values in the module. If they are not equal then the |
433 | kernel refuses to load the module. | 448 | kernel refuses to load the module. |
434 | 449 | ||
435 | During a kernel build a file named Module.symvers will be generated. This | 450 | Module.symvers contains a list of all exported symbols from a kernel build. |
436 | file includes the symbol version of all symbols within the kernel. If the | 451 | |
437 | Module.symvers file is saved from the last full kernel compile one does not | 452 | --- 7.1 Symbols fron the kernel (vmlinux + modules) |
438 | have to do a full kernel compile to build a module version's compatible module. | 453 | |
454 | During a kernel build a file named Module.symvers will be generated. | ||
455 | Module.symvers contains all exported symbols from the kernel and | ||
456 | compiled modules. For each symbols the corresponding CRC value | ||
457 | is stored too. | ||
458 | |||
459 | The syntax of the Module.symvers file is: | ||
460 | <CRC> <Symbol> <module> | ||
461 | Sample: | ||
462 | 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod | ||
439 | 463 | ||
464 | For a kernel build without CONFIG_MODVERSIONING enabled the crc | ||
465 | would read: 0x00000000 | ||
466 | |||
467 | Module.symvers serve two purposes. | ||
468 | 1) It list all exported symbols both from vmlinux and all modules | ||
469 | 2) It list CRC if CONFIG_MODVERSION is enabled | ||
470 | |||
471 | --- 7.2 Symbols and external modules | ||
472 | |||
473 | When building an external module the build system needs access to | ||
474 | the symbols from the kernel to check if all external symbols are | ||
475 | defined. This is done in the MODPOST step and to obtain all | ||
476 | symbols modpost reads Module.symvers from the kernel. | ||
477 | If a Module.symvers file is present in the directory where | ||
478 | the external module is being build this file will be read too. | ||
479 | During the MODPOST step a new Module.symvers file will be written | ||
480 | containing all exported symbols that was not defined in the kernel. | ||
481 | |||
482 | --- 7.3 Symbols from another external module | ||
483 | |||
484 | Sometimes one external module uses exported symbols from another | ||
485 | external module. Kbuild needs to have full knowledge on all symbols | ||
486 | to avoid spitting out warnings about undefined symbols. | ||
487 | Two solutions exist to let kbuild know all symbols of more than | ||
488 | one external module. | ||
489 | The method with a top-level kbuild file is recommended but may be | ||
490 | impractical in certain situations. | ||
491 | |||
492 | Use a top-level Kbuild file | ||
493 | If you have two modules: 'foo', 'bar' and 'foo' needs symbols | ||
494 | from 'bar' then one can use a common top-level kbuild file so | ||
495 | both modules are compiled in same build. | ||
496 | |||
497 | Consider following directory layout: | ||
498 | ./foo/ <= contains the foo module | ||
499 | ./bar/ <= contains the bar module | ||
500 | The top-level Kbuild file would then look like: | ||
501 | |||
502 | #./Kbuild: (this file may also be named Makefile) | ||
503 | obj-y := foo/ bar/ | ||
504 | |||
505 | Executing: | ||
506 | make -C $KDIR M=`pwd` | ||
507 | |||
508 | will then do the expected and compile both modules with full | ||
509 | knowledge on symbols from both modules. | ||
510 | |||
511 | Use an extra Module.symvers file | ||
512 | When an external module is build a Module.symvers file is | ||
513 | generated containing all exported symbols which are not | ||
514 | defined in the kernel. | ||
515 | To get access to symbols from module 'bar' one can copy the | ||
516 | Module.symvers file from the compilation of the 'bar' module | ||
517 | to the directory where the 'foo' module is build. | ||
518 | During the module build kbuild will read the Module.symvers | ||
519 | file in the directory of the external module and when the | ||
520 | build is finished a new Module.symvers file is created | ||
521 | containing the sum of all symbols defined and not part of the | ||
522 | kernel. | ||
523 | |||
440 | === 8. Tips & Tricks | 524 | === 8. Tips & Tricks |
441 | 525 | ||
442 | --- 8.1 Testing for CONFIG_FOO_BAR | 526 | --- 8.1 Testing for CONFIG_FOO_BAR |
diff --git a/Documentation/smart-config.txt b/Documentation/smart-config.txt index c9bed4cf8773..8467447b5a87 100644 --- a/Documentation/smart-config.txt +++ b/Documentation/smart-config.txt | |||
@@ -56,10 +56,6 @@ Here is the solution: | |||
56 | writing one file per option. It updates only the files for options | 56 | writing one file per option. It updates only the files for options |
57 | that have changed. | 57 | that have changed. |
58 | 58 | ||
59 | mkdep.c no longer generates warning messages for missing or unneeded | ||
60 | <linux/config.h> lines. The new top-level target 'make checkconfig' | ||
61 | checks for these problems. | ||
62 | |||
63 | Flag Dependencies | 59 | Flag Dependencies |
64 | 60 | ||
65 | Martin Von Loewis contributed another feature to this patch: | 61 | Martin Von Loewis contributed another feature to this patch: |