ACK/Cmnt: [PATCH][linux-restricted-modules-$clouds][Jammy] UBUNTU: [Packaging] LRMv6: add multi-architecture support
Tim Gardner
tim.gardner at canonical.com
Fri Jun 17 15:22:44 UTC 2022
On 6/17/22 06:46, Dimitri John Ledkov wrote:
> BugLink: https://bugs.launchpad.net/bugs/1968774
>
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
> ---
>
> Upgrade from ~LRMv5 to LRMv6 in Jammy for:
>
> - linux-restricted-modules-aws
> - linux-restricted-modules-azure
> - linux-restricted-modules-gcp
> - linux-restricted-modules-oracle
>
> This patch applies to all of the above repositories unmodified.
>
> Test build performed with aws flavour, in a private PPA for
> lrm/lrg/lrs, builds correctly.
>
> This brings these LRMs to feature parity with generic LRM.
>
> debian/lrm-version | 1 +
> debian/scripts/gen-rules | 1 +
> debian/scripts/gen-rules.lrg | 43 ++++++++++++++++++++++++++---
> debian/scripts/gen-rules.lrm | 53 ++++++++++++++++++++++++++++++------
> debian/scripts/gen-rules.lrs | 12 ++++++++
> update-version | 2 +-
> 6 files changed, 98 insertions(+), 14 deletions(-)
> create mode 100644 debian/lrm-version
>
> diff --git a/debian/lrm-version b/debian/lrm-version
> new file mode 100644
> index 0000000000..e0ea36feef
> --- /dev/null
> +++ b/debian/lrm-version
> @@ -0,0 +1 @@
> +6.0
> diff --git a/debian/scripts/gen-rules b/debian/scripts/gen-rules
> index 48944818a8..c5c36a60e8 100755
> --- a/debian/scripts/gen-rules
> +++ b/debian/scripts/gen-rules
> @@ -1,4 +1,5 @@
> #!/bin/bash
> +set -e
>
> src_package=$(LC_ALL=C dpkg-parsechangelog -SSource)
> case "$src_package" in
> diff --git a/debian/scripts/gen-rules.lrg b/debian/scripts/gen-rules.lrg
> index 61ad057804..db613272ae 100755
> --- a/debian/scripts/gen-rules.lrg
> +++ b/debian/scripts/gen-rules.lrg
> @@ -1,4 +1,15 @@
> #!/bin/bash
> +set -e
> +
> +validate_unique()
> +{
> + [ "$#" = "2" ]
> + local duplicates=$(echo $2 | tr " " "\n" | sort | uniq -d)
> + if [ "$duplicates" ]; then
> + echo "EE: duplicate values in $1" 1>&2
> + exit 1
> + fi
> +}
>
> # Pick out relevant version and package information including our predecessor
> # packages: linux -> linux-restricted-modules-signatures -> linux-restricted-modules
> @@ -58,6 +69,7 @@ do
> *) continue ;;
> esac
>
> + validate_unique "archs" "$archs"
> for arch in $archs
> do
> case " $build_archs " in
> @@ -66,8 +78,6 @@ do
> esac
> done
>
> - targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
> -
> while read package version extra
> do
> case "$package" in
> @@ -87,14 +97,39 @@ do
> *\ signonly\ *) continue ;;
> esac
>
> + # If package specifies arch= keys, only build it on
> + # the intersection of kernel flavour arches & the
> + # package arches, otherwise build for all kernel
> + # flavour arches.
> + pkg_archs=
> + for cmd in $extra
> + do
> + case "$cmd" in
> + arch=*) pkg_archs="$pkg_archs ${cmd#arch=}" ;;
> + esac
> + done
> + # No package arches set, build for everything
> + if [ -z "$pkg_archs" ]; then
> + pkg_archs=$archs
> + else
> + # Package arches set, build for intersection
> + validate_unique "pkg_archs" "$pkg_archs"
> + pkg_archs=$(sort <(echo $archs | tr " " "\n") <(echo $pkg_archs | tr " " "\n") | uniq -d | tr "\n" " ")
> + # No intersection, skip
> + if [ -z "$pkg_archs" ]; then
> + continue
> + fi
> + fi
> +
> + targets=$(echo "$pkg_archs" | sed -e 's/\</nvidia-/g')
> suffix_minus=$(echo "$package" | sed -e 's/nvidia-graphics-drivers-//')
> suffix_under=$(echo "$suffix_minus" | sed -e 's/-/_/g')
> suffix_short=$(echo "$suffix_minus" | sed -e 's/-server/srv/g')
>
> - echo "II: build $package for $flavour $archs"
> + echo "II: build $package for $flavour $pkg_archs"
>
> cat - >>"debian/control.interlock-up" <<EOL
> - linux-objects-nvidia-${suffix_minus}-${src_abi}-${flavour} (>= ${src_lrm_version}) [${archs}],
> + linux-objects-nvidia-${suffix_minus}-${src_abi}-${flavour} (>= ${src_lrm_version}) [${pkg_archs}],
> EOL
>
> # debian/rules.gen
> diff --git a/debian/scripts/gen-rules.lrm b/debian/scripts/gen-rules.lrm
> index 574a00ec3a..223918f50a 100755
> --- a/debian/scripts/gen-rules.lrm
> +++ b/debian/scripts/gen-rules.lrm
> @@ -1,4 +1,15 @@
> #!/bin/bash
> +set -e
> +
> +validate_unique()
> +{
> + [ "$#" = "2" ]
> + local duplicates=$(echo $2 | tr " " "\n" | sort | uniq -d)
> + if [ "$duplicates" ]; then
> + echo "EE: duplicate values in $1" 1>&2
> + exit 1
> + fi
> +}
>
> # Pick out relevant version and package information including our predecessor
> # packages: linux -> linux-restricted-modules-signatures -> linux-restricted-modules
> @@ -70,8 +81,7 @@ do
> *) continue ;;
> esac
>
> - targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
> -
> + validate_unique "archs" "$archs"
> cat - >>"debian/control.interlock-up" <<EOL
> linux-headers-${src_abi}-${flavour} (>= @VERSION@) [${archs}],
> EOL
> @@ -95,11 +105,36 @@ EOL
> *\ signonly\ *) continue ;;
> esac
>
> + # If package specifies arch= keys, only build it on
> + # the intersection of kernel flavour arches & the
> + # package arches, otherwise build for all kernel
> + # flavour arches.
> + pkg_archs=
> + for cmd in $extra
> + do
> + case "$cmd" in
> + arch=*) pkg_archs="$pkg_archs ${cmd#arch=}" ;;
> + esac
> + done
> + # No package arches set, build for everything
> + if [ -z "$pkg_archs" ]; then
> + pkg_archs=$archs
> + else
> + # Package arches set, build for intersection
> + validate_unique "pkg_archs" "$pkg_archs"
> + pkg_archs=$(sort <(echo $archs | tr " " "\n") <(echo $pkg_archs | tr " " "\n") | uniq -d | tr "\n" " ")
> + # No intersection, skip
> + if [ -z "$pkg_archs" ]; then
> + continue
> + fi
> + fi
> +
> + targets=$(echo "$pkg_archs" | sed -e 's/\</nvidia-/g')
> suffix_minus=$(echo "$package" | sed -e 's/nvidia-graphics-drivers-//')
> suffix_under=$(echo "$suffix_minus" | sed -e 's/-/_/g')
> suffix_short=$(echo "$suffix_minus" | sed -e 's/-server/srv/g')
>
> - echo "II: build $package for $flavour $archs"
> + echo "II: build $package for $flavour $pkg_archs"
>
> # debian/rules.gen
> cat - >>"debian/rules.gen" <<EOL
> @@ -126,7 +161,7 @@ EOL
>
> Package: linux-modules-nvidia-${suffix_minus}-${flavour}\${variant:suffix}
> Build-Profiles: <!stage1>
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
> Section: kernel
> Provides: \${dkms:nvidia-${suffix_minus}-modules}, nvidia-prebuilt-kernel
> Depends:
> @@ -142,7 +177,7 @@ EOL
>
> Package: linux-objects-nvidia-${suffix_minus}-${src_abi}-${flavour}
> Build-Profiles: <!stage1>
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
> Section: kernel
> Priority: optional
> Built-Using: \${linux:BuiltUsing}
> @@ -160,7 +195,7 @@ Description: Linux kernel nvidia modules for version ${src_abi} (objects)
>
> Package: linux-modules-nvidia-${suffix_minus}-${src_abi}-${flavour}
> Build-Profiles: <!stage1>
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
> Section: kernel
> Priority: optional
> Built-Using: \${linux:BuiltUsing}
> @@ -187,11 +222,11 @@ EOL
> transition=*)
> from="${cmd#transition=}"
> from_minus=$(echo "$from" | sed -e 's/nvidia-graphics-drivers-//')
> - echo "II: general transition $from -> $package ($from_minus -> $suffix_minus)"
> + echo "II: general transition $from -> $package ($from_minus -> $suffix_minus) $pkg_archs"
> cat - >>"debian/control.d/migrate-nvidia" <<EOL
>
> Package: linux-modules-nvidia-${from_minus}-${flavour}\${variant:suffix}
> -Architecture: ${archs}
> +Architecture: ${pkg_archs}
> Section: oldlibs
> Depends: linux-modules-nvidia-${suffix_minus}-${flavour}\${variant:suffix}
> Description: Extra drivers for nvidia-${from_minus} for the ${flavour} flavour (dummy transitional package)
> @@ -214,7 +249,7 @@ do
> esac
>
> # debian/control.d/transitionals-local
> - echo "II: manual transition linux-modules-nvidia-$from -> linux-modules-nvidia-$to"
> + echo "II: manual transition linux-modules-nvidia-$from -> linux-modules-nvidia-$to $archs"
> cat - >>"debian/control.d/transitionals-local" <<EOL
>
> Package: linux-modules-nvidia-${from}
> diff --git a/debian/scripts/gen-rules.lrs b/debian/scripts/gen-rules.lrs
> index c28fc2f66b..e2ab3a1493 100755
> --- a/debian/scripts/gen-rules.lrs
> +++ b/debian/scripts/gen-rules.lrs
> @@ -1,4 +1,15 @@
> #!/bin/bash
> +set -e
> +
> +validate_unique()
> +{
> + [ "$#" = "2" ]
> + local duplicates=$(echo $2 | tr " " "\n" | sort | uniq -d)
> + if [ "$duplicates" ]; then
> + echo "EE: duplicate values in $1" 1>&2
> + exit 1
> + fi
> +}
>
> # Pick out relevant version and package information including our predecessor
> # packages: linux-restricted-generate -> linux-restricted-signatures -> linux-restricted-modules
> @@ -57,6 +68,7 @@ do
> *) continue ;;
> esac
>
> + validate_unique "archs" "$archs"
> targets=$(echo "$archs" | sed -e 's/\</nvidia-/g')
>
> echo "II: build linux-signatures-nvidia-${src_abi}-${flavour} for ${archs}"
> diff --git a/update-version b/update-version
> index fd7a29aeaa..d945eb348d 100755
> --- a/update-version
> +++ b/update-version
> @@ -78,7 +78,7 @@ update_file()
> # Update things from the primary package.
> if [ "$no_update" = 'false' ]; then
> update_file "$master_dir/$branch/tracking-bug" "debian/tracking-bug"
> - "$here/update-dkms-versions"
> + "$here/update-dkms-versions" || exit 1
> for master_file in \
> debian/scripts/misc/git-ubuntu-log \
> debian/scripts/dkms-build \
Acked-by: Tim Gardner <tim.gardner at canonical.com>
Does this mean I should also enable arm64 for aws/azure linux-lrm packages ?
rtg
--
-----------
Tim Gardner
Canonical, Inc
More information about the kernel-team
mailing list