From patchwork Fri Aug 16 14:18:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13766399 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5AF01AD9D6; Fri, 16 Aug 2024 14:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723817931; cv=none; b=IZK4r4hFFiyBTHtKoC6ufHnLtLSkOHRRgEpKn8EkQ3j4Fixeojpscgb6c12I+xhBRuj8lVSdAfpDtVd8C+RuwsdigUV3FCJvz/M4A2C277+2yLgsQwvrZU6PcXksPZ0N5Fh59dk8qpGbceeAoTBNDE3qPQ5kimTlDs3IU8UVyrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723817931; c=relaxed/simple; bh=8PcWZ6u8ejj0P8ViD/wgyJXvbvFIHANHO5AQPKq7jk0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bSxHxl0ha3m/c7GveZHKz4JN/huoPkVdja7TPbB1IPKiydoZNz5sWl/KQzTtvmn7yvPaz5yxFNTcsjjsRLwfLFjcUiqGSNHJ2oMTQ62yEZQ85YlUP6wRkaA0hFiwrpJxWBangFVAcS74XXswYKG3c7kO6Pujl7c0Tn3KhQ0pnqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L7hFLHv6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L7hFLHv6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B292FC32782; Fri, 16 Aug 2024 14:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723817931; bh=8PcWZ6u8ejj0P8ViD/wgyJXvbvFIHANHO5AQPKq7jk0=; h=From:To:Cc:Subject:Date:From; b=L7hFLHv6ifDj05J2U4hz6Oroea/owuHdzHoV/Q8MpPk/gi6h0APbqtEryViPrrFil +VN1dVs9ROoXtIWaHQ7GVR9fH0ZPAfvH2GtPZfff31MBeVKkzKOagEZXUdaTmGr9u0 KVODB1t6cqVsc1tuQNkzPuXzasE6WYz8eQOcj4nSFrY+no4kLw8VMqpvbgTzKFRblW i05UUFz2hULnXLuki2Qg6Gxf6hhMnJt08MZD2FeIL2FU3MF+mlz/WY4LzdccaGnTy1 qay2XpgpR6ikr73pFTHxrmnBJXWMyZmAbjy2NscT9Wi3G7FkL3xMO3ALb0p3JcTKCa FGbjXn0/NbhZA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Christian Heusel , Nathan Chancellor , Nicolas Schier , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH 1/2] kbuild: pacman-pkg: move common commands to a separate function Date: Fri, 16 Aug 2024 23:18:14 +0900 Message-ID: <20240816141844.1217356-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All build and package functions share the following commands: export MAKEFLAGS="${KBUILD_MAKEFLAGS}" cd "${objtree}" Factor out the common code. Signed-off-by: Masahiro Yamada Acked-by:  Thomas Weißschuh Reviewed-by: Nathan Chancellor Reviewed-by: Christian Heusel --- scripts/package/PKGBUILD | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD index fbd7eb10a52c..e2d9c2601ca9 100644 --- a/scripts/package/PKGBUILD +++ b/scripts/package/PKGBUILD @@ -36,11 +36,15 @@ makedepends=( ) options=(!debug !strip !buildflags !makeflags) -build() { +_prologue() { # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild. # Bypass this override with a custom variable. export MAKEFLAGS="${KBUILD_MAKEFLAGS}" cd "${objtree}" +} + +build() { + _prologue ${MAKE} KERNELRELEASE="${KERNELRELEASE}" KBUILD_BUILD_VERSION="${pkgrel}" } @@ -48,10 +52,10 @@ build() { _package() { pkgdesc="The ${pkgdesc} kernel and modules" - export MAKEFLAGS="${KBUILD_MAKEFLAGS}" - cd "${objtree}" local modulesdir="${pkgdir}/usr/${MODLIB}" + _prologue + echo "Installing boot image..." # systemd expects to find the kernel here to allow hibernation # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344 @@ -76,10 +80,10 @@ _package() { _package-headers() { pkgdesc="Headers and scripts for building modules for the ${pkgdesc} kernel" - export MAKEFLAGS="${KBUILD_MAKEFLAGS}" - cd "${objtree}" local builddir="${pkgdir}/usr/${MODLIB}/build" + _prologue + if grep -q CONFIG_MODULES=y include/config/auto.conf; then echo "Installing build files..." "${srctree}/scripts/package/install-extmod-build" "${builddir}" @@ -100,8 +104,7 @@ _package-api-headers() { provides=(linux-api-headers) conflicts=(linux-api-headers) - export MAKEFLAGS="${KBUILD_MAKEFLAGS}" - cd "${objtree}" + _prologue ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" } From patchwork Fri Aug 16 14:18:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13766400 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18D981BD51B; Fri, 16 Aug 2024 14:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723817934; cv=none; b=IuaetV/Xv55C4wkhRhAB9Rl2YprkYTExFAFKHE9duoczJN9Hvv9WC2srIiDDWnbSmWj+fm4mA6svCW+yhNXLV5CUuVMBWeinVHTLEiTR3J7BP1sNPTLeSoph9uDrJjGZIu3sJ8xhSBrN6WiEZktfDPiuyvQI62QfFBUpwaJxKOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723817934; c=relaxed/simple; bh=85yDOCa0mesRomJqkSrS/sZzpbNIJP6Eq012jbYPrRU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gpg/2KXqD3hCFyLxcAGyRvg+fK5tgBhuRDLofq6v++AweBD4wEU3XQWXA6VC74NWNH/PN0ecrNgfElurEVRUMi+SpkLySm/Gm0loKVKcM8iMoSObYj4vmL1VONYLmZXis/jfpBYMOamn5JiF/OtK5PtDMf/kJwv6Zx52VFGwWx8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TXxQiKYA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TXxQiKYA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D154CC32782; Fri, 16 Aug 2024 14:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723817933; bh=85yDOCa0mesRomJqkSrS/sZzpbNIJP6Eq012jbYPrRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXxQiKYApcKQ+mybs7VzPMncIPblEehw2gw+pa/meVopTgz5gi0SEYDn8xJEaRxmr BoZSgs084UOi9qbKXzh1+iRTwh0eMxNkFAoFgSiBQ1Lyt831+SBQZF4TfLmXQAOodl 5aPmIY9bUAaCTYWa46igH6n6v40iLyac8AmmrJGaW/g6cfGXwGD1stJ0A+FVlcP6Gi wwNtV24/OnOW+5VcNiKzTusGg/1YdAGuUYmBlFu0/e7D7dTPXz1aZEuJO0/sOVrjoP pKbe6droSg+bqPiTkYQ1da0APyR4CTOkus8Ds5kaMP/Qm4xjHfS5ge/sl31ux1fnFk O2qAHfJgs9hvA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Christian Heusel , Nathan Chancellor , Nicolas Schier , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH 2/2] kbuild: pacman-pkg: do not override objtree Date: Fri, 16 Aug 2024 23:18:15 +0900 Message-ID: <20240816141844.1217356-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240816141844.1217356-1-masahiroy@kernel.org> References: <20240816141844.1217356-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 objtree is defined and exported by the top-level Makefile. I prefer not to override it. There is no need to pass the absolute pass of objtree. PKGBUILD can detect it by itself. Signed-off-by: Masahiro Yamada Acked-by:  Thomas Weißschuh Reviewed-by: Nathan Chancellor Reviewed-by: Christian Heusel --- scripts/Makefile.package | 3 +-- scripts/package/PKGBUILD | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 4a80584ec771..2c261a0d42b0 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -147,8 +147,7 @@ snap-pkg: PHONY += pacman-pkg pacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD - +objtree="$(realpath $(objtree))" \ - BUILDDIR="$(realpath $(objtree))/pacman" \ + BUILDDIR="$(realpath $(objtree))/pacman" \ CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD index e2d9c2601ca9..839cd5e634d2 100644 --- a/scripts/package/PKGBUILD +++ b/scripts/package/PKGBUILD @@ -40,7 +40,9 @@ _prologue() { # MAKEFLAGS from makepkg.conf override the ones inherited from kbuild. # Bypass this override with a custom variable. export MAKEFLAGS="${KBUILD_MAKEFLAGS}" - cd "${objtree}" + + # Kbuild works in the output directory, where this PKGBUILD is located. + cd "$(dirname "${BASH_SOURCE[0]}")" } build() {