From: "Thomas Weißschuh" <linux@weissschuh.net>
To: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>,
linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kbuild: add script and target to generate pacman package
Date: Thu, 4 Jul 2024 21:33:25 +0200 [thread overview]
Message-ID: <c1aa960c-27de-41f9-bdb3-d5cad954047a@t-8ch.de> (raw)
In-Reply-To: <63c53ab962254e49d0eb3a67a067b48023d679b0.camel@archlinux.org>
Hi,
thanks for the review!
On 2024-07-04 21:02:50+0000, Jan Alexander Steffens (heftig) wrote:
> 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@archlinux.org>
> > +# Maintainer: Thomas Weißschuh <linux@weissschuh.net>
>
> Nitpick: Normally these lines are sorted newest to oldest, with the
> current maintainer(s) at the top.
Ack.
> > +
> > +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.
Ack.
> Might also be worth considering !buildflags (to turn off injection of
> CFLAGS etc) and !makeflags (to turn off injection of MAKEFLAGS).
Ack.
!makeflags doesn't really help because the MAKEFLAGS inherited from
Kbuild are still overwritten, but with empty values.
Which is why the KBUILD_MAKEFLAGS variable is used.
But it's still better to have for safety.
>
> > +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.
That doesn't seem to work, MAKEFLAGS seem to be set before the function
is called.
>
> > + 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.
Ack, Nathan also proposed this.
> > +
> > + # 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?
Maybe. It is missing a few things like resolve_btfids.
In the kernel repo if something is missing we can fix the script itself.
Downstream would still require custom logic.
> > +
> > + 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:
prev parent reply other threads:[~2024-07-04 19:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 16:36 Thomas Weißschuh
2024-07-04 18:21 ` Nathan Chancellor
2024-07-04 18:33 ` Thomas Weißschuh
2024-07-04 19:02 ` Jan Alexander Steffens (heftig)
2024-07-04 19:33 ` Thomas Weißschuh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1aa960c-27de-41f9-bdb3-d5cad954047a@t-8ch.de \
--to=linux@weissschuh.net \
--cc=heftig@archlinux.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®