[Concept,08/18] ulib: Add an option to build U-Boot as a library

Message ID 20250904130459.848794-9-sjg@u-boot.org
State New
Headers
Series ulib: Introduce building U-Boot as a shared library |

Commit Message

Simon Glass Sept. 4, 2025, 1:04 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

It is sometimes useful to create a different main program for U-Boot,
or even to use some parts of U-Boot in an entirely different project.
Add a new option to allow building a .so from parts of U-Boot. For now
this does nothing.

Enable it by default for sandbox, excluding the tools-only build, where
it has no meaning.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 Kconfig                      | 9 +++++++++
 configs/tools-only_defconfig | 1 +
 2 files changed, 10 insertions(+)
  

Patch

diff --git a/Kconfig b/Kconfig
index de9d9ad5653..3b136a5f897 100644
--- a/Kconfig
+++ b/Kconfig
@@ -98,6 +98,15 @@  config CC_OPTIMIZE_FOR_DEBUG
 
 endchoice
 
+config ULIB
+	bool "Build U-Boot as a library"
+	default y if SANDBOX
+	help
+	  Enable this to build a library which can be linked to other programs,
+	  to extend U-Boot's functionality.
+
+	  The library is called libu-boot.so
+
 config OPTIMIZE_INLINING
 	bool "Allow compiler to uninline functions marked 'inline' in full U-Boot"
 	help
diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
index 20ac1e63f09..9e4866b494c 100644
--- a/configs/tools-only_defconfig
+++ b/configs/tools-only_defconfig
@@ -5,6 +5,7 @@  CONFIG_DEFAULT_DEVICE_TREE="sandbox"
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 # CONFIG_SANDBOX_SDL is not set
+# CONFIG_ULIB is not set
 # CONFIG_EFI_LOADER is not set
 CONFIG_ANDROID_BOOT_IMAGE=y
 CONFIG_TIMESTAMP=y