
From: Simon Glass <sjg@chromium.org> U-Boot is currently built as a monolithic binary. While there is an API of sorts, allowing U-Boot to be called from another program, it is not widely used. In some cases it is useful to write a separate program which is in control of the boot process, but uses U-Boot to implement some of the functionality. Some examples are: - Creating a main program written in a different language, such as Rust or Python - For Python specifically, an interface on top of U-Boot would permit direct execution of sandbox tests - For Rust specifically, it could make it feasible to progressively rewrite U-Boot in Rust, if that were desirable - For testing, it would permit tests to be in control of execution, rather than being embedded within U-Boot itself This series begins the progress of supporting U-Boot as a shared library. At this point the functionality is very limited: - it targets sandbox only - the test program simply starts U-Boot and boots to a prompt Future work will build on this meagre foundation. Simon Glass (18): doc: Add fuzzing build documentation board_r: Drop MMC init from the startup sequence sandbox: Avoid mon_len being larger than available RAM sandbox: Move PCI functions to separate header file sandbox: Move main.h contents into u-boot-sandbox header sandbox: Split main() into separate file sandbox: Extract init code into sandbox_init() ulib: Add an option to build U-Boot as a library ulib: Support building U-Boot as a shared library ulib: Create a test program for the shared library ulib: Add linker script for shared library build ulib: efi: Disable relocation or runtime-services ulib: Enable building the ulib test program ulib: Implement GD_FLG_ULIB for library-usage mode ulib: Drop the initial banner for the library ulib: Drop DRAM announcements for the library ulib: Allow dropping NAND init from the startup sequence ulib: Drop dm stats for the library Kconfig | 9 + Makefile | 31 ++- arch/sandbox/cpu/Makefile | 7 +- arch/sandbox/cpu/fuzz.c | 81 ++++++++ arch/sandbox/cpu/main.c | 11 ++ arch/sandbox/cpu/mem.c | 1 + arch/sandbox/cpu/os.c | 76 +------- arch/sandbox/cpu/start.c | 26 ++- arch/sandbox/cpu/u-boot-lib.lds | 88 +++++++++ arch/sandbox/include/asm/main.h | 18 -- arch/sandbox/include/asm/sandbox_pci.h | 61 ++++++ arch/sandbox/include/asm/u-boot-sandbox.h | 76 ++++---- common/board_f.c | 24 ++- common/board_r.c | 17 +- configs/tools-only_defconfig | 1 + doc/build/fuzz.rst | 219 ++++++++++++++++++++++ doc/build/index.rst | 1 + drivers/pci/pci-emul-uclass.c | 3 +- include/asm-generic/global_data.h | 12 ++ lib/display_options.c | 15 +- lib/efi_loader/efi_runtime.c | 4 + test/dm/pci.c | 1 + test/ulib/Makefile | 12 ++ test/ulib/ulib_test.c | 37 ++++ 24 files changed, 658 insertions(+), 173 deletions(-) create mode 100644 arch/sandbox/cpu/fuzz.c create mode 100644 arch/sandbox/cpu/main.c create mode 100644 arch/sandbox/cpu/u-boot-lib.lds delete mode 100644 arch/sandbox/include/asm/main.h create mode 100644 arch/sandbox/include/asm/sandbox_pci.h create mode 100644 doc/build/fuzz.rst create mode 100644 test/ulib/Makefile create mode 100644 test/ulib/ulib_test.c -- 2.43.0 base-commit: 9bdc48e838ab200854c37fdb770fdd2abdeacc83 branch: ulib