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

Showing the changes to scripts (10 of 20 files). Show all

Unified · Split

10 files
  1. scripts/Kbuild.include +11 −14
  2. scripts/Kconfig.include +1 −1
  3. scripts/Makefile.build +2 −2
  4. scripts/Makefile.lib +14 −7
  5. scripts/Makefile.modbuiltin +0 −57
  6. scripts/Makefile.modpost +0 −1
  7. scripts/kconfig/confdata.c +2 −43
  8. scripts/link-vmlinux.sh +4 −0
  9. scripts/mod/modpost.c +1 −7
  10. scripts/package/builddeb +63 −43
scripts/Kbuild.include+11−14
@@ -32,6 +32,10 @@ real-prereqs = $(filter-out $(PHONY), $^) · 31 unmodified lines
32# Escape single quote for use in echo statements32# Escape single quote for use in echo statements
33escsq = $(subst $(squote),'\$(squote)',$1)33escsq = $(subst $(squote),'\$(squote)',$1)
34 34
35###
36# Quote a string to pass it to C files. foo => '"foo"'
37stringify = $(squote)$(quote)$1$(quote)$(squote)
38
35###39###
36# Easy method for doing a status message40# Easy method for doing a status message
37 kecho := :41 kecho := :
@@ -55,14 +59,13 @@ kecho := $($(quiet)kecho) · 17 unmodified lines
55# - stdin is piped in from the first prerequisite ($<) so one has59# - stdin is piped in from the first prerequisite ($<) so one has
56# to specify a valid file as first prerequisite (often the kbuild file)60# to specify a valid file as first prerequisite (often the kbuild file)
57define filechk61define filechk
58 $(Q)set -e; \62 $(Q)set -e; \
59 mkdir -p $(dir $@); \63 mkdir -p $(dir $@); \
60 { $(filechk_$(1)); } > $@.tmp; \64 trap "rm -f $(dot-target).tmp" EXIT; \
61 if [ -r $@ ] && cmp -s $@ $@.tmp; then \65 { $(filechk_$(1)); } > $(dot-target).tmp; \
62 rm -f $@.tmp; \66 if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \
63 else \67 $(kecho) ' UPD $@'; \
64 $(kecho) ' UPD $@'; \68 mv -f $(dot-target).tmp $@; \
65 mv -f $@.tmp $@; \
66 fi69 fi
67endef70endef
68 71
@@ -159,12 +162,6 @@ ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4)) · 90 unmodified lines
159# $(Q)$(MAKE) $(build)=dir162# $(Q)$(MAKE) $(build)=dir
160build := -f $(srctree)/scripts/Makefile.build obj163build := -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
166modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj
167
168###165###
169# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=166# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
170# Usage:167# Usage:
scripts/Kconfig.include+1−1
@@ -25,7 +25,7 @@ failure = $(if-success,$(1),n,y) · 24 unmodified lines
25 25
26# $(cc-option,<flag>)26# $(cc-option,<flag>)
27# Return y if the compiler supports <flag>, n otherwise27# Return y if the compiler supports <flag>, n otherwise
28cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null)28cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)
29 29
30# $(ld-option,<flag>)30# $(ld-option,<flag>)
31# Return y if the linker supports <flag>, n otherwise31# 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
66real-obj-y += $(obj)/lib-ksyms.o66real-obj-y += $(obj)/lib-ksyms.o
67endif67endif
68 68
69ifneq ($(strip $(real-obj-y) $(need-builtin)),)69ifdef need-builtin
70builtin-target := $(obj)/built-in.a70builtin-target := $(obj)/built-in.a
71endif71endif
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# To build objects in subdirs, we need to descend into the directories374# 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# Rule to compile a set of .o files into one .a file (without symbol table)378# 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
35subdir-y += $(__subdir-y)35subdir-y += $(__subdir-y)
36__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))36__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
37subdir-m += $(__subdir-m)37subdir-m += $(__subdir-m)
38ifdef need-builtin
38obj-y := $(patsubst %/, %/built-in.a, $(obj-y))39obj-y := $(patsubst %/, %/built-in.a, $(obj-y))
40else
41obj-y := $(filter-out %/, $(obj-y))
42endif
39obj-m := $(filter-out %/, $(obj-m))43obj-m := $(filter-out %/, $(obj-m))
40 44
41# Subdirectories we need to descend into45# Subdirectories we need to descend into
@@ -80,12 +84,14 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) · 38 unmodified lines
80subdir-ym := $(addprefix $(obj)/,$(subdir-ym))84subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
81 85
82# Finds the multi-part object the current object will be linked into.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 are87# If the object belongs to two or more multi-part objects, list them all.
84# concatenated with a colon separator.88modname-multi = $(sort $(foreach m,$(multi-used),\
85modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\89 $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))
86 $(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
88modname = $(if $(modname-multi),$(modname-multi),$(basetarget))93modname = $(subst $(space),:,$(__modname))
94modfile = $(addprefix $(obj)/,$(__modname))
89 95
90# target with $(obj)/ and its suffix stripped96# target with $(obj)/ and its suffix stripped
91target-stem = $(basename $(patsubst $(obj)/%,%,$@))97target-stem = $(basename $(patsubst $(obj)/%,%,$@))
@@ -93,9 +99,10 @@ target-stem = $(basename $(patsubst $(obj)/%,%,$@)) · 1 unmodified line
93# These flags are needed for modversions and compiling, so we define them here99# These flags are needed for modversions and compiling, so we define them here
94# $(modname_flags) defines KBUILD_MODNAME as the name of the module it will100# $(modname_flags) defines KBUILD_MODNAME as the name of the module it will
95# end up in (or would, if it gets compiled in)101# end up in (or would, if it gets compiled in)
96name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)102name-fix = $(call stringify,$(subst $(comma),_,$(subst -,_,$1)))
97basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))103basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
98modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname))104modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname))
105modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile))
99 106
100orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \107orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
101 $(ccflags-y) $(CFLAGS_$(target-stem).o)108 $(ccflags-y) $(CFLAGS_$(target-stem).o)
@@ -154,7 +161,7 @@ quiet_modtag = $(if $(part-of-module),[M], ) · 52 unmodified lines
154modkern_cflags = \161modkern_cflags = \
155 $(if $(part-of-module), \162 $(if $(part-of-module), \
156 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \163 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
157 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))164 $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL) $(modfile_flags))
158 165
159modkern_aflags = $(if $(part-of-module), \166modkern_aflags = $(if $(part-of-module), \
160 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \167 $(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
6src := $(obj)
7
8PHONY := __modbuiltin
9__modbuiltin:
10
11include 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
14include include/config/tristate.conf
15
16include scripts/Kbuild.include
17
18ifdef building_out_of_srctree
19# Create output directory if not already present
20_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
21endif
22
23# The filename Kbuild has precedence over Makefile
24kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
25kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
26include $(kbuild-file)
27
28include scripts/Makefile.lib
29__subdir-Y := $(patsubst %/,%,$(filter %/, $(obj-Y)))
30subdir-Y += $(__subdir-Y)
31subdir-ym := $(sort $(subdir-y) $(subdir-Y) $(subdir-m))
32subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
33obj-Y := $(addprefix $(obj)/,$(obj-Y))
34
35modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym))
36modbuiltin-mods := $(filter %.ko, $(obj-Y:.o=.ko))
37modbuiltin-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
46PHONY += FORCE
47
48FORCE:
49
50# Descending
51# ---------------------------------------------------------------------------
52
53PHONY += $(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
90 cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST)90 cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST)
91 91
92__modpost:92__modpost:
93 @$(kecho) ' Building modules, stage 2.'
94 $(call cmd,modpost)93 $(call cmd,modpost)
95ifneq ($(KBUILD_MODPOST_NOFINAL),1)94ifneq ($(KBUILD_MODPOST_NOFINAL),1)
96 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal95 $(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
710 .print_comment = header_print_comment,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 */
718static void
719tristate_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
726static struct conf_printer tristate_printer_cb =
727{
728 .print_symbol = tristate_print_symbol,
729 .print_comment = kconfig_print_comment,
730};
731
732static void conf_write_symbol(FILE *fp, struct symbol *sym,713static void conf_write_symbol(FILE *fp, struct symbol *sym,
733 struct conf_printer *printer, void *printer_arg)714 struct conf_printer *printer, void *printer_arg)
734{715{
@@ -1062,7 +1043,7 @@ int conf_write_autoconf(int overwrite) · 327 unmodified lines
1062 struct symbol *sym;1043 struct symbol *sym;
1063 const char *name;1044 const char *name;
1064 const char *autoconf_name = conf_get_autoconfig_name();1045 const char *autoconf_name = conf_get_autoconfig_name();
1065 FILE *out, *tristate, *out_h;1046 FILE *out, *out_h;
1066 int i;1047 int i;
1067 1048
1068 if (!overwrite && is_present(autoconf_name))1049 if (!overwrite && is_present(autoconf_name))
@@ -1077,23 +1058,13 @@ int conf_write_autoconf(int overwrite) · 8 unmodified lines
1077 if (!out)1058 if (!out)
1078 return 1;1059 return 1;
1079 1060
1080 tristate = fopen(".tmpconfig_tristate", "w");
1081 if (!tristate) {
1082 fclose(out);
1083 return 1;
1084 }
1085
1086 out_h = fopen(".tmpconfig.h", "w");1061 out_h = fopen(".tmpconfig.h", "w");
1087 if (!out_h) {1062 if (!out_h) {
1088 fclose(out);1063 fclose(out);
1089 fclose(tristate);
1090 return 1;1064 return 1;
1091 }1065 }
1092 1066
1093 conf_write_heading(out, &kconfig_printer_cb, NULL);1067 conf_write_heading(out, &kconfig_printer_cb, NULL);
1094
1095 conf_write_heading(tristate, &tristate_printer_cb, NULL);
1096
1097 conf_write_heading(out_h, &header_printer_cb, NULL);1068 conf_write_heading(out_h, &header_printer_cb, NULL);
1098 1069
1099 for_all_symbols(i, sym) {1070 for_all_symbols(i, sym) {
@@ -1101,15 +1072,11 @@ int conf_write_autoconf(int overwrite) · 1 unmodified line
1101 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)1072 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
1102 continue;1073 continue;
1103 1074
1104 /* write symbol to auto.conf, tristate and header files */1075 /* write symbols to auto.conf and autoconf.h */
1105 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);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 conf_write_symbol(out_h, sym, &header_printer_cb, NULL);1077 conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
1110 }1078 }
1111 fclose(out);1079 fclose(out);
1112 fclose(tristate);
1113 fclose(out_h);1080 fclose(out_h);
1114 1081
1115 name = getenv("KCONFIG_AUTOHEADER");1082 name = getenv("KCONFIG_AUTOHEADER");
@@ -1120,14 +1087,6 @@ int conf_write_autoconf(int overwrite) · 4 unmodified lines
1120 if (rename(".tmpconfig.h", name))1087 if (rename(".tmpconfig.h", name))
1121 return 1;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 if (make_parent_dir(autoconf_name))1090 if (make_parent_dir(autoconf_name))
1132 return 1;1091 return 1;
1133 /*1092 /*
scripts/link-vmlinux.sh+4−0
@@ -250,6 +250,10 @@ ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1 · 249 unmodified lines
250 250
251info MODINFO modules.builtin.modinfo251info MODINFO modules.builtin.modinfo
252${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo252${OBJCOPY} -j .modinfo -O binary vmlinux.o modules.builtin.modinfo
253info GEN modules.builtin
254# The second line aids cases where multiple modules share the same object.
255tr '\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
254btf_vmlinux_bin_o=""258btf_vmlinux_bin_o=""
255if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then259if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
scripts/mod/modpost.c+1−7
@@ -12,6 +12,7 @@ · 11 unmodified lines
12 */12 */
13 13
14#define _GNU_SOURCE14#define _GNU_SOURCE
15#include <elf.h>
15#include <stdio.h>16#include <stdio.h>
16#include <ctype.h>17#include <ctype.h>
17#include <string.h>18#include <string.h>
@@ -729,12 +730,6 @@ static void handle_symbol(struct module *mod, struct elf_info *info, · 711 unmodified lines
729 break;730 break;
730 if (ignore_undef_symbol(info, symname))731 if (ignore_undef_symbol(info, symname))
731 break;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 if (info->hdr->e_machine == EM_SPARC ||733 if (info->hdr->e_machine == EM_SPARC ||
739 info->hdr->e_machine == EM_SPARCV9) {734 info->hdr->e_machine == EM_SPARCV9) {
740 /* Ignore register directives. */735 /* Ignore register directives. */
@@ -747,7 +742,6 @@ static void handle_symbol(struct module *mod, struct elf_info *info, · 6 unmodified lines
747 symname = munged;742 symname = munged;
748 }743 }
749 }744 }
750#endif
751 745
752 mod->unres = alloc_symbol(symname,746 mod->unres = alloc_symbol(symname,
753 ELF_ST_BIND(sym->st_info) == STB_WEAK,747 ELF_ST_BIND(sym->st_info) == STB_WEAK,
scripts/package/builddeb+63−43
@@ -43,17 +43,66 @@ create_package() { · 42 unmodified lines
43 43
44 # Create the package44 # Create the package
45 dpkg-gencontrol -p$pname -P"$pdir"45 dpkg-gencontrol -p$pname -P"$pdir"
46 dpkg --build "$pdir" ..46 dpkg-deb ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
47}
48
49deploy_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
87deploy_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
49version=$KERNELRELEASE102version=$KERNELRELEASE
50tmpdir="$objtree/debian/tmp"103tmpdir=debian/linux-image
51kernel_headers_dir="$objtree/debian/hdrtmp"104dbg_dir=debian/linux-image-dbg
52libc_headers_dir="$objtree/debian/headertmp"
53dbg_dir="$objtree/debian/dbgtmp"
54packagename=linux-image-$version105packagename=linux-image-$version
55kernel_headers_packagename=linux-headers-$version
56libc_headers_packagename=linux-libc-dev
57dbg_packagename=$packagename-dbg106dbg_packagename=$packagename-dbg
58 107
59if [ "$ARCH" = "um" ] ; then108if [ "$ARCH" = "um" ] ; then
@@ -77,15 +126,13 @@ esac · 17 unmodified lines
77BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)126BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
78 127
79# Setup the directory structure128# Setup the directory structure
80rm -rf "$tmpdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files129rm -rf "$tmpdir" "$dbg_dir" debian/files
81mkdir -m 755 -p "$tmpdir/DEBIAN"130mkdir -m 755 -p "$tmpdir/DEBIAN"
82mkdir -p "$tmpdir/lib" "$tmpdir/boot"131mkdir -p "$tmpdir/lib" "$tmpdir/boot"
83mkdir -p "$kernel_headers_dir/lib/modules/$version/"
84 132
85# Build and install the kernel133# Install the kernel
86if [ "$ARCH" = "um" ] ; then134if [ "$ARCH" = "um" ] ; then
87 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"135 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
88 $MAKE linux
89 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"136 cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
90 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"137 cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
91 gzip "$tmpdir/usr/share/doc/$packagename/config"138 gzip "$tmpdir/usr/share/doc/$packagename/config"
@@ -129,16 +176,6 @@ if is_enabled CONFIG_MODULES; then · 37 unmodified lines
129 fi176 fi
130fi177fi
131 178
132if [ "$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/
140fi
141
142# Install the maintainer scripts179# Install the maintainer scripts
143# Note: hook scripts under /etc/kernel are also executed by official Debian180# Note: hook scripts under /etc/kernel are also executed by official Debian
144# kernel packages, as well as kernel packages built using make-kpkg.181# kernel packages, as well as kernel packages built using make-kpkg.
@@ -164,29 +201,12 @@ EOF · 19 unmodified lines
164 chmod 755 "$tmpdir/DEBIAN/$script"201 chmod 755 "$tmpdir/DEBIAN/$script"
165done202done
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"
172if is_enabled CONFIG_STACK_VALIDATION; then
173 (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles"
174fi
175(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles"
176if is_enabled CONFIG_GCC_PLUGINS; then
177 (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles"
178fi
179destdir=$kernel_headers_dir/usr/src/linux-headers-$version
180mkdir -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
184ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
185rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
186
187if [ "$ARCH" != "um" ]; then204if [ "$ARCH" != "um" ]; then
188 create_package "$kernel_headers_packagename" "$kernel_headers_dir"205 deploy_kernel_headers debian/linux-headers
189 create_package "$libc_headers_packagename" "$libc_headers_dir"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
190fi210fi
191 211
192create_package "$packagename" "$tmpdir"212create_package "$packagename" "$tmpdir"

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