public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Kees Cook <kees@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Ben Hutchings <ben@decadent.org.uk>,
	Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 3/4] kbuild: slim down package for building external modules
Date: Sat, 27 Jul 2024 16:42:03 +0900	[thread overview]
Message-ID: <20240727074526.1771247-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20240727074526.1771247-1-masahiroy@kernel.org>

Exclude directories and files unnecessary for building external modules:

 - include/config/  (except include/config/auto.conf)
 - scripts/atomic/
 - scripts/dtc/
 - scripts/kconfig/
 - scripts/mod/mk_elfconfig
 - scripts/package/
 - scripts/unifdef
 - .config
 - *.o
 - .*.cmd

Avoid copying files twice for the following directories:

 - include/generated/
 - arch/*/include/generated/

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/install-extmod-build | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build
index 8cc9e13403ae..cc335945dfbc 100755
--- a/scripts/package/install-extmod-build
+++ b/scripts/package/install-extmod-build
@@ -9,15 +9,22 @@ is_enabled() {
 	grep -q "^$1=y" include/config/auto.conf
 }
 
+find_in_scripts() {
+	find scripts \
+		\( -name atomic -o -name dtc -o -name kconfig -o -name package \) -prune -o \
+		! -name unifdef -a ! -name mk_elfconfig -a \( -type f -o -type l \) -print
+}
+
 mkdir -p "${destdir}"
 
 (
 	cd "${srctree}"
 	echo Makefile
 	find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
-	find include scripts -type f -o -type l
+	find "arch/${SRCARCH}" -name generated -prune -o -name include -type d -print
 	find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
-	find "arch/${SRCARCH}" -name include -type d
+	find include \( -name config -o -name generated \) -prune -o \( -type f -o -type l \) -print
+	find_in_scripts
 ) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
 
 {
@@ -25,12 +32,15 @@ mkdir -p "${destdir}"
 		echo tools/objtool/objtool
 	fi
 
-	find "arch/${SRCARCH}/include" Module.symvers include scripts -type f
+	echo Module.symvers
+	echo "arch/${SRCARCH}/include/generated"
+	echo include/config/auto.conf
+	echo include/generated
+	find_in_scripts
 
 	if is_enabled CONFIG_GCC_PLUGINS; then
 		find scripts/gcc-plugins -name '*.so'
 	fi
 } | tar -c -f - -T - | tar -xf - -C "${destdir}"
 
-# copy .config manually to be where it's expected to be
-cp "${KCONFIG_CONFIG}" "${destdir}/.config"
+find "${destdir}" \( -name '.*.cmd' -o -name '*.o' \) -delete
-- 
2.43.0


  parent reply	other threads:[~2024-07-27  7:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-27  7:42 [PATCH 0/4] kbuild: cross-compile linux-headers package Masahiro Yamada
2024-07-27  7:42 ` [PATCH 1/4] modpost: remove unused HOST_ELFCLASS Masahiro Yamada
2024-07-31 20:43   ` Nicolas Schier
2024-07-27  7:42 ` [PATCH 2/4] modpost: detect endianness on run-time Masahiro Yamada
2024-07-31 20:47   ` Nicolas Schier
2024-07-27  7:42 ` Masahiro Yamada [this message]
2024-07-31 21:01   ` [PATCH 3/4] kbuild: slim down package for building external modules Nicolas Schier
2024-08-24 12:27   ` Thomas Weißschuh
2024-08-24 16:58     ` Masahiro Yamada
2025-02-18 20:25   ` Jeffrey Hugo
2025-02-20 10:03     ` Nicolas Schier
2025-02-20 15:03       ` Jeffrey Hugo
2025-02-20 15:54         ` Nicolas Schier
2025-02-20 16:31           ` Jeffrey Hugo
2025-02-20 16:49             ` Greg KH
2025-02-20 17:24               ` Jeffrey Hugo
2025-02-20 17:43                 ` Greg KH
2025-02-20 18:12                   ` Masahiro Yamada
2025-02-28 22:04                   ` Jeffrey Hugo
2025-02-20 17:57                 ` Masahiro Yamada
2024-07-27  7:42 ` [PATCH 4/4] kbuild: cross-compile linux-headers package when possible Masahiro Yamada
2024-07-30  1:03   ` Kees Cook
2024-08-01  2:26     ` Masahiro Yamada
2024-07-31 21:10   ` Nicolas Schier
2024-08-01  2:37     ` Masahiro Yamada
2024-08-01  7:04       ` Nicolas Schier
2024-10-17 14:45   ` Ron Economos
2024-10-17 19:24     ` Nicolas Schier
2024-10-17 19:34       ` Ron Economos
2024-11-14 20:57         ` Charlie Jenkins
2024-11-16  8:03           ` Masahiro Yamada

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=20240727074526.1771247-4-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=ben@decadent.org.uk \
    --cc=kees@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.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