From patchwork Thu Mar 11 12:06:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1451100 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 4Dx73B44Kgz9srY; Thu, 11 Mar 2021 23:06:46 +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 1lKK5T-0007OI-31; Thu, 11 Mar 2021 12:06:43 +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 1lKK5Q-0007MK-31 for kernel-team@lists.ubuntu.com; Thu, 11 Mar 2021 12:06:40 +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 1lKK5P-0004dP-PO for kernel-team@lists.ubuntu.com; Thu, 11 Mar 2021 12:06:39 +0000 Received: by mail-ed1-f69.google.com with SMTP id n20so9838712edr.8 for ; Thu, 11 Mar 2021 04:06:39 -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=XYghSMtSf4IYtoO/LhgL3n13oiWSMD+WWM9uF1jaDkY=; b=uODwB9a7sRLSXzYrzXv5esz85cpe84y/j63ORevaN9YL4yx8pcmZmprNAVGNqcztrc K8a3XLXkqbYl4343zI8zjkM/B6nh9W1mY/gm6s4Z1KrRViMkTKxf4SSiA2RKsdkzDGyF 7IqXBz4JsUwRHakhqXqWzpaNPcZ+6foPI9mBBcmP3fIzGbXJdAY96/rrenprp778Kk40 O6jwOrjd7EkqgZOb7h48vVOYAJbdbPeCrrn41PVjFVC5o3lOIUj8XHYaQjaRC00f6Wup 57yXc4ATkDkSOlRGh/Cw5rPU2e9i113iPqgT3IeYKWz9n8iVYl+4qKe0jrnFlOPQsaKo /dkg== X-Gm-Message-State: AOAM532LVNHfFzLAsVMBUd3kzB9LRkJlxq4ARCPw0NqN/mjLj/WwQBb2 a/xPZVmpG0BL/z+FWxlNSy31feJIpYkDXuDBPlmf46a7SoTETDuXUWz1YXrqnKuy4u2v8PBa/yP yQ6DEPgHL/RAJWhmmOSrawSy9z7auL+DDltUNhDaFdQ== X-Received: by 2002:a05:6402:12cf:: with SMTP id k15mr7914599edx.192.1615464399100; Thu, 11 Mar 2021 04:06:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwp5VDmQrYwwvVGGnp/NddTjpoE/ogMfrKehZtLwF5Q/tCoUTpM73Fhl1abPHbwquDMs0krfw== X-Received: by 2002:a05:6402:12cf:: with SMTP id k15mr7914563edx.192.1615464398802; Thu, 11 Mar 2021 04:06:38 -0800 (PST) Received: from localhost ([2001:470:6973:2:6fa5:6802:f869:4973]) by smtp.gmail.com with ESMTPSA id o1sm1192315eds.26.2021.03.11.04.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 04:06:38 -0800 (PST) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [focal/linux-oem-5.6 1/1] UBUNTU: [Packaging] sync dkms-build et al from LRMv4 Date: Thu, 11 Mar 2021 12:06:30 +0000 Message-Id: <20210311120632.2456390-5-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 | 2 +- debian/scripts/dkms-build--nvidia-N | 62 +++++++++++++++-------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build index 638b3122a05d..c1751ffaa016 100755 --- a/debian/scripts/dkms-build +++ b/debian/scripts/dkms-build @@ -234,7 +234,7 @@ done # as squirreled away, and the log in case it is useful. Finally pass a formed # signing command line in case we need to do that. dkms_build_specific="$srcdir/$0--$package" -dkms_build_generic=$(echo "$dkms_build_specific" | sed -n -e 's/-[0-9][0-9]*$/-N/p') +dkms_build_generic=$(echo "$dkms_build_specific" | sed -n -e 's/-[0-9][0-9]*[a-z]*$/-N/p') for dkms_build in "$dkms_build_specific" "$dkms_build_generic" do if [ -z "$dkms_build" -o ! -e "$dkms_build" ]; then 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.