From patchwork Thu Mar 11 12:06:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1451104 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 4Dx73G1GJtz9svs; Thu, 11 Mar 2021 23:06:49 +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 1lKK5V-0007Qc-Ml; Thu, 11 Mar 2021 12:06:45 +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 1lKK5T-0007O6-1J for kernel-team@lists.ubuntu.com; Thu, 11 Mar 2021 12:06:43 +0000 Received: from mail-ed1-f70.google.com ([209.85.208.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lKK5S-0004dv-Fy for kernel-team@lists.ubuntu.com; Thu, 11 Mar 2021 12:06:42 +0000 Received: by mail-ed1-f70.google.com with SMTP id h5so9797902edf.17 for ; Thu, 11 Mar 2021 04:06:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4mjpyXmuJ+plDWWuYQWYf8wdIqpF1YgrrvvF3JPvV/8=; b=qbhDnbCVq0Fm8yVt8GJx04Drv7Fb3NPLPzFCDb5NxgWl9LoX+m+G/bdUmgtUgADfgR sZWLiCdgGen2CXDsHiefqIORaN0nQlyfx+EihsfNd72cLsAUnYc0LaTKXI6/HNPIav8d neKRMNrsd6KMDU5rykAUYRkmQoro42V9VF4tTZP2sSIQKkxkzsMDhVL8G6aupLlw/R6r CRp6gfkgmUFAWboWaZgLvZ2yvswzKYV2VpVPDxRye4vdjfJPefrbupjswyz4+IopJGYR fh1Jxo4gpA1PqnT59K9mQ0fOdSdm2LS2S/KfozohiFBp2MOWpLgnjCkZvNKxjRCO/p5/ 8Yeg== X-Gm-Message-State: AOAM532NL9Le8oK2eosh/VfEb0K14L1wd3Obpnq0eF/M1kkWKoz2ceM6 6TCgdQkhrfTUNOgAcHwQn52joqYUTCggtnbzD/2HsfVk5Gywngi25BI7xNTWBE0RiUBOX7p5k+D In6YEC8XeWg+HEO0X9k6+Nm99rzTP5rSnyLLXWBcOYQ== X-Received: by 2002:a05:6402:17e9:: with SMTP id t9mr8171725edy.211.1615464401873; Thu, 11 Mar 2021 04:06:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVArGJuBnCAsoXWiY9L0L3OkUvc3kZdfmDOe8bREj5D+6/O2FNmQWYLOEZZKKr9E5tUYxM9Q== X-Received: by 2002:a05:6402:17e9:: with SMTP id t9mr8171693edy.211.1615464401576; Thu, 11 Mar 2021 04:06:41 -0800 (PST) Received: from localhost ([2001:470:6973:2:6fa5:6802:f869:4973]) by smtp.gmail.com with ESMTPSA id l61sm1237484edl.37.2021.03.11.04.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 04:06:41 -0800 (PST) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [hirsute/linux 1/1] UBUNTU: [Packaging] sync dkms-build et al from LRMv4 Date: Thu, 11 Mar 2021 12:06:32 +0000 Message-Id: <20210311120632.2456390-7-apw@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311120632.2456390-1-apw@canonical.com> References: <20210311120632.2456390-1-apw@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: , Cc: Andy Whitcroft Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" dkms-build and particularly dkms-build--nvidia-N are consumed in all derivative linux-restricted-modules packages. Each gets its local independant copy from its main kernel package, and that is common to all kernels based on a particular top-level kernel. Sync the latest updated versions of these back into the kernel. BugLink: https://bugs.launchpad.net/bugs/1918134 Signed-off-by: Andy Whitcroft --- debian/scripts/dkms-build | 10 +---- debian/scripts/dkms-build--nvidia-N | 66 ++++++++++++++--------------- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build index 3aabf94be492..c1751ffaa016 100755 --- a/debian/scripts/dkms-build +++ b/debian/scripts/dkms-build @@ -61,15 +61,7 @@ do fi # Download from the available pools. - for pool in $( apt-cache policy | grep '^ [^ ]' | sort -r -n -k 1,1 -s | \ - awk ' - ($2 ~ /^http/) { - if (!($2 in E)) { - E[$2]=1; - print $2; - } - } - ') + for pool in $( grep -h '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | awk '{print $2}' | sort -u ) do if package_present "$lpackage"; then break diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N index 84bc57931120..310d63b5edda 100755 --- a/debian/scripts/dkms-build--nvidia-N +++ b/debian/scripts/dkms-build--nvidia-N @@ -35,55 +35,53 @@ mkdir -p "$pkgdir/bits/scripts" ) # Install the support files we need. -lds_src="$dkms_dir/headers/linux-headers-$abi_flavour" -if [ "$sign" = "--lrm" ]; then - lds_src="/usr/src/linux-headers-$abi_flavour" -fi -cp "$lds_src/scripts/module.lds" "$pkgdir/bits/scripts" -grep /usr/bin/ld.bfd "$log" | sed -e "s@$build/@@g" >"$pkgdir/bits/BUILD" -grep /usr/bin/ld.bfd "$log" | sed -e "s@$build/@@g" \ - -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' >"$pkgdir/bits/CLEAN" +echo "II: copying support files ..." +for lds_src in \ + "$dkms_dir/headers/linux-headers-$abi_flavour/scripts/module.lds" \ + "/usr/src/linux-headers-$abi_flavour/scripts/module.lds" \ + "$dkms_dir/headers/linux-headers-$abi_flavour/scripts/module-common.lds" \ + "/usr/src/linux-headers-$abi_flavour/scripts/module-common.lds" +do + [ ! -f "$lds_src" ] && continue + echo "II: copying support files ... found $lds_src" + cp "$lds_src" "$pkgdir/bits/scripts" + break +done + +# Build helper scripts. +cat - <<'EOL' >"$pkgdir/bits/BUILD" +[ "$1" = "unsigned" ] && signed_only=: +EOL +grep /usr/bin/ld.bfd "$log" | grep -v scripts/genksyms/genksyms | sed -e "s@$build/@@g" >>"$pkgdir/bits/BUILD" +sed -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/CLEAN" # As the builds contain the absolute filenames as used. Use RECONSTRUCT to # rebuild the .ko's, sign them, pull off the signatures and then finally clean # up again. ( cd "$pkgdir/bits" || exit 1 - sh ./CLEAN - sh ./BUILD - for ko in *.ko + + # Add .ko handling to the CLEAN/BUILD dance. + for ko in "$pkgdir"/*.ko do - echo "cat '$ko' '$ko.sig' >'../$ko'" >>"$pkgdir/bits/BUILD" - echo "rm -f '$ko'" >>"$pkgdir/bits/BUILD" + ko=$(basename "$ko") + echo "\$signed_only cat '$ko' '$ko.sig' >'../$ko'" >>"$pkgdir/bits/BUILD" + echo "\$signed_only rm -f '$ko'" >>"$pkgdir/bits/BUILD" echo "rm -f '../$ko'" >>"$pkgdir/bits/CLEAN" done + # Clear out anything we are not going to distribute and build unsigned .kos. + sh ./CLEAN + sh ./BUILD unsigned + if [ "$sign" = "--custom" ]; then # We are building for and archive custom signing upload. Keep everything. : elif [ "$sign" = "--lrm" ]; then - # We are in LRM build the package a copy in any signatures we can - # find for them. These will be added after linking. - base="/usr/lib/linux/$abi_flavour" - - # Check the GCC version we are using against that used in the kernel - # NOTE: that we treat this as only a warning, as if the binaries did come - # out differently then we will actually - echo "II: checking gcc version ..." - cat "$base/compiler" - gcc --version - gcc_was=$(cat "$base/compiler" | sed -e 's/^GCC:/gcc/') - gcc_is=$(gcc --version | head -1) - if [ "$gcc_was" != "$gcc_is" ]; then - echo "WW: gcc version missmatch between linux and linux-restricted-modules" - echo "WW: was: $gcc_was is: $gcc_is" - fi - - # Apply any local signatures. - echo "II: adding signatures from $base ..." - cp "$base/signatures/$package/"*".ko.sig" "$pkgdir/bits" - sha256sum -c "$base/signatures/$package/SHA256SUMS" || exit 1 + # We are in the LRM build; grab sha256 checksums and clean up. + sha256sum -b *.ko >"SHA256SUMS" sh ./CLEAN + else # We are in the main kernel, put the .kos together as we will # on the users machine, sign them, and keep just the signature.