diff options
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r-- | scripts/Makefile.lib | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index f3ccdb1b302b..1c702ca8aac8 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -101,14 +101,6 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" | |||
101 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 101 | modname_flags = $(if $(filter 1,$(words $(modname))),\ |
102 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 102 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
103 | 103 | ||
104 | #hash values | ||
105 | ifdef CONFIG_DYNAMIC_DEBUG | ||
106 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ | ||
107 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" | ||
108 | else | ||
109 | debug_flags = | ||
110 | endif | ||
111 | |||
112 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ | 104 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ |
113 | $(ccflags-y) $(CFLAGS_$(basetarget).o) | 105 | $(ccflags-y) $(CFLAGS_$(basetarget).o) |
114 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 106 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
@@ -128,7 +120,9 @@ _c_flags += $(if $(patsubst n%,, \ | |||
128 | endif | 120 | endif |
129 | 121 | ||
130 | ifdef CONFIG_SYMBOL_PREFIX | 122 | ifdef CONFIG_SYMBOL_PREFIX |
131 | _cpp_flags += -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)) | 123 | _sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)) |
124 | _cpp_flags += $(_sym_flags) | ||
125 | _a_flags += $(_sym_flags) | ||
132 | endif | 126 | endif |
133 | 127 | ||
134 | 128 | ||
@@ -152,8 +146,7 @@ endif | |||
152 | 146 | ||
153 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 147 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
154 | $(__c_flags) $(modkern_cflags) \ | 148 | $(__c_flags) $(modkern_cflags) \ |
155 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) \ | 149 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) |
156 | $(debug_flags) | ||
157 | 150 | ||
158 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ | 151 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
159 | $(__a_flags) $(modkern_aflags) | 152 | $(__a_flags) $(modkern_aflags) |
@@ -207,6 +200,29 @@ quiet_cmd_gzip = GZIP $@ | |||
207 | cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ | 200 | cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ |
208 | (rm -f $@ ; false) | 201 | (rm -f $@ ; false) |
209 | 202 | ||
203 | # DTC | ||
204 | # --------------------------------------------------------------------------- | ||
205 | |||
206 | # Generate an assembly file to wrap the output of the device tree compiler | ||
207 | quiet_cmd_dt_S_dtb= DTB $@ | ||
208 | cmd_dt_S_dtb= \ | ||
209 | ( \ | ||
210 | echo '\#include <asm-generic/vmlinux.lds.h>'; \ | ||
211 | echo '.section .dtb.init.rodata,"a"'; \ | ||
212 | echo '.balign STRUCT_ALIGNMENT'; \ | ||
213 | echo '.global __dtb_$(*F)_begin'; \ | ||
214 | echo '__dtb_$(*F)_begin:'; \ | ||
215 | echo '.incbin "$<" '; \ | ||
216 | echo '__dtb_$(*F)_end:'; \ | ||
217 | echo '.global __dtb_$(*F)_end'; \ | ||
218 | echo '.balign STRUCT_ALIGNMENT'; \ | ||
219 | ) > $@ | ||
220 | |||
221 | $(obj)/%.dtb.S: $(obj)/%.dtb | ||
222 | $(call cmd,dt_S_dtb) | ||
223 | |||
224 | quiet_cmd_dtc = DTC $@ | ||
225 | cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $< | ||
210 | 226 | ||
211 | # Bzip2 | 227 | # Bzip2 |
212 | # --------------------------------------------------------------------------- | 228 | # --------------------------------------------------------------------------- |
@@ -245,3 +261,35 @@ quiet_cmd_lzo = LZO $@ | |||
245 | cmd_lzo = (cat $(filter-out FORCE,$^) | \ | 261 | cmd_lzo = (cat $(filter-out FORCE,$^) | \ |
246 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 262 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
247 | (rm -f $@ ; false) | 263 | (rm -f $@ ; false) |
264 | |||
265 | # XZ | ||
266 | # --------------------------------------------------------------------------- | ||
267 | # Use xzkern to compress the kernel image and xzmisc to compress other things. | ||
268 | # | ||
269 | # xzkern uses a big LZMA2 dictionary since it doesn't increase memory usage | ||
270 | # of the kernel decompressor. A BCJ filter is used if it is available for | ||
271 | # the target architecture. xzkern also appends uncompressed size of the data | ||
272 | # using size_append. The .xz format has the size information available at | ||
273 | # the end of the file too, but it's in more complex format and it's good to | ||
274 | # avoid changing the part of the boot code that reads the uncompressed size. | ||
275 | # Note that the bytes added by size_append will make the xz tool think that | ||
276 | # the file is corrupt. This is expected. | ||
277 | # | ||
278 | # xzmisc doesn't use size_append, so it can be used to create normal .xz | ||
279 | # files. xzmisc uses smaller LZMA2 dictionary than xzkern, because a very | ||
280 | # big dictionary would increase the memory usage too much in the multi-call | ||
281 | # decompression mode. A BCJ filter isn't used either. | ||
282 | quiet_cmd_xzkern = XZKERN $@ | ||
283 | cmd_xzkern = (cat $(filter-out FORCE,$^) | \ | ||
284 | sh $(srctree)/scripts/xz_wrap.sh && \ | ||
285 | $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | ||
286 | (rm -f $@ ; false) | ||
287 | |||
288 | quiet_cmd_xzmisc = XZMISC $@ | ||
289 | cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ | ||
290 | xz --check=crc32 --lzma2=dict=1MiB) > $@ || \ | ||
291 | (rm -f $@ ; false) | ||
292 | |||
293 | # misc stuff | ||
294 | # --------------------------------------------------------------------------- | ||
295 | quote:=" | ||