APPLIED (hirsute/5.11): [hirsute/linux 1/1] UBUNTU: [Packaging] sync dkms-build et al from LRMv4
Andrea Righi
andrea.righi at canonical.com
Mon Mar 15 15:45:57 UTC 2021
Applied to hirsute/5.11.
Thanks,
-Andrea
On Thu, Mar 11, 2021 at 12:06:32PM +0000, Andy Whitcroft wrote:
> 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 <apw at canonical.com>
> ---
> 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.
> --
> 2.29.2
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
More information about the kernel-team
mailing list