From patchwork Sat Feb 14 02:12:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1861 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035222; bh=/C1+0bqMTqFIj1foG+9lS3kbXiVGv62S3yPbl2zEtmc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IdTcPsWUEjN7RxWLBVJWBJTs2vyTMTywY7IdhL48Qm/MCxefn2o23m2AIi9gdA/oJ oQ0XoKGKVYnUKbBu/YSTjOYrTf4ov+9cV8F4qZHIX4zSf1wqcF27FsWMRu4vI22Pm9 uhRzA1UDftAPMyz2GdvcJGHMtMX/NfqRngHG71Nx4kwiu9pNpcI9Vm/J7qCu2BrRxw hjVeCkZazfwjfaEQMKlh3hdwf6hYnWgC7k+OHJiPu5Laurlm0/0D6gkaCt/cEen1Yi ZE95+V2+7pudBYk9KGVV44olJ3G6QsopU1zVXRHEt0PgWr7yR8FbGwBNM0Hy1PgiGz 1GH1rlhvQzPsw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D2DC569B5B for ; Fri, 13 Feb 2026 19:13:42 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XF5h__ktThdW for ; Fri, 13 Feb 2026 19:13:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035222; bh=/C1+0bqMTqFIj1foG+9lS3kbXiVGv62S3yPbl2zEtmc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=IdTcPsWUEjN7RxWLBVJWBJTs2vyTMTywY7IdhL48Qm/MCxefn2o23m2AIi9gdA/oJ oQ0XoKGKVYnUKbBu/YSTjOYrTf4ov+9cV8F4qZHIX4zSf1wqcF27FsWMRu4vI22Pm9 uhRzA1UDftAPMyz2GdvcJGHMtMX/NfqRngHG71Nx4kwiu9pNpcI9Vm/J7qCu2BrRxw hjVeCkZazfwjfaEQMKlh3hdwf6hYnWgC7k+OHJiPu5Laurlm0/0D6gkaCt/cEen1Yi ZE95+V2+7pudBYk9KGVV44olJ3G6QsopU1zVXRHEt0PgWr7yR8FbGwBNM0Hy1PgiGz 1GH1rlhvQzPsw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C2CF269B58 for ; Fri, 13 Feb 2026 19:13:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035220; bh=5de3wD/JGl9tTSevCrUayitBMCHO6zIW7Rw5X/X6oYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndu0v+Cvqh2Fxu/jAbpanXT7+iQQa1MZtOHWWzzv4uN7X2gvM4iqE7jn9+wtFTVQz oP/+iEFDSz6ZRaDUowLxy2KM5fb1R14GO07zhWRFewLmdyjQdiqQX4iZmz9l4FEx/R FmuIC7NTSKD0l1+tYMfmjuz+L9TFfp9hVpV0ntE/amtdHZgLY6+vda3EEP5Fzu0eVy hO2jZ2M7JdoDLcgGZILrDW/MvqBCGksdPjeOWo4NRONRCLDyl67MVfIRJndI/sjvTS uHHCFww7zbwaPAxv6sWeYQxGSKOY+QmeUc9DRQQk7zDRFX26cLkaPSH5QqC3FEPIST jfSZGrAkKdQ7A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B738869B56; Fri, 13 Feb 2026 19:13:40 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id lJLfcYwsq_ZB; Fri, 13 Feb 2026 19:13:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035216; bh=n/aqUcvsd7VqifLMfQRYRhhr2HJK7JtWrxFYHkHVsqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSFTCeedZ7ZtRPKtmxrw4OjXkuEt3weP8aU/p/sxSXx2I0Uw2YdlauRtr7ytU6NnK YeyuuO7DDARzikwHh5U1XhDbzSOSUMeqs5GV2h2pJ75K5E2m64rQkyaTA7VTd7/eSn v1MBc7FUO9OsURx1gQOXjAxVYA+Db93Z8YOloS6OGel1YtkMXdJbX5YThtAoDn5n7C jVQl8HIQRpDVhvqK3hSE/HoG+lnEUcY7Xzsgg5crzY/Wv9lcPfKTec4Zn/vK7FshKp HhduZQ6U8flwEqgkXam4Q1foUuikiu7/B/pvRVoFpGcLojAFmWdWyRstyZ0A064GwK /GMjcHGDJjGXw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 494FA69A69; Fri, 13 Feb 2026 19:13:36 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:12:55 -0700 Message-ID: <20260214021317.816170-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EWOP27CP2Z2C53FKLGHZSRH22Y645HJ5 X-Message-ID-Hash: EWOP27CP2Z2C53FKLGHZSRH22Y645HJ5 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/13] ulib: Add MAINTAINERS entry List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass There is no MAINTAINERS entry for the ulib subsystem, so patches do not get automatically routed. Add an entry covering the library, examples, tests and documentation. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bda924912c1..62c98772441 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1875,6 +1875,17 @@ M: Neha Malcom Francis S: Maintained F: drivers/ufs/ +ULIB +M: Simon Glass +S: Maintained +T: git https://source.denx.de/u-boot/custodians/u-boot-dm.git +F: doc/develop/ulib.rst +F: examples/ulib/ +F: include/u-boot-lib.h +F: lib/ulib/ +F: test/py/tests/test_ulib.py +F: test/ulib/ + UPL M: Simon Glass S: Maintained From patchwork Sat Feb 14 02:12:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1862 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035228; bh=+Fk/KC9nx6ogjP6bkWTwrCwWAwARXzSzwiEbmrFKQ84=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Lo4oNVBK6qROVSWpflCqYBXwA9ZAuOTCFPiOe2G3I692utly8e3m2U67/wgrOa/T9 UTkpYcT5MYpvkl8ZWv/aLuVfFjRIkD7TgMHlGS99LhSQvWmuhZ2P1M8zOGs5OMHz1J 9chPVI5ILNWsn2NoMAeguTlcpdDKu4oD2l7BwdG4pIHTWKd0BzV3pcNj7P7x5XfUT0 5+dPJa1LNcRj/SW/2hLE8iWUxTY7Gy7mJjqHaH3gM5bG7mShRGWhBiEXC8DW7/Je4l FZOWQ66OGooMb+nIzeWLzP+88i2VDqa2jVnClgBIHvF69Uz//OA1sF47lbo21IDvjC jsJzGiUGWFXRw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 460A369B56 for ; Fri, 13 Feb 2026 19:13:48 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Xw5Sf9BJVx2o for ; Fri, 13 Feb 2026 19:13:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035228; bh=+Fk/KC9nx6ogjP6bkWTwrCwWAwARXzSzwiEbmrFKQ84=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Lo4oNVBK6qROVSWpflCqYBXwA9ZAuOTCFPiOe2G3I692utly8e3m2U67/wgrOa/T9 UTkpYcT5MYpvkl8ZWv/aLuVfFjRIkD7TgMHlGS99LhSQvWmuhZ2P1M8zOGs5OMHz1J 9chPVI5ILNWsn2NoMAeguTlcpdDKu4oD2l7BwdG4pIHTWKd0BzV3pcNj7P7x5XfUT0 5+dPJa1LNcRj/SW/2hLE8iWUxTY7Gy7mJjqHaH3gM5bG7mShRGWhBiEXC8DW7/Je4l FZOWQ66OGooMb+nIzeWLzP+88i2VDqa2jVnClgBIHvF69Uz//OA1sF47lbo21IDvjC jsJzGiUGWFXRw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 35E3469B58 for ; Fri, 13 Feb 2026 19:13:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035225; bh=75YLyuavqFizbws5fdv0RNpduMTBZGibe5Fh9ScJorI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdsmB7W1gFLkLh+TbrnWl+NjaRnUuS6VbUMcsewNUzq6kAVBwXh13Mtx/3OnLXrzB E0sY/BN/TQKkhzkC6D1A027qZGwEjrkmqJxTkpEnwBW38Yf44wqNVn90ZvO7hyeHWn oO7M2ar8duPuBDLb7wD1l5PvQQGN6m7nugmL2X1ZfOFMXSV8EwY+lI6r7wNM4OuB4b PzHYMc54u+f9Yg5qDLCVyL9gksuSFL48ZlfvwM7ykdH7sd6PqZMKvsjkDwLCQUC7eL YvT92Pz5P2RnElqzbZJiNduqnz7nWnpFSq24P4uxHrbxyulk2xtALM5B5sNC60Gltx lvMWjE9EAWemA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AD65569B56; Fri, 13 Feb 2026 19:13:45 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id cZRWhcM_JgVU; Fri, 13 Feb 2026 19:13:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035221; bh=X/1gMwJJUTVzAC5dXiJPM/9gtZyB6kqVTNiKPKl+hEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2C9VRRZ+lW4Lk2M82x41/x90Fyy7rQ9eTibbMkNg0wX8MkiqDLz1NDhgEu/iGT4f u/PHRB4QeOffpF1lJkBsKgrdIDGkIThSlZ41YjWBumK5oGq0p+rUTZRLYphZ1kGxHZ k9A7WLDZK6LrMKuqDLJY5LzTtqaYA91TQbO7raJ08anR3/5PwLp/WqGOu0zQnIXmQP R+qjm06VJr7TPoyCVI2W348gkESwenQePZSO87T36uxotBXaEcL2FU2i6MT/CjmT/m NOniyMw8PgXclk+LzGD9uQKYb+0pvYI7wgokJq8wY4yxR/xpBbJqIG1GhqxR6+NEjd 0GKIlwtdzwm6Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3814869A69; Fri, 13 Feb 2026 19:13:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:12:56 -0700 Message-ID: <20260214021317.816170-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5SQNJ7ZGJXOT6B6C5GZHS23FX6PEDIRU X-Message-ID-Hash: 5SQNJ7ZGJXOT6B6C5GZHS23FX6PEDIRU X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/13] ulib: Use cross-toolchain objcopy for symbol redefinition List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass build_api.py hardcodes the host 'objcopy' for symbol redefinition, which fails for cross-compiled targets (e.g. qemu_arm64) since the host objcopy cannot handle foreign ELF formats. Add an --objcopy argument to build_api.py and pass $(OBJCOPY) from the Makefile so the correct cross-toolchain binary is used. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Makefile | 1 + scripts/build_api.py | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e22c12da712..263914b3757 100644 --- a/Makefile +++ b/Makefile @@ -1891,6 +1891,7 @@ quiet_cmd_ulib-objs = OBJS $@ $(PYTHON3) $(srctree)/scripts/build_api.py \ $(srctree)/lib/ulib/rename.syms \ --redefine $$(cat $@.objlist) --output-dir $@.objdir \ + --objcopy $(OBJCOPY) \ $(if $(filter -j%,$(MAKEFLAGS)),--jobs $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))) \ > $@; \ rm -f $@.tmp $@.objlist diff --git a/scripts/build_api.py b/scripts/build_api.py index 7adc6c978a3..aa8b4f16a1a 100755 --- a/scripts/build_api.py +++ b/scripts/build_api.py @@ -310,7 +310,7 @@ class SymbolRedefiner: """ def __init__(self, syms: List[Symbol], outdir: str, max_workers, - verbose=False): + verbose=False, objcopy='objcopy'): """Initialize with symbols and output settings Args: @@ -318,11 +318,13 @@ class SymbolRedefiner: outdir (str): Directory to write modified object files max_workers (int): Number of parallel workers verbose (bool): Whether to show verbose output + objcopy (str): Path to objcopy binary """ self.syms = syms self.outdir = outdir self.verbose = verbose self.max_workers = max_workers + self.objcopy = objcopy self.redefine_args = [] self.symbol_names = set() @@ -339,7 +341,7 @@ class SymbolRedefiner: infile (str): Input object file path outfile (str): Output object file path """ - cmd = ['objcopy'] + self.redefine_args + [infile, outfile] + cmd = [self.objcopy] + self.redefine_args + [infile, outfile] subprocess.run(cmd, check=True, capture_output=True, text=True) if self.verbose: print(f'Copied and modified {infile} -> {outfile}') @@ -397,7 +399,8 @@ class SymbolRedefiner: return outfiles, modified @staticmethod - def apply_renames(obj_files, syms, outdir: str, max_workers, verbose=False): + def apply_renames(obj_files, syms, outdir: str, max_workers, + verbose=False, objcopy='objcopy'): """Apply symbol redefinitions to object files using objcopy Args: @@ -406,6 +409,7 @@ class SymbolRedefiner: outdir (str): Directory to write modified object files max_workers (int): Number of parallel workers verbose (bool): Whether to show verbose output + objcopy (str): Path to objcopy binary Returns: tuple[List[str], int]: List of output object file paths and @@ -414,7 +418,8 @@ class SymbolRedefiner: if not syms: return obj_files, 0 - redefiner = SymbolRedefiner(syms, outdir, max_workers, verbose) + redefiner = SymbolRedefiner(syms, outdir, max_workers, verbose, + objcopy) # Setup: create output directory and prepare work items os.makedirs(outdir, exist_ok=True) @@ -618,6 +623,8 @@ def parse_args(argv): help='Show verbose output') parser.add_argument('-j', '--jobs', type=int, metavar='N', help='Number of parallel jobs for symbol processing') + parser.add_argument('--objcopy', default='objcopy', + help='Path to objcopy binary (default: objcopy)') parser.add_argument('-P', '--processes', type=int, help='set number of processes to use for running tests') parser.add_argument('-t', '--test', action='store_true', dest='test', @@ -692,7 +699,8 @@ def main(argv=None): jobs = args.jobs if args.jobs else min(os.cpu_count() or 4, 8) start_time = time.time() outfiles, modified = SymbolRedefiner.apply_renames( - args.redefine, syms, args.output_dir, jobs, args.verbose) + args.redefine, syms, args.output_dir, jobs, args.verbose, + args.objcopy) # Print the list of output files for the build system to use if args.output_dir: print('\n'.join(outfiles)) From patchwork Sat Feb 14 02:12:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1863 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035228; bh=64WjETbTsctgysZzDmzJuFcxLfI+WpWlSp/8eMgKsAM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hooG1PVcozX1UR/jVwsC1R1k7QYDkRE8lSAG4PAnTW7zrXsRJ6SELdJVdH0yn5aOc VBXNB8/zUhueIvQcxFl1yaUlDMtVqdbqtN2dqX5/NZBj4PAdzd5DfqLaQ9y64Osw3l LXzqAC3VpBBk2HMXntiOaM/glFg5qj0wLn31Fn40wI0uA9XKNeMx/WjkRI1dqP/cWw 1svEBBIhNLIBZFr1O+Oi7JQjsEDr5Ip4Rx0zOhkm17VnH8rRiMOXEGXpTXH5ToZyFN X6cdzw8i0ZiXVArMdblCpbij5JSopYSo+3NiRD30fKls1HEVONbrjbeS8j09KZ85P1 p5SLOcsavI7jg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3EC169B64 for ; Fri, 13 Feb 2026 19:13:48 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id KxzxW2OUsi6B for ; Fri, 13 Feb 2026 19:13:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035228; bh=64WjETbTsctgysZzDmzJuFcxLfI+WpWlSp/8eMgKsAM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hooG1PVcozX1UR/jVwsC1R1k7QYDkRE8lSAG4PAnTW7zrXsRJ6SELdJVdH0yn5aOc VBXNB8/zUhueIvQcxFl1yaUlDMtVqdbqtN2dqX5/NZBj4PAdzd5DfqLaQ9y64Osw3l LXzqAC3VpBBk2HMXntiOaM/glFg5qj0wLn31Fn40wI0uA9XKNeMx/WjkRI1dqP/cWw 1svEBBIhNLIBZFr1O+Oi7JQjsEDr5Ip4Rx0zOhkm17VnH8rRiMOXEGXpTXH5ToZyFN X6cdzw8i0ZiXVArMdblCpbij5JSopYSo+3NiRD30fKls1HEVONbrjbeS8j09KZ85P1 p5SLOcsavI7jg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A41EF69B5C for ; Fri, 13 Feb 2026 19:13:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035226; bh=CdVQuFbVnOBZUP19l7TsoOTaYfEsOI7FLq128UhbSuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mQY80bCTUVQfxleOqZSyOkyfA7+rHm9PVRnghLIGXRjOsxtoLmYJDoKLZFZWP5qjC f7X2MMRvz2XDXzGOHQV6acu33cmnoIzrKA/BdNEYzu1/OMgXUjmGRY3OtdoVE8KjJk ejfbyFQf+MXYDNV66vLv9i1ocNM1gPuzx4dxGQU3iU8kMXq3iSQBu9wEvwQxpTKrFp XZyQInIBUBGm6jTrtNNJcqIq+IgtETXs+HtAAkBL834DAUVtsAsRwJQdxGL/1VgRlm yh+AVTLgVMoI/RYMcoGrplScojbxeqE4BETkRHTwUQZ9WtqCwyfElovkMtkm7eCGHN jlnqIU5V1LmUA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DAB0E69B56; Fri, 13 Feb 2026 19:13:46 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ZB2XbWeKbs9C; Fri, 13 Feb 2026 19:13:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035226; bh=9ZNSFD88pQ4gZGYaBS8HE2H3kyMPG/0DUZetxjMLgoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQPW5VUEjnN4STMtG1rG0zQ6Vc1LsNfOaJ/gFkM3rXq4FRvdVa6AqgLKyG9eTq7n+ RIa35XfvRi2sSgbIBnKJdELPebzcN1cPHBV20JEUiJOPHMHUqIBEToOncCYH16rCAJ v5UAWB01IdQvAGL6m2NidK1mO5NGy9X3YXm7oDg7Wtur+imKMPKHceQC6V+tQRM8gH JpkARaYQsYsQrE0aVMzwDtE+ECpaqo5aq+r1WUq7kX0c1wFndHG9a5JZ60b3fC7XoE OESXOQHPFjAMVPTJG5E1pniBsmZYu9sjwYg5g+c9nAhkKB2K2WnNkVMFidK4cbp9Pf qNoeQ4iPNdT4w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3D5D869A69; Fri, 13 Feb 2026 19:13:46 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:12:57 -0700 Message-ID: <20260214021317.816170-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CD7ANZDDEMBINV2CE6CXRLVAVFHR74ZF X-Message-ID-Hash: CD7ANZDDEMBINV2CE6CXRLVAVFHR74ZF X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/13] examples: ulib: Support both sandbox and linked-in demo List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Refactor demo.c so it builds as a standalone sandbox binary (using ulib_init/ulib_uninit and os_* helpers) or as an example linked into U-Boot (providing a strong ulib_has_main() and main()). Extract demo_run() for the common path and use IS_ENABLED(CONFIG_SANDBOX) to gate the sandbox-specific initialisation and /proc/version reading. Update demo_helper.c to use printf() directly when built as part of U-Boot (CONFIG_ULIB) rather than the u-boot-api shim. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- examples/ulib/demo.c | 87 +++++++++++++++++++++---------------- examples/ulib/demo_helper.c | 5 +++ test/py/tests/test_ulib.py | 10 +++-- 3 files changed, 62 insertions(+), 40 deletions(-) diff --git a/examples/ulib/demo.c b/examples/ulib/demo.c index 5077fcda0a6..0dbe5d233f5 100644 --- a/examples/ulib/demo.c +++ b/examples/ulib/demo.c @@ -2,66 +2,79 @@ /* * Demo program showing U-Boot library functionality * - * This demonstrates using U-Boot library functions in sandbox like os_* - * from external programs. + * This demonstrates using U-Boot library functions from external programs + * (sandbox) or as a standalone example linked into U-Boot. * * Copyright 2025 Canonical Ltd. * Written by Simon Glass */ -#include -#include -#include -#include - #include +#include #include #include #include "demo_helper.h" +#ifndef CONFIG_SANDBOX +bool ulib_has_main(void) +{ + return true; +} +#endif + +static const char *get_version(void) +{ + if (IS_ENABLED(CONFIG_SANDBOX)) + return ulib_get_version(); + return version_string; +} + +static int demo_run(void) +{ + demo_show_banner(); + printf("U-Boot version: %s\n", get_version()); + printf("\n"); + + demo_add_numbers(42, 13); + demo_show_footer(); + + return 0; +} + +#ifdef CONFIG_SANDBOX int main(int argc, char *argv[]) { - int fd, result, lines = 0; + int fd, lines = 0; char line[256]; + int ret; - /* Init U-Boot library */ if (ulib_init(argv[0]) < 0) { fprintf(stderr, "Failed to initialize U-Boot library\n"); return 1; } - demo_show_banner(); - printf("U-Boot version: %s\n", ulib_get_version()); - printf("\n"); + ret = demo_run(); - /* Use U-Boot's os_open to open a file */ + /* Also demonstrate using U-Boot's os_* functions to read a file */ fd = os_open("/proc/version", 0); - if (fd < 0) { - fprintf(stderr, "Failed to open /proc/version\n"); - ulib_uninit(); - return 1; - } - - printf("System version:\n"); - - /* Use U-Boot's os_fgets to read lines */ - while (os_fgets(line, sizeof(line), fd)) { - printf(" %s", line); - lines++; + if (fd >= 0) { + printf("\nSystem version:\n"); + while (os_fgets(line, sizeof(line), fd)) { + printf(" %s", line); + lines++; + } + os_close(fd); + printf("\nRead %d line(s) using U-Boot library functions.\n", + lines); } - os_close(fd); - - printf("\nRead %d line(s) using U-Boot library functions.\n", lines); - - /* Test the helper function */ - result = demo_add_numbers(42, 13); - printf("Helper function result: %d\n", result); - - demo_show_footer(); - - /* Clean up */ ulib_uninit(); - return 0; + return ret; +} +#else +int main(void) +{ + return demo_run(); } +#endif diff --git a/examples/ulib/demo_helper.c b/examples/ulib/demo_helper.c index e3a2c6bdcfb..167bbd26f64 100644 --- a/examples/ulib/demo_helper.c +++ b/examples/ulib/demo_helper.c @@ -6,7 +6,12 @@ * Written by Simon Glass */ +#ifndef CONFIG_ULIB #include +#else +#include +#define ub_printf printf +#endif void demo_show_banner(void) { diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 9b8b7097db4..9e46d529c87 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -53,18 +53,22 @@ def check_demo_output(ubman, out): with open('/proc/version', 'r', encoding='utf-8') as f: proc_version = f.read().strip() + # demo.c uses U-Boot's printf (compiled with U-Boot headers) while + # demo_helper.c uses glibc's printf, so their output streams are + # buffered separately. The helper output appears first, then the + # U-Boot printf output is flushed at exit. expected = [ 'U-Boot Library Demo Helper\r', '==========================\r', - 'System version:helper: Adding 42 + 13 = 55\r', + 'helper: Adding 42 + 13 = 55\r', '=================================\r', 'Demo complete\r', - f'U-Boot version: {ubman.u_boot_version_string}', + '\r', + f'System version:U-Boot version: {ubman.u_boot_version_string}', '', f' {proc_version}', '', 'Read 1 line(s) using U-Boot library functions.', - 'Helper function result: 55', '' ] From patchwork Sat Feb 14 02:12:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1864 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035235; bh=gbNjJUW6zEILDEvPzYqyQrNGZhe2Gar6+Sl/4Bdxopc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UrejXB/6WY/OJJJtNCtkf0o3aLO8cmbf0taM47ijQREMb9TxuI8TGl4AHIL+lHnBE n6q2e31GPuwcmDTnEs2sNbVev3E2NPcUggqUZdRJBiOuNL0w/KsyPd7WS9cOhiSNSG jV8y/XBH3v6Jt8DBpg7dSXIXKwHnUT1/uuPKTcs79qMDA0czBsVk3a4h6MWl+eoLTk yO1lZ+EnQy57kNVWFHzAdCw+4JLrlRAfIIMOkLoHA5Y/rnrhtYLFzGTJ8XeJBOsVrg 7lULykGSKJPnJtEbZo7OzqrtzmXvkCW6bX9pwb/CasOlCFhOlxbVlxCPdtn9vGLjpe Kpo5zg+hh+v5w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 808F769B5B for ; Fri, 13 Feb 2026 19:13:55 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wnYF6tBQCf7D for ; Fri, 13 Feb 2026 19:13:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035235; bh=gbNjJUW6zEILDEvPzYqyQrNGZhe2Gar6+Sl/4Bdxopc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UrejXB/6WY/OJJJtNCtkf0o3aLO8cmbf0taM47ijQREMb9TxuI8TGl4AHIL+lHnBE n6q2e31GPuwcmDTnEs2sNbVev3E2NPcUggqUZdRJBiOuNL0w/KsyPd7WS9cOhiSNSG jV8y/XBH3v6Jt8DBpg7dSXIXKwHnUT1/uuPKTcs79qMDA0czBsVk3a4h6MWl+eoLTk yO1lZ+EnQy57kNVWFHzAdCw+4JLrlRAfIIMOkLoHA5Y/rnrhtYLFzGTJ8XeJBOsVrg 7lULykGSKJPnJtEbZo7OzqrtzmXvkCW6bX9pwb/CasOlCFhOlxbVlxCPdtn9vGLjpe Kpo5zg+hh+v5w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6FA9F69B58 for ; Fri, 13 Feb 2026 19:13:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035233; bh=RSJU8TbQu69Rj3qAqeb9v0rEB0wrK3y1TO9EQqMRmBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vy/KN0mpspzIxDfRQxch26pmO8vUbu8iTfhccQVC4qsLjQQjCMG69rkHhcnO0lym3 UqeQP0Goc0hCYV16B7HXNk6c7YPEWr1XD4/H/hu1cPsZwRlUF2g81OGGPaNJYavTTH tpw5CC23Bntbm5hZQ5Xn39cveDyAypkePR0plQKjGMNPhzz8ftrX13ei63BtiyiKaF 8rKWPqWMGBWnMyEzzQ95NBMVx2fG6JUHBzf6yGUdnDSKoRlJ4HjUtQrkBcDDrQNAvF TxNbIkyifMacbxbmvqcNY1bzjlr9g6X3LXl1DxxZ/G0hbDQgyt67Vzk1c72j9rp95+ toT8ASLoKOaEg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0EC9A69B58; Fri, 13 Feb 2026 19:13:53 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id P6Fsoto3dG9u; Fri, 13 Feb 2026 19:13:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035227; bh=cAQG2/mChh5xvHUQcO0RtvX1ieLLSan7zu3YjB0KVcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vih1jAKxQQU/+9rhcsodsLWqPGL6ifcUIZZ7dgnPbbQc1Gxzv+icgLg/dXgBDrkzP ZZnW4GN7MRs5OZZaHE4CyB6qTTxNBTXQZ4Nhy5xQ2W5f6vMyiwRu+iQJ7DluSNIZwd bGyc3T6za4ENGneBI0unLjdcJiBjHENhQ7OQcuuyFq1nUnSOwcaQ9AXTfVNajKoK6q JN1VUT7lepIafP+9DRyXXvnmoBiEjhdLT+maYo4d1f3B72SzVUD+3ttM3/3sKDTM2c WawnFtXhqlsacfxPkENvKCmF2wUOHXMdfa+mdIV5LnmNDcNkHFrJVs7U0rdXWyjxBm rlq/wBNgFm63Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6BF1769A69; Fri, 13 Feb 2026 19:13:47 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:12:58 -0700 Message-ID: <20260214021317.816170-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MSN5B4R3A54B73OGZSQYVDU5PLWSYL2R X-Message-ID-Hash: MSN5B4R3A54B73OGZSQYVDU5PLWSYL2R X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/13] ulib: Make shared-lib deps conditional on ULIB_SHARED_LIB List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The examples_ulib and examples_rust targets unconditionally depend on libu-boot.so, which is only buildable on sandbox (ULIB_SHARED_LIB depends on SANDBOX). Make the dependency conditional on CONFIG_ULIB_SHARED_LIB so the targets can also be built on other architectures such as x86. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 263914b3757..26ecf59a98a 100644 --- a/Makefile +++ b/Makefile @@ -1961,7 +1961,7 @@ test/ulib/ulib_test_static: test/ulib/ulib_test.o libu-boot.a \ # abspath is used since many paths are relative PHONY += examples_ulib -examples_ulib: libu-boot.a libu-boot.so FORCE +examples_ulib: libu-boot.a $(if $(CONFIG_ULIB_SHARED_LIB),libu-boot.so) FORCE $(Q)$(MAKE) -C $(srctree)/examples/ulib \ UBOOT_BUILD=$(abspath $(obj)) \ EXAMPLE_DIR=. \ @@ -1973,7 +1973,7 @@ examples_ulib: libu-boot.a libu-boot.so FORCE LIB_STATIC_LDS="$(abspath $(LIB_STATIC_LDS))" PHONY += examples_rust -examples_rust: libu-boot.a libu-boot.so FORCE +examples_rust: libu-boot.a $(if $(CONFIG_ULIB_SHARED_LIB),libu-boot.so) FORCE @if command -v cargo >/dev/null 2>&1; then \ $(MAKE) -C $(srctree)/examples/rust \ UBOOT_BUILD=$(abspath $(obj)) \ From patchwork Sat Feb 14 02:12:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1865 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035239; bh=1ufaQd7mfv2gz+SO9ATaRoFGtLNGtrikwZi2M0g6t/I=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=s+15yHSbdi0ELKcHm6tOT1xKAM6EHhEcGA9Q+i5tesOFIVZOdTc7/yXomDaoAN4YZ kux45L0bCH68ydSCC0fzdhmYdowq8cVgnYQgvZjaxoJsME5KXUtQa345ffGqfVBtbU xIMoNaadURslQx9FFtIOFdh6DTDFW18n2fWVYdtmsth/fAC/O8+cfOYXWEJF3SCtNX 42jMPI98ST5J4IgRXEDySZIaCMT49XWFIC3Piuwhujsv+XIZ7LOQknefd05RCy+lVf 8ClBiRY/QgZb5PsyAGYR2zI9SFijflchxse252PxTBKpR8iHPB5a8XAYLWX7Tr17kK MiO3Apr+zqkLQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EE7D769B5B for ; Fri, 13 Feb 2026 19:13:59 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hTxcsZl-Lu_I for ; Fri, 13 Feb 2026 19:13:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035239; bh=1ufaQd7mfv2gz+SO9ATaRoFGtLNGtrikwZi2M0g6t/I=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=s+15yHSbdi0ELKcHm6tOT1xKAM6EHhEcGA9Q+i5tesOFIVZOdTc7/yXomDaoAN4YZ kux45L0bCH68ydSCC0fzdhmYdowq8cVgnYQgvZjaxoJsME5KXUtQa345ffGqfVBtbU xIMoNaadURslQx9FFtIOFdh6DTDFW18n2fWVYdtmsth/fAC/O8+cfOYXWEJF3SCtNX 42jMPI98ST5J4IgRXEDySZIaCMT49XWFIC3Piuwhujsv+XIZ7LOQknefd05RCy+lVf 8ClBiRY/QgZb5PsyAGYR2zI9SFijflchxse252PxTBKpR8iHPB5a8XAYLWX7Tr17kK MiO3Apr+zqkLQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DE22169B58 for ; Fri, 13 Feb 2026 19:13:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035237; bh=6TCybWoGhrJsTk43GdpyuO35pqPB2Pm+m8rMnGALDsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Asjf3j4VF41gBx9WlRbIQ+TBJkKng0yjLosz+mlAeFzycnnZlWHJnFrOSOJPtffSq wbc9ZMpcO21sXFr8h0pbYw9eEp4QYFuVIVGj8YnmZK8PFEEcNi53p5iowyaTwRlo+D YvHRwOTGxOmi0eKAs5B5FgegXwdhvrmEBtvBt78W3qGerlvQ0b3xkVoxpe/5GV1eLb zvYfPacjpvC1jBI3T40VEAjH8PMgsyV5kQXSoLCrAfYXvzASnEkteskOXblODD0Z1z b9zjrwcBh3enCDhuPS05hHPW0+rGVcObMQVuwvqwXypAxHGrFoMEhElgKXAJ5uyBx/ pG9uY/AmlnLHw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E26D469B58; Fri, 13 Feb 2026 19:13:57 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id d6VOHaHZJJFA; Fri, 13 Feb 2026 19:13:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035232; bh=g1YyfDFnh8mjddvU9uXmZt7vWbMIr+xbQBqwraQYBJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9yaamkOSRtQDRYlBkuhbnGOQLwvRRKyfaUvQR5BGgQztU55PWFV0FAYDLfqQzN02 vBp93BXtVPUtEmsKmUx4oSwztg3ZwcU54r/8qfEUYP8HQYtYexrB4LPlf2i5R2hIPK d9qxHNYe5MGiMYYDQgetJE5OOdSZdCThBfsUJh7BSio0C8fUu0W8SySFmyy46BVY7T L0azvCOq63Qyqzn2QXwmNPTpBpnut8OH5+SGbsKBmYunj7XHj8NNFpn8QpYY9H5Zu6 lLjrEPsxtsRpW34DOIwhx+doSzBFhgvc5E7R+b5EPvJADrT4yRVy15kQZOV4k+REtl hAUAqxUilRk3Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1E62B69B56; Fri, 13 Feb 2026 19:13:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:12:59 -0700 Message-ID: <20260214021317.816170-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MBLRCUB6QQ2URZST4X3NQKWTFB6AQPVP X-Message-ID-Hash: MBLRCUB6QQ2URZST4X3NQKWTFB6AQPVP X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/13] examples: ulib: Build shared-linked binaries only when .so is available List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The shared-linked example binaries (demo, boot) are only useful when libu-boot.so exists. Use $(wildcard) to conditionally include them, so standalone builds also adapt correctly. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- examples/ulib/rules.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/ulib/rules.mk b/examples/ulib/rules.mk index c4b0bdb3668..bc677488649 100644 --- a/examples/ulib/rules.mk +++ b/examples/ulib/rules.mk @@ -5,9 +5,12 @@ # Copyright 2025 Canonical Ltd. # Written by Simon Glass -# Generate normal and statically linked binary names from progs variable -all_bins := $(foreach prog,$(progs),$(OUTDIR)/$(prog) \ - $(OUTDIR)/$(prog)_static) +# Generate binary names from progs variable +# Shared-linked versions are only built when libu-boot.so is available +static_bins := $(foreach prog,$(progs),$(OUTDIR)/$(prog)_static) +shared_bins := $(if $(wildcard $(UBOOT_BUILD)/libu-boot.so),\ + $(foreach prog,$(progs),$(OUTDIR)/$(prog))) +all_bins := $(shared_bins) $(static_bins) # Default target builds both programs all: $(all_bins) From patchwork Sat Feb 14 02:13:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1866 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035244; bh=wrvYawvPoCdDjkT8ocT0BeI/wiMiDoyuoikIqyvoJy0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RnJ2yVJU9W65KpG6D9kT7rAhvlwAFrSOW8m+FgYMC7xMK9dXdBJcJhu1pnwZz1tbk P5BOW+inhDFveyRTF4OhS8wZOfmmNZAT+T8+jWSnGRZL3gPGk2OvIlhvoVgtFkbGRg pPgztaz9SbvnUa64d1YJ1JhCb9TGHXGhpZ+P0iXLcqVGKrXMALe5IbuRl33jElbU/f 2KbtsWrGRe33YC9mL6qvcFqzqYGnZbgPg4b4EmwPktXNeCMoJFr3FWaALtyheXv7y8 pkJ1pAQchnYzFB/5b5IlBhf3m3KaPNXAXyDY9yJ++pH48+1m9ijAKi21C++PLoWbO3 WcYdElVwbg+QA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7284569B5B for ; Fri, 13 Feb 2026 19:14:04 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ul5ooT_dEeqt for ; Fri, 13 Feb 2026 19:14:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035244; bh=wrvYawvPoCdDjkT8ocT0BeI/wiMiDoyuoikIqyvoJy0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RnJ2yVJU9W65KpG6D9kT7rAhvlwAFrSOW8m+FgYMC7xMK9dXdBJcJhu1pnwZz1tbk P5BOW+inhDFveyRTF4OhS8wZOfmmNZAT+T8+jWSnGRZL3gPGk2OvIlhvoVgtFkbGRg pPgztaz9SbvnUa64d1YJ1JhCb9TGHXGhpZ+P0iXLcqVGKrXMALe5IbuRl33jElbU/f 2KbtsWrGRe33YC9mL6qvcFqzqYGnZbgPg4b4EmwPktXNeCMoJFr3FWaALtyheXv7y8 pkJ1pAQchnYzFB/5b5IlBhf3m3KaPNXAXyDY9yJ++pH48+1m9ijAKi21C++PLoWbO3 WcYdElVwbg+QA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 62E9869B58 for ; Fri, 13 Feb 2026 19:14:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035242; bh=jppukV/5EtrGpVJC1MRUJ4zRDCwk6NV4lhPpL60/TCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/KZR4Ooz2Cd81bAz6VLS21pGQZE+GsasQNjH5etnCHsNv2hTc5CI9SyTnK4mmzfG wNPMvdRA4+Sqo5qPKJMR/Lmk0gcj9iAgCV1FbvMuUU/p7ZH8Soi1lhll0WckSjB6dF ZG1c4sUZz1VJuINPd+MM4InHYkaf8S9k1qVrkeSdgW8BjJVYkFbtVB5nghf3FHRe+k Db6Y4VjqP5A9yoxvmPKms+kiDdvuQTYbQ8pXBiopa8yapOBnmi6GjLcxeb/gSfpqzm U5JVvwVK1si1VmbIWS+Y9Xv+3BqC8SvSa1lceccKaBnMOTwLNaWWqPdGuAI6f3lak8 FfkMK3FaifmSw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 54B6F69B58; Fri, 13 Feb 2026 19:14:02 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id cedxDFlw3cCb; Fri, 13 Feb 2026 19:14:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035237; bh=r3gqs/JdQn6/XKmOUPxQhDSROKJ9IVyn3/PPNZTLZPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bYSSLBLJTJgCkCRDMEMrIKQBK7AA65S4k1oOFOjG2NEqnBo1YRZWLro6+VKXz07o/ SShSCX9SvMJZC53PTFnXOIWzvKu+LdLteUkg/b+zA5MhSI6LOOpNa24vcTfa1Ui+fI +xgry7uhot2l9j/BsLpXjNkfUyyFUSE5DouPmQ2dGL50E3UzZ6FGWYbWs8bOZvlnYG p9paXgZ7QruKkIr9HTWjYYY+CUID1HHaA36MINxYCjDugv7AXrgQup3Of+welszTG0 LzQ85nu5L6EBTGzUIrpS61IJzP7hu/oWnLEUryg0q8hYlJaU/vl7bWIK++2aFMTQCM yE57MbRfYLXSA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6212C69A69; Fri, 13 Feb 2026 19:13:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:00 -0700 Message-ID: <20260214021317.816170-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: WHFNJHHHAJO4SOXEZUPJBEAVCBECBK66 X-Message-ID-Hash: WHFNJHHHAJO4SOXEZUPJBEAVCBECBK66 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/13] efi: Allow runtime relocation in library mode List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass EFI runtime relocation is needed even when U-Boot runs in library mode, so remove the early return that skips it when gd_ulib() is set. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- lib/efi_loader/efi_runtime.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index bd09d78d047..8c0301e3918 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -718,10 +718,6 @@ static __efi_runtime void efi_relocate_runtime_table(ulong offset) /* Relocate EFI runtime to uboot_reloc_base = offset */ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) { - /* Skip EFI runtime relocation when running as a library */ - if (gd_ulib()) - return; - /* * Cache gd->relocaddr for use by the EFI runtime services after * the OS has taken over. On architectures where 'gd' is accessed From patchwork Sat Feb 14 02:13:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1867 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035246; bh=qt9b860Hi7uFF8Sgh/qajV54AdEtU6rOJ7hab4n66nc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=cP6x61T6bKimotIDOiU3+g6KS6SYbBRUceawsNfw0y96cPhbjytMmIaZ1R9gh3xIs vQKcSxAURVeoa0hVCsgte7J39sw09l0WhG1+SwJDU81UCsIuID22JSigmaI4B3Fntl eEaUCb0X2D8q+D6VJdW/zZp5OQqIeC0V6qidhDK5bJk+s7kYF4aPfKYoVV4qNrMe9p vv9X0MScGPPz/O8MbNTkoAavchqYOui+kR1FqjMO4DRtIyQxRnoW/Jd/vZIJsd2XUX YYHFyB7J/ucG30kA0VdbGrYy5E4yic3MYT5rLJYWNQ8GAKcnxgT3gyUFlfY5Yaolqh WGlWcPoWWqIkw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CC10169B58 for ; Fri, 13 Feb 2026 19:14:06 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7rRQDvPRQSHO for ; Fri, 13 Feb 2026 19:14:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035245; bh=qt9b860Hi7uFF8Sgh/qajV54AdEtU6rOJ7hab4n66nc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=u7/vms0wVis2a/smba0rR5oqd9ATN5S83abpdjK0LdQBAx4KLWdON72VxtkOhfzBq 3hKjRzFFnr/I0g2tsf0w1D/nAlsnBwvmg3AsOu1yyFpXFx6N16VorE5xISN+pmO1mT T3NOotsrkObsMd1QjxUo13e4QLcX5TJ8HJt1xuSuEMKq0UgirGlmTPFY781fT43IZ1 lYfKIBKMZAdAK1iPA71PYp39SPsrUq3AtRO+52mv+esB1XiVrNP9YXOr3QnZt/lC3t qxv8ZkzjQPFCoOURJv8QEig3g9bml5G8dy1ukcQPsunV95DhEmQhEYHEZW81F/qaeI TO7qo5P/KVqLA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4067069B5B for ; Fri, 13 Feb 2026 19:14:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035242; bh=VaipgS5H73k9blM5yZZ55j1k1IbdKdaiDOnbPJiUmz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BZFs5QP6SotW1/fLkllTYhYH62BqPdtWzd5LkdIaofDHBAaIoMUFGu0UzqMXS4oAn 7K7348oUSehNEpJIUeDxfBpp6m4uM2vTIFht/JVU3GO/VnuTUHbNj1DgelZ9IG1x4+ 8NlY0sNC+CnqPZGEQygNsUEGPi6l8yGH9bIwbwSYn93Pj6Z0SLku/8EHGnbxhdcipH IexGJzxqCwFY2y+DQjSGOe2wq6uEduZ4/BcxFwHGp1fQoiXAxyObdYQ3k7SKs9R7pU c4zXI5yFh4k/zetbQi7RDBKBR3Hpqe3hTCGqQaawJiK5XZbklgfhMcQrWaJjXoJx7i TnzyQzKS5tajw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C397F69B5A; Fri, 13 Feb 2026 19:14:02 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ZPSyOArVIKrT; Fri, 13 Feb 2026 19:14:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035242; bh=Npn3vQrKzLXrdEfJv4runrcMCQn/TctwXzRN7vdQf/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pbcvi/zkGvkO3uXltJxsSh5Fyrg95HvinHiiTM3kwD1ieWjGTxl638+OxABys5NK8 YHPs3wJkrv0q4OfBStT4tzL7gmryzlYdvGcPe6zhckzTRunCvAz46vvTzekXgdAEVv SXlwJlp0bCTYCww3BXDTFsZYIwPFd08XlY48o6/3ZpxlJo2pgpFPmhaCtpAHD/wGXK ZyiFnbxdZyKJiJWvn4b4Ky50R3fskNG5DBDjx2b7stVfDHqOtatedFUpYKsRTzZMD3 nq900cu4Bz2AG+SBliALEfEgy6YBrLT0TPVEirFR83r0tzZgnxtetkbQYtkfxNxNdo Lm6IVzm0nOYsw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2E63869B56; Fri, 13 Feb 2026 19:14:02 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:01 -0700 Message-ID: <20260214021317.816170-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OW6M4YGQ43S4IYNVK37W476YUT2TWZY6 X-Message-ID-Hash: OW6M4YGQ43S4IYNVK37W476YUT2TWZY6 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/13] ulib: Replace CONFIG_ULIB_JUMP_TO_MAIN with runtime ulib_has_main() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The Kconfig option CONFIG_ULIB_JUMP_TO_MAIN is a build-time switch that cannot vary per-binary when multiple images share the same config. Replace it with a weak ulib_has_main() function that returns false by default. Example programs override it to return true, so the decision to set GD_FLG_ULIB and jump to main() is made at link time rather than build time. Add a weak main() fallback that enters the normal command loop. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Kconfig | 9 --------- common/board_f.c | 2 +- common/board_r.c | 18 +++++++++++++++++- include/init.h | 11 +++++++++++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Kconfig b/Kconfig index 011f248ba03..ccd62220f0e 100644 --- a/Kconfig +++ b/Kconfig @@ -129,15 +129,6 @@ config ULIB_SHARED_LIB available for SANDBOX builds since shared libraries are not meaningful for bare-metal targets. -config ULIB_JUMP_TO_MAIN - bool "Set GD_FLG_ULIB flag in early boot" - depends on ULIB - help - Enable this to set the GD_FLG_ULIB flag in the global data structure - during early boot (in start.S before calling board_init_f). This allows - U-Boot code to detect that it's running as a library from the very - beginning of initialization. - config OPTIMIZE_INLINING bool "Allow compiler to uninline functions marked 'inline' in full U-Boot" help diff --git a/common/board_f.c b/common/board_f.c index 448cf2e319a..4558fdf297a 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -1031,7 +1031,7 @@ void board_init_f(ulong boot_flags) gd->flags = boot_flags; gd->flags &= ~GD_FLG_HAVE_CONSOLE; - if (IS_ENABLED(CONFIG_ULIB_JUMP_TO_MAIN)) + if (ulib_has_main()) gd->flags |= GD_FLG_ULIB; gd->boardf = &boardf; diff --git a/common/board_r.c b/common/board_r.c index 53851504c8f..ce5aa28b1e5 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -771,6 +771,22 @@ static void initcall_run_r(void) INITCALL(run_main_loop); } +__weak bool ulib_has_main(void) +{ + return false; +} + +#ifdef CONFIG_ULIB +__weak int main(void) +{ + /* No example linked -- fall through to normal command loop */ + for (;;) + main_loop(); + + return 0; +} +#endif + void board_init_r(gd_t *new_gd, ulong dest_addr) { /* @@ -803,7 +819,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) if (gd_ulib()) { #ifdef CONFIG_ULIB /* handle __noreturn attribute */ - if (!IS_ENABLED(CONFIG_ULIB_JUMP_TO_MAIN)) + if (!ulib_has_main()) return; #endif main(); diff --git a/include/init.h b/include/init.h index 4e2155abb22..8a4e23403cc 100644 --- a/include/init.h +++ b/include/init.h @@ -392,6 +392,17 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); */ int ulib_init_with_data(char *progname, struct global_data *data); +/** + * ulib_has_main() - check whether an example main() is linked + * + * This weak function returns false by default. Example programs override it + * to return true so that U-Boot can set GD_FLG_ULIB and jump to main() after + * initialisation. + * + * Return: true if an example main() is present, false otherwise + */ +bool ulib_has_main(void); + /** * main() - main program called from ulib * From patchwork Sat Feb 14 02:13:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1868 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035249; bh=01n/hHASp0HatVX7X2ZnWQD2+Ab+U/DErqX83mEndQI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=u1i7Q5xJJNskkxNCFTyzlUuOMp4hSEnGtHfvGTEhs0M2AiYaNOR9E5UTOFR6I7Gq+ KV5VXn1239ogqu0LLE+dtiVJqsbSCnXhAuMnKuysM8MciVvaVZ1hWHY8kx4R0BKTGL xeSvg6vQ8Bc94vh7bMTBB/EIUqO8NVpRjd/EfmNlo/l73PDiffV+aPeZJdLhpgQ0Hs J0te4+LhSWiDIz77l3sZCHRLDe3NWKO+ypzQSkThUZUqXkNWe4wPzs4FESVoiABr4N bWWcX1Er38+OcZMlpszxaR8BGd5u4CLmHzGmlq9kVvV7y901Tqp2LyAoJhK5rm7SFy 96kbl97cPfiCg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B865869B5B for ; Fri, 13 Feb 2026 19:14:09 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id frccfVtA4JXF for ; Fri, 13 Feb 2026 19:14:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035249; bh=01n/hHASp0HatVX7X2ZnWQD2+Ab+U/DErqX83mEndQI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=u1i7Q5xJJNskkxNCFTyzlUuOMp4hSEnGtHfvGTEhs0M2AiYaNOR9E5UTOFR6I7Gq+ KV5VXn1239ogqu0LLE+dtiVJqsbSCnXhAuMnKuysM8MciVvaVZ1hWHY8kx4R0BKTGL xeSvg6vQ8Bc94vh7bMTBB/EIUqO8NVpRjd/EfmNlo/l73PDiffV+aPeZJdLhpgQ0Hs J0te4+LhSWiDIz77l3sZCHRLDe3NWKO+ypzQSkThUZUqXkNWe4wPzs4FESVoiABr4N bWWcX1Er38+OcZMlpszxaR8BGd5u4CLmHzGmlq9kVvV7y901Tqp2LyAoJhK5rm7SFy 96kbl97cPfiCg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A73B469B58 for ; Fri, 13 Feb 2026 19:14:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035248; bh=mOmP1Et7UNIPWMSvQlQpB+5jjaRsrK6SDVwHGSfLIzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4HoRCz9KPN/S5Xc8NoKDfz4UGCkKETtxqQJWwZyQAsTZRpXaKi0kEdqqvUmvcSuE 73puo4XksAr2lmA/orEfulkZSbo4333yybqor70Jb6n2nlL0/avKogg80rNAyiksro ggvFJwYaTEHiKNW9x1Hze+sS3np4a8a9zWH+8hQpjjoVxYh0rPUW0AFdO/PZohQ8r4 Vkyv+efBgF9l7PhJFltEOyk+xZas7t3iL95+zYCuFK453tlz2G5NfsZhuUqY+mBnV0 +7PTJiRNdhlZEIdKFlQB6XxBVpHc5VWAMKzsJkv7G8B/03eqcLR1UHj59/+fAYf9qM /vJxqRilGP89A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1E7A569B56; Fri, 13 Feb 2026 19:14:08 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id cMJu_tZ7QYr9; Fri, 13 Feb 2026 19:14:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035243; bh=W8hvo+Nb2SU9XH7WCQYOGbKaiNcQW/UocJ6Pu9CZ7HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFQ30BYBNj1Ut+rS3qjbZ9TRECcbvJoVAiOjhykEvrRnmU3KStvFYhqgkKD8UjsTz rCIcLa6RJhce3YnQ0PBNfz/g3QDG0AWXdiSdMDRsiyMviSCta0ov2oCvacYzgh1OGH dwJr/NnxcnarY5zQVutf9SR1I6ZsiNLPAwcO01BTYxpqal0am6anghhTqXvHfTTXJ+ y6LOAlxjN54PPlEYbukqZE6vCR1MBiTXPXXdqIhjz1Dbz5mU1GFnRwHf31xHE+uxGX yrkjVaDZq8OQDkidxEQ/rWfn/jBZ/f/9tJbGZz4bWYBzPMeiFBZ859BnT4M+sQBZrt P7Yu0bUPvZ/Mg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4A15D69A69; Fri, 13 Feb 2026 19:14:03 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:02 -0700 Message-ID: <20260214021317.816170-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5ATQAK2GF66IDBBRUS7TBBY2VE4Y3ROR X-Message-ID-Hash: 5ATQAK2GF66IDBBRUS7TBBY2VE4Y3ROR X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/13] Makefile: Extract u-boot-link helper for reuse List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Factor the u-boot link command into a parameterised u-boot-link macro that accepts extra objects and a map-file path. The existing cmd_u-boot__ calls it with empty extra objects and u-boot.map, so behaviour is unchanged. This allows arch/x86 example builds to reuse the same link logic to produce binaries that override weak symbols in the main u-boot archive. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 26ecf59a98a..e61e1c7fe94 100644 --- a/Makefile +++ b/Makefile @@ -1831,33 +1831,40 @@ endif # Rule to link u-boot # May be overridden by arch/$(ARCH)/config.mk +# +# u-boot-link is a parameterised helper shared with arch/x86 example builds: +# $(1) - extra objects to link alongside $(u-boot-init) (empty for u-boot) +# $(2) - map-file path ifeq ($(LTO_ENABLE),y) quiet_cmd_u-boot__ ?= LTO $@ - cmd_u-boot__ ?= \ +define u-boot-link touch $(u-boot-main) ; \ $(CC) -nostdlib -nostartfiles \ $(LTO_FINAL_LDFLAGS) $(c_flags) \ $(KBUILD_LDFLAGS:%=-Wl,%) $(LDFLAGS_u-boot:%=-Wl,%) -o $@ \ - -T u-boot.lds $(u-boot-init) \ + -T u-boot.lds $(u-boot-init) $(1) \ -Wl,--whole-archive \ $(u-boot-main) \ $(u-boot-keep-syms-lto) \ $(PLATFORM_LIBS) \ -Wl,--no-whole-archive \ - -Wl,-Map,u-boot.map; \ + -Wl,-Map,$(2); \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) +endef else quiet_cmd_u-boot__ ?= LD $@ - cmd_u-boot__ ?= \ +define u-boot-link touch $(u-boot-main) ; \ - $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ - -T u-boot.lds $(u-boot-init) \ + $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ + -T u-boot.lds $(u-boot-init) $(1) \ --whole-archive \ $(u-boot-main) \ --no-whole-archive \ - $(PLATFORM_LIBS) -Map u-boot.map; \ + $(PLATFORM_LIBS) -Map $(2); \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) +endef endif + cmd_u-boot__ ?= $(call u-boot-link,,u-boot.map) quiet_cmd_smap = GEN common/system_map.o cmd_smap = \ From patchwork Sat Feb 14 02:13:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1869 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035254; bh=uIRMcZXtuu1ZzPI8E2m1DyZYCEAka/WmNi9Fx7BqflU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DE8FncXrt6BJY6XkRqMPuXl+QSXJn5Sk5fewpzKnrAJZbAGJu68MrmoXIzKJA5GbJ NbpZQ4wFU+/6S0TkirVJn8PJD72gxfxL41gg/zSpoD4tT8FmzxRVVwg91kAdwsszlX /GhBFJJTJ34RsgCOldTpIwzLGd8X0QRBOdR0Ne7D5LKHTmKi56Hn2wIVeQYsPWmqtH 10EFrSMja9LmjxUWxJRtx+fe4kOabIwc6buVIAcLJLqeW0Abp6ILX9o+IyZQawomOQ GY1UAKUs2TBB5zUkwNaTDCmfbWd5eG5XwY/RSWepYm6Sd279uUfjx6h2+7O09EsW3O W1NIeibEggwDA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2A2D469B5B for ; Fri, 13 Feb 2026 19:14:14 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 6-3dMHuLUKtG for ; Fri, 13 Feb 2026 19:14:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035254; bh=uIRMcZXtuu1ZzPI8E2m1DyZYCEAka/WmNi9Fx7BqflU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DE8FncXrt6BJY6XkRqMPuXl+QSXJn5Sk5fewpzKnrAJZbAGJu68MrmoXIzKJA5GbJ NbpZQ4wFU+/6S0TkirVJn8PJD72gxfxL41gg/zSpoD4tT8FmzxRVVwg91kAdwsszlX /GhBFJJTJ34RsgCOldTpIwzLGd8X0QRBOdR0Ne7D5LKHTmKi56Hn2wIVeQYsPWmqtH 10EFrSMja9LmjxUWxJRtx+fe4kOabIwc6buVIAcLJLqeW0Abp6ILX9o+IyZQawomOQ GY1UAKUs2TBB5zUkwNaTDCmfbWd5eG5XwY/RSWepYm6Sd279uUfjx6h2+7O09EsW3O W1NIeibEggwDA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1923569B58 for ; Fri, 13 Feb 2026 19:14:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035252; bh=Hj7NiSlPwo7QNmTjSKJ5C45NZSO344y6B6fqBeUyfQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJPr6L6nozsCZMdO9y8bYpVmga3IVtZB908lm+cD/APxVQ/vSDfi8xNecwZuBVHNe FhrNmb2QqQ6/Pp4RApFZtLy+c0KnqiRfXKJdsHRKQt49LW62M/+qBTA66y4eZr4eam jzzNZzgHmvTHDOPF+/KwEaFgLDmN/2W4SVoajo8/HEKsjmEN7dA7NRh5a10Wy/4xZL lTPfczJu1d+B+gbMYBlf/Cz8uUYPYWDEDSnQ/k1uRX3UgqvYk7hHjWFUJayyGFLIKy CpeOtRoQYlZthKp9bCYd/RZySMirm0v8QmPUWzjToe/8DCLj+s6WKRI5stcvradDaa gwGJBFP6UTzQQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 808B369B56; Fri, 13 Feb 2026 19:14:12 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id D5-D6z1595F8; Fri, 13 Feb 2026 19:14:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035248; bh=IJYwtbozy190/a0KuMSRoawJzn1FTyXDr74DRv8+uPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsJMi5hWzcyJVtbiNfB3F/pTnOnlrCQdgi3u3XTLdi6KZkIfV6UtpM3Dc8dqxBTVr CYP+rATqODJvE6Q2Cp9MkABQzSSHolCm5PrLN5AO2z2hgGC0uoLvl3TxPNxIMMNqTW +mgeDpxJnPMQRRbJT0+oDhc2LmhmJh7+xSP+d44Gte0vyWRSzjv1Jnvuoxr05iYS57 0wNQxeh41Zr1W/r1QSiaikeS1r5E3uUzaxi6OE8AXe+M4k+QRmN3kF3FA2jSqYubda 3UPEqSAMCDyZ1yAPk/tm/W2EfEXMMugEmjVmnAUPr3wqwxKsXRD0pkASc9TBGHvjva 65+uXY2Cfth+w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 37DD369A69; Fri, 13 Feb 2026 19:14:08 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:03 -0700 Message-ID: <20260214021317.816170-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KNBES3IDYX3TWWDPA4UNFM4MMYAJHWQJ X-Message-ID-Hash: KNBES3IDYX3TWWDPA4UNFM4MMYAJHWQJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/13] x86: binman: Extract common ROM entries into a template List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The x86 ROM image (u-boot.rom) contains a set of entries that are common to all x86 boards: the start16/reset16 vectors and image-header. These are currently inlined in the &rom node, making them hard to reuse. Add a 'binman' label to the binman node and use it to add a rom_common template containing these shared entries. The &rom node then pulls them in with insert-template, so board-specific dtsi files can also reference the template. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/x86/dts/u-boot.dtsi | 66 ++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi index c26b855edc9..630f85db31a 100644 --- a/arch/x86/dts/u-boot.dtsi +++ b/arch/x86/dts/u-boot.dtsi @@ -7,7 +7,7 @@ #include / { - binman { + binman: binman { multiple-images; rom: rom { }; @@ -15,12 +15,43 @@ }; #ifdef CONFIG_ROM_SIZE +&binman { + rom_common: template { + end-at-4gb; + sort-by-offset; + pad-byte = <0xff>; + size = ; +#ifdef CONFIG_TPL + x86-start16-tpl { + offset = ; + }; + x86-reset16-tpl { + offset = ; + }; +#elif defined(CONFIG_SPL) + x86-start16-spl { + offset = ; + }; + x86-reset16-spl { + offset = ; + }; +#else + x86-start16 { + offset = ; + }; + x86-reset16 { + offset = ; + }; +#endif + image-header { + location = "end"; + }; + }; +}; + &rom { filename = "u-boot.rom"; - end-at-4gb; - sort-by-offset; - pad-byte = <0xff>; - size = ; + insert-template = <&rom_common>; #ifdef CONFIG_HAVE_INTEL_ME intel-descriptor { filename = CONFIG_FLASH_DESCRIPTOR_FILE; @@ -163,30 +194,5 @@ offset = ; }; #endif -#ifdef CONFIG_TPL - x86-start16-tpl { - offset = ; - }; - x86-reset16-tpl { - offset = ; - }; -#elif defined(CONFIG_SPL) - x86-start16-spl { - offset = ; - }; - x86-reset16-spl { - offset = ; - }; -#else - x86-start16 { - offset = ; - }; - x86-reset16 { - offset = ; - }; -#endif - image-header { - location = "end"; - }; }; #endif From patchwork Sat Feb 14 02:13:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1870 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035256; bh=MiAemH0DLZMZTZyYNiughL2iEleIGXvnbZD5B9d4vRI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vy+4s6ZbLfIXpdWEP/sXPoZve8R+SBNckGIIkNn/fSwClW7Ju4j2+DeVMmGqwt94+ xBO9XhvHL6ep3AMjNziqbdSbsPCAM6pM+LdC3DcgsZVJCOvb1H29BwLpqH4x7BLjhl 3N4bisYXNbWItE3ySr11TqizLlM3nRy2EnJDU/CFc7fAiRDvdngTu+oWc0UfdyBG8A 378+AQqU7qo+AH1VVx/fa2YzHn1DmyKkyEOiSJtMDopHpywoRQ5hR3iqo8tfAsWI8l RA5UoFRmzxph2X6cDUOMsiHSZDebScgFTeZg01nkvg6QkLE+4g+kRU4imsT8fUyGQk xPN2OR+OipnOQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8604369B69 for ; Fri, 13 Feb 2026 19:14:16 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id V7G0u9RclDW6 for ; Fri, 13 Feb 2026 19:14:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035254; bh=MiAemH0DLZMZTZyYNiughL2iEleIGXvnbZD5B9d4vRI=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=O1C0NcjlpmOsDkYgGlh5Il0eYp5plmHZRZgnADZdzhmviCxOkHxW3+4P1QqKBpSPB i7qdY1q3fbHHtMWrrpPfU8u+6LtgesrRoXQMyNkkjzEy8pQYftg/8UYCIXMLdJFrkO c/WP4Xc7sfesKLnPe9YbsiNkELEie/uAx7GNPuNBigg4PxtBjvLzZPW3CI573wk4Fd 0pI037Jr04RQ+l2/L780b6K2NIDLvsPUZPXpf8orZgdgpYmDzBn6OTIXHnQ3ljr2ns DdRKJPB4QxulOORVaubMYNblJG1H/Ph8/exICxQBgHnRpS3Drz2abFJPmkqVzxXGol PU3YovglRKwKg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7F8A469A69 for ; Fri, 13 Feb 2026 19:14:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035253; bh=8mXUVF3wIZw3Y9jH9a2p2RL8gtxMuP9W4EsgMmOVRnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m7APGr9+pHj4QlonGkktugAGXz0wYmt2/KAKAQQykp09NDZ/dRZFA8/DITma37Tag EM+WbHPjqFWqBgAZqSGlr+RaB9MapYlNUZYA43QdskYV6p1v6B8R/PeEq13/1Malc9 diID7kPMYE47Ww7AM+l+ebHk/iRZhMPJUHN9uKNxEZu3EOnmnC8swpXLKvXwWZTrq3 L8NjjgfPEQ7Kx2+rI9xXhmonA+FySdRM4K/bMBcjARAzvH7MQgkjuh1ENPXuDuDntw wn01LVxNJLgiKodh7SbI+7DR1ilIHb7FTNGmUQQxQ0+W2J+GthYsqskcFVg537FYA5 xbgcvgzvUQb0A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A7F0569B56; Fri, 13 Feb 2026 19:14:13 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 1tonq2rUbULS; Fri, 13 Feb 2026 19:14:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035253; bh=+ex/23NgZh1FKxIQcdJ2O49dQiwOpehkLoznBuMw/a4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWZlQ7DaZUZy31DcYc0dNx89K59NJ5AZCzcbTHmQ/n7GGb1MsaFjBeQETGx+vaSkK 1R6fq3l/Rk2uZy3ClwK2UWrwjolJ2zT/nFOD4S9eY3TEIlsq+YRs4UtUq4YbJ87V3V 18MBR/i28bcoYuXsSELc67z/V3BRwu+rQReGoUDlm+w/YjfwNm3ke+PcWfGVJHk6os T0UoK7Es9q3zovMEnbpasUXazMenQg7W1dWqBvTMl7e8FHe2bM+ny3SYzaWahvbwT6 ePnZJmSN+zFBxSIzF1EDANF/gtvwDQEacJIt7XNseM1udRuoDZtBQLGO5zf4TDyijt GwaZWXuHs/KHQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 07F9069A69; Fri, 13 Feb 2026 19:14:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:04 -0700 Message-ID: <20260214021317.816170-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XNWDAG5B4CTUF6P5RY3YXUDHF4XH72I6 X-Message-ID-Hash: XNWDAG5B4CTUF6P5RY3YXUDHF4XH72I6 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/13] x86: ulib: Add build infrastructure for example/ List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add the kbuild and Makefile plumbing to compile and link ulib example programs for x86: - examples/ulib/Kbuild compiles demo objects via kbuild (not linked into u-boot itself) - examples/Makefile hooks the ulib subdirectory for non-sandbox builds - arch/x86/Makefile re-links u-boot with the example objects using the u-boot-link helper, so the example's strong main() overrides the weak default, then objcopy produces a flat binary Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/x86/Makefile | 32 ++++++++++++++++++++++++++++++++ examples/Makefile | 4 ++++ examples/ulib/Kbuild | 6 ++++++ 3 files changed, 42 insertions(+) create mode 100644 examples/ulib/Kbuild diff --git a/arch/x86/Makefile b/arch/x86/Makefile index e8813aa7e28..7df20c43de1 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -64,3 +64,35 @@ u-boot-x86-start16.bin: u-boot-x86-16bit.elf FORCE u-boot-x86-reset16.bin: u-boot-x86-16bit.elf FORCE $(call if_changed,objcopy) endif + +# x86 example targets: re-link U-Boot with example objects providing main() +# +# The example .o files are compiled via kbuild (examples/ulib/Kbuild). +# This re-links u-boot with those objects so the example's strong main() +# overrides the weak one in board_r.c, using the shared u-boot-link helper. +ifdef CONFIG_EXAMPLES +INPUTS-$(CONFIG_ULIB) += examples_x86 + +PHONY += examples_x86 + +X86_EXAMPLES := demo + +quiet_cmd_u-boot-example = LD $@ + cmd_u-boot-example = $(call u-boot-link,$(example-objs),$@.map) + +# Per-example object lists (matches examples/ulib/Makefile:demo_objs) +example-demo-objs := examples/ulib/demo.o examples/ulib/demo_helper.o + +# Link each example ELF (depends on u-boot to ensure archives exist) +examples/ulib/demo: $(example-demo-objs) u-boot FORCE + $(eval example-objs := $(example-demo-objs)) + $(call if_changed,u-boot-example) + +# Binary targets (same objcopy flags as u-boot-nodtb.bin) +OBJCOPYFLAGS_demo-nodtb.bin = $(OBJCOPYFLAGS_u-boot-nodtb.bin) +examples/ulib/demo-nodtb.bin: examples/ulib/demo FORCE + $(call if_changed,objcopy) + +examples_x86: $(foreach e,$(X86_EXAMPLES),examples/ulib/$(e)-nodtb.bin) FORCE + @: +endif diff --git a/examples/Makefile b/examples/Makefile index 50bef4e6157..21c703d144b 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -8,4 +8,8 @@ endif subdir-$(EXAMPLES_STANDALONE) += standalone subdir-$(CONFIG_LEGACY_API) += api +# Sandbox examples use the standalone Makefile; other archs use kbuild +ifndef CONFIG_SANDBOX +subdir-$(CONFIG_ULIB) += ulib +endif endif diff --git a/examples/ulib/Kbuild b/examples/ulib/Kbuild new file mode 100644 index 00000000000..88d6a805b91 --- /dev/null +++ b/examples/ulib/Kbuild @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Example objects for x86 platforms (compiled via kbuild, not linked into +# u-boot). The standalone Makefile is used for sandbox builds instead. + +extra-y += demo.o demo_helper.o From patchwork Sat Feb 14 02:13:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1871 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035260; bh=HwYR8Nh2gElFwb035cgWjSnp98R2WglBSPzfC7p+Qyw=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=T9m5A7hTqTCAiTkjxKUy04/8yeQZCkjBUmt5NfbmzOLpXQaOq5C1PpXd6/RPkTW6+ z4virAihracFjjKIhjvsgtzLEnUL+dLMel2pl9h8eTJLfOtQV8eKCECAhYMVx3a3dD lxTiwmIHNIF8Dswd5azN7rpz5NkwTxeAI0hI19zQjtITuh2x7qi1qGtT5sdjh8uv3d a2mL+S7MhciUgzwoboIcU+QHrr+WhPqF/DApqeIagxLFQ9izAeWxAy1lsyzZMTcaZs TEVuzpdUJbjpy9NTaxNPcP1HikjFR/Th2YWGFNe7p8sUCzLKYcMcwL0VjpfrCl8G7c WYg04QxebC+/w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 46DBE69B5B for ; Fri, 13 Feb 2026 19:14:20 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1emo3uaXWJC2 for ; Fri, 13 Feb 2026 19:14:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035260; bh=HwYR8Nh2gElFwb035cgWjSnp98R2WglBSPzfC7p+Qyw=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=T9m5A7hTqTCAiTkjxKUy04/8yeQZCkjBUmt5NfbmzOLpXQaOq5C1PpXd6/RPkTW6+ z4virAihracFjjKIhjvsgtzLEnUL+dLMel2pl9h8eTJLfOtQV8eKCECAhYMVx3a3dD lxTiwmIHNIF8Dswd5azN7rpz5NkwTxeAI0hI19zQjtITuh2x7qi1qGtT5sdjh8uv3d a2mL+S7MhciUgzwoboIcU+QHrr+WhPqF/DApqeIagxLFQ9izAeWxAy1lsyzZMTcaZs TEVuzpdUJbjpy9NTaxNPcP1HikjFR/Th2YWGFNe7p8sUCzLKYcMcwL0VjpfrCl8G7c WYg04QxebC+/w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3543C69B58 for ; Fri, 13 Feb 2026 19:14:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035258; bh=O9hMFu0Qy/d856RZN6PfvxFJ0h7UGUL43PHaPPI4m9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjqdhjEdeUqw5GYUD2/1Q3n2mBJWVtvb8FJoUlP61Agmg5QgdekxhPj5eSC5vqPJr PI5oAFOK6fGu2Sg9ScEtIT4fpVBhtSyOD3jFr99L6ChIvbT/vTJH+JP9vD4QuPJT5d xMTBxGE3vW8QCPOuVa9QUe+IRx3jQXLp8Qq66MdqOtUpKpVfKtNHpQjHSkz/hH30Ca q57nqlmagkPZUHgexWNebuuZpy2zOZulbDqGG0dO6jbNFlRifk41fPydHJk4xFDTWy vOkpxsDzCJkU4RLBbn8PFROxaTETGz0ZjQ4sA4QQs3201PaxHranq/7XSwk6fCmgD5 n0G+EKdlt2iJw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CCE7B69A69; Fri, 13 Feb 2026 19:14:18 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id bTJJAmEhRQTV; Fri, 13 Feb 2026 19:14:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035254; bh=4JGx93i+tnfH3SwHguG8JCrY9plIyIzARmCJhtgyPVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFkerxewAW/E+Kzg5J4xhWQaw2nra59zZTnloJubppv8qZHJZXppB4Um2q0IiEVMW 5i+7s/Sv7Ma2QvlRS7a66hmIvI1EcncQh72n/USd2fQjl2QzSGLCEFabGAoHKoEJ5a 1xMQLxwABfjHEkQKi8qUQGl9Y9/BIAxB1FxE1Fz0n6/bf3Jp41KbN6BVSoMGnrMTl/ oG0kADhNH9aRzZv/eaQ53iAN6KmQKdFfF5FRJomlsh66Vs2I21Q/P0H9HYbeZf2chz H722t7+aEkePlkHbmYevwSDFlp/5v0+Il6e1C+T65AUm03N/J0YCeahDka3IRHWdTF q+g/DpoE7/Nnw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2D3E769B5C; Fri, 13 Feb 2026 19:14:14 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:05 -0700 Message-ID: <20260214021317.816170-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PRY6XOB7VOGZCJHCYZN55KLNVV4MUMXO X-Message-ID-Hash: PRY6XOB7VOGZCJHCYZN55KLNVV4MUMXO X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/13] x86: ulib: Add demo.rom and enable examples for qemu-x86 List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a demo-rom binman entry that reuses the rom_common template and packages the demo example binary alongside the device tree and fdtmap, producing a demo.rom that can be run on qemu-x86. Enable CONFIG_EXAMPLES in qemu-x86_defconfig so the demo is built by default. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/x86/dts/u-boot.dtsi | 18 ++++++++++++++++++ configs/qemu-x86_defconfig | 1 + 2 files changed, 19 insertions(+) diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi index 630f85db31a..69925c49c49 100644 --- a/arch/x86/dts/u-boot.dtsi +++ b/arch/x86/dts/u-boot.dtsi @@ -195,4 +195,22 @@ }; #endif }; + +#ifdef CONFIG_EXAMPLES +/ { binman { + demo-rom { + filename = "demo.rom"; + insert-template = <&rom_common>; + + blob { + filename = "examples/ulib/demo-nodtb.bin"; + offset = ; + }; + u-boot-dtb { + }; + fdtmap { + }; + }; +}; }; +#endif #endif diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 30b69908988..2275ff9de1a 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -14,6 +14,7 @@ CONFIG_SMP=y CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y CONFIG_ULIB=y +CONFIG_EXAMPLES=y CONFIG_FIT=y CONFIG_BOOTSTD_FULL=y CONFIG_BOOTSTAGE=y From patchwork Sat Feb 14 02:13:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1872 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035264; bh=7M+fSrGCqxBWx2CWvBLy+/Ce6rrkFyWchmfDIbYWgAE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=r/GVtvuJKOTuvCGu+G35F5Q8VPacCreWuafBFw1m2M6mWBMq9DyG0/OeLcTy6Yz0v E8nGqLiBPYjK+7NFnQ40XinjEIKy8CSE2hCZIU87lJfsGChtBCJW+bKra7EPbNldpF LkGAZykyvR5I+RVxvunqrNkm6aR+kcqjpXFVsyEf58vHLkPR9ya6ZFUUSQNKh99l8D cL62MOrMx7+bvA1AcIQuTh6J/zeSb0WFXKs/jUWv7eGx1hdAERICdCkys7FPPtXxL+ WrtcWvjTODBVsvreW92hmIjo7Vj3qzDe9kPd+rYud5inMPKtO5x8NkhsHM1fOnQjlc aP3DwvolmAyfg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3E0169B5B for ; Fri, 13 Feb 2026 19:14:24 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id twP4iuVwOHeU for ; Fri, 13 Feb 2026 19:14:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035264; bh=7M+fSrGCqxBWx2CWvBLy+/Ce6rrkFyWchmfDIbYWgAE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=r/GVtvuJKOTuvCGu+G35F5Q8VPacCreWuafBFw1m2M6mWBMq9DyG0/OeLcTy6Yz0v E8nGqLiBPYjK+7NFnQ40XinjEIKy8CSE2hCZIU87lJfsGChtBCJW+bKra7EPbNldpF LkGAZykyvR5I+RVxvunqrNkm6aR+kcqjpXFVsyEf58vHLkPR9ya6ZFUUSQNKh99l8D cL62MOrMx7+bvA1AcIQuTh6J/zeSb0WFXKs/jUWv7eGx1hdAERICdCkys7FPPtXxL+ WrtcWvjTODBVsvreW92hmIjo7Vj3qzDe9kPd+rYud5inMPKtO5x8NkhsHM1fOnQjlc aP3DwvolmAyfg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A32C869B5A for ; Fri, 13 Feb 2026 19:14:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035263; bh=7cqwD4vpp+KTNmvIQY69LSHZb4bk73fAJyvSujz5KiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRrl43DLz5lwL79b/GH/IxY8eUQMKMcpMhjRr3iFwc/9p10HSHYkxfAqEFGOHTCah xTBREQrEtWOxJcft3U+lKuPN8vC5cS3ZN8CBZgnD74Hlv2Zz9r8xGkOByh3qEePwED NDqOtVW+ucVGP5BqsIWY8zxBGfIeNtMK9obuCdw9IQRu8kth4ZutaL0xuNSnIUcYtO fBZfhbx6OvvL0zp7O+/NZHLU2lTEeraZdb/CMlFtMS3kW68DMcKhXXM8vVrU8VlW08 tWl7TlIqs0/sBaipUZ89E6utrTP4uN0ftsS6SOyWPV6IL830iMg/sq4KO9y9CubOoo PBfKzwOedYmIg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 730CA69A69; Fri, 13 Feb 2026 19:14:23 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id xG63ottgMcon; Fri, 13 Feb 2026 19:14:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035259; bh=YaGTzs5mhN2Isg35ZJL3vjZJzBt/NcmhWlppP4r0vpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UYAwl23hoNUiyDxq4OIQwbFAM9blEaR6vQ2mo1vKYCve9DIbzrtWfZMtNPrxqkAxd 78q8073kAmI8p9VTOx8FFPoHJhvTtnecIysK5GMlpQ5j2a8+XvKuVjcsZ1NQG5cqbw +DZ9IVACFMxGDmfhnBrPOm062YohHjAhqX5NaFWXbsbJ7YUFQp1e7o73K2XPGJNu1X Bq2/GxSPm0GP46BrR5b/52yVG7JXvPql1zV8Vk5Wm6PG8QeQYuCRrW8bTBEXNNYLSp 0LvMifjNxgZK7ASaysVKbA9uBbSsY+rs1Uuckn8IgI9Au3PV0fEFBJAOzITXKqS1sX 3T4EOcx1lJ9IQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 07B4869B56; Fri, 13 Feb 2026 19:14:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:06 -0700 Message-ID: <20260214021317.816170-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: LN5TPJCAZJLREGHU26G35L64CXTXBW6U X-Message-ID-Hash: LN5TPJCAZJLREGHU26G35L64CXTXBW6U X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/13] Makefile: Only run standalone ulib examples for sandbox List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The examples_ulib target invokes the standalone Makefile in examples/ulib/ which uses sandbox-specific headers and linking flags (e.g. -lpthread, -ldl, arch/sandbox/include). Running this for non-sandbox builds like qemu-x86 causes compilation failures due to missing sandbox-specific CONFIG symbols and GD_SIZE mismatches. Non-sandbox architectures already build ulib examples via the kbuild path (examples/ulib/Kbuild + arch-specific re-linking), so guard the standalone Makefile target with CONFIG_SANDBOX. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index e61e1c7fe94..f1fdace661d 100644 --- a/Makefile +++ b/Makefile @@ -1061,11 +1061,13 @@ ifeq ($(NO_LIBS),) INPUTS-$(CONFIG_ULIB_SHARED_LIB) += libu-boot.so test/ulib/ulib_test INPUTS-$(CONFIG_ULIB) += libu-boot.a ifdef CONFIG_EXAMPLES +ifdef CONFIG_SANDBOX INPUTS-$(CONFIG_ULIB) += examples_ulib examples_rust endif endif endif endif +endif LDFLAGS_u-boot += $(LDFLAGS_FINAL) From patchwork Sat Feb 14 02:13:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1873 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035266; bh=OudJiVrQE1YphAGGRpRRS5Qy2/LUGfvfhSuH2kDZtoU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=M6wKu3OyU0CkVWOBivBMtpxlolLoDk6pRzZr1+XHwFiT07NMZaqTkRh/cOClouFfL 4oO6UgZgBlbEVhTgABBxRwDzz9ugspoCuw4Cl4tBpMWxpudGlSieiU557gamiUyl9f O7vSzod5pFsptO+TR66X2ALSUdZOH4wszjcNS1OojdWwkt70V6u8TY1cJ8wDVVcxy+ tKai4Gcd5S75JQkNwBRdRUUmgorvanViUs6JyBB+6YA8k6ifU2QtAgBo0b57nSrDkc HxNDPpvXMUi98q9Bl80JVRC4tNe9W43dLLNFpEpv9Aj90txgyeO7FBskUO1v1QSG52 nFpfTxUZN+vrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2E74669B5A for ; Fri, 13 Feb 2026 19:14:26 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tRLCVqEUsjAH for ; Fri, 13 Feb 2026 19:14:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035266; bh=OudJiVrQE1YphAGGRpRRS5Qy2/LUGfvfhSuH2kDZtoU=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=M6wKu3OyU0CkVWOBivBMtpxlolLoDk6pRzZr1+XHwFiT07NMZaqTkRh/cOClouFfL 4oO6UgZgBlbEVhTgABBxRwDzz9ugspoCuw4Cl4tBpMWxpudGlSieiU557gamiUyl9f O7vSzod5pFsptO+TR66X2ALSUdZOH4wszjcNS1OojdWwkt70V6u8TY1cJ8wDVVcxy+ tKai4Gcd5S75JQkNwBRdRUUmgorvanViUs6JyBB+6YA8k6ifU2QtAgBo0b57nSrDkc HxNDPpvXMUi98q9Bl80JVRC4tNe9W43dLLNFpEpv9Aj90txgyeO7FBskUO1v1QSG52 nFpfTxUZN+vrQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 18FCA69B56 for ; Fri, 13 Feb 2026 19:14:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035264; bh=M/zTsI2pFzTMuggLq848vftST5I3e1wxd0NM3VKuBrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtyngzyr3lY5fbhaXjYNk3fhrAOet7+4WgLNzBtWiFytOFvlT07Zs1fjGEkF+d/rn lRjyacrk/wCkKVK85jhWhK2Ga/Dlt7OJuUnh0gkLB7NICnmlmFLFaTrn4JmkDJPVna wz51nNLj8FOO6b/0FdVBHLh6+96k7VvxiKcPbntBwWPWSpS3ry24KNK0AtAaY8Gs+c QPIB70srwLt2YOFh0/ZtXOZC0qaH2DXErQIpW9zHMfZYHzpzPSBTY/1ZhRLhwvZnEX +6dE1ctX9h2CSGbjoFwrW09zCqeRgpJp0SEfIkYfBDOtBPzAwDspZJ48VJ6ZZqmOYS qcfyvC+JiIHog== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A142569B58; Fri, 13 Feb 2026 19:14:24 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id MgRe1GxDXsAm; Fri, 13 Feb 2026 19:14:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771035264; bh=x7jAJ3cuMH3mCuAkZRFjMGgqHuh6+c5l8ewW8/d7XBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hYwnjHNhlXf3nbTkKieUOoFnZ6SPZ1f/jTWxzS2Pdafy1yzzhQO7qKAWPX4u/Culg c0I7rakAEiffZd57DuOiktVSfGrc93eQJ/nbK/0X4MhCyiAaoRDLKYqrmnro7Z6nof 755B0m5iDeRYzEgH4snHaExqPVyurbqB8H6t38SSGHCeqVuq6yuTXeSUZqdNfTSuqx XpF82Ht7mOqzRBvYYMSXHDDh8aNo/Eho8oQ5rhSlRU/6OUDjbumu7P2R8SASTdnoem s/NiaANcRodkR5VgGEKoKiFHBOJEHCQZMKF+GKms8G18c7f7yaZuD12lSxOPfiP2Gn 7Vnna+jMEhrTg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 08D0C69B56; Fri, 13 Feb 2026 19:14:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 13 Feb 2026 19:13:07 -0700 Message-ID: <20260214021317.816170-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260214021317.816170-1-sjg@u-boot.org> References: <20260214021317.816170-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BKVKHCYFZGHUV3TRSWTVOPLRN4HG3Y4L X-Message-ID-Hash: BKVKHCYFZGHUV3TRSWTVOPLRN4HG3Y4L X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/13] x86: ulib: Add pytest for demo.rom under QEMU List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass There is no test coverage for the demo.rom x86 image that packages the ulib example program. Add test_ulib_demo_rom() which boots demo.rom under qemu-system-i386 and verifies the expected demo output strings appear on the serial console. The test skips gracefully if demo.rom or QEMU is not available. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 9e46d529c87..aff586c4d79 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -4,6 +4,7 @@ """Test U-Boot library functionality""" import os +import shutil import subprocess import pytest import utils @@ -208,3 +209,32 @@ def test_ulib_api_header(ubman): assert 'ub_printf(const char *fmt, ...)' in out assert 'ub_snprintf(char *buf, size_t size, const char *fmt, ...)' in out assert 'ub_vprintf(const char *fmt, va_list args)' in out + +@pytest.mark.boardspec('qemu-x86') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_rom(ubman): + """Test the ulib demo ROM image under QEMU x86.""" + build = ubman.config.build_dir + demo_rom = os.path.join(build, 'demo.rom') + + assert os.path.exists(demo_rom), 'demo.rom not found in build directory' + assert shutil.which('qemu-system-i386'), 'qemu-system-i386 not found' + + cmd = ['qemu-system-i386', '-bios', demo_rom, '-nographic', + '-no-reboot'] + with subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as proc: + try: + stdout, _ = proc.communicate(timeout=5) + except subprocess.TimeoutExpired: + proc.kill() + stdout, _ = proc.communicate() + + out = stdout.decode('utf-8', errors='replace') + + assert 'U-Boot Library Demo Helper' in out + assert '==========================' in out + assert 'U-Boot version:' in out + assert 'helper: Adding 42 + 13 = 55' in out + assert '=================================' in out + assert 'Demo complete' in out