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@xxxxxxxxxxxxx> > +# Maintainer: Thomas Weißschuh <linux@xxxxxxxxxxxxxx> 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: