From patchwork Thu Mar 11 12:06:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1451101 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 4Dx7381PTVz9sjD; Thu, 11 Mar 2021 23:06:44 +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 1lKK5Q-0007MX-Eu; Thu, 11 Mar 2021 12:06:40 +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 1lKK5N-0007LV-Iz for kernel-team@lists.ubuntu.com; Thu, 11 Mar 2021 12:06:37 +0000 Received: from mail-ed1-f69.google.com ([209.85.208.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lKK5N-0004dB-Bu for kernel-team@lists.ubuntu.com; Thu, 11 Mar 2021 12:06:37 +0000 Received: by mail-ed1-f69.google.com with SMTP id a2so9773915edx.0 for ; Thu, 11 Mar 2021 04:06:37 -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=abNfUI0tAZgbAezpyzmDgghqCuq0I6dOk1b2jaKjIK0=; b=d57gNYkqm2P+tYtIpJFcD29KnJ/BjGfrWq0FyDfN84tHf+6FXyJRCC7QFiPAvTB6HG nVYNqwzMO+got5rTk9INPK9bYwHmiB/JDDiK5KBFNAVPN/U8vj1/SdSkiaOiIzw1I/VU bap2zA6bhARDv2yQRxSVEMtWe9yq4Y/emhFyJg5aM23T3iKH05tEY7DkvSF4yUEi+pyP 3dLi7y+MR1DBaKkEUuLyuQpMPcXy+FTBSBCOEScXiLklqYkVSy/Kbm8iHIUDn55Jp/7I e2PJN/IHrM2OGAI0PaLjruZJozA8d77SUb1quP1BpONuowEn+0lSeqkHb/BFzGMJs+vj XofQ== X-Gm-Message-State: AOAM5320JLHnAR3QAyde1HqNLv6QNSW+yJ0nlsoFdzw8C8YNsWlwTnrC rarlw/dXAMyQSfPpf56GJLUS4zoMW/jHMDyp4MCHbwGA8e5rFfVkQY9nX0d5uoZlGrZD3Be3rvW +YVvqAUrz1+HkuIgdv0Hd1To2dS0jvCTy0TeeSHCHdQ== X-Received: by 2002:a17:906:af6f:: with SMTP id os15mr2784903ejb.279.1615464396529; Thu, 11 Mar 2021 04:06:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJy44Y98l3ukSDup7/MfHxlgGCjsQpBq+jYu+JPy8B20GJ840haFXczkdzJaLfLFBFqhAlEtkw== X-Received: by 2002:a17:906:af6f:: with SMTP id os15mr2784880ejb.279.1615464396287; Thu, 11 Mar 2021 04:06:36 -0800 (PST) Received: from localhost ([2001:470:6973:2:6fa5:6802:f869:4973]) by smtp.gmail.com with ESMTPSA id d3sm1168614edp.43.2021.03.11.04.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 04:06:35 -0800 (PST) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [focal/master-next 1/1] UBUNTU: [Packaging] sync dkms-build et al from LRMv4 Date: Thu, 11 Mar 2021 12:06:28 +0000 Message-Id: <20210311120632.2456390-3-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--nvidia-N | 62 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N index bdec78233b43..310d63b5edda 100755 --- a/debian/scripts/dkms-build--nvidia-N +++ b/debian/scripts/dkms-build--nvidia-N @@ -35,51 +35,53 @@ mkdir -p "$pkgdir/bits/scripts" ) # Install the support files we need. -cp "$srcdir/scripts/module-common.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.