lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63c53ab962254e49d0eb3a67a067b48023d679b0.camel@archlinux.org>
Date: Thu, 04 Jul 2024 21:02:50 +0200
From: "Jan Alexander Steffens (heftig)" <heftig@...hlinux.org>
To: Thomas Weißschuh <linux@...ssschuh.net>, Masahiro
 Yamada <masahiroy@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
 Nicolas Schier <nicolas@...sle.eu>
Cc: linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org
Subject: Re: [PATCH] kbuild: add script and target to generate pacman package

On Thu, 2024-07-04 at 18:36 +0200, Thomas Weißschuh wrote:
> diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
> new file mode 100644
> index 000000000000..29daf357edc1
> --- /dev/null
> +++ b/scripts/package/PKGBUILD
> @@ -0,0 +1,72 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +# Contributor: Jan Alexander Steffens (heftig) <heftig@...hlinux.org>
> +# Maintainer: Thomas Weißschuh <linux@...ssschuh.net>

Nitpick: Normally these lines are sorted newest to oldest, with the
current maintainer(s) at the top.

> +
> +pkgbase=linux-upstream
> +pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-api-headers")
> +pkgver="${KERNELRELEASE//-/_}"
> +pkgrel="$KBUILD_REVISION"
> +pkgdesc='Linux'
> +url='https://www.kernel.org/'
> +arch=("$UTS_MACHINE")
> +options=(!strip)

You should have !debug !strip here, otherwise makepkg can attempt (and
will fail) to gather source files, creating an empty
/usr/src/debug/$pkgbase.

Might also be worth considering !buildflags (to turn off injection of
CFLAGS etc) and !makeflags (to turn off injection of MAKEFLAGS).

> +license=(GPL-2.0-only)
> +
> +build() {
> +  export MAKEFLAGS="${KBUILD_MAKEFLAGS}"

I think you can have this export at the top level instead of in each
function.

> +  cd "$objtree"
> +
> +  ${MAKE} -f "${srctree}/Makefile"
> +
> +}
> +
> +package_linux-upstream() {
> +  pkgdesc="The $pkgdesc kernel and modules"
> +
> +  export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
> +  cd "$objtree"
> +  local modulesdir="$pkgdir/usr/$MODLIB"
> +
> +  echo "Installing boot image..."
> +  # systemd expects to find the kernel here to allow hibernation
> +  # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
> +  install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"

An invocation of make that could also use ${MAKE} for consistency.

> +
> +  # Used by mkinitcpio to name the kernel
> +  echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
> +
> +  echo "Installing modules..."
> +  ${MAKE} INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
> +    DEPMOD=/doesnt/exist modules_install  # Suppress depmod
> +
> +  # remove build link
> +  rm -f "$modulesdir/build"
> +}
> +
> +package_linux-upstream-headers() {
> +  pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
> +
> +  export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
> +  cd "$objtree"
> +  local builddir="$pkgdir/usr/$MODLIB/build"
> +
> +  echo "Installing build files..."
> +  "$srctree/scripts/package/install-extmod-build" "$builddir"

Should we be using this script upstream as well instead of our
homegrown mess of install commands?

> +
> +  echo "Adding symlink..."
> +  mkdir -p "$pkgdir/usr/src"
> +  ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
> +}
> +
> +package_linux-upstream-api-headers() {
> +  pkgdesc="Kernel headers sanitized for use in userspace"
> +  provides=(linux-api-headers)
> +  conflicts=(linux-api-headers)
> +
> +  export MAKEFLAGS="${KBUILD_MAKEFLAGS}"
> +  cd "$objtree"
> +
> +  ${MAKE} headers_install INSTALL_HDR_PATH="$pkgdir/usr"
> +}
> +
> +# vim:set ts=8 sts=2 sw=2 et:


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ