History

Merge tag 'kbuild-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

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 ...

Linus Torvalds committed 6 years ago

Commit 368d0602 parents acd7750 451dff320 files · +281 −449Browse files

Unified · Split

20 files
  1. Documentation/kbuild/kconfig.rst +0 −5
  2. Makefile +6 −18
  3. include/linux/module.h +11 −1
  4. scripts/Kbuild.include +11 −14
  5. scripts/Kconfig.include +1 −1
  6. scripts/Makefile.build +2 −2
  7. scripts/Makefile.lib +14 −7
  8. scripts/Makefile.modbuiltin +0 −57
  9. scripts/Makefile.modpost +0 −1
  10. scripts/kconfig/confdata.c +2 −43
  11. scripts/link-vmlinux.sh +4 −0
  12. scripts/mod/modpost.c +1 −7
  13. scripts/package/builddeb +63 −43
  14. usr/.gitignore +1 −7
  15. usr/Kconfig +0 −26
  16. usr/Makefile +61 −36
  17. usr/default_cpio_list +6 −0
  18. usr/gen_initramfs.sh +43 −124
  19. usr/include/Makefile +54 −53
  20. usr/initramfs_data.S +1 −4
Documentation/kbuild/kconfig.rst+0−5
@@ -154,11 +154,6 @@ KCONFIG_AUTOCONFIG · 153 unmodified lines
154154 This environment variable can be set to specify the path & name of the
155155 "auto.conf" file. Its default value is "include/config/auto.conf".
156156
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−
162157 KCONFIG_AUTOHEADER
163158 ------------------
164159 This environment variable can be set to specify the path & name of the
Makefile+6−18
@@ -423,7 +423,6 @@ INSTALLKERNEL := installkernel · 422 unmodified lines
423423 DEPMOD = /sbin/depmod
424424 PERL = perl
425425 PYTHON = python
426−PYTHON2 = python2
427426 PYTHON3 = python3
428427 CHECK = sparse
429428 BASH = bash
@@ -474,7 +473,7 @@ CLANG_FLAGS := · 44 unmodified lines
474473
475474 export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
476475 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
478477 export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
479478
480479 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
@@ -674,7 +673,7 @@ $(KCONFIG_CONFIG): · 193 unmodified lines
674673 #
675674 # This exploits the 'multi-target pattern rule' trick.
676675 # 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)
678677 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
679678 else # !may-sync-config
680679 # External modules and some install targets need include/generated/autoconf.h
@@ -1278,24 +1277,13 @@ all: modules · 597 unmodified lines
12781277 # using awk while concatenating to the final file.
12791278
12801279 PHONY += modules
1281−modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin
1280+modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order
12821281 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
12831282 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
12841283
12851284 modules.order: descend
12861285 $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@
12871286
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−
12991287 # Target to prepare building external modules
13001288 PHONY += modules_prepare
13011289 modules_prepare: prepare
@@ -1315,7 +1303,7 @@ _modinst_: · 13 unmodified lines
13151303 ln -s $(CURDIR) $(MODLIB)/build ; \
13161304 fi
13171305 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
1318− @sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin
1306+ @cp -f modules.builtin $(MODLIB)/
13191307 @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
13201308 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
13211309
@@ -1357,7 +1345,7 @@ endif # CONFIG_MODULES · 35 unmodified lines
13571345
13581346 # Directories & files removed with 'make clean'
13591347 CLEAN_DIRS += include/ksym
1360−CLEAN_FILES += modules.builtin.modinfo modules.nsdeps
1348+CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps
13611349
13621350 # Directories & files removed with 'make mrproper'
13631351 MRPROPER_DIRS += include/config include/generated \
@@ -1712,7 +1700,7 @@ clean: $(clean-dirs) · 348 unmodified lines
17121700 -o -name '*.lex.c' -o -name '*.tab.[ch]' \
17131701 -o -name '*.asn1.[ch]' \
17141702 -o -name '*.symtypes' -o -name 'modules.order' \
1715− -o -name modules.builtin -o -name '.tmp_*.o.*' \
1703+ -o -name '.tmp_*.o.*' \
17161704 -o -name '*.c.[012]*.*' \
17171705 -o -name '*.ll' \
17181706 -o -name '*.gcno' \) -type f -print | xargs rm -f
include/linux/module.h+11−1
@@ -169,6 +169,16 @@ extern void cleanup_module(void); · 168 unmodified lines
169169 */
170170 #define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)
171171
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+
172182 /*
173183 * The following license idents are currently accepted as indicating free
174184 * software modules
@@ -213,7 +223,7 @@ extern void cleanup_module(void); · 38 unmodified lines
213223 * 2. So the community can ignore bug reports including proprietary modules
214224 * 3. So vendors can do likewise based on their own policies
215225 */
216−#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
226+#define MODULE_LICENSE(_license) MODULE_FILE MODULE_INFO(license, _license)
217227
218228 /*
219229 * Author(s), use "Name <email>" or just "Name", for multiple
scripts/Kbuild.include+11−14
@@ -32,6 +32,10 @@ real-prereqs = $(filter-out $(PHONY), $^) · 31 unmodified lines
3232 # Escape single quote for use in echo statements
3333 escsq = $(subst $(squote),'\$(squote)',$1)
3434
35+###
36+# Quote a string to pass it to C files. foo => '"foo"'
37+stringify = $(squote)$(quote)$1$(quote)$(squote)
38+
3539 ###
3640 # Easy method for doing a status message
3741 kecho := :
@@ -55,14 +59,13 @@ kecho := $($(quiet)kecho) · 17 unmodified lines
5559 # - stdin is piped in from the first prerequisite ($<) so one has
5660 # to specify a valid file as first prerequisite (often the kbuild file)
5761 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 $@; \
6669 fi
6770 endef
6871
@@ -159,12 +162,6 @@ ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4)) · 90 unmodified lines
159162 # $(Q)$(MAKE) $(build)=dir
160163 build := -f $(srctree)/scripts/Makefile.build obj
161164
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−
168165 ###
169166 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
170167 # Usage:
scripts/Kconfig.include+1−1
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y) · 24 unmodified lines
2525
2626 # $(cc-option,<flag>)
2727 # 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)
2929
3030 # $(ld-option,<flag>)
3131 # Return y if the linker supports <flag>, n otherwise
scripts/Makefile.build+2−2
@@ -66,7 +66,7 @@ lib-target := $(obj)/lib.a · 65 unmodified lines
6666 real-obj-y += $(obj)/lib-ksyms.o
6767 endif
6868
69−ifneq ($(strip $(real-obj-y) $(need-builtin)),)
69+ifdef need-builtin
7070 builtin-target := $(obj)/built-in.a
7171 endif
7272
@@ -372,7 +372,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler · 299 unmodified lines
372372 # ---------------------------------------------------------------------------
373373
374374 # 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)/% ;
376376
377377 #
378378 # Rule to compile a set of .o files into one .a file (without symbol table)
scripts/Makefile.lib+14−7
@@ -35,7 +35,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) · 34 unmodified lines
3535 subdir-y += $(__subdir-y)
3636 __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
3737 subdir-m += $(__subdir-m)
38+ifdef need-builtin
3839 obj-y := $(patsubst %/, %/built-in.a, $(obj-y))
40+else
41+obj-y := $(filter-out %/, $(obj-y))
42+endif
3943 obj-m := $(filter-out %/, $(obj-m))
4044
4145 # Subdirectories we need to descend into
@@ -80,12 +84,14 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) · 38 unmodified lines
8084 subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
8185
8286 # 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))
8792
88−modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
93+modname = $(subst $(space),:,$(__modname))
94+modfile = $(addprefix $(obj)/,$(__modname))
8995
9096 # target with $(obj)/ and its suffix stripped
9197 target-stem = $(basename $(patsubst $(obj)/%,%,$@))
@@ -93,9 +99,10 @@ target-stem = $(basename $(patsubst $(obj)/%,%,$@)) · 1 unmodified line
9399 # These flags are needed for modversions and compiling, so we define them here
94100 # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
95101 # 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)))
97103 basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
98104 modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname))
105+modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile))
99106
100107 orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
101108 $(ccflags-y) $(CFLAGS_$(target-stem).o)
@@ -154,7 +161,7 @@ quiet_modtag = $(if $(part-of-module),[M], ) · 52 unmodified lines
154161 modkern_cflags = \
155162 $(if $(part-of-module), \
156163 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
157− $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
164+ $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL) $(modfile_flags))
158165
159166 modkern_aflags = $(if $(part-of-module), \
160167 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \
scripts/Makefile.modbuiltin+0−57
@@ -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)
scripts/Makefile.modpost+0−1
@@ -90,7 +90,6 @@ quiet_cmd_modpost = MODPOST $(words $(modules)) modules · 89 unmodified lines
9090 cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST)
9191
9292 __modpost:
93− @$(kecho) ' Building modules, stage 2.'
9493 $(call cmd,modpost)
9594 ifneq ($(KBUILD_MODPOST_NOFINAL),1)
9695 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
scripts/kconfig/confdata.c+2−43
@@ -710,25 +710,6 @@ static struct conf_printer header_printer_cb = · 709 unmodified lines
710710 .print_comment = header_print_comment,
711711 };
712712
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−
732713 static void conf_write_symbol(FILE *fp, struct symbol *sym,
733714 struct conf_printer *printer, void *printer_arg)
734715 {
@@ -1062,7 +1043,7 @@ int conf_write_autoconf(int overwrite) · 327 unmodified lines
10621043 struct symbol *sym;
10631044 const char *name;
10641045 const char *autoconf_name = conf_get_autoconfig_name();
1065− FILE *out, *tristate, *out_h;
1046+ FILE *out, *out_h;
10661047 int i;
10671048
10681049 if (!overwrite && is_present(autoconf_name))
@@ -1077,23 +1058,13 @@ int conf_write_autoconf(int overwrite) · 8 unmodified lines
10771058 if (!out)
10781059 return 1;
10791060
1080− tristate = fopen(".tmpconfig_tristate", "w");
1081− if (!tristate) {
1082− fclose(out);
1083− return 1;
1084− }
1085−
10861061 out_h = fopen(".tmpconfig.h", "w");
10871062 if (!out_h) {
10881063 fclose(out);
1089− fclose(tristate);
10901064 return 1;
10911065 }
10921066
10931067 conf_write_heading(out, &kconfig_printer_cb, NULL);
1094−
1095− conf_write_heading(tristate, &tristate_printer_cb, NULL);
1096−
10971068 conf_write_heading(out_h, &header_printer_cb, NULL);
10981069
10991070 for_all_symbols(i, sym) {
@@ -1101,15 +1072,11 @@ int conf_write_autoconf(int overwrite) · 1 unmodified line
11011072 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
11021073 continue;
11031074
1104− /* write symbol to auto.conf, tristate and header files */
1075+ /* write symbols to auto.conf and autoconf.h */
11051076 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
1106−
1107− conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
1108−
11091077 conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
11101078 }
11111079 fclose(out);
1112− fclose(tristate);
11131080 fclose(out_h);
11141081
11151082 name = getenv("KCONFIG_AUTOHEADER");
@@ -1120,14 +1087,6 @@ int conf_write_autoconf(int overwrite) · 4 unmodified lines
11201087 if (rename(".tmpconfig.h", name))
11211088 return 1;
11221089
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−
11311090 if (make_parent_dir(autoconf_name))
11321091 return 1;
11331092 /*
scripts/link-vmlinux.sh+4−0
@@ -250,6 +250,10 @@ ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1 · 249 unmodified lines
250250
251251 info MODINFO modules.builtin.modinfo
252252 ${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
253257
254258 btf_vmlinux_bin_o=""
255259 if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
scripts/mod/modpost.c+1−7
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 */
1313
1414 #define _GNU_SOURCE
15+#include <elf.h>
1516 #include <stdio.h>
1617 #include <ctype.h>
1718 #include <string.h>
@@ -729,12 +730,6 @@ static void handle_symbol(struct module *mod, struct elf_info *info, · 711 unmodified lines
729730 break;
730731 if (ignore_undef_symbol(info, symname))
731732 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
738733 if (info->hdr->e_machine == EM_SPARC ||
739734 info->hdr->e_machine == EM_SPARCV9) {
740735 /* Ignore register directives. */
@@ -747,7 +742,6 @@ static void handle_symbol(struct module *mod, struct elf_info *info, · 6 unmodified lines
747742 symname = munged;
748743 }
749744 }
750−#endif
751745
752746 mod->unres = alloc_symbol(symname,
753747 ELF_ST_BIND(sym->st_info) == STB_WEAK,
scripts/package/builddeb+63−43
@@ -43,17 +43,66 @@ create_package() { · 42 unmodified lines
4343
4444 # Create the package
4545 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/
47100 }
48101
49102 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
54105 packagename=linux-image-$version
55−kernel_headers_packagename=linux-headers-$version
56−libc_headers_packagename=linux-libc-dev
57106 dbg_packagename=$packagename-dbg
58107
59108 if [ "$ARCH" = "um" ] ; then
@@ -77,15 +126,13 @@ esac · 17 unmodified lines
77126 BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
78127
79128 # 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
81130 mkdir -m 755 -p "$tmpdir/DEBIAN"
82131 mkdir -p "$tmpdir/lib" "$tmpdir/boot"
83−mkdir -p "$kernel_headers_dir/lib/modules/$version/"
84132
85−# Build and install the kernel
133+# Install the kernel
86134 if [ "$ARCH" = "um" ] ; then
87135 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
88− $MAKE linux
89136 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
90137 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
91138 gzip "$tmpdir/usr/share/doc/$packagename/config"
@@ -129,16 +176,6 @@ if is_enabled CONFIG_MODULES; then · 37 unmodified lines
129176 fi
130177 fi
131178
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−
142179 # Install the maintainer scripts
143180 # Note: hook scripts under /etc/kernel are also executed by official Debian
144181 # kernel packages, as well as kernel packages built using make-kpkg.
@@ -164,29 +201,12 @@ EOF · 19 unmodified lines
164201 chmod 755 "$tmpdir/DEBIAN/$script"
165202 done
166203
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−
187204 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
190210 fi
191211
192212 create_package "$packagename" "$tmpdir"
usr/.gitignore+1−7
@@ -1,9 +1,3 @@
1−#
2−# Generated files
3−#
41 gen_init_cpio
52 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
usr/Kconfig+0−26
@@ -54,7 +54,6 @@ config INITRAMFS_ROOT_GID · 53 unmodified lines
5454
5555 config RD_GZIP
5656 bool "Support initial ramdisk/ramfs compressed using gzip"
57− depends on BLK_DEV_INITRD
5857 default y
5958 select DECOMPRESS_GZIP
6059 help
@@ -64,7 +63,6 @@ config RD_GZIP · 3 unmodified lines
6463 config RD_BZIP2
6564 bool "Support initial ramdisk/ramfs compressed using bzip2"
6665 default y
67− depends on BLK_DEV_INITRD
6866 select DECOMPRESS_BZIP2
6967 help
7068 Support loading of a bzip2 encoded initial ramdisk or cpio buffer
@@ -73,7 +71,6 @@ config RD_BZIP2 · 2 unmodified lines
7371 config RD_LZMA
7472 bool "Support initial ramdisk/ramfs compressed using LZMA"
7573 default y
76− depends on BLK_DEV_INITRD
7774 select DECOMPRESS_LZMA
7875 help
7976 Support loading of a LZMA encoded initial ramdisk or cpio buffer
@@ -81,7 +78,6 @@ config RD_LZMA · 1 unmodified line
8178
8279 config RD_XZ
8380 bool "Support initial ramdisk/ramfs compressed using XZ"
84− depends on BLK_DEV_INITRD
8581 default y
8682 select DECOMPRESS_XZ
8783 help
@@ -91,7 +87,6 @@ config RD_XZ · 3 unmodified lines
9187 config RD_LZO
9288 bool "Support initial ramdisk/ramfs compressed using LZO"
9389 default y
94− depends on BLK_DEV_INITRD
9590 select DECOMPRESS_LZO
9691 help
9792 Support loading of a LZO encoded initial ramdisk or cpio buffer
@@ -100,7 +95,6 @@ config RD_LZO · 2 unmodified lines
10095 config RD_LZ4
10196 bool "Support initial ramdisk/ramfs compressed using LZ4"
10297 default y
103− depends on BLK_DEV_INITRD
10498 select DECOMPRESS_LZ4
10599 help
106100 Support loading of a LZ4 encoded initial ramdisk or cpio buffer
@@ -108,8 +102,6 @@ config RD_LZ4 · 1 unmodified line
108102
109103 choice
110104 prompt "Built-in initramfs compression mode"
111− depends on INITRAMFS_SOURCE!=""
112− optional
113105 help
114106 This option allows you to decide by which algorithm the builtin
115107 initramfs will be compressed. Several compression algorithms are
@@ -215,21 +207,3 @@ config INITRAMFS_COMPRESSION_LZ4 · 99 unmodified lines
215207 by default which could cause a build failure.
216208
217209 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 ""
usr/Makefile+61−36
@@ -3,61 +3,86 @@ · 2 unmodified lines
33 # kbuild file for usr/ - including initramfs image
44 #
55
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 := :
810
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
1318
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
1919 obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
2020
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),)
2552
26−#####
27−# Generate the initramfs cpio archive
53+cpio-data := $(obj)/initramfs_data.cpio
2854
2955 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
3858 # in initramfs and to detect if any files are added/removed.
3959 # Removed files are identified by directory timestamp being updated
4060 # 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
4962
5063 # do not try to update files included in initramfs
5164 $(deps_initramfs): ;
5265
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+
5473 # We rebuild initramfs_data.cpio if:
5574 # 1) Any included file is newer than initramfs_data.cpio
5675 # 2) There are changes in which files are included (added or deleted)
5776 # 3) If gen_init_cpio are newer than initramfs_data.cpio
5877 # 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
6179 $(call if_changed,initfs)
6280
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+
6388 subdir-$(CONFIG_UAPI_HEADER_TEST) += include
usr/default_cpio_list+6−0
@@ -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
usr/gen_initramfs.shrenamed from usr/gen_initramfs_list.sh+43−124
@@ -5,8 +5,7 @@ · 4 unmodified lines
55 # Released under the terms of the GNU GPL
66 #
77 # 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.
109 # This script assumes that gen_init_cpio is located in usr/ directory
1110
1211 # error out on errors
@@ -15,9 +14,9 @@ set -e · 2 unmodified lines
1514 usage() {
1615 cat << EOF
1716 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>
2120 -u <uid> User ID to map to user ID 0 (root).
2221 <uid> is only meaningful if <cpio_source> is a
2322 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
2726 <cpio_source> File list or directory for cpio archive.
2827 If <cpio_source> is a .cpio file it will be used
2928 as direct input to initramfs.
30− -d Output the default cpio list.
3129
3230 All options except -o and -l may be repeated and are interpreted
3331 sequentially and immediately. -u and -g states are preserved across
@@ -42,23 +40,6 @@ field() { · 8 unmodified lines
4240 shift $1 ; echo $1
4341 }
4442
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−
6243 filetype() {
6344 local argv1="$1"
6445
@@ -81,10 +62,6 @@ filetype() { · 16 unmodified lines
8162 return 0
8263 }
8364
84−list_print_mtime() {
85− :
86−}
87−
8865 print_mtime() {
8966 local my_mtime="0"
9067
@@ -92,15 +69,15 @@ print_mtime() { · 1 unmodified line
9269 my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1)
9370 fi
9471
95− echo "# Last modified: ${my_mtime}" >> ${output}
96− echo "" >> ${output}
72+ echo "# Last modified: ${my_mtime}" >> $cpio_list
73+ echo "" >> $cpio_list
9774 }
9875
9976 list_parse() {
100− if [ -L "$1" ]; then
77+ if [ -z "$dep_list" -o -L "$1" ]; then
10178 return
10279 fi
103− echo "$1" | sed 's/:/\\:/g; s/$/ \\/'
80+ echo "$1" | sed 's/:/\\:/g; s/$/ \\/' >> $dep_list
10481 }
10582
10683 # for each file print a line in following format
@@ -146,7 +123,7 @@ parse() { · 39 unmodified lines
146123 ;;
147124 esac
148125
149− echo "${str}" >> ${output}
126+ echo "${str}" >> $cpio_list
150127
151128 return 0
152129 }
@@ -161,58 +138,47 @@ unknown_option() { · 8 unmodified lines
161138 exit 1
162139 }
163140
164−list_header() {
165− :
166−}
167−
168141 header() {
169− printf "\n#####################\n# $1\n" >> ${output}
142+ printf "\n#####################\n# $1\n" >> $cpio_list
170143 }
171144
172145 # process one directory (incl sub-directories)
173146 dir_filelist() {
174− ${dep_list}header "$1"
147+ header "$1"
175148
176149 srcdir=$(echo "$1" | sed -e 's://*:/:g')
177150 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)
178151
179152 # If $dirlist is only one line, then the directory is empty
180153 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
181− ${dep_list}print_mtime "$1"
154+ print_mtime "$1"
182155
183156 echo "${dirlist}" | \
184157 while read x; do
185− ${dep_list}parse ${x}
158+ list_parse $x
159+ parse $x
186160 done
187161 fi
188162 }
189163
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
193164 input_file() {
194165 source="$1"
195166 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
209174 cat "$1" | while read type dir file perm ; do
210175 if [ "$type" = "file" ]; then
211− echo "$file \\";
176+ echo "$file \\" >> $dep_list
212177 fi
213178 done
214179 fi
215180 elif [ -d "$1" ]; then
181+ # If a directory is specified then add all files in it to fs
216182 dir_filelist "$1"
217183 else
218184 echo " ${prog}: Cannot open '$1'" >&2
@@ -224,51 +190,24 @@ prog=$0 · 5 unmodified lines
224190 root_uid=0
225191 root_gid=0
226192 dep_list=
227−cpio_file=
228−cpio_list=
193+cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)
229194 output="/dev/stdout"
230−output_file=""
231−is_cpio_compressed=
232−compr="gzip -n -9 -f"
233195
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+
268198 while [ $# -gt 0 ]; do
269199 arg="$1"
270200 shift
271201 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+ ;;
272211 "-u") # map $1 to uid=0 (root)
273212 root_uid="$1"
274213 [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
@@ -279,10 +218,6 @@ while [ $# -gt 0 ]; do · 4 unmodified lines
279218 [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
280219 shift
281220 ;;
282− "-d") # display default initramfs list
283− default_list="$arg"
284− ${dep_list}default_initramfs
285− ;;
286221 "-h")
287222 usage
288223 exit 0
@@ -293,36 +228,20 @@ while [ $# -gt 0 ]; do · 4 unmodified lines
293228 unknown_option
294229 ;;
295230 *) # input file/dir - process it
296− input_file "$arg" "$#"
231+ input_file "$arg"
297232 ;;
298233 esac
299234 ;;
300235 esac
301236 done
302237
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
304239 # 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"
325245 fi
326− [ -z ${cpio_file} ] && rm ${cpio_tfile}
327246 fi
328−exit 0
247+usr/gen_init_cpio $timestamp $cpio_list > $output
usr/include/Makefile+54−53
@@ -16,87 +16,88 @@ override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include · 15 unmodified lines
1616 # Please consider to fix the header first.
1717 #
1818 # 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
5757
5858 # More headers are broken in some architectures
5959
6060 ifeq ($(SRCARCH),arc)
61−header-test- += linux/bpf_perf_event.h
61+no-header-test += linux/bpf_perf_event.h
6262 endif
6363
6464 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
7070 endif
7171
7272 ifeq ($(SRCARCH),mips)
73−header-test- += asm/stat.h
73+no-header-test += asm/stat.h
7474 endif
7575
7676 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
7979 endif
8080
8181 ifeq ($(SRCARCH),riscv)
82−header-test- += linux/bpf_perf_event.h
82+no-header-test += linux/bpf_perf_event.h
8383 endif
8484
8585 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
8989 endif
9090
9191 # 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/%
9393
9494 extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null))
9595
96+# Include the header to detect missing include guard.
9697 quiet_cmd_hdrtest = HDRTEST $<
9798 cmd_hdrtest = \
9899 $(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 $<); \
100101 $(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \
101102 touch $@
102103
usr/initramfs_data.S+1−4
@@ -22,12 +22,9 @@ · 21 unmodified lines
2222 in the ELF header, as required by certain architectures.
2323 */
2424
25−#include <linux/stringify.h>
26−#include <asm-generic/vmlinux.lds.h>
27−
2825 .section .init.ramfs,"a"
2926 __irf_start:
30−.incbin __stringify(INITRAMFS_IMAGE)
27+.incbin "usr/initramfs_inc_data"
3128 __irf_end:
3229 .section .init.ramfs.info,"a"
3330 .globl __initramfs_size

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t