From: Simon Glass <simon.glass@canonical.com> This series adds a callback-free API for PXE/extlinux parsing that eparates the process into three distinct phases: parse, load, and boot. The traditional API uses callbacks during parsing to load files immediately. The new API instead collects file information (kernel, initrd, FDT, overlays) into a list during parsing, allowing callers to load files manually before booting. Include files are handled in a similar way. Rather than requiring the config files to be nul-termiated, the size of the file is provided and used to determine the end of the configuration file. New functions: - pxe_parse() - Parse config and return menu with file list - pxe_load() - Load files for a selected label (optional helper) - pxe_boot() - Boot using loaded files (renamed from pxe_do_boot) - pxe_cleanup() - Clean up context and menu The series also fixes several memory leaks in the parser found through malloc dump analysis. Size growth is unfortunately significant. On Thumb2 the memory-leak fixes add 116 bytes; removing the need for nul-termination takes 116 bytes and the alists and and general logic take another 60 Simon Glass (26): lib: abuf: Add abuf_init_addr() helper boot: pxe: Free bmp in pxe_menu_uninit() boot: pxe: Fix token memory leaks in parser boot: pxe: Free menu label in label_destroy() boot: pxe: Fix memory leak in parse_fdtoverlays() boot: pxe: Make pxe_prepare() static and document it boot: pxe: Simplify pxe_parse_include() to take only address boot: pxe: Add struct pxe_file for file loading boot: pxe: Replace pxe_fdtoverlay with pxe_file boot: pxe: Use the files list instead of fdtoverlays boot: pxe: Add a helper to add to the file list boot: pxe: Add the kernel to the files list when parsing boot: pxe: Add the initrd to the files list when parsing boot: pxe: Add the FDT to the files list when parsing boot: pxe: Set pxe_file_size in get_pxe_file() boot: pxe: Set pxe_file_size in extlinux_read_all() boot: pxe: Add size parameter to parse_pxefile() boot: pxe: Add pxe_process_str() for nul-terminated strings boot: pxe: Update parse_pxefile() to take struct abuf boot: pxe: Remove unused base parameter from parse_menu() boot: pxe: Remove unused base parameter from parse_pxefile_top() boot: pxe: Add a limit parameter to parser functions boot: pxe: Add a callback-free PXE API test: pxe: Add a test for the callback-free files API test: pxe: Add memory-leak check to files-API test doc: bootstd: Add PXE parser API documentation boot/ext_pxe_common.c | 5 +- boot/pxe_parse.c | 242 +++++++++++++++++++---------- boot/pxe_utils.c | 127 ++++++++++++--- cmd/pxe.c | 2 +- cmd/sysboot.c | 2 +- doc/develop/bootstd/extlinux.rst | 2 +- doc/develop/bootstd/index.rst | 1 + doc/develop/bootstd/pxe_api.rst | 194 +++++++++++++++++++++++ doc/develop/bootstd/pxelinux.rst | 2 +- include/abuf.h | 12 ++ include/pxe_utils.h | 176 ++++++++++++++++----- lib/abuf.c | 6 + test/boot/pxe.c | 255 +++++++++++++++++++++++++++---- test/lib/abuf.c | 23 +++ test/py/tests/test_pxe_parser.py | 11 ++ 15 files changed, 876 insertions(+), 184 deletions(-) create mode 100644 doc/develop/bootstd/pxe_api.rst -- 2.43.0 base-commit: c0b7ed1ad434eabf50bc8bdf7ef7f31423f4977d branch: fite