diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2011-04-27 16:29:49 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-04-28 12:01:41 -0400 |
commit | d8ecc5cd8e227bc318513b5306ae88a474b8886d (patch) | |
tree | f05fe662c000b8219923b8c464c9c186b599190e /Documentation | |
parent | 28bc20dccadc610c56e27255aeef2938141a0cd3 (diff) |
kbuild: asm-generic support
There is an increasing amount of header files
shared between individual architectures in asm-generic.
To avoid a lot of dummy wrapper files that just
include the corresponding file in asm-generic provide
some basic support in kbuild for this.
With the following patch an architecture can maintain
a list of files in the file arch/$(ARCH)/include/asm/Kbuild
To use a generic file just add:
generic-y += <name-of-header-file.h>
For each file listed kbuild will generate the necessary
wrapper in arch/$(ARCH)/include/generated/asm.
When installing userspace headers a wrapper is likewise created.
The original inspiration for this came from the unicore32
patchset - although a different method is used.
The patch includes several improvements from Arnd Bergmann.
Michael Marek contributed Makefile.asm-generic.
Remis Baima did an intial implementation along to achive
the same - see https://patchwork.kernel.org/patch/13352/
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
Tested-by: Guan Xuetao <guanxuetao@mprc.pku.edu.cn>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Remis Lima Baima <remis.developer@googlemail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 40e082bb8c52..835b64acf0b4 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -40,11 +40,13 @@ This document describes the Linux kernel Makefiles. | |||
40 | --- 6.6 Commands useful for building a boot image | 40 | --- 6.6 Commands useful for building a boot image |
41 | --- 6.7 Custom kbuild commands | 41 | --- 6.7 Custom kbuild commands |
42 | --- 6.8 Preprocessing linker scripts | 42 | --- 6.8 Preprocessing linker scripts |
43 | --- 6.9 Generic header files | ||
43 | 44 | ||
44 | === 7 Kbuild syntax for exported headers | 45 | === 7 Kbuild syntax for exported headers |
45 | --- 7.1 header-y | 46 | --- 7.1 header-y |
46 | --- 7.2 objhdr-y | 47 | --- 7.2 objhdr-y |
47 | --- 7.3 destination-y | 48 | --- 7.3 destination-y |
49 | --- 7.4 generic-y | ||
48 | 50 | ||
49 | === 8 Kbuild Variables | 51 | === 8 Kbuild Variables |
50 | === 9 Makefile language | 52 | === 9 Makefile language |
@@ -1214,6 +1216,14 @@ When kbuild executes, the following steps are followed (roughly): | |||
1214 | The kbuild infrastructure for *lds file are used in several | 1216 | The kbuild infrastructure for *lds file are used in several |
1215 | architecture-specific files. | 1217 | architecture-specific files. |
1216 | 1218 | ||
1219 | --- 6.9 Generic header files | ||
1220 | |||
1221 | The directory include/asm-generic contains the header files | ||
1222 | that may be shared between individual architectures. | ||
1223 | The recommended approach how to use a generic header file is | ||
1224 | to list the file in the Kbuild file. | ||
1225 | See "7.4 generic-y" for further info on syntax etc. | ||
1226 | |||
1217 | === 7 Kbuild syntax for exported headers | 1227 | === 7 Kbuild syntax for exported headers |
1218 | 1228 | ||
1219 | The kernel include a set of headers that is exported to userspace. | 1229 | The kernel include a set of headers that is exported to userspace. |
@@ -1270,6 +1280,32 @@ See subsequent chapter for the syntax of the Kbuild file. | |||
1270 | In the example above all exported headers in the Kbuild file | 1280 | In the example above all exported headers in the Kbuild file |
1271 | will be located in the directory "include/linux" when exported. | 1281 | will be located in the directory "include/linux" when exported. |
1272 | 1282 | ||
1283 | --- 7.4 generic-y | ||
1284 | |||
1285 | If an architecture uses a verbatim copy of a header from | ||
1286 | include/asm-generic then this is listed in the file | ||
1287 | arch/$(ARCH)/include/asm/Kbuild like this: | ||
1288 | |||
1289 | Example: | ||
1290 | #arch/x86/include/asm/Kbuild | ||
1291 | generic-y += termios.h | ||
1292 | generic-y += rtc.h | ||
1293 | |||
1294 | During the prepare phase of the build a wrapper include | ||
1295 | file is generated in the directory: | ||
1296 | |||
1297 | arch/$(ARCH)/include/generated/asm | ||
1298 | |||
1299 | When a header is exported where the architecture uses | ||
1300 | the generic header a similar wrapper is generated as part | ||
1301 | of the set of exported headers in the directory: | ||
1302 | |||
1303 | usr/include/asm | ||
1304 | |||
1305 | The generated wrapper will in both cases look like the following: | ||
1306 | |||
1307 | Example: termios.h | ||
1308 | #include <asm-generic/termios.h> | ||
1273 | 1309 | ||
1274 | === 8 Kbuild Variables | 1310 | === 8 Kbuild Variables |
1275 | 1311 | ||