From patchwork Mon Jan 25 13:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 1431228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DPWJ12HKjz9sRR; Tue, 26 Jan 2021 00:42:07 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1l4282-0003Ar-Vl; Mon, 25 Jan 2021 13:42:02 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l4281-00039q-4m for kernel-team@lists.ubuntu.com; Mon, 25 Jan 2021 13:42:01 +0000 Received: from 1.general.smb.uk.vpn ([10.172.193.28] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l4280-0006Oc-P0 for kernel-team@lists.ubuntu.com; Mon, 25 Jan 2021 13:42:00 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [SRU F][PATCH 1/2] UBUNTU: [Packaging] Add support for ODM drivers Date: Mon, 25 Jan 2021 14:41:58 +0100 Message-Id: <20210125134159.142286-2-stefan.bader@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210125134159.142286-1-stefan.bader@canonical.com> References: <20210125134159.142286-1-stefan.bader@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1912789 We want to be able to selectively turn on ODM driver support for those kernels/arches we have to but otherwise not inherit this to other derivatives. This is done by a new config option which we will have to depend on in the new drivers config options. Support is toggled by changing a makefile rule variable. The new config option will be hidden as long as not at least one of the arches supported turns on the rule variable. Signed-off-by: Stefan Bader --- debian/rules.d/0-common-vars.mk | 4 ++++ debian/rules.d/1-maintainer.mk | 1 + debian/rules.d/2-binary-arch.mk | 3 +++ debian/scripts/misc/arch-has-odm-enabled.sh | 21 +++++++++++++++++++++ debian/scripts/misc/kernelconfig | 2 +- ubuntu/Kconfig | 6 ++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 debian/scripts/misc/arch-has-odm-enabled.sh diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk index 5394b7c96f82..b71546ab03a0 100644 --- a/debian/rules.d/0-common-vars.mk +++ b/debian/rules.d/0-common-vars.mk @@ -187,6 +187,10 @@ do_common_headers_indep=true # add a 'full source' mode do_full_source=false +# Add an option to enable special drivers which should only be build when +# explicitly enabled. +do_odm_drivers=false + # build tools ifneq ($(wildcard $(CURDIR)/tools),) ifeq ($(do_tools),) diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk index 956829027e0f..fabdf0888fce 100644 --- a/debian/rules.d/1-maintainer.mk +++ b/debian/rules.d/1-maintainer.mk @@ -86,6 +86,7 @@ printenv: @echo "do_flavour_header_package = $(do_flavour_header_package)" @echo "do_common_headers_indep = $(do_common_headers_indep)" @echo "do_full_source = $(do_full_source)" + @echo "do_odm_drivers = $(do_odm_drivers)" @echo "do_tools = $(do_tools)" @echo "do_any_tools = $(do_any_tools)" @echo "do_linux_tools = $(do_linux_tools)" diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index 703fd2ade338..6311c9a74e05 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -31,6 +31,9 @@ $(stampdir)/stamp-prepare-tree-%: $(commonconfdir)/config.common.$(family) $(arc [ "$(do_full_source)" != 'true' ] && true || \ rsync -a --exclude debian --exclude debian.master --exclude $(DEBIAN) * $(builddir)/build-$* cat $(wordlist 1,3,$^) | sed -e 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(raw_kernelversion)"/' > $(builddir)/build-$*/.config + [ "$(do_odm_drivers)" = 'true' ] && true || \ + sed -ie 's/.*CONFIG_UBUNTU_ODM_DRIVERS.*/# CONFIG_UBUNTU_ODM_DRIVERS is not set/' \ + $(builddir)/build-$*/.config find $(builddir)/build-$* -name "*.ko" | xargs rm -f $(build_cd) $(kmake) $(build_O) -j1 syncconfig prepare scripts touch $@ diff --git a/debian/scripts/misc/arch-has-odm-enabled.sh b/debian/scripts/misc/arch-has-odm-enabled.sh new file mode 100755 index 000000000000..7bc8a5db0db0 --- /dev/null +++ b/debian/scripts/misc/arch-has-odm-enabled.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Evaluate whether arch ($1) will be built with do_odm_drivers set to true. +set -e + +if [ "$1" = "" ]; then + return 1 +fi + +TOPDIR=$(dirname $0)/../../.. +. $TOPDIR/debian/debian.env +RULESDIR=$TOPDIR/$DEBIAN/rules.d + +do_odm_drivers=false +for f in $1.mk hooks.mk; do + eval $(cat $RULESDIR/$f | sed -n -e '/do_odm_drivers/s/ \+//gp') +done +if [ "$do_odm_drivers" != "true" ]; then + return 1 +fi + +return 0 diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig index dd45d2f2b085..dfb24e5be7c2 100755 --- a/debian/scripts/misc/kernelconfig +++ b/debian/scripts/misc/kernelconfig @@ -67,7 +67,7 @@ for arch in $archs; do # for i386 since it is no longer supported after 19.04, however # we maintain the configs for hwe. modify_config=true - env="ARCH=$kernarch" + env="ARCH=$kernarch DEB_ARCH=$arch" compiler_path=$(which "${cross_compile}gcc" || true) if [ "$compiler_path" != '' ]; then env="$env CROSS_COMPILE=$cross_compile" diff --git a/ubuntu/Kconfig b/ubuntu/Kconfig index 8cea998f29a3..94c9b357d566 100644 --- a/ubuntu/Kconfig +++ b/ubuntu/Kconfig @@ -1,5 +1,11 @@ menu "Ubuntu Supplied Third-Party Device Drivers" + +config UBUNTU_ODM_DRIVERS + def_bool $(success,$(srctree)/debian/scripts/misc/arch-has-odm-enabled.sh $(DEB_ARCH)) + ---help--- + Turn on support for Ubuntu ODM supplied drivers + # # NOTE: to allow drivers to be added and removed without causing merge # collisions you should add new entries in the middle of the six lines