diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2011-11-17 16:17:35 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-11-17 16:35:20 -0500 |
commit | 052ad274964e613a12bf8ce7c5631f70d0bc82cc (patch) | |
tree | fd3519410801d766f63b07dc308d2b702f3c9ec0 | |
parent | cb97914b04e7b587cf555ec5b1c69d61014f3378 (diff) |
kbuild: Add support for an "archheaders" target
Add support for an "archheaders" target. This target can generate
files that need to be installed for user space by "make
headers_install" or "make headers_install_all".
In order to support "make headers_install_all", it must be able to run
without the tree having to be configured first.
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 50 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rwxr-xr-x | scripts/headers.sh | 1 |
3 files changed, 39 insertions, 21 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index f47cdefb4d1e..ab0a984530d8 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -33,14 +33,15 @@ This document describes the Linux kernel Makefiles. | |||
33 | 33 | ||
34 | === 6 Architecture Makefiles | 34 | === 6 Architecture Makefiles |
35 | --- 6.1 Set variables to tweak the build to the architecture | 35 | --- 6.1 Set variables to tweak the build to the architecture |
36 | --- 6.2 Add prerequisites to archprepare: | 36 | --- 6.2 Add prerequisites to archheaders: |
37 | --- 6.3 List directories to visit when descending | 37 | --- 6.3 Add prerequisites to archprepare: |
38 | --- 6.4 Architecture-specific boot images | 38 | --- 6.4 List directories to visit when descending |
39 | --- 6.5 Building non-kbuild targets | 39 | --- 6.5 Architecture-specific boot images |
40 | --- 6.6 Commands useful for building a boot image | 40 | --- 6.6 Building non-kbuild targets |
41 | --- 6.7 Custom kbuild commands | 41 | --- 6.7 Commands useful for building a boot image |
42 | --- 6.8 Preprocessing linker scripts | 42 | --- 6.8 Custom kbuild commands |
43 | --- 6.9 Generic header files | 43 | --- 6.9 Preprocessing linker scripts |
44 | --- 6.10 Generic header files | ||
44 | 45 | ||
45 | === 7 Kbuild syntax for exported headers | 46 | === 7 Kbuild syntax for exported headers |
46 | --- 7.1 header-y | 47 | --- 7.1 header-y |
@@ -252,7 +253,7 @@ more details, with real examples. | |||
252 | This will create a library lib.a based on delay.o. For kbuild to | 253 | This will create a library lib.a based on delay.o. For kbuild to |
253 | actually recognize that there is a lib.a being built, the directory | 254 | actually recognize that there is a lib.a being built, the directory |
254 | shall be listed in libs-y. | 255 | shall be listed in libs-y. |
255 | See also "6.3 List directories to visit when descending". | 256 | See also "6.4 List directories to visit when descending". |
256 | 257 | ||
257 | Use of lib-y is normally restricted to lib/ and arch/*/lib. | 258 | Use of lib-y is normally restricted to lib/ and arch/*/lib. |
258 | 259 | ||
@@ -974,7 +975,20 @@ When kbuild executes, the following steps are followed (roughly): | |||
974 | $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic | 975 | $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic |
975 | mode) if this option is supported by $(AR). | 976 | mode) if this option is supported by $(AR). |
976 | 977 | ||
977 | --- 6.2 Add prerequisites to archprepare: | 978 | --- 6.2 Add prerequisites to archheaders: |
979 | |||
980 | The archheaders: rule is used to generate header files that | ||
981 | may be installed into user space by "make header_install" or | ||
982 | "make headers_install_all". In order to support | ||
983 | "make headers_install_all", this target has to be able to run | ||
984 | on an unconfigured tree, or a tree configured for another | ||
985 | architecture. | ||
986 | |||
987 | It is run before "make archprepare" when run on the | ||
988 | architecture itself. | ||
989 | |||
990 | |||
991 | --- 6.3 Add prerequisites to archprepare: | ||
978 | 992 | ||
979 | The archprepare: rule is used to list prerequisites that need to be | 993 | The archprepare: rule is used to list prerequisites that need to be |
980 | built before starting to descend down in the subdirectories. | 994 | built before starting to descend down in the subdirectories. |
@@ -990,7 +1004,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
990 | generating offset header files. | 1004 | generating offset header files. |
991 | 1005 | ||
992 | 1006 | ||
993 | --- 6.3 List directories to visit when descending | 1007 | --- 6.4 List directories to visit when descending |
994 | 1008 | ||
995 | An arch Makefile cooperates with the top Makefile to define variables | 1009 | An arch Makefile cooperates with the top Makefile to define variables |
996 | which specify how to build the vmlinux file. Note that there is no | 1010 | which specify how to build the vmlinux file. Note that there is no |
@@ -1019,7 +1033,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1019 | drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ | 1033 | drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ |
1020 | 1034 | ||
1021 | 1035 | ||
1022 | --- 6.4 Architecture-specific boot images | 1036 | --- 6.5 Architecture-specific boot images |
1023 | 1037 | ||
1024 | An arch Makefile specifies goals that take the vmlinux file, compress | 1038 | An arch Makefile specifies goals that take the vmlinux file, compress |
1025 | it, wrap it in bootstrapping code, and copy the resulting files | 1039 | it, wrap it in bootstrapping code, and copy the resulting files |
@@ -1070,7 +1084,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1070 | 1084 | ||
1071 | When "make" is executed without arguments, bzImage will be built. | 1085 | When "make" is executed without arguments, bzImage will be built. |
1072 | 1086 | ||
1073 | --- 6.5 Building non-kbuild targets | 1087 | --- 6.6 Building non-kbuild targets |
1074 | 1088 | ||
1075 | extra-y | 1089 | extra-y |
1076 | 1090 | ||
@@ -1090,7 +1104,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1090 | shall be built, but shall not be linked as part of built-in.o. | 1104 | shall be built, but shall not be linked as part of built-in.o. |
1091 | 1105 | ||
1092 | 1106 | ||
1093 | --- 6.6 Commands useful for building a boot image | 1107 | --- 6.7 Commands useful for building a boot image |
1094 | 1108 | ||
1095 | Kbuild provides a few macros that are useful when building a | 1109 | Kbuild provides a few macros that are useful when building a |
1096 | boot image. | 1110 | boot image. |
@@ -1112,7 +1126,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1112 | always be built. | 1126 | always be built. |
1113 | Assignments to $(targets) are without $(obj)/ prefix. | 1127 | Assignments to $(targets) are without $(obj)/ prefix. |
1114 | if_changed may be used in conjunction with custom commands as | 1128 | if_changed may be used in conjunction with custom commands as |
1115 | defined in 6.7 "Custom kbuild commands". | 1129 | defined in 6.8 "Custom kbuild commands". |
1116 | 1130 | ||
1117 | Note: It is a typical mistake to forget the FORCE prerequisite. | 1131 | Note: It is a typical mistake to forget the FORCE prerequisite. |
1118 | Another common pitfall is that whitespace is sometimes | 1132 | Another common pitfall is that whitespace is sometimes |
@@ -1171,7 +1185,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1171 | $(obj)/%.dtb: $(src)/%.dts | 1185 | $(obj)/%.dtb: $(src)/%.dts |
1172 | $(call cmd,dtc) | 1186 | $(call cmd,dtc) |
1173 | 1187 | ||
1174 | --- 6.7 Custom kbuild commands | 1188 | --- 6.8 Custom kbuild commands |
1175 | 1189 | ||
1176 | When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand | 1190 | When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand |
1177 | of a command is normally displayed. | 1191 | of a command is normally displayed. |
@@ -1198,7 +1212,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1198 | will be displayed with "make KBUILD_VERBOSE=0". | 1212 | will be displayed with "make KBUILD_VERBOSE=0". |
1199 | 1213 | ||
1200 | 1214 | ||
1201 | --- 6.8 Preprocessing linker scripts | 1215 | --- 6.9 Preprocessing linker scripts |
1202 | 1216 | ||
1203 | When the vmlinux image is built, the linker script | 1217 | When the vmlinux image is built, the linker script |
1204 | arch/$(ARCH)/kernel/vmlinux.lds is used. | 1218 | arch/$(ARCH)/kernel/vmlinux.lds is used. |
@@ -1228,7 +1242,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1228 | The kbuild infrastructure for *lds file are used in several | 1242 | The kbuild infrastructure for *lds file are used in several |
1229 | architecture-specific files. | 1243 | architecture-specific files. |
1230 | 1244 | ||
1231 | --- 6.9 Generic header files | 1245 | --- 6.10 Generic header files |
1232 | 1246 | ||
1233 | The directory include/asm-generic contains the header files | 1247 | The directory include/asm-generic contains the header files |
1234 | that may be shared between individual architectures. | 1248 | that may be shared between individual architectures. |
@@ -442,7 +442,7 @@ asm-generic: | |||
442 | 442 | ||
443 | no-dot-config-targets := clean mrproper distclean \ | 443 | no-dot-config-targets := clean mrproper distclean \ |
444 | cscope gtags TAGS tags help %docs check% coccicheck \ | 444 | cscope gtags TAGS tags help %docs check% coccicheck \ |
445 | include/linux/version.h headers_% \ | 445 | include/linux/version.h headers_% archheaders \ |
446 | kernelversion %src-pkg | 446 | kernelversion %src-pkg |
447 | 447 | ||
448 | config-targets := 0 | 448 | config-targets := 0 |
@@ -979,7 +979,7 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ | |||
979 | include/config/auto.conf | 979 | include/config/auto.conf |
980 | $(cmd_crmodverdir) | 980 | $(cmd_crmodverdir) |
981 | 981 | ||
982 | archprepare: prepare1 scripts_basic | 982 | archprepare: archheaders prepare1 scripts_basic |
983 | 983 | ||
984 | prepare0: archprepare FORCE | 984 | prepare0: archprepare FORCE |
985 | $(Q)$(MAKE) $(build)=. | 985 | $(Q)$(MAKE) $(build)=. |
@@ -1046,8 +1046,11 @@ hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | |||
1046 | # If we do an all arch process set dst to asm-$(hdr-arch) | 1046 | # If we do an all arch process set dst to asm-$(hdr-arch) |
1047 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) | 1047 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) |
1048 | 1048 | ||
1049 | PHONY += archheaders | ||
1050 | archheaders: | ||
1051 | |||
1049 | PHONY += __headers | 1052 | PHONY += __headers |
1050 | __headers: include/linux/version.h scripts_basic asm-generic FORCE | 1053 | __headers: include/linux/version.h scripts_basic asm-generic archheaders FORCE |
1051 | $(Q)$(MAKE) $(build)=scripts build_unifdef | 1054 | $(Q)$(MAKE) $(build)=scripts build_unifdef |
1052 | 1055 | ||
1053 | PHONY += headers_install_all | 1056 | PHONY += headers_install_all |
diff --git a/scripts/headers.sh b/scripts/headers.sh index 978b42b3acd7..af1ed8810087 100755 --- a/scripts/headers.sh +++ b/scripts/headers.sh | |||
@@ -7,6 +7,7 @@ set -e | |||
7 | do_command() | 7 | do_command() |
8 | { | 8 | { |
9 | if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then | 9 | if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then |
10 | make ARCH=$2 KBUILD_HEADERS=$1 archheaders | ||
10 | make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 | 11 | make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 |
11 | else | 12 | else |
12 | printf "Ignoring arch: %s\n" ${arch} | 13 | printf "Ignoring arch: %s\n" ${arch} |