From a14e37b110093d27a777312c5f0bd068cb454578 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 3 Jul 2018 02:57:30 +0100 Subject: [PATCH] Move config files from linux-source to an arch-dependent linux-config package In Linux 4.18, various compiler version and feature tests are invoked via kconfig rather than via kbuild. This means that we generally cannot generate kconfig files for foreign architectures. Move the config files to a new linux-config- package which is arch-dependent (and also M-A: same). Make linux-config- and linux-source- recommend each other. --- debian/bin/gencontrol.py | 26 ++++++++++++-------------- debian/changelog | 2 ++ debian/rules.real | 22 ++++++++++++++++------ debian/templates/control.config.in | 11 +++++++++++ debian/templates/control.main.in | 2 +- 5 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 debian/templates/control.config.in diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 24354cbf8..53e0508fb 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -81,6 +81,7 @@ class Gencontrol(Base): makeflags['DO_TOOLS_UNVERSIONED'] = False if not self.config.merge('packages').get('tools-versioned', True): makeflags['DO_TOOLS_VERSIONED'] = False + makeflags['SOURCE_BASENAME'] = self.vars['source_basename'] # Prepare to generate debian/tests/control self.tests_control = None @@ -99,27 +100,14 @@ class Gencontrol(Base): ['source_%s_real' % featureset]) makefile.add('source', ['source_%s' % featureset]) - triplet_enabled = [] - for arch in iter(self.config['base', ]['arches']): - for featureset in self.config['base', arch].get('featuresets', ()): - if self.config.merge('base', None, featureset).get('enabled', True): - for flavour in self.config['base', arch, featureset]['flavours']: - triplet_enabled.append('%s_%s_%s' % - (arch, featureset, flavour)) - makeflags = makeflags.copy() makeflags['ALL_FEATURESETS'] = ' '.join(fs_enabled) - makeflags['ALL_TRIPLETS'] = ' '.join(triplet_enabled) - makeflags['SOURCE_BASENAME'] = self.vars['source_basename'] if not self.config.merge('packages').get('docs', True): makeflags['DO_DOCS'] = False if not self.config.merge('packages').get('source', True): makeflags['DO_SOURCE'] = False super(Gencontrol, self).do_main_makefile(makefile, makeflags, extra) - # linux-source-$UPSTREAMVERSION will contain all kconfig files - makefile.add('binary-indep', deps=['setup']) - def do_main_packages(self, packages, vars, makeflags, extra): packages.extend(self.process_packages(self.templates["control.main"], self.vars)) if self.config.merge('packages').get('docs', True): @@ -210,11 +198,21 @@ class Gencontrol(Base): merge_packages(packages, packages_headers_arch, arch) + if (self.config['base', arch].get('featuresets') and + self.config.merge('packages').get('source', True)): + merge_packages(packages, + self.process_packages( + self.templates["control.config"], vars), + arch) + else: + makeflags['DO_CONFIG'] = False + cmds_build_arch = ["$(MAKE) -f debian/rules.real build-arch-arch %s" % makeflags] makefile.add('build-arch_%s_real' % arch, cmds=cmds_build_arch) cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-arch %s" % makeflags] - makefile.add('binary-arch_%s_real' % arch, cmds=cmds_binary_arch) + makefile.add('binary-arch_%s_real' % arch, cmds=cmds_binary_arch, + deps=['setup_%s' % arch]) # For stage1 build profile makefile.add('binary-libc-dev_%s' % arch, diff --git a/debian/changelog b/debian/changelog index 9c0441164..c83b66103 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ linux (4.18~rc3-1~exp1) UNRELEASED; urgency=medium * netfilter: ipvs: Fix invalid bytes in IP_VS_MH_TAB_INDEX help text * Update config for 4.18 using kconfigeditor2 - [x86,arm64] PCI: HOTPLUG_PCI_SHPC is now built-in + * Move config files from linux-source- to an arch-dependent + linux-config- package [ YunQiang Su ] * [mips*r6*] Enable dtb building for boston. diff --git a/debian/rules.real b/debian/rules.real index d3e47b7a6..82ecf081a 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -52,6 +52,9 @@ build-indep: binary-arch-arch: binary-indep: +ifneq ($(DO_CONFIG),False) + binary-arch-arch: install-config_$(ARCH) +endif ifneq ($(DO_HEADERS_ALL),False) binary-arch-arch: install-headers_$(ARCH) endif @@ -554,19 +557,26 @@ install-source: DH_OPTIONS = -p$(PACKAGE_NAME) install-source: $(BUILD_DIR)/$(SOURCE_BASENAME)-source-$(UPSTREAMVERSION).tar.xz $(foreach FEATURESET,$(filter-out none,$(ALL_FEATURESETS)),$(BUILD_DIR)/linux-patch-$(UPSTREAMVERSION)-$(FEATURESET).patch.xz) dh_testdir dh_testroot - dh_installdirs /usr/src/linux-config-$(UPSTREAMVERSION) dh_install $^ /usr/src -# Include our kernel config files, but with the module signing -# configuration fixed to work for custom kernels. - for triplet in $(ALL_TRIPLETS); do \ - sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\)[ =]/d' $(BUILD_DIR)/build_$$triplet/.config | xz -c >debian/$(PACKAGE_NAME)/usr/src/linux-config-$(UPSTREAMVERSION)/config.$$triplet.xz; \ - done # We don't want to recompress, but -Znone is not compatible with older # tools and is currently rejected by dak. -Zgzip -z0 (uncompressed # data.tar.gz!) makes dpkg and dak happy, but is incomaptible with # other things (#725492). So use the fastest real gzip mode. +$(MAKE_SELF) install-base BUILDDEB_ARGS='-Zgzip -z1' +install-config_$(ARCH): PACKAGE_NAME = $(SOURCE_BASENAME)-config-$(VERSION) +install-config_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME) +install-config_$(ARCH): TRIPLETS = $(subst $(BUILD_DIR)/build_,,$(wildcard $(BUILD_DIR)/build_$(ARCH)_*_*)) +install-config_$(ARCH): + dh_testdir + dh_testroot + dh_installdirs /usr/src/linux-config-$(UPSTREAMVERSION) +# Fix the module signing configuration to work for custom kernels + for triplet in $(TRIPLETS); do \ + sed '/CONFIG_\(MODULE_SIG_\(ALL\|KEY\)\|SYSTEM_TRUSTED_KEYS\)[ =]/d' $(BUILD_DIR)/build_$$triplet/.config | xz -c >debian/$(PACKAGE_NAME)/usr/src/linux-config-$(UPSTREAMVERSION)/config.$$triplet.xz; \ + done + +$(MAKE_SELF) install-base + define make-tools +mkdir -p $(BUILD_DIR)/build-tools/$(1) && $(MAKE_CLEAN) -C $(BUILD_DIR)/build-tools/$(1) -f $(CURDIR)/debian/rules.d/$(1)/Makefile top_srcdir=$(CURDIR) top_rulesdir=$(CURDIR)/debian/rules.d OUTDIR=$(1) VERSION=$(VERSION) endef diff --git a/debian/templates/control.config.in b/debian/templates/control.config.in new file mode 100644 index 000000000..5b3822776 --- /dev/null +++ b/debian/templates/control.config.in @@ -0,0 +1,11 @@ +Package: @source_basename@-config-@version@ +Build-Profiles: +Multi-Arch: same +Depends: ${misc:Depends} +Recommends: @source_basename@-source-@version@ +Description: Debian kernel configurations for Linux @version@ + This package contains the configuration files used to build the + official Debian kernel files, but without references to Debian's + signing certificates. + . + These can be used as a basis for configuring custom kernels. diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index aebe8e4f9..b775da2de 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -3,7 +3,7 @@ Build-Profiles: Architecture: all Section: kernel Depends: binutils, xz-utils, ${misc:Depends} -Recommends: libc6-dev | libc-dev, gcc, make, bc +Recommends: libc6-dev | libc-dev, gcc, make, bc, @source_basename@-config-@version@ Suggests: libncurses-dev | ncurses-dev, libqt4-dev, pkg-config Multi-Arch: foreign Description: Linux kernel source for version @version@ with Debian patches