Pull Kbuild updates from Masahiro Yamada: - detect missing include guard in UAPI headers - do not create orphan built-in.a or obj-y objects - generate modules.builtin more simply, and drop tristate.conf - simplify built-in initramfs creation - make linux-headers deb package thinner - optimize the deb package build script - misc cleanups * tag 'kbuild-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (34 commits) builddeb: split libc headers deployment out into a function builddeb: split kernel headers deployment out into a function builddeb: remove redundant make for ARCH=um builddeb: avoid invoking sub-shells where possible builddeb: remove redundant $objtree/ builddeb: match temporary directory name to the package name builddeb: remove unneeded files in hdrobjfiles for headers package kbuild: use -S instead of -E for precise cc-option test in Kconfig builddeb: allow selection of .deb compressor kbuild: remove 'Building modules, stage 2.' log kbuild: remove *.tmp file when filechk fails kbuild: remove PYTHON2 variable modpost: assume STT_SPARC_REGISTER is defined gen_initramfs.sh: remove intermediate cpio_list on errors initramfs: refactor the initramfs build rules gen_initramfs.sh: always output cpio even without -o option initramfs: add default_cpio_list, and delete -d option support initramfs: generate dependency list and cpio at the same time initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile initramfs: make initramfs compression choice non-optional ...
Unified · Split
| @@ -154,11 +154,6 @@ KCONFIG_AUTOCONFIG · 153 unmodified lines | ||
| 154 | 154 | This environment variable can be set to specify the path & name of the |
| 155 | 155 | "auto.conf" file. Its default value is "include/config/auto.conf". |
| 156 | 156 | |
| 157 | −KCONFIG_TRISTATE | |
| 158 | −---------------- | |
| 159 | −This environment variable can be set to specify the path & name of the | |
| 160 | −"tristate.conf" file. Its default value is "include/config/tristate.conf". | |
| 161 | − | |
| 162 | 157 | KCONFIG_AUTOHEADER |
| 163 | 158 | ------------------ |
| 164 | 159 | This environment variable can be set to specify the path & name of the |
| @@ -423,7 +423,6 @@ INSTALLKERNEL := installkernel · 422 unmodified lines | ||
| 423 | 423 | DEPMOD = /sbin/depmod |
| 424 | 424 | PERL = perl |
| 425 | 425 | PYTHON = python |
| 426 | −PYTHON2 = python2 | |
| 427 | 426 | PYTHON3 = python3 |
| 428 | 427 | CHECK = sparse |
| 429 | 428 | BASH = bash |
| @@ -474,7 +473,7 @@ CLANG_FLAGS := · 44 unmodified lines | ||
| 474 | 473 | |
| 475 | 474 | export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC |
| 476 | 475 | export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL |
| 477 | −export PERL PYTHON PYTHON2 PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX | |
| 476 | +export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX | |
| 478 | 477 | export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE |
| 479 | 478 | |
| 480 | 479 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS |
| @@ -674,7 +673,7 @@ $(KCONFIG_CONFIG): · 193 unmodified lines | ||
| 674 | 673 | # |
| 675 | 674 | # This exploits the 'multi-target pattern rule' trick. |
| 676 | 675 | # The syncconfig should be executed only once to make all the targets. |
| 677 | −%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG) | |
| 676 | +%/auto.conf %/auto.conf.cmd: $(KCONFIG_CONFIG) | |
| 678 | 677 | $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig |
| 679 | 678 | else # !may-sync-config |
| 680 | 679 | # External modules and some install targets need include/generated/autoconf.h |
| @@ -1278,24 +1277,13 @@ all: modules · 597 unmodified lines | ||
| 1278 | 1277 | # using awk while concatenating to the final file. |
| 1279 | 1278 | |
| 1280 | 1279 | PHONY += modules |
| 1281 | −modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin | |
| 1280 | +modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order | |
| 1282 | 1281 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| 1283 | 1282 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh |
| 1284 | 1283 | |
| 1285 | 1284 | modules.order: descend |
| 1286 | 1285 | $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@ |
| 1287 | 1286 | |
| 1288 | −modbuiltin-dirs := $(addprefix _modbuiltin_, $(build-dirs)) | |
| 1289 | − | |
| 1290 | −modules.builtin: $(modbuiltin-dirs) | |
| 1291 | − $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@ | |
| 1292 | − | |
| 1293 | −PHONY += $(modbuiltin-dirs) | |
| 1294 | −# tristate.conf is not included from this Makefile. Add it as a prerequisite | |
| 1295 | −# here to make it self-healing in case somebody accidentally removes it. | |
| 1296 | −$(modbuiltin-dirs): include/config/tristate.conf | |
| 1297 | − $(Q)$(MAKE) $(modbuiltin)=$(patsubst _modbuiltin_%,%,$@) | |
| 1298 | − | |
| 1299 | 1287 | # Target to prepare building external modules |
| 1300 | 1288 | PHONY += modules_prepare |
| 1301 | 1289 | modules_prepare: prepare |
| @@ -1315,7 +1303,7 @@ _modinst_: · 13 unmodified lines | ||
| 1315 | 1303 | ln -s $(CURDIR) $(MODLIB)/build ; \ |
| 1316 | 1304 | fi |
| 1317 | 1305 | @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order |
| 1318 | − @sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin | |
| 1306 | + @cp -f modules.builtin $(MODLIB)/ | |
| 1319 | 1307 | @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ |
| 1320 | 1308 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
| 1321 | 1309 | |
| @@ -1357,7 +1345,7 @@ endif # CONFIG_MODULES · 35 unmodified lines | ||
| 1357 | 1345 | |
| 1358 | 1346 | # Directories & files removed with 'make clean' |
| 1359 | 1347 | CLEAN_DIRS += include/ksym |
| 1360 | −CLEAN_FILES += modules.builtin.modinfo modules.nsdeps | |
| 1348 | +CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps | |
| 1361 | 1349 | |
| 1362 | 1350 | # Directories & files removed with 'make mrproper' |
| 1363 | 1351 | MRPROPER_DIRS += include/config include/generated \ |
| @@ -1712,7 +1700,7 @@ clean: $(clean-dirs) · 348 unmodified lines | ||
| 1712 | 1700 | -o -name '*.lex.c' -o -name '*.tab.[ch]' \ |
| 1713 | 1701 | -o -name '*.asn1.[ch]' \ |
| 1714 | 1702 | -o -name '*.symtypes' -o -name 'modules.order' \ |
| 1715 | − -o -name modules.builtin -o -name '.tmp_*.o.*' \ | |
| 1703 | + -o -name '.tmp_*.o.*' \ | |
| 1716 | 1704 | -o -name '*.c.[012]*.*' \ |
| 1717 | 1705 | -o -name '*.ll' \ |
| 1718 | 1706 | -o -name '*.gcno' \) -type f -print | xargs rm -f |
| @@ -169,6 +169,16 @@ extern void cleanup_module(void); · 168 unmodified lines | ||
| 169 | 169 | */ |
| 170 | 170 | #define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep) |
| 171 | 171 | |
| 172 | +/* | |
| 173 | + * MODULE_FILE is used for generating modules.builtin | |
| 174 | + * So, make it no-op when this is being built as a module | |
| 175 | + */ | |
| 176 | +#ifdef MODULE | |
| 177 | +#define MODULE_FILE | |
| 178 | +#else | |
| 179 | +#define MODULE_FILE MODULE_INFO(file, KBUILD_MODFILE); | |
| 180 | +#endif | |
| 181 | + | |
| 172 | 182 | /* |
| 173 | 183 | * The following license idents are currently accepted as indicating free |
| 174 | 184 | * software modules |
| @@ -213,7 +223,7 @@ extern void cleanup_module(void); · 38 unmodified lines | ||
| 213 | 223 | * 2. So the community can ignore bug reports including proprietary modules |
| 214 | 224 | * 3. So vendors can do likewise based on their own policies |
| 215 | 225 | */ |
| 216 | −#define MODULE_LICENSE(_license) MODULE_INFO(license, _license) | |
| 226 | +#define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license, _license) | |
| 217 | 227 | |
| 218 | 228 | /* |
| 219 | 229 | * Author(s), use "Name <email>" or just "Name", for multiple |
| @@ -32,6 +32,10 @@ real-prereqs = $(filter-out $(PHONY), $^) · 31 unmodified lines | ||
| 32 | 32 | # Escape single quote for use in echo statements |
| 33 | 33 | escsq = $(subst $(squote),'\$(squote)',$1) |
| 34 | 34 | |
| 35 | +### | |
| 36 | +# Quote a string to pass it to C files. foo => '"foo"' | |
| 37 | +stringify = $(squote)$(quote)$1$(quote)$(squote) | |
| 38 | + | |
| 35 | 39 | ### |
| 36 | 40 | # Easy method for doing a status message |
| 37 | 41 | kecho := : |
| @@ -55,14 +59,13 @@ kecho := $($(quiet)kecho) · 17 unmodified lines | ||
| 55 | 59 | # - stdin is piped in from the first prerequisite ($<) so one has |
| 56 | 60 | # to specify a valid file as first prerequisite (often the kbuild file) |
| 57 | 61 | define filechk |
| 58 | − $(Q)set -e; \ | |
| 59 | − mkdir -p $(dir $@); \ | |
| 60 | − { $(filechk_$(1)); } > $@.tmp; \ | |
| 61 | − if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | |
| 62 | − rm -f $@.tmp; \ | |
| 63 | − else \ | |
| 64 | − $(kecho) ' UPD $@'; \ | |
| 65 | − mv -f $@.tmp $@; \ | |
| 62 | + $(Q)set -e; \ | |
| 63 | + mkdir -p $(dir $@); \ | |
| 64 | + trap "rm -f $(dot-target).tmp" EXIT; \ | |
| 65 | + { $(filechk_$(1)); } > $(dot-target).tmp; \ | |
| 66 | + if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \ | |
| 67 | + $(kecho) ' UPD $@'; \ | |
| 68 | + mv -f $(dot-target).tmp $@; \ | |
| 66 | 69 | fi |
| 67 | 70 | endef |
| 68 | 71 | |
| @@ -159,12 +162,6 @@ ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4)) · 90 unmodified lines | ||
| 159 | 162 | # $(Q)$(MAKE) $(build)=dir |
| 160 | 163 | build := -f $(srctree)/scripts/Makefile.build obj |
| 161 | 164 | |
| 162 | −### | |
| 163 | −# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj= | |
| 164 | −# Usage: | |
| 165 | −# $(Q)$(MAKE) $(modbuiltin)=dir | |
| 166 | −modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj | |
| 167 | − | |
| 168 | 165 | ### |
| 169 | 166 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj= |
| 170 | 167 | # Usage: |
| @@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y) · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | # $(cc-option,<flag>) |
| 27 | 27 | # Return y if the compiler supports <flag>, n otherwise |
| 28 | −cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null) | |
| 28 | +cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null) | |
| 29 | 29 | |
| 30 | 30 | # $(ld-option,<flag>) |
| 31 | 31 | # Return y if the linker supports <flag>, n otherwise |
| @@ -66,7 +66,7 @@ lib-target := $(obj)/lib.a · 65 unmodified lines | ||
| 66 | 66 | real-obj-y += $(obj)/lib-ksyms.o |
| 67 | 67 | endif |
| 68 | 68 | |
| 69 | −ifneq ($(strip $(real-obj-y) $(need-builtin)),) | |
| 69 | +ifdef need-builtin | |
| 70 | 70 | builtin-target := $(obj)/built-in.a |
| 71 | 71 | endif |
| 72 | 72 | |
| @@ -372,7 +372,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler · 299 unmodified lines | ||
| 372 | 372 | # --------------------------------------------------------------------------- |
| 373 | 373 | |
| 374 | 374 | # To build objects in subdirs, we need to descend into the directories |
| 375 | −$(sort $(subdir-obj-y)): $(subdir-ym) ; | |
| 375 | +$(obj)/%/built-in.a: $(obj)/% ; | |
| 376 | 376 | |
| 377 | 377 | # |
| 378 | 378 | # Rule to compile a set of .o files into one .a file (without symbol table) |
| @@ -35,7 +35,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) · 34 unmodified lines | ||
| 35 | 35 | subdir-y += $(__subdir-y) |
| 36 | 36 | __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) |
| 37 | 37 | subdir-m += $(__subdir-m) |
| 38 | +ifdef need-builtin | |
| 38 | 39 | obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) |
| 40 | +else | |
| 41 | +obj-y := $(filter-out %/, $(obj-y)) | |
| 42 | +endif | |
| 39 | 43 | obj-m := $(filter-out %/, $(obj-m)) |
| 40 | 44 | |
| 41 | 45 | # Subdirectories we need to descend into |
| @@ -80,12 +84,14 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) · 38 unmodified lines | ||
| 80 | 84 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) |
| 81 | 85 | |
| 82 | 86 | # Finds the multi-part object the current object will be linked into. |
| 83 | −# If the object belongs to two or more multi-part objects, all of them are | |
| 84 | −# concatenated with a colon separator. | |
| 85 | −modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ | |
| 86 | − $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) | |
| 87 | +# If the object belongs to two or more multi-part objects, list them all. | |
| 88 | +modname-multi = $(sort $(foreach m,$(multi-used),\ | |
| 89 | + $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=)))) | |
| 90 | + | |
| 91 | +__modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) | |
| 87 | 92 | |
| 88 | −modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) | |
| 93 | +modname = $(subst $(space),:,$(__modname)) | |
| 94 | +modfile = $(addprefix $(obj)/,$(__modname)) | |
| 89 | 95 | |
| 90 | 96 | # target with $(obj)/ and its suffix stripped |
| 91 | 97 | target-stem = $(basename $(patsubst $(obj)/%,%,$@)) |
| @@ -93,9 +99,10 @@ target-stem = $(basename $(patsubst $(obj)/%,%,$@)) · 1 unmodified line | ||
| 93 | 99 | # These flags are needed for modversions and compiling, so we define them here |
| 94 | 100 | # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will |
| 95 | 101 | # end up in (or would, if it gets compiled in) |
| 96 | −name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) | |
| 102 | +name-fix = $(call stringify,$(subst $(comma),_,$(subst -,_,$1))) | |
| 97 | 103 | basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) |
| 98 | 104 | modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) |
| 105 | +modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile)) | |
| 99 | 106 | |
| 100 | 107 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ |
| 101 | 108 | $(ccflags-y) $(CFLAGS_$(target-stem).o) |
| @@ -154,7 +161,7 @@ quiet_modtag = $(if $(part-of-module),[M], ) · 52 unmodified lines | ||
| 154 | 161 | modkern_cflags = \ |
| 155 | 162 | $(if $(part-of-module), \ |
| 156 | 163 | $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ |
| 157 | − $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | |
| 164 | + $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL) $(modfile_flags)) | |
| 158 | 165 | |
| 159 | 166 | modkern_aflags = $(if $(part-of-module), \ |
| 160 | 167 | $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \ |
| @@ -1,57 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# ========================================================================== | |
| 3 | −# Generating modules.builtin | |
| 4 | −# ========================================================================== | |
| 5 | − | |
| 6 | −src := $(obj) | |
| 7 | − | |
| 8 | −PHONY := __modbuiltin | |
| 9 | −__modbuiltin: | |
| 10 | − | |
| 11 | −include include/config/auto.conf | |
| 12 | −# tristate.conf sets tristate variables to uppercase 'Y' or 'M' | |
| 13 | −# That way, we get the list of built-in modules in obj-Y | |
| 14 | −include include/config/tristate.conf | |
| 15 | − | |
| 16 | −include scripts/Kbuild.include | |
| 17 | − | |
| 18 | −ifdef building_out_of_srctree | |
| 19 | −# Create output directory if not already present | |
| 20 | −_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | |
| 21 | −endif | |
| 22 | − | |
| 23 | −# The filename Kbuild has precedence over Makefile | |
| 24 | −kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | |
| 25 | −kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) | |
| 26 | −include $(kbuild-file) | |
| 27 | − | |
| 28 | −include scripts/Makefile.lib | |
| 29 | −__subdir-Y := $(patsubst %/,%,$(filter %/, $(obj-Y))) | |
| 30 | −subdir-Y += $(__subdir-Y) | |
| 31 | −subdir-ym := $(sort $(subdir-y) $(subdir-Y) $(subdir-m)) | |
| 32 | −subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) | |
| 33 | −obj-Y := $(addprefix $(obj)/,$(obj-Y)) | |
| 34 | − | |
| 35 | −modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym)) | |
| 36 | −modbuiltin-mods := $(filter %.ko, $(obj-Y:.o=.ko)) | |
| 37 | −modbuiltin-target := $(obj)/modules.builtin | |
| 38 | − | |
| 39 | −__modbuiltin: $(modbuiltin-target) $(subdir-ym) | |
| 40 | − @: | |
| 41 | − | |
| 42 | −$(modbuiltin-target): $(subdir-ym) FORCE | |
| 43 | − $(Q)(for m in $(modbuiltin-mods); do echo $$m; done; \ | |
| 44 | − cat /dev/null $(modbuiltin-subdirs)) > $@ | |
| 45 | − | |
| 46 | −PHONY += FORCE | |
| 47 | − | |
| 48 | −FORCE: | |
| 49 | − | |
| 50 | −# Descending | |
| 51 | −# --------------------------------------------------------------------------- | |
| 52 | − | |
| 53 | −PHONY += $(subdir-ym) | |
| 54 | −$(subdir-ym): | |
| 55 | − $(Q)$(MAKE) $(modbuiltin)=$@ | |
| 56 | − | |
| 57 | −.PHONY: $(PHONY) | |
| @@ -90,7 +90,6 @@ quiet_cmd_modpost = MODPOST $(words $(modules)) modules · 89 unmodified lines | ||
| 90 | 90 | cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST) |
| 91 | 91 | |
| 92 | 92 | __modpost: |
| 93 | − @$(kecho) ' Building modules, stage 2.' | |
| 94 | 93 | $(call cmd,modpost) |
| 95 | 94 | ifneq ($(KBUILD_MODPOST_NOFINAL),1) |
| 96 | 95 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal |
| @@ -710,25 +710,6 @@ static struct conf_printer header_printer_cb = · 709 unmodified lines | ||
| 710 | 710 | .print_comment = header_print_comment, |
| 711 | 711 | }; |
| 712 | 712 | |
| 713 | −/* | |
| 714 | − * Tristate printer | |
| 715 | − * | |
| 716 | − * This printer is used when generating the `include/config/tristate.conf' file. | |
| 717 | − */ | |
| 718 | −static void | |
| 719 | −tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | |
| 720 | −{ | |
| 721 | − | |
| 722 | − if (sym->type == S_TRISTATE && *value != 'n') | |
| 723 | − fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value)); | |
| 724 | −} | |
| 725 | − | |
| 726 | −static struct conf_printer tristate_printer_cb = | |
| 727 | −{ | |
| 728 | − .print_symbol = tristate_print_symbol, | |
| 729 | − .print_comment = kconfig_print_comment, | |
| 730 | −}; | |
| 731 | − | |
| 732 | 713 | static void conf_write_symbol(FILE *fp, struct symbol *sym, |
| 733 | 714 | struct conf_printer *printer, void *printer_arg) |
| 734 | 715 | { |
| @@ -1062,7 +1043,7 @@ int conf_write_autoconf(int overwrite) · 327 unmodified lines | ||
| 1062 | 1043 | struct symbol *sym; |
| 1063 | 1044 | const char *name; |
| 1064 | 1045 | const char *autoconf_name = conf_get_autoconfig_name(); |
| 1065 | − FILE *out, *tristate, *out_h; | |
| 1046 | + FILE *out, *out_h; | |
| 1066 | 1047 | int i; |
| 1067 | 1048 | |
| 1068 | 1049 | if (!overwrite && is_present(autoconf_name)) |
| @@ -1077,23 +1058,13 @@ int conf_write_autoconf(int overwrite) · 8 unmodified lines | ||
| 1077 | 1058 | if (!out) |
| 1078 | 1059 | return 1; |
| 1079 | 1060 | |
| 1080 | − tristate = fopen(".tmpconfig_tristate", "w"); | |
| 1081 | − if (!tristate) { | |
| 1082 | − fclose(out); | |
| 1083 | − return 1; | |
| 1084 | − } | |
| 1085 | − | |
| 1086 | 1061 | out_h = fopen(".tmpconfig.h", "w"); |
| 1087 | 1062 | if (!out_h) { |
| 1088 | 1063 | fclose(out); |
| 1089 | − fclose(tristate); | |
| 1090 | 1064 | return 1; |
| 1091 | 1065 | } |
| 1092 | 1066 | |
| 1093 | 1067 | conf_write_heading(out, &kconfig_printer_cb, NULL); |
| 1094 | − | |
| 1095 | − conf_write_heading(tristate, &tristate_printer_cb, NULL); | |
| 1096 | − | |
| 1097 | 1068 | conf_write_heading(out_h, &header_printer_cb, NULL); |
| 1098 | 1069 | |
| 1099 | 1070 | for_all_symbols(i, sym) { |
| @@ -1101,15 +1072,11 @@ int conf_write_autoconf(int overwrite) · 1 unmodified line | ||
| 1101 | 1072 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) |
| 1102 | 1073 | continue; |
| 1103 | 1074 | |
| 1104 | − /* write symbol to auto.conf, tristate and header files */ | |
| 1075 | + /* write symbols to auto.conf and autoconf.h */ | |
| 1105 | 1076 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
| 1106 | − | |
| 1107 | − conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); | |
| 1108 | − | |
| 1109 | 1077 | conf_write_symbol(out_h, sym, &header_printer_cb, NULL); |
| 1110 | 1078 | } |
| 1111 | 1079 | fclose(out); |
| 1112 | − fclose(tristate); | |
| 1113 | 1080 | fclose(out_h); |
| 1114 | 1081 | |
| 1115 | 1082 | name = getenv("KCONFIG_AUTOHEADER"); |
| @@ -1120,14 +1087,6 @@ int conf_write_autoconf(int overwrite) · 4 unmodified lines | ||
| 1120 | 1087 | if (rename(".tmpconfig.h", name)) |
| 1121 | 1088 | return 1; |
| 1122 | 1089 | |
| 1123 | − name = getenv("KCONFIG_TRISTATE"); | |
| 1124 | − if (!name) | |
| 1125 | − name = "include/config/tristate.conf"; | |
| 1126 | − if (make_parent_dir(name)) | |
| 1127 | − return 1; | |
| 1128 | − if (rename(".tmpconfig_tristate", name)) | |
| 1129 | − return 1; | |
| 1130 | − | |
| 1131 | 1090 | if (make_parent_dir(autoconf_name)) |
| 1132 | 1091 | return 1; |
| 1133 | 1092 | /* |
| @@ -250,6 +250,10 @@ ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1 · 249 unmodified lines | ||
| 250 | 250 | |
| 251 | 251 | info MODINFO modules.builtin.modinfo |
| 252 | 252 | ${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo |
| 253 | +info GEN modules.builtin | |
| 254 | +# The second line aids cases where multiple modules share the same object. | |
| 255 | +tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | | |
| 256 | + tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin | |
| 253 | 257 | |
| 254 | 258 | btf_vmlinux_bin_o="" |
| 255 | 259 | if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #define _GNU_SOURCE |
| 15 | +#include <elf.h> | |
| 15 | 16 | #include <stdio.h> |
| 16 | 17 | #include <ctype.h> |
| 17 | 18 | #include <string.h> |
| @@ -729,12 +730,6 @@ static void handle_symbol(struct module *mod, struct elf_info *info, · 711 unmodified lines | ||
| 729 | 730 | break; |
| 730 | 731 | if (ignore_undef_symbol(info, symname)) |
| 731 | 732 | break; |
| 732 | −/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */ | |
| 733 | −#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER) | |
| 734 | −/* add compatibility with older glibc */ | |
| 735 | −#ifndef STT_SPARC_REGISTER | |
| 736 | −#define STT_SPARC_REGISTER STT_REGISTER | |
| 737 | −#endif | |
| 738 | 733 | if (info->hdr->e_machine == EM_SPARC || |
| 739 | 734 | info->hdr->e_machine == EM_SPARCV9) { |
| 740 | 735 | /* Ignore register directives. */ |
| @@ -747,7 +742,6 @@ static void handle_symbol(struct module *mod, struct elf_info *info, · 6 unmodified lines | ||
| 747 | 742 | symname = munged; |
| 748 | 743 | } |
| 749 | 744 | } |
| 750 | −#endif | |
| 751 | 745 | |
| 752 | 746 | mod->unres = alloc_symbol(symname, |
| 753 | 747 | ELF_ST_BIND(sym->st_info) == STB_WEAK, |
| @@ -43,17 +43,66 @@ create_package() { · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | # Create the package |
| 45 | 45 | dpkg-gencontrol -p$pname -P"$pdir" |
| 46 | − dpkg --build "$pdir" .. | |
| 46 | + dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" .. | |
| 47 | +} | |
| 48 | + | |
| 49 | +deploy_kernel_headers () { | |
| 50 | + pdir=$1 | |
| 51 | + | |
| 52 | + rm -rf $pdir | |
| 53 | + | |
| 54 | + ( | |
| 55 | + cd $srctree | |
| 56 | + find . arch/$SRCARCH -maxdepth 1 -name Makefile\* | |
| 57 | + find include scripts -type f -o -type l | |
| 58 | + find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform | |
| 59 | + find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f | |
| 60 | + ) > debian/hdrsrcfiles | |
| 61 | + | |
| 62 | + { | |
| 63 | + if is_enabled CONFIG_STACK_VALIDATION; then | |
| 64 | + echo tools/objtool/objtool | |
| 65 | + fi | |
| 66 | + | |
| 67 | + find arch/$SRCARCH/include Module.symvers include scripts -type f | |
| 68 | + | |
| 69 | + if is_enabled CONFIG_GCC_PLUGINS; then | |
| 70 | + find scripts/gcc-plugins -name \*.so | |
| 71 | + fi | |
| 72 | + } > debian/hdrobjfiles | |
| 73 | + | |
| 74 | + destdir=$pdir/usr/src/linux-headers-$version | |
| 75 | + mkdir -p $destdir | |
| 76 | + tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir | |
| 77 | + tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir | |
| 78 | + rm -f debian/hdrsrcfiles debian/hdrobjfiles | |
| 79 | + | |
| 80 | + # copy .config manually to be where it's expected to be | |
| 81 | + cp $KCONFIG_CONFIG $destdir/.config | |
| 82 | + | |
| 83 | + mkdir -p $pdir/lib/modules/$version/ | |
| 84 | + ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build | |
| 85 | +} | |
| 86 | + | |
| 87 | +deploy_libc_headers () { | |
| 88 | + pdir=$1 | |
| 89 | + | |
| 90 | + rm -rf $pdir | |
| 91 | + | |
| 92 | + $MAKE -f $srctree/Makefile headers | |
| 93 | + $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr | |
| 94 | + | |
| 95 | + # move asm headers to /usr/include/<libc-machine>/asm to match the structure | |
| 96 | + # used by Debian-based distros (to support multi-arch) | |
| 97 | + host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH) | |
| 98 | + mkdir $pdir/usr/include/$host_arch | |
| 99 | + mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ | |
| 47 | 100 | } |
| 48 | 101 | |
| 49 | 102 | version=$KERNELRELEASE |
| 50 | −tmpdir="$objtree/debian/tmp" | |
| 51 | −kernel_headers_dir="$objtree/debian/hdrtmp" | |
| 52 | −libc_headers_dir="$objtree/debian/headertmp" | |
| 53 | −dbg_dir="$objtree/debian/dbgtmp" | |
| 103 | +tmpdir=debian/linux-image | |
| 104 | +dbg_dir=debian/linux-image-dbg | |
| 54 | 105 | packagename=linux-image-$version |
| 55 | −kernel_headers_packagename=linux-headers-$version | |
| 56 | −libc_headers_packagename=linux-libc-dev | |
| 57 | 106 | dbg_packagename=$packagename-dbg |
| 58 | 107 | |
| 59 | 108 | if [ "$ARCH" = "um" ] ; then |
| @@ -77,15 +126,13 @@ esac · 17 unmodified lines | ||
| 77 | 126 | BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes) |
| 78 | 127 | |
| 79 | 128 | # Setup the directory structure |
| 80 | −rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files | |
| 129 | +rm -rf "$tmpdir" "$dbg_dir" debian/files | |
| 81 | 130 | mkdir -m 755 -p "$tmpdir/DEBIAN" |
| 82 | 131 | mkdir -p "$tmpdir/lib" "$tmpdir/boot" |
| 83 | −mkdir -p "$kernel_headers_dir/lib/modules/$version/" | |
| 84 | 132 | |
| 85 | −# Build and install the kernel | |
| 133 | +# Install the kernel | |
| 86 | 134 | if [ "$ARCH" = "um" ] ; then |
| 87 | 135 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename" |
| 88 | − $MAKE linux | |
| 89 | 136 | cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" |
| 90 | 137 | cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config" |
| 91 | 138 | gzip "$tmpdir/usr/share/doc/$packagename/config" |
| @@ -129,16 +176,6 @@ if is_enabled CONFIG_MODULES; then · 37 unmodified lines | ||
| 129 | 176 | fi |
| 130 | 177 | fi |
| 131 | 178 | |
| 132 | −if [ "$ARCH" != "um" ]; then | |
| 133 | − $MAKE -f $srctree/Makefile headers | |
| 134 | − $MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" | |
| 135 | − # move asm headers to /usr/include/<libc-machine>/asm to match the structure | |
| 136 | − # used by Debian-based distros (to support multi-arch) | |
| 137 | − host_arch=$(dpkg-architecture -a$(cat debian/arch) -qDEB_HOST_MULTIARCH) | |
| 138 | − mkdir $libc_headers_dir/usr/include/$host_arch | |
| 139 | − mv $libc_headers_dir/usr/include/asm $libc_headers_dir/usr/include/$host_arch/ | |
| 140 | −fi | |
| 141 | − | |
| 142 | 179 | # Install the maintainer scripts |
| 143 | 180 | # Note: hook scripts under /etc/kernel are also executed by official Debian |
| 144 | 181 | # kernel packages, as well as kernel packages built using make-kpkg. |
| @@ -164,29 +201,12 @@ EOF · 19 unmodified lines | ||
| 164 | 201 | chmod 755 "$tmpdir/DEBIAN/$script" |
| 165 | 202 | done |
| 166 | 203 | |
| 167 | −# Build kernel header package | |
| 168 | −(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles" | |
| 169 | −(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles" | |
| 170 | −(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" | |
| 171 | −(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" | |
| 172 | −if is_enabled CONFIG_STACK_VALIDATION; then | |
| 173 | − (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles" | |
| 174 | −fi | |
| 175 | −(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" | |
| 176 | −if is_enabled CONFIG_GCC_PLUGINS; then | |
| 177 | − (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles" | |
| 178 | −fi | |
| 179 | −destdir=$kernel_headers_dir/usr/src/linux-headers-$version | |
| 180 | −mkdir -p "$destdir" | |
| 181 | −(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) | |
| 182 | −(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -) | |
| 183 | −(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be | |
| 184 | −ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" | |
| 185 | −rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" | |
| 186 | − | |
| 187 | 204 | if [ "$ARCH" != "um" ]; then |
| 188 | − create_package "$kernel_headers_packagename" "$kernel_headers_dir" | |
| 189 | − create_package "$libc_headers_packagename" "$libc_headers_dir" | |
| 205 | + deploy_kernel_headers debian/linux-headers | |
| 206 | + create_package linux-headers-$version debian/linux-headers | |
| 207 | + | |
| 208 | + deploy_libc_headers debian/linux-libc-dev | |
| 209 | + create_package linux-libc-dev debian/linux-libc-dev | |
| 190 | 210 | fi |
| 191 | 211 | |
| 192 | 212 | create_package "$packagename" "$tmpdir" |
| @@ -1,9 +1,3 @@ | ||
| 1 | −# | |
| 2 | −# Generated files | |
| 3 | −# | |
| 4 | 1 | gen_init_cpio |
| 5 | 2 | initramfs_data.cpio |
| 6 | −initramfs_data.cpio.gz | |
| 7 | −initramfs_data.cpio.bz2 | |
| 8 | −initramfs_data.cpio.lzma | |
| 9 | −initramfs_list | |
| 3 | +/initramfs_inc_data | |
| @@ -54,7 +54,6 @@ config INITRAMFS_ROOT_GID · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | config RD_GZIP |
| 56 | 56 | bool "Support initial ramdisk/ramfs compressed using gzip" |
| 57 | − depends on BLK_DEV_INITRD | |
| 58 | 57 | default y |
| 59 | 58 | select DECOMPRESS_GZIP |
| 60 | 59 | help |
| @@ -64,7 +63,6 @@ config RD_GZIP · 3 unmodified lines | ||
| 64 | 63 | config RD_BZIP2 |
| 65 | 64 | bool "Support initial ramdisk/ramfs compressed using bzip2" |
| 66 | 65 | default y |
| 67 | − depends on BLK_DEV_INITRD | |
| 68 | 66 | select DECOMPRESS_BZIP2 |
| 69 | 67 | help |
| 70 | 68 | Support loading of a bzip2 encoded initial ramdisk or cpio buffer |
| @@ -73,7 +71,6 @@ config RD_BZIP2 · 2 unmodified lines | ||
| 73 | 71 | config RD_LZMA |
| 74 | 72 | bool "Support initial ramdisk/ramfs compressed using LZMA" |
| 75 | 73 | default y |
| 76 | − depends on BLK_DEV_INITRD | |
| 77 | 74 | select DECOMPRESS_LZMA |
| 78 | 75 | help |
| 79 | 76 | Support loading of a LZMA encoded initial ramdisk or cpio buffer |
| @@ -81,7 +78,6 @@ config RD_LZMA · 1 unmodified line | ||
| 81 | 78 | |
| 82 | 79 | config RD_XZ |
| 83 | 80 | bool "Support initial ramdisk/ramfs compressed using XZ" |
| 84 | − depends on BLK_DEV_INITRD | |
| 85 | 81 | default y |
| 86 | 82 | select DECOMPRESS_XZ |
| 87 | 83 | help |
| @@ -91,7 +87,6 @@ config RD_XZ · 3 unmodified lines | ||
| 91 | 87 | config RD_LZO |
| 92 | 88 | bool "Support initial ramdisk/ramfs compressed using LZO" |
| 93 | 89 | default y |
| 94 | − depends on BLK_DEV_INITRD | |
| 95 | 90 | select DECOMPRESS_LZO |
| 96 | 91 | help |
| 97 | 92 | Support loading of a LZO encoded initial ramdisk or cpio buffer |
| @@ -100,7 +95,6 @@ config RD_LZO · 2 unmodified lines | ||
| 100 | 95 | config RD_LZ4 |
| 101 | 96 | bool "Support initial ramdisk/ramfs compressed using LZ4" |
| 102 | 97 | default y |
| 103 | − depends on BLK_DEV_INITRD | |
| 104 | 98 | select DECOMPRESS_LZ4 |
| 105 | 99 | help |
| 106 | 100 | Support loading of a LZ4 encoded initial ramdisk or cpio buffer |
| @@ -108,8 +102,6 @@ config RD_LZ4 · 1 unmodified line | ||
| 108 | 102 | |
| 109 | 103 | choice |
| 110 | 104 | prompt "Built-in initramfs compression mode" |
| 111 | − depends on INITRAMFS_SOURCE!="" | |
| 112 | − optional | |
| 113 | 105 | help |
| 114 | 106 | This option allows you to decide by which algorithm the builtin |
| 115 | 107 | initramfs will be compressed. Several compression algorithms are |
| @@ -215,21 +207,3 @@ config INITRAMFS_COMPRESSION_LZ4 · 99 unmodified lines | ||
| 215 | 207 | by default which could cause a build failure. |
| 216 | 208 | |
| 217 | 209 | endchoice |
| 218 | − | |
| 219 | −config INITRAMFS_COMPRESSION | |
| 220 | − depends on INITRAMFS_SOURCE!="" | |
| 221 | − string | |
| 222 | − default "" if INITRAMFS_COMPRESSION_NONE | |
| 223 | − default ".gz" if INITRAMFS_COMPRESSION_GZIP | |
| 224 | − default ".bz2" if INITRAMFS_COMPRESSION_BZIP2 | |
| 225 | − default ".lzma" if INITRAMFS_COMPRESSION_LZMA | |
| 226 | − default ".xz" if INITRAMFS_COMPRESSION_XZ | |
| 227 | − default ".lzo" if INITRAMFS_COMPRESSION_LZO | |
| 228 | − default ".lz4" if INITRAMFS_COMPRESSION_LZ4 | |
| 229 | − default ".gz" if RD_GZIP | |
| 230 | − default ".lz4" if RD_LZ4 | |
| 231 | − default ".lzo" if RD_LZO | |
| 232 | − default ".xz" if RD_XZ | |
| 233 | − default ".lzma" if RD_LZMA | |
| 234 | − default ".bz2" if RD_BZIP2 | |
| 235 | − default "" | |
| @@ -3,61 +3,86 @@ · 2 unmodified lines | ||
| 3 | 3 | # kbuild file for usr/ - including initramfs image |
| 4 | 4 | # |
| 5 | 5 | |
| 6 | −klibcdirs:; | |
| 7 | −PHONY += klibcdirs | |
| 6 | +# cmd_bzip2, cmd_lzma, cmd_lzo, cmd_lz4 from scripts/Makefile.lib appends the | |
| 7 | +# size at the end of the compressed file, which unfortunately does not work | |
| 8 | +# with unpack_to_rootfs(). Make size_append no-op. | |
| 9 | +override size_append := : | |
| 8 | 10 | |
| 9 | −suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION)) | |
| 10 | −datafile_y = initramfs_data.cpio$(suffix_y) | |
| 11 | −datafile_d_y = .$(datafile_y).d | |
| 12 | −AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)" | |
| 11 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_NONE) := shipped | |
| 12 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip | |
| 13 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2 | |
| 14 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_LZMA) := lzma | |
| 15 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_XZ) := xzmisc | |
| 16 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_LZO) := lzo | |
| 17 | +compress-$(CONFIG_INITRAMFS_COMPRESSION_LZ4) := lz4 | |
| 13 | 18 | |
| 14 | −# clean rules do not have CONFIG_INITRAMFS_COMPRESSION. So clean up after all | |
| 15 | −# possible compression formats. | |
| 16 | −clean-files += initramfs_data.cpio* | |
| 17 | − | |
| 18 | −# Generate builtin.o based on initramfs_data.o | |
| 19 | 19 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o |
| 20 | 20 | |
| 21 | −# initramfs_data.o contains the compressed initramfs_data.cpio image. | |
| 22 | −# The image is included using .incbin, a dependency which is not | |
| 23 | −# tracked automatically. | |
| 24 | −$(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE | |
| 21 | +$(obj)/initramfs_data.o: $(obj)/initramfs_inc_data | |
| 22 | + | |
| 23 | +ramfs-input := $(strip $(shell echo $(CONFIG_INITRAMFS_SOURCE))) | |
| 24 | +cpio-data := | |
| 25 | + | |
| 26 | +# If CONFIG_INITRAMFS_SOURCE is empty, generate a small initramfs with the | |
| 27 | +# default contents. | |
| 28 | +ifeq ($(ramfs-input),) | |
| 29 | +ramfs-input := $(srctree)/$(src)/default_cpio_list | |
| 30 | +endif | |
| 31 | + | |
| 32 | +ifeq ($(words $(ramfs-input)),1) | |
| 33 | + | |
| 34 | +# If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with | |
| 35 | +# .cpio, use it directly as an initramfs. | |
| 36 | +ifneq ($(filter %.cpio,$(ramfs-input)),) | |
| 37 | +cpio-data := $(ramfs-input) | |
| 38 | +endif | |
| 39 | + | |
| 40 | +# If CONFIG_INITRAMFS_SOURCE specifies a single file, and it is suffixed with | |
| 41 | +# .cpio.*, use it directly as an initramfs, and avoid double compression. | |
| 42 | +ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2) | |
| 43 | +cpio-data := $(ramfs-input) | |
| 44 | +compress-y := shipped | |
| 45 | +endif | |
| 46 | + | |
| 47 | +endif | |
| 48 | + | |
| 49 | +# For other cases, generate the initramfs cpio archive based on the contents | |
| 50 | +# specified by CONFIG_INITRAMFS_SOURCE. | |
| 51 | +ifeq ($(cpio-data),) | |
| 25 | 52 | |
| 26 | −##### | |
| 27 | −# Generate the initramfs cpio archive | |
| 53 | +cpio-data := $(obj)/initramfs_data.cpio | |
| 28 | 54 | |
| 29 | 55 | hostprogs-y := gen_init_cpio |
| 30 | −initramfs := $(CONFIG_SHELL) $(srctree)/$(src)/gen_initramfs_list.sh | |
| 31 | −ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ | |
| 32 | − $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) | |
| 33 | −ramfs-args := \ | |
| 34 | − $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ | |
| 35 | − $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) | |
| 36 | − | |
| 37 | −# $(datafile_d_y) is used to identify all files included | |
| 56 | + | |
| 57 | +# .initramfs_data.cpio.d is used to identify all files included | |
| 38 | 58 | # in initramfs and to detect if any files are added/removed. |
| 39 | 59 | # Removed files are identified by directory timestamp being updated |
| 40 | 60 | # The dependency list is generated by gen_initramfs.sh -l |
| 41 | −ifneq ($(wildcard $(obj)/$(datafile_d_y)),) | |
| 42 | − include $(obj)/$(datafile_d_y) | |
| 43 | −endif | |
| 44 | − | |
| 45 | −quiet_cmd_initfs = GEN $@ | |
| 46 | − cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) | |
| 47 | − | |
| 48 | −targets := $(datafile_y) | |
| 61 | +-include $(obj)/.initramfs_data.cpio.d | |
| 49 | 62 | |
| 50 | 63 | # do not try to update files included in initramfs |
| 51 | 64 | $(deps_initramfs): ; |
| 52 | 65 | |
| 53 | −$(deps_initramfs): klibcdirs | |
| 66 | +quiet_cmd_initfs = GEN $@ | |
| 67 | + cmd_initfs = \ | |
| 68 | + $(CONFIG_SHELL) $< -o $@ -l $(obj)/.initramfs_data.cpio.d \ | |
| 69 | + $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ | |
| 70 | + $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \ | |
| 71 | + $(ramfs-input) | |
| 72 | + | |
| 54 | 73 | # We rebuild initramfs_data.cpio if: |
| 55 | 74 | # 1) Any included file is newer than initramfs_data.cpio |
| 56 | 75 | # 2) There are changes in which files are included (added or deleted) |
| 57 | 76 | # 3) If gen_init_cpio are newer than initramfs_data.cpio |
| 58 | 77 | # 4) Arguments to gen_initramfs.sh changes |
| 59 | −$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs | |
| 60 | − $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y) | |
| 78 | +$(obj)/initramfs_data.cpio: $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_initramfs) FORCE | |
| 61 | 79 | $(call if_changed,initfs) |
| 62 | 80 | |
| 81 | +endif | |
| 82 | + | |
| 83 | +$(obj)/initramfs_inc_data: $(cpio-data) FORCE | |
| 84 | + $(call if_changed,$(compress-y)) | |
| 85 | + | |
| 86 | +targets += initramfs_data.cpio initramfs_inc_data | |
| 87 | + | |
| 63 | 88 | subdir-$(CONFIG_UAPI_HEADER_TEST) += include |
| @@ -0,0 +1,6 @@ | ||
| 1 | +# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +# This is a very simple, default initramfs | |
| 3 | + | |
| 4 | +dir /dev 0755 0 0 | |
| 5 | +nod /dev/console 0600 0 0 c 5 1 | |
| 6 | +dir /root 0700 0 0 | |
| @@ -5,8 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | # Released under the terms of the GNU GPL |
| 6 | 6 | # |
| 7 | 7 | # Generate a cpio packed initramfs. It uses gen_init_cpio to generate |
| 8 | −# the cpio archive, and then compresses it. | |
| 9 | −# The script may also be used to generate the inputfile used for gen_init_cpio | |
| 8 | +# the cpio archive. | |
| 10 | 9 | # This script assumes that gen_init_cpio is located in usr/ directory |
| 11 | 10 | |
| 12 | 11 | # error out on errors |
| @@ -15,9 +14,9 @@ set -e · 2 unmodified lines | ||
| 15 | 14 | usage() { |
| 16 | 15 | cat << EOF |
| 17 | 16 | Usage: |
| 18 | −$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... | |
| 19 | − -o <file> Create compressed initramfs file named <file> using | |
| 20 | − gen_init_cpio and compressor depending on the extension | |
| 17 | +$0 [-o <file>] [-l <dep_list>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... | |
| 18 | + -o <file> Create initramfs file named <file> by using gen_init_cpio | |
| 19 | + -l <dep_list> Create dependency list named <dep_list> | |
| 21 | 20 | -u <uid> User ID to map to user ID 0 (root). |
| 22 | 21 | <uid> is only meaningful if <cpio_source> is a |
| 23 | 22 | directory. "squash" forces all files to uid 0. |
| @@ -27,7 +26,6 @@ $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... · 3 unmodified lines | ||
| 27 | 26 | <cpio_source> File list or directory for cpio archive. |
| 28 | 27 | If <cpio_source> is a .cpio file it will be used |
| 29 | 28 | as direct input to initramfs. |
| 30 | − -d Output the default cpio list. | |
| 31 | 29 | |
| 32 | 30 | All options except -o and -l may be repeated and are interpreted |
| 33 | 31 | sequentially and immediately. -u and -g states are preserved across |
| @@ -42,23 +40,6 @@ field() { · 8 unmodified lines | ||
| 42 | 40 | shift $1 ; echo $1 |
| 43 | 41 | } |
| 44 | 42 | |
| 45 | −list_default_initramfs() { | |
| 46 | − # echo usr/kinit/kinit | |
| 47 | − : | |
| 48 | −} | |
| 49 | − | |
| 50 | −default_initramfs() { | |
| 51 | − cat <<-EOF >> ${output} | |
| 52 | − # This is a very simple, default initramfs | |
| 53 | − | |
| 54 | − dir /dev 0755 0 0 | |
| 55 | − nod /dev/console 0600 0 0 c 5 1 | |
| 56 | − dir /root 0700 0 0 | |
| 57 | − # file /kinit usr/kinit/kinit 0755 0 0 | |
| 58 | − # slink /init kinit 0755 0 0 | |
| 59 | − EOF | |
| 60 | −} | |
| 61 | − | |
| 62 | 43 | filetype() { |
| 63 | 44 | local argv1="$1" |
| 64 | 45 | |
| @@ -81,10 +62,6 @@ filetype() { · 16 unmodified lines | ||
| 81 | 62 | return 0 |
| 82 | 63 | } |
| 83 | 64 | |
| 84 | −list_print_mtime() { | |
| 85 | − : | |
| 86 | −} | |
| 87 | − | |
| 88 | 65 | print_mtime() { |
| 89 | 66 | local my_mtime="0" |
| 90 | 67 | |
| @@ -92,15 +69,15 @@ print_mtime() { · 1 unmodified line | ||
| 92 | 69 | my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1) |
| 93 | 70 | fi |
| 94 | 71 | |
| 95 | − echo "# Last modified: ${my_mtime}" >> ${output} | |
| 96 | − echo "" >> ${output} | |
| 72 | + echo "# Last modified: ${my_mtime}" >> $cpio_list | |
| 73 | + echo "" >> $cpio_list | |
| 97 | 74 | } |
| 98 | 75 | |
| 99 | 76 | list_parse() { |
| 100 | − if [ -L "$1" ]; then | |
| 77 | + if [ -z "$dep_list" -o -L "$1" ]; then | |
| 101 | 78 | return |
| 102 | 79 | fi |
| 103 | − echo "$1" | sed 's/:/\\:/g; s/$/ \\/' | |
| 80 | + echo "$1" | sed 's/:/\\:/g; s/$/ \\/' >> $dep_list | |
| 104 | 81 | } |
| 105 | 82 | |
| 106 | 83 | # for each file print a line in following format |
| @@ -146,7 +123,7 @@ parse() { · 39 unmodified lines | ||
| 146 | 123 | ;; |
| 147 | 124 | esac |
| 148 | 125 | |
| 149 | − echo "${str}" >> ${output} | |
| 126 | + echo "${str}" >> $cpio_list | |
| 150 | 127 | |
| 151 | 128 | return 0 |
| 152 | 129 | } |
| @@ -161,58 +138,47 @@ unknown_option() { · 8 unmodified lines | ||
| 161 | 138 | exit 1 |
| 162 | 139 | } |
| 163 | 140 | |
| 164 | −list_header() { | |
| 165 | − : | |
| 166 | −} | |
| 167 | − | |
| 168 | 141 | header() { |
| 169 | − printf "\n#####################\n# $1\n" >> ${output} | |
| 142 | + printf "\n#####################\n# $1\n" >> $cpio_list | |
| 170 | 143 | } |
| 171 | 144 | |
| 172 | 145 | # process one directory (incl sub-directories) |
| 173 | 146 | dir_filelist() { |
| 174 | − ${dep_list}header "$1" | |
| 147 | + header "$1" | |
| 175 | 148 | |
| 176 | 149 | srcdir=$(echo "$1" | sed -e 's://*:/:g') |
| 177 | 150 | dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort) |
| 178 | 151 | |
| 179 | 152 | # If $dirlist is only one line, then the directory is empty |
| 180 | 153 | if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then |
| 181 | − ${dep_list}print_mtime "$1" | |
| 154 | + print_mtime "$1" | |
| 182 | 155 | |
| 183 | 156 | echo "${dirlist}" | \ |
| 184 | 157 | while read x; do |
| 185 | − ${dep_list}parse ${x} | |
| 158 | + list_parse $x | |
| 159 | + parse $x | |
| 186 | 160 | done |
| 187 | 161 | fi |
| 188 | 162 | } |
| 189 | 163 | |
| 190 | −# if only one file is specified and it is .cpio file then use it direct as fs | |
| 191 | −# if a directory is specified then add all files in given direcotry to fs | |
| 192 | −# if a regular file is specified assume it is in gen_initramfs format | |
| 193 | 164 | input_file() { |
| 194 | 165 | source="$1" |
| 195 | 166 | if [ -f "$1" ]; then |
| 196 | − ${dep_list}header "$1" | |
| 197 | − is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')" | |
| 198 | − if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then | |
| 199 | − cpio_file=$1 | |
| 200 | − echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" | |
| 201 | − [ ! -z ${dep_list} ] && echo "$1" | |
| 202 | − return 0 | |
| 203 | − fi | |
| 204 | − if [ -z ${dep_list} ]; then | |
| 205 | − print_mtime "$1" >> ${output} | |
| 206 | − cat "$1" >> ${output} | |
| 207 | − else | |
| 208 | − echo "$1 \\" | |
| 167 | + # If a regular file is specified, assume it is in | |
| 168 | + # gen_init_cpio format | |
| 169 | + header "$1" | |
| 170 | + print_mtime "$1" >> $cpio_list | |
| 171 | + cat "$1" >> $cpio_list | |
| 172 | + if [ -n "$dep_list" ]; then | |
| 173 | + echo "$1 \\" >> $dep_list | |
| 209 | 174 | cat "$1" | while read type dir file perm ; do |
| 210 | 175 | if [ "$type" = "file" ]; then |
| 211 | − echo "$file \\"; | |
| 176 | + echo "$file \\" >> $dep_list | |
| 212 | 177 | fi |
| 213 | 178 | done |
| 214 | 179 | fi |
| 215 | 180 | elif [ -d "$1" ]; then |
| 181 | + # If a directory is specified then add all files in it to fs | |
| 216 | 182 | dir_filelist "$1" |
| 217 | 183 | else |
| 218 | 184 | echo " ${prog}: Cannot open '$1'" >&2 |
| @@ -224,51 +190,24 @@ prog=$0 · 5 unmodified lines | ||
| 224 | 190 | root_uid=0 |
| 225 | 191 | root_gid=0 |
| 226 | 192 | dep_list= |
| 227 | −cpio_file= | |
| 228 | −cpio_list= | |
| 193 | +cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX) | |
| 229 | 194 | output="/dev/stdout" |
| 230 | −output_file="" | |
| 231 | −is_cpio_compressed= | |
| 232 | −compr="gzip -n -9 -f" | |
| 233 | 195 | |
| 234 | −arg="$1" | |
| 235 | −case "$arg" in | |
| 236 | − "-l") # files included in initramfs - used by kbuild | |
| 237 | − dep_list="list_" | |
| 238 | − echo "deps_initramfs := $0 \\" | |
| 239 | − shift | |
| 240 | − ;; | |
| 241 | − "-o") # generate compressed cpio image named $1 | |
| 242 | − shift | |
| 243 | − output_file="$1" | |
| 244 | − cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" | |
| 245 | − output=${cpio_list} | |
| 246 | − echo "$output_file" | grep -q "\.gz$" \ | |
| 247 | − && [ -x "`which gzip 2> /dev/null`" ] \ | |
| 248 | − && compr="gzip -n -9 -f" | |
| 249 | − echo "$output_file" | grep -q "\.bz2$" \ | |
| 250 | − && [ -x "`which bzip2 2> /dev/null`" ] \ | |
| 251 | − && compr="bzip2 -9 -f" | |
| 252 | − echo "$output_file" | grep -q "\.lzma$" \ | |
| 253 | − && [ -x "`which lzma 2> /dev/null`" ] \ | |
| 254 | − && compr="lzma -9 -f" | |
| 255 | − echo "$output_file" | grep -q "\.xz$" \ | |
| 256 | − && [ -x "`which xz 2> /dev/null`" ] \ | |
| 257 | − && compr="xz --check=crc32 --lzma2=dict=1MiB" | |
| 258 | − echo "$output_file" | grep -q "\.lzo$" \ | |
| 259 | − && [ -x "`which lzop 2> /dev/null`" ] \ | |
| 260 | − && compr="lzop -9 -f" | |
| 261 | − echo "$output_file" | grep -q "\.lz4$" \ | |
| 262 | − && [ -x "`which lz4 2> /dev/null`" ] \ | |
| 263 | − && compr="lz4 -l -9 -f" | |
| 264 | − echo "$output_file" | grep -q "\.cpio$" && compr="cat" | |
| 265 | − shift | |
| 266 | − ;; | |
| 267 | −esac | |
| 196 | +trap "rm -f $cpio_list" EXIT | |
| 197 | + | |
| 268 | 198 | while [ $# -gt 0 ]; do |
| 269 | 199 | arg="$1" |
| 270 | 200 | shift |
| 271 | 201 | case "$arg" in |
| 202 | + "-l") # files included in initramfs - used by kbuild | |
| 203 | + dep_list="$1" | |
| 204 | + echo "deps_initramfs := \\" > $dep_list | |
| 205 | + shift | |
| 206 | + ;; | |
| 207 | + "-o") # generate cpio image named $1 | |
| 208 | + output="$1" | |
| 209 | + shift | |
| 210 | + ;; | |
| 272 | 211 | "-u") # map $1 to uid=0 (root) |
| 273 | 212 | root_uid="$1" |
| 274 | 213 | [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0) |
| @@ -279,10 +218,6 @@ while [ $# -gt 0 ]; do · 4 unmodified lines | ||
| 279 | 218 | [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0) |
| 280 | 219 | shift |
| 281 | 220 | ;; |
| 282 | − "-d") # display default initramfs list | |
| 283 | − default_list="$arg" | |
| 284 | − ${dep_list}default_initramfs | |
| 285 | − ;; | |
| 286 | 221 | "-h") |
| 287 | 222 | usage |
| 288 | 223 | exit 0 |
| @@ -293,36 +228,20 @@ while [ $# -gt 0 ]; do · 4 unmodified lines | ||
| 293 | 228 | unknown_option |
| 294 | 229 | ;; |
| 295 | 230 | *) # input file/dir - process it |
| 296 | − input_file "$arg" "$#" | |
| 231 | + input_file "$arg" | |
| 297 | 232 | ;; |
| 298 | 233 | esac |
| 299 | 234 | ;; |
| 300 | 235 | esac |
| 301 | 236 | done |
| 302 | 237 | |
| 303 | −# If output_file is set we will generate cpio archive and compress it | |
| 238 | +# If output_file is set we will generate cpio archive | |
| 304 | 239 | # we are careful to delete tmp files |
| 305 | −if [ ! -z ${output_file} ]; then | |
| 306 | − if [ -z ${cpio_file} ]; then | |
| 307 | − timestamp= | |
| 308 | − if test -n "$KBUILD_BUILD_TIMESTAMP"; then | |
| 309 | − timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" | |
| 310 | − if test -n "$timestamp"; then | |
| 311 | − timestamp="-t $timestamp" | |
| 312 | − fi | |
| 313 | − fi | |
| 314 | − cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" | |
| 315 | − usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} | |
| 316 | − else | |
| 317 | − cpio_tfile=${cpio_file} | |
| 318 | − fi | |
| 319 | − rm ${cpio_list} | |
| 320 | − if [ "${is_cpio_compressed}" = "compressed" ]; then | |
| 321 | − cat ${cpio_tfile} > ${output_file} | |
| 322 | − else | |
| 323 | − (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ | |
| 324 | − || (rm -f ${output_file} ; false) | |
| 240 | +timestamp= | |
| 241 | +if test -n "$KBUILD_BUILD_TIMESTAMP"; then | |
| 242 | + timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" | |
| 243 | + if test -n "$timestamp"; then | |
| 244 | + timestamp="-t $timestamp" | |
| 325 | 245 | fi |
| 326 | − [ -z ${cpio_file} ] && rm ${cpio_tfile} | |
| 327 | 246 | fi |
| 328 | −exit 0 | |
| 247 | +usr/gen_init_cpio $timestamp $cpio_list > $output | |
| @@ -16,87 +16,88 @@ override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include · 15 unmodified lines | ||
| 16 | 16 | # Please consider to fix the header first. |
| 17 | 17 | # |
| 18 | 18 | # Sorted alphabetically. |
| 19 | −header-test- += asm/shmbuf.h | |
| 20 | −header-test- += asm/signal.h | |
| 21 | −header-test- += asm/ucontext.h | |
| 22 | −header-test- += drm/vmwgfx_drm.h | |
| 23 | −header-test- += linux/am437x-vpfe.h | |
| 24 | −header-test- += linux/android/binder.h | |
| 25 | −header-test- += linux/android/binderfs.h | |
| 26 | −header-test- += linux/coda.h | |
| 27 | −header-test- += linux/elfcore.h | |
| 28 | −header-test- += linux/errqueue.h | |
| 29 | −header-test- += linux/fsmap.h | |
| 30 | −header-test- += linux/hdlc/ioctl.h | |
| 31 | −header-test- += linux/ivtv.h | |
| 32 | −header-test- += linux/kexec.h | |
| 33 | −header-test- += linux/matroxfb.h | |
| 34 | −header-test- += linux/nfc.h | |
| 35 | −header-test- += linux/omap3isp.h | |
| 36 | −header-test- += linux/omapfb.h | |
| 37 | −header-test- += linux/patchkey.h | |
| 38 | −header-test- += linux/phonet.h | |
| 39 | −header-test- += linux/reiserfs_xattr.h | |
| 40 | −header-test- += linux/sctp.h | |
| 41 | −header-test- += linux/signal.h | |
| 42 | −header-test- += linux/sysctl.h | |
| 43 | −header-test- += linux/usb/audio.h | |
| 44 | −header-test- += linux/v4l2-mediabus.h | |
| 45 | −header-test- += linux/v4l2-subdev.h | |
| 46 | −header-test- += linux/videodev2.h | |
| 47 | −header-test- += linux/vm_sockets.h | |
| 48 | −header-test- += sound/asequencer.h | |
| 49 | −header-test- += sound/asoc.h | |
| 50 | −header-test- += sound/asound.h | |
| 51 | −header-test- += sound/compress_offload.h | |
| 52 | −header-test- += sound/emu10k1.h | |
| 53 | −header-test- += sound/sfnt_info.h | |
| 54 | −header-test- += xen/evtchn.h | |
| 55 | −header-test- += xen/gntdev.h | |
| 56 | −header-test- += xen/privcmd.h | |
| 19 | +no-header-test += asm/shmbuf.h | |
| 20 | +no-header-test += asm/signal.h | |
| 21 | +no-header-test += asm/ucontext.h | |
| 22 | +no-header-test += drm/vmwgfx_drm.h | |
| 23 | +no-header-test += linux/am437x-vpfe.h | |
| 24 | +no-header-test += linux/android/binder.h | |
| 25 | +no-header-test += linux/android/binderfs.h | |
| 26 | +no-header-test += linux/coda.h | |
| 27 | +no-header-test += linux/elfcore.h | |
| 28 | +no-header-test += linux/errqueue.h | |
| 29 | +no-header-test += linux/fsmap.h | |
| 30 | +no-header-test += linux/hdlc/ioctl.h | |
| 31 | +no-header-test += linux/ivtv.h | |
| 32 | +no-header-test += linux/kexec.h | |
| 33 | +no-header-test += linux/matroxfb.h | |
| 34 | +no-header-test += linux/nfc.h | |
| 35 | +no-header-test += linux/omap3isp.h | |
| 36 | +no-header-test += linux/omapfb.h | |
| 37 | +no-header-test += linux/patchkey.h | |
| 38 | +no-header-test += linux/phonet.h | |
| 39 | +no-header-test += linux/reiserfs_xattr.h | |
| 40 | +no-header-test += linux/sctp.h | |
| 41 | +no-header-test += linux/signal.h | |
| 42 | +no-header-test += linux/sysctl.h | |
| 43 | +no-header-test += linux/usb/audio.h | |
| 44 | +no-header-test += linux/v4l2-mediabus.h | |
| 45 | +no-header-test += linux/v4l2-subdev.h | |
| 46 | +no-header-test += linux/videodev2.h | |
| 47 | +no-header-test += linux/vm_sockets.h | |
| 48 | +no-header-test += sound/asequencer.h | |
| 49 | +no-header-test += sound/asoc.h | |
| 50 | +no-header-test += sound/asound.h | |
| 51 | +no-header-test += sound/compress_offload.h | |
| 52 | +no-header-test += sound/emu10k1.h | |
| 53 | +no-header-test += sound/sfnt_info.h | |
| 54 | +no-header-test += xen/evtchn.h | |
| 55 | +no-header-test += xen/gntdev.h | |
| 56 | +no-header-test += xen/privcmd.h | |
| 57 | 57 | |
| 58 | 58 | # More headers are broken in some architectures |
| 59 | 59 | |
| 60 | 60 | ifeq ($(SRCARCH),arc) |
| 61 | −header-test- += linux/bpf_perf_event.h | |
| 61 | +no-header-test += linux/bpf_perf_event.h | |
| 62 | 62 | endif |
| 63 | 63 | |
| 64 | 64 | ifeq ($(SRCARCH),ia64) |
| 65 | −header-test- += asm/setup.h | |
| 66 | −header-test- += asm/sigcontext.h | |
| 67 | −header-test- += asm/perfmon.h | |
| 68 | −header-test- += asm/perfmon_default_smpl.h | |
| 69 | −header-test- += linux/if_bonding.h | |
| 65 | +no-header-test += asm/setup.h | |
| 66 | +no-header-test += asm/sigcontext.h | |
| 67 | +no-header-test += asm/perfmon.h | |
| 68 | +no-header-test += asm/perfmon_default_smpl.h | |
| 69 | +no-header-test += linux/if_bonding.h | |
| 70 | 70 | endif |
| 71 | 71 | |
| 72 | 72 | ifeq ($(SRCARCH),mips) |
| 73 | −header-test- += asm/stat.h | |
| 73 | +no-header-test += asm/stat.h | |
| 74 | 74 | endif |
| 75 | 75 | |
| 76 | 76 | ifeq ($(SRCARCH),powerpc) |
| 77 | −header-test- += asm/stat.h | |
| 78 | −header-test- += linux/bpf_perf_event.h | |
| 77 | +no-header-test += asm/stat.h | |
| 78 | +no-header-test += linux/bpf_perf_event.h | |
| 79 | 79 | endif |
| 80 | 80 | |
| 81 | 81 | ifeq ($(SRCARCH),riscv) |
| 82 | −header-test- += linux/bpf_perf_event.h | |
| 82 | +no-header-test += linux/bpf_perf_event.h | |
| 83 | 83 | endif |
| 84 | 84 | |
| 85 | 85 | ifeq ($(SRCARCH),sparc) |
| 86 | −header-test- += asm/stat.h | |
| 87 | −header-test- += asm/uctx.h | |
| 88 | −header-test- += asm/fbio.h | |
| 86 | +no-header-test += asm/stat.h | |
| 87 | +no-header-test += asm/uctx.h | |
| 88 | +no-header-test += asm/fbio.h | |
| 89 | 89 | endif |
| 90 | 90 | |
| 91 | 91 | # asm-generic/*.h is used by asm/*.h, and should not be included directly |
| 92 | −header-test- += asm-generic/% | |
| 92 | +no-header-test += asm-generic/% | |
| 93 | 93 | |
| 94 | 94 | extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) |
| 95 | 95 | |
| 96 | +# Include the header to detect missing include guard. | |
| 96 | 97 | quiet_cmd_hdrtest = HDRTEST $< |
| 97 | 98 | cmd_hdrtest = \ |
| 98 | 99 | $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \ |
| 99 | − $(if $(filter-out $(header-test-), $*.h), -include $<); \ | |
| 100 | + $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \ | |
| 100 | 101 | $(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \ |
| 101 | 102 | touch $@ |
| 102 | 103 | |
| @@ -22,12 +22,9 @@ · 21 unmodified lines | ||
| 22 | 22 | in the ELF header, as required by certain architectures. |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | −#include <linux/stringify.h> | |
| 26 | −#include <asm-generic/vmlinux.lds.h> | |
| 27 | − | |
| 28 | 25 | .section .init.ramfs,"a" |
| 29 | 26 | __irf_start: |
| 30 | −.incbin __stringify(INITRAMFS_IMAGE) | |
| 27 | +.incbin "usr/initramfs_inc_data" | |
| 31 | 28 | __irf_end: |
| 32 | 29 | .section .init.ramfs.info,"a" |
| 33 | 30 | .globl __initramfs_size |