Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] linux: Install artifacts to staging for kmod build
@ 2024-10-22 16:06 Michaelis, Adam J Collins via buildroot
  2024-10-22 19:24 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 5+ messages in thread
From: Michaelis, Adam J Collins via buildroot @ 2024-10-22 16:06 UTC (permalink / raw)
  To: buildroot@buildroot.org
  Cc: Maier, Brandon L                            Collins,
	Buchmeyer, Neal Collins

From 45b18a0b5af619fd90194634530cc75f995ea57a Mon Sep 17 00:00:00 2001
From: Adam Michaelis <adam.michaelis@collins.com>
Date: Wed, 16 Oct 2024 09:06:14 -0500
Subject: [PATCH v2 1/1] linux: Install artifacts to staging for kmod build

Installing kernel build artifacts to staging so that the user could use
the exported SDK to build out-of-tree kernel modules.

Signed-off-by: Adam Michaelis <adam.michaelis@collins.com>
---
 linux/Config.in |  8 ++++++++
 linux/linux.mk  | 17 +++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/linux/Config.in b/linux/Config.in
index e8c0722de0f9..372cd9ddd7aa 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -454,6 +454,14 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
          /boot if DTBs have been generated by the kernel build
          process.

+config BR2_LINUX_KERNEL_INSTALL_STAGING
+       bool "Install kmod build files to staging"
+       help
+         Select this option to have the kernel files required for
+         out-of-tree module building installed to staging. This will
+         then enable module building from an exported SDK without
+         the full Linux build and Buildroot.
+
 config BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL
        bool "Needs host OpenSSL"
        help
diff --git a/linux/linux.mk b/linux/linux.mk
index 469a80db9f55..8d46f2e4b7f2 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -585,6 +585,23 @@ define LINUX_RUN_DEPMOD
 endef
 LINUX_TARGET_FINALIZE_HOOKS += LINUX_RUN_DEPMOD

+ifeq ($(BR2_LINUX_KERNEL_INSTALL_STAGING),y)
+LINUX_INSTALL_STAGING=YES
+endif
+
+define LINUX_INSTALL_STAGING_CMDS
+       # Install artifacts needed for module builds into staging for SDK use
+       if grep -q "CONFIG_MODULES=y" $(@D)/.config; then \
+               install -d "$(STAGING_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/build/arch" && \
+               rsync --exclude "*.o" -a "$(@D)/arch/$(KERNEL_ARCH)" \
+                       "$(STAGING_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/build/arch/" && \
+               rsync --exclude "*.o" --exclude "*.a" -a "$(@D)/include" \
+                       "$(@D)/scripts" "$(@D)/certs" "$(@D)/Makefile" \
+                       "$(@D)/Module.symvers" "$(@D)/.config" \
+                       "$(STAGING_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/build/" ;\
+       fi
+endef
+
 # Include all our extensions.
 #
 # Note: our package infrastructure uses the full-path of the last-scanned
--
2.29.0


Adam Michaelis
Prin. Eng. LLSW
Mission Systems
Collins Aerospace
Cedar Rapids, IA, USA

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-22 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 16:06 [Buildroot] [PATCH v2 1/1] linux: Install artifacts to staging for kmod build Michaelis, Adam J Collins via buildroot
2024-10-22 19:24 ` Thomas Petazzoni via buildroot
2024-10-22 20:14   ` Brandon Maier via buildroot
2024-10-22 20:23     ` Thomas Petazzoni via buildroot
2024-10-22 21:08       ` [Buildroot] [External] " Michaelis, Adam J Collins via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox