From patchwork Sat Apr 18 00:39: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: 2218 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=1776472832; bh=nCcmd+mecnICOYl+jYaXJjEAiibWPn6/vdgUL9kXot4=; 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=pb18HB9fN0B3u9I7D3ilmF6/UKaeiGNTviOO5Wv3ux6RgeOSEHI2zF/FvSq7cPmjT rwagroeQMVxncDeSgebzg8JFxTsdXJiOsMFyrhm5jSATihrVtOJLZG77Ky4Y7dgXDw w8KIHErbVkfF6wzAQXePDZW/WkCm/ZJwCzkJ+F+w= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4861E6A516 for ; Fri, 17 Apr 2026 18:40:32 -0600 (MDT) 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 ZC6GqxpFMb95 for ; Fri, 17 Apr 2026 18:40:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472831; bh=nCcmd+mecnICOYl+jYaXJjEAiibWPn6/vdgUL9kXot4=; 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=itrnmNKl/KDVhraR26gJ3Tmwzq/BhYKgd6wOxweFO/N3kpIrWB7d/cXEWSRMTQk9s Fbe13t+B1cAbYAseCy/pNroE+vlI3Dfa0ts4Ewp2rnzeUexJkDCi1foQSVJz3Sd56E O+KbSN3AVHht/WKxeJ7Df9oa2JEaNnkfVwdUrumc= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 31CFE6A53B for ; Fri, 17 Apr 2026 18:40:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472829; bh=KMsv4uybhZ3mJDrW8tTq3XPLw7B2WhkjP+/cT/piiUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sy4okwtr/Oy1fHEej40G4CN49mKTbvyBNXeR7XoqwlGL9CtlpuJzDEWWWNYA0+sUK 9oXlrpu8wnMSnxlXug43kGWp+hza25mmX1hKhSi7OtK6unpplPwv6dgiWpUh+ZkXAK T+Z2Z2Fa5rU8BzF0A/eVOWCRDCgLENbz1sf9Xpvg= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AF9646A516; Fri, 17 Apr 2026 18:40:29 -0600 (MDT) 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 8uMAVbZw-Cnv; Fri, 17 Apr 2026 18:40:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472829; bh=GzbanrGpTw0JfvgM9GFiGpeGz8qArgK+rJjYBM1dh38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVmwordZog0BvfaZWMFnC6/ivlYOg537+UVfVrEE7AHIeZ1eZqAV5e/IuzQaTvtz5 P3jZyQ17Zunf81qDI26QfdNiSz8KMixgDmUI2KcANQrixpTss/2YEAZLaO3hj72/SA 8moeQqLpZn8MacErJLmWG0ulY+K1qgGd1YeQlH7g= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0F4196A414; Fri, 17 Apr 2026 18:40:29 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:39:55 -0600 Message-ID: <20260418004014.1889749-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BFWRYJXT2C23CNXGP2H7VYE5GURYRBRG X-Message-ID-Hash: BFWRYJXT2C23CNXGP2H7VYE5GURYRBRG 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/10] x86: atomic: Add atomic_dec_and_test() 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 Linux fs.h port for ext4l and isofs uses atomic_dec_and_test() on buffer_head reference counts. The x86 asm/atomic.h provides atomic_dec() but lacks the dec-and-test variant, so any file that includes linux/fs.h on x86 fails to build once that code path is reached. Add the standard "LOCK decl + sete" implementation, mirroring the Linux kernel x86 atomic primitives, so the per-arch x86 atomic header is complete enough to back linux/fs.h without needing the asm-generic fallback. Signed-off-by: Simon Glass --- arch/x86/include/asm/atomic.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index 14f811fc367..addbece6c3e 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h @@ -90,6 +90,23 @@ static inline void atomic_dec(atomic_t *v) : "+m" (v->counter)); } +/** + * atomic_dec_and_test - decrement and test + * @v: pointer of type atomic_t + * + * Atomically decrements @v by 1 and returns true if the result is 0, + * or false for all other cases. + */ +static inline int atomic_dec_and_test(atomic_t *v) +{ + unsigned char c; + + asm volatile(LOCK_PREFIX "decl %0; sete %1" + : "+m" (v->counter), "=qm" (c) + : : "memory"); + return c != 0; +} + /** * atomic_inc_short - increment of a short integer * @v: pointer to type int From patchwork Sat Apr 18 00:39: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: 2219 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=1776472834; bh=255lhdvmn/y2nLAEPap3v4KAcFogQcavPazSxUHDIvE=; 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=oqmDHylV11iHNTyaaElcfTk3KtYqy/2X3w94dB7W+GcjvQkh7kt8ScHmbe9ku0Bi4 tpKPLvFa30dc29Q2o9A3pDZlkWPnyWFac/g0qAyGjdlPiXIKdsbJ/7wqf1PhQgOUO8 2rgnkSkmfwLNSHRTHX2ef8UHvcNk203rRmzCPFDE= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 85FC76A516 for ; Fri, 17 Apr 2026 18:40:34 -0600 (MDT) 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 cCaCEZM9izsC for ; Fri, 17 Apr 2026 18:40:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472833; bh=255lhdvmn/y2nLAEPap3v4KAcFogQcavPazSxUHDIvE=; 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=PmUXwU6uyvD70PgQFOsGUy/NCRYSFqswaMgt7IPam1haYFCTu8lFYoXES8PR9zLh2 JTNfzbaPffmxPFhB+1OE+DfI24hSpntGp+8zwBElwYJlhrf+rkAzcE+BNsF+tM3hG1 0rmgKzC9rDLfd/W8dEhFUX37XxXehmd3GFGhuqs8= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 952C06A538 for ; Fri, 17 Apr 2026 18:40:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472832; bh=P1/+MUD3s+xz0UwAXzJYMzXVFRrgUOJ33P1smpJJFWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xh7E8fLSxMArtd9gQzd0BJs3pfwbmmbN7GGgaoed/Y3yQXfK90TVS1FWxh+sMPfqf 7Vfg5m935ggMyJztXjX16E4NNCXD9o6HX/XBoKBm8zfEnyc4AhNOb8KNDgVTFXq+yq xfCnUtW9Ugnb3yXsQPZgOSONSvvXnCZJ+UaVsZek= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 377236A543; Fri, 17 Apr 2026 18:40:32 -0600 (MDT) 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 ZimXTCTvrU5J; Fri, 17 Apr 2026 18:40:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472830; bh=36uzP8SBGPDtTKYtarLiKI1Ji9FBVmXWhIGGaUi5YVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSLKKf2Cad3QS7/qE/cAbShE1FdP83g8cc820Up9HIWESpjMY/Y8XQbrwk0QHi3Y/ 0VE0Gsr+Dfp8L6lckKRvzqSYmXBqbRE5XgDLs2Es3iQbOYzgmqkQ8CKoUdnCNf7b3W q3Ddr4ko4gUGTihdU3BKdUtl24we1mkUbjmAufrI= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 45C426A53A; Fri, 17 Apr 2026 18:40:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:39:56 -0600 Message-ID: <20260418004014.1889749-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZAKKEPT2UOLW3CXQOMSUNXSBXTUWOQ3F X-Message-ID-Hash: ZAKKEPT2UOLW3CXQOMSUNXSBXTUWOQ3F 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/10] linux: Use asm/atomic.h in fs, buffer_head, refcount 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 Including directly in linux/fs.h, linux/buffer_head.h and linux/refcount.h forces every consumer to the generic implementation, even on architectures with their own asm/atomic.h. On x86 this means atomic_add() and friends call local_irq_save() and local_irq_restore(), which are not declared, so any file that drags these headers in fails to build with -Werror=implicit-function-declaration. Switch the includes to so each architecture's per-arch atomic header wins. Architectures without one fall through to asm-generic transparently. Signed-off-by: Simon Glass --- include/linux/buffer_head.h | 2 +- include/linux/fs.h | 2 +- include/linux/refcount.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 3b829e035aa..e844402500d 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include enum bh_state_bits { BH_Uptodate, /* Contains valid data */ diff --git a/include/linux/fs.h b/include/linux/fs.h index c8b95528013..89e683ca647 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include /* Forward declarations */ struct buffer_head; diff --git a/include/linux/refcount.h b/include/linux/refcount.h index ce001b437bf..6b6d84f308c 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -7,7 +7,7 @@ #ifndef _LINUX_REFCOUNT_H #define _LINUX_REFCOUNT_H -#include +#include /** * typedef refcount_t - reference count type From patchwork Sat Apr 18 00:39: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: 2220 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=1776472838; bh=Ndfh0xojBQ7sUT4slGKHfPOZSMDHBGTxIkLUCi+5WRs=; 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=G0fHEQU0vtsGWr0KLQGXREbhUqhCJ3LGcJZhXdIW9t9B+HLxyd/ijL8SgQrsNsKqN HrwPDGDfMuqLYoha1UlyO1qRNr9EQkkKohtlArzKSQNOV+5nwz52zCh5Q+jIg38sCl F9ROC8hVX26JuEx7skNiccZkpHfuwhTaFStg69VI= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1C14A6A53B for ; Fri, 17 Apr 2026 18:40:38 -0600 (MDT) 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 gFNRU0UTh3D3 for ; Fri, 17 Apr 2026 18:40:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472838; bh=Ndfh0xojBQ7sUT4slGKHfPOZSMDHBGTxIkLUCi+5WRs=; 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=G0fHEQU0vtsGWr0KLQGXREbhUqhCJ3LGcJZhXdIW9t9B+HLxyd/ijL8SgQrsNsKqN HrwPDGDfMuqLYoha1UlyO1qRNr9EQkkKohtlArzKSQNOV+5nwz52zCh5Q+jIg38sCl F9ROC8hVX26JuEx7skNiccZkpHfuwhTaFStg69VI= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0C7F26A539 for ; Fri, 17 Apr 2026 18:40:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472836; bh=dtzDqdvYFCpIN/DKVTAO40USXV3ow6x11S1FIzx2wtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zb37EBKqtphYkLo5CTTAh0egg6fKJRbP9+xF4dlN8hoHaJvEhkywzs3IUBc3QRL3a 6IcT6FU+2nadizoWguPMFKO9gGe+AKzgic189mtVCON42b5NrG13HIby16n/H1ejpn TKAKZjDzTpveVzxW8UuMWO3naKT+q2WwSJjiZ6lw= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C44246A538; Fri, 17 Apr 2026 18:40:36 -0600 (MDT) 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 YnEEs597LLfE; Fri, 17 Apr 2026 18:40:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472831; bh=XXMkrSBDLiIkUVlRZwjDdeflKulJKOnf25b/PF0IkwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E19uynb0LTj2E00xI3KoHZy2DuanntinkzyZM0WOYCEAaDa6/jKDoHspEX84kBHjb ChT2qv/TlJ/c/cWyAjnmgmAQLqigxntNlFQCoXbMh5prlSMviefGZKGxBg7BeUl7MT /NE52AS+PYcoL8Nfeh6cMzCGoworRnwfGQ/hPbOM= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7A2B46A542; Fri, 17 Apr 2026 18:40:31 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:39:57 -0600 Message-ID: <20260418004014.1889749-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BGHZGJJG77LJEWBEWQQ4JZSO6NOWOXKH X-Message-ID-Hash: BGHZGJJG77LJEWBEWQQ4JZSO6NOWOXKH 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/10] fs: Use asm/atomic.h in linux_fs and ext4l 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 fs/linux_fs.c and fs/ext4l/support.c pull in directly, bypassing the per-arch implementation. On x86 the generic inline functions reference local_irq_save() and local_irq_restore(), which are not declared, so the files fail to build once the header is actually used. Switch these two remaining users in fs/ to , so each architecture's per-arch atomic header wins. Architectures without one fall through to asm-generic transparently. Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 2 +- fs/linux_fs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1d83ac43ccc..b79848f6a57 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -75,7 +75,7 @@ #define no_printk(fmt, ...) ({ 0; }) /* More Linux headers (alphabetical) */ -#include +#include #include #include #include diff --git a/fs/linux_fs.c b/fs/linux_fs.c index 2237c567a9f..581df65432a 100644 --- a/fs/linux_fs.c +++ b/fs/linux_fs.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #if IS_ENABLED(CONFIG_FS_EXT4L) #include "../fs/ext4l/ext4_uboot.h" From patchwork Sat Apr 18 00:39: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: 2221 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=1776472842; bh=3+w0lcnKWz5aEDkio5mWHH7/gR97Ru29fET05ZyuDv4=; 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=Y6p93zVfyoDLtdbjXCYn675s8LysXQykPYlgd5/jhcuLaQmn13ezKXCTfEnYarnJ9 CaYr91Et3GiZLOqtAf3iiIeU3oeVLrD3UyOU+MRE7fv2BgjBu5ZdP6KjxsPRukJarA mbEaTXN0u3iOdrYMJLSnN6jiIQQ5umF7SQiG8MIw= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E03EE6A53B for ; Fri, 17 Apr 2026 18:40:42 -0600 (MDT) 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 u-M1f3CRQS3i for ; Fri, 17 Apr 2026 18:40:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472842; bh=3+w0lcnKWz5aEDkio5mWHH7/gR97Ru29fET05ZyuDv4=; 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=Y6p93zVfyoDLtdbjXCYn675s8LysXQykPYlgd5/jhcuLaQmn13ezKXCTfEnYarnJ9 CaYr91Et3GiZLOqtAf3iiIeU3oeVLrD3UyOU+MRE7fv2BgjBu5ZdP6KjxsPRukJarA mbEaTXN0u3iOdrYMJLSnN6jiIQQ5umF7SQiG8MIw= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D0C406A539 for ; Fri, 17 Apr 2026 18:40:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472841; bh=XwaCEXHW8XLuQN+gkImpRoyj+QfckKi24czr018saro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKf1oQ7hyrolwzNzDs8mN8Yr/ADweYGQulpgjQmSGm81ReLL6bW2bxuVQrInjVFyG 1cLm+3zDQBiGj6cQtMmvPfCvA+EyfzSeawPTi6NpsrrBUQpRubpGrNTekSLDHzQWdH glPaDeeVZz2zNBEhEP6hnjrVoRKPeqVAU+uTYLaY= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 06CE86A538; Fri, 17 Apr 2026 18:40:41 -0600 (MDT) 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 jk4FLvknsiha; Fri, 17 Apr 2026 18:40:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472836; bh=GOXLsi7IAclqjvzFdHoWuNkixBm4D7hj+9iub70XSGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8TcVbGXh+BzYFD08LlnCATn1Kvg0YOeglJ0yIXbPvGwV+Vn+MrDGBceoowAr3DHS aMGadpHtjOll9mxjPd7J8SljGOL709p18LT5FnGJDtHJU3cabixe9wRh92HSOo7q3Y EJAmi6o5ogLWkR4ZY2Ro5YmD2UUkAoF0opFdXBcw= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9591A6A516; Fri, 17 Apr 2026 18:40:36 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:39:58 -0600 Message-ID: <20260418004014.1889749-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UMQOAHQTBMHWUUXDANVLGBX25L2AZP2W X-Message-ID-Hash: UMQOAHQTBMHWUUXDANVLGBX25L2AZP2W 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/10] fs: Drop redundant asm-generic/atomic.h include 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 isofs port does not call any atomic operation directly, and the header is reachable transitively via linux/buffer_head.h. The direct include just drags in a second copy of the inline functions for no benefit, and on x86 it adds another spot to fix when switching to . Drop it. Signed-off-by: Simon Glass --- fs/isofs/isofs_uboot.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/isofs/isofs_uboot.h b/fs/isofs/isofs_uboot.h index b543ecb8999..d73c94f12c2 100644 --- a/fs/isofs/isofs_uboot.h +++ b/fs/isofs/isofs_uboot.h @@ -29,7 +29,6 @@ /* Linux headers */ #include #include -#include #include #include #include From patchwork Sat Apr 18 00:39: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: 2222 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=1776472845; bh=f0Wgkn00McTeIUZ+pvoGcY2BE/4nX2vlXqwY/oiG0hA=; 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=RSZVRkDuW/EhoSwSQfrzLppM5cfZYBTMlh0IhoK95lLdcMa/cqWixBzKqs0iGk9vt JqX9U/aOe3QsSi/l9nXHabOTDdbDo9iReQOc/VbOVMitHS2JWOlooa7uH96CXwanao 6/IL8OKH9M3sez+NcsxaMpqJAT/FuXX0o7yTIryQ= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 555F46A539 for ; Fri, 17 Apr 2026 18:40:45 -0600 (MDT) 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 8954s8Lgsmpl for ; Fri, 17 Apr 2026 18:40:45 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472844; bh=f0Wgkn00McTeIUZ+pvoGcY2BE/4nX2vlXqwY/oiG0hA=; 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=E3ZhUec+P7aeXVWNfs6UtDa2jDht824SV8wvcRfGpp+xif8DNjYJfLSfmZe0qwvH0 fcCU+UsUEsNe8RRp7IsExruYpsxQUrKX/OEiS43/tZXyeUl9dsIAd/FEI+sj4yZpvH LaCp6JK1zZktf+aGYjbetCxIIUtqNZHRUuiQgaOI= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 52D5D6A53A for ; Fri, 17 Apr 2026 18:40:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472842; bh=Na1sJeDr2jGdOYB4Q0bGV3n5jPdZeDuuTWjvj+IZ1G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTSJh9zHLnPY3WjGEPajMm4OeQJJO6mdI/RUVafID0G7d7GbtASfsBV0Mph3FY2PV mE3r/S7F7jT/t9q7K7+3cYPCn1dYwcXOt0D73jFpXNoh31V4G+pBPmBBNZnXjiYH/2 Kl5jlslfN0BZW5ie14MpPcV3f5rXa5ZmZMfwp/8o= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 206056A538; Fri, 17 Apr 2026 18:40:42 -0600 (MDT) 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 QPxZAWQNjEsR; Fri, 17 Apr 2026 18:40:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472841; bh=pJxZO+OGad4q7Q4NzjPQ9mpldPJRKV91YvawQDkMq1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LASCIbPJnBgThkAMfM4xnADWSD1T5ainSICfJKEP9a+Ym9YbtKW/W8DMJOF+zFKAn C/WPmDYnBajqhDGnKJnLUQLvUyk8Bcu1QL6Dm4FdKo+ltRk9U34FVGWwuaV44USbSi Z/2NCnREFrwEVHpCvUvrsw7oo5vpTNMUiYnnQzkY= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A15C86A516; Fri, 17 Apr 2026 18:40:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:39:59 -0600 Message-ID: <20260418004014.1889749-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: G7MSNWMCBSAKZOSUUKYQDYFGTX5WQYM3 X-Message-ID-Hash: G7MSNWMCBSAKZOSUUKYQDYFGTX5WQYM3 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/10] fs: Include linux/blk_types.h for REQ_OP_READ 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 linux_fs_read_block() calls submit_bh() with REQ_OP_READ, but neither linux/bio.h nor any other current include declares it. The file only happens to compile when an unrelated header in the include chain transitively pulls in ; once that chain changes (e.g. when reshuffling the atomic includes) the build breaks. Include it explicitly so the file no longer depends on transitive include order. Signed-off-by: Simon Glass --- fs/linux_fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/linux_fs.c b/fs/linux_fs.c index 581df65432a..f922bed3b84 100644 --- a/fs/linux_fs.c +++ b/fs/linux_fs.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #if IS_ENABLED(CONFIG_FS_EXT4L) From patchwork Sat Apr 18 00:40: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: 2223 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=1776472849; bh=jlWW1br4bdXE0b6QbwJBDNewbkJbKpGPSQCePJhdGgM=; 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=SRg+XX34t9upjSobq0Z9dUFgVj9QxhHmicwoBiqKG2S87U8o9eiTK9bPKVwlNqlwp Gj/V2DbkcVQ+BrOsh1lKzLogY1pvScduyAp9lFx9/FDY0LU/HkmvCW/9TjFymIOFeT eqb3ZbcYnmd3SfphJSlQFthFd7DehwxjdRYeR9d4= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D86A96A54B for ; Fri, 17 Apr 2026 18:40:49 -0600 (MDT) 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 9nbu_dXBSXNT for ; Fri, 17 Apr 2026 18:40:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472846; bh=jlWW1br4bdXE0b6QbwJBDNewbkJbKpGPSQCePJhdGgM=; 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=bViWwtorBKYBbiw/TJXUIjgKT45sw1JbWRTkLTS1Gf67pnmZT7Y3nfe0YLcG6eFLv IsnWdUFBboj78okbYYia+hBLnf8eL7f3i2b3xoKWs8ieeBlVt6q6B0y1szO8EhVuaJ NWQ2R5rUb4uLw7iOmJXAO4joR/rc5QnWfp/Ut+dw= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CAE086A53D for ; Fri, 17 Apr 2026 18:40:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472845; bh=F456tsVD8FgshFIK40dbeJTrxJTWggD040MVB+g47fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrNsC3sBNQqpy4rAfv3D0r8thEeJ1rCeH3er3SFJXbQRoj39/QAIs8ZWjKZENmH2+ 9AYWeDZqOkOFFynDnRV6UjWOZiPPDsnUkal3P5wV8d6h0qeqGpAgfMxV9wmVoP7LpS RIx+TcBlY+92i02UFCxfZyVByl3R+YmstVR1KXMA= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A47A6A53D; Fri, 17 Apr 2026 18:40:45 -0600 (MDT) 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 3xx2eL6RpZDT; Fri, 17 Apr 2026 18:40:45 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472843; bh=lvYav2EkWkzqN5Y5GRP3yl+rkZ6hEuStbXpAOq55Z5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RXkqj0AgBHNHvi9Qo5sbqLshzj40vixDGSuKgFK9jZNoTUfbyaELhppY+ZKodwZK2 cEepfh8/tAeru1ETaRqR1x8FH9wcoebMTr9YHadgZnok+evYRAtVYaKRBBXkolldsO dDplAKhODQDcyeRTuLL2v8Q5c1INH+I9QsUwnB+s= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BE8346A516; Fri, 17 Apr 2026 18:40:42 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:40:00 -0600 Message-ID: <20260418004014.1889749-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2UIPFQXQLQANT3CFYJUPY3DIIPN2WGVQ X-Message-ID-Hash: 2UIPFQXQLQANT3CFYJUPY3DIIPN2WGVQ 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/10] fs: Guard journal_head deref under FS_EXT4L 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 bh_cache_release_jbd() dereferences journal_head fields to clear the buffer-to-journal link. When CONFIG_FS_EXT4L is disabled, the file forward-declares struct journal_head with no definition and buffer_jbd() expands to a literal 0, so the inner block is dead code. The compiler still type-checks it, however, and rejects the dereference of an incomplete type. Wrap the loop body in #if IS_ENABLED(CONFIG_FS_EXT4L) so the function reduces to an empty stub when ext4l is off, matching how buffer_jbd() and bh2jh() work. Signed-off-by: Simon Glass --- fs/linux_fs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/linux_fs.c b/fs/linux_fs.c index f922bed3b84..04f4c551f0b 100644 --- a/fs/linux_fs.c +++ b/fs/linux_fs.c @@ -243,6 +243,7 @@ void bh_cache_clear(struct block_device *bdev) */ void bh_cache_release_jbd(struct block_device *bdev) { +#if IS_ENABLED(CONFIG_FS_EXT4L) int i; struct bh_cache_entry *entry; @@ -264,6 +265,7 @@ void bh_cache_release_jbd(struct block_device *bdev) } } } +#endif } /** From patchwork Sat Apr 18 00:40: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: 2225 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=1776472850; bh=Nz2jJKRLAP6rx7aOy780/5Lz7K+PLoYkpfLlr4UUCNY=; 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=ZiFMXFlkLgpXjpNCnyS8E6zIWaMzByQVIlSdgarwkqYvM7OyDpkPXGZSZTwV18RfV JnH19K414W6VGvxyK6xLROJU+LA2XHuRasfkv/DEFR08cqlZFF9XYDpPx3e7ORSvxh DKMisd8zH+wA01f4kw3bjPb2PWa0aKJzGGl8VV9I= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6DB456A54A for ; Fri, 17 Apr 2026 18:40:50 -0600 (MDT) 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 aXjNt5CSk3he for ; Fri, 17 Apr 2026 18:40:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472850; bh=Nz2jJKRLAP6rx7aOy780/5Lz7K+PLoYkpfLlr4UUCNY=; 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=ZiFMXFlkLgpXjpNCnyS8E6zIWaMzByQVIlSdgarwkqYvM7OyDpkPXGZSZTwV18RfV JnH19K414W6VGvxyK6xLROJU+LA2XHuRasfkv/DEFR08cqlZFF9XYDpPx3e7ORSvxh DKMisd8zH+wA01f4kw3bjPb2PWa0aKJzGGl8VV9I= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 421886A53A for ; Fri, 17 Apr 2026 18:40:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472847; bh=NNtpIKFnER/WAlf/M1dGFYFGlDg8/pLU55xs6gB3sGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lOasd2QrOjaiidxraIECdD3vAP2ZMofjGvcmHlhK1nhW7FqthNA1xgxzDEfPnJ4GX KcWc4zfgkDSjBSf6bpFmA2ipoo4GzQgqmxR/LTZLOjyL8ecd0G6/uD/JiEjf/HOWth 6+aEd1I7gxvIAgTppld280lndWL3mLIsnjrUzyXM= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C1AAF6A53A; Fri, 17 Apr 2026 18:40:47 -0600 (MDT) 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 krCAaqsK4l3D; Fri, 17 Apr 2026 18:40:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472844; bh=JR5B/Zu1i1004wrTmqkD4RsSLhX97B9p9GMHN4qBD9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzeiojYRAeuU9rWlef8JS3zUhE/DCnm7MjTbJfNpm0tE27oyFiHvU/iDUb2sVQy1T JvbtPKHWPd0GBCz/o+2EdFLnPbwKZBUgRMalXiQiPsbw8f4Utu421tOEr+XTvnUHiR Gvrh0T5ZolHoicLlQL6G7SmE+yywVTbPbJcla1cM= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F23296A538; Fri, 17 Apr 2026 18:40:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:40:01 -0600 Message-ID: <20260418004014.1889749-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: A3E5KXQUYRY3LKH3VKBAWOASNJVZG543 X-Message-ID-Hash: A3E5KXQUYRY3LKH3VKBAWOASNJVZG543 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/10] efi-x86_app64: Enable BLS bootmeth 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 EFI x86 app target is a natural fit for booting distributions that ship Boot Loader Specification Type #1 entries, but the bootmeth is currently off by default on this board so those entries are silently skipped during bootflow scan. Enable CONFIG_BOOTMETH_BLS=y so U-Boot finds loader/entry.conf on the EFI system partition it is launched from, alongside the existing extlinux and EFI chainload methods. Signed-off-by: Simon Glass --- configs/efi-x86_app64_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index c6e47beacb3..787059aa2e6 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -18,6 +18,7 @@ CONFIG_EFI_CLIENT=y CONFIG_EFI_APP_64BIT=y CONFIG_FIT=y CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTMETH_BLS=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" From patchwork Sat Apr 18 00:40: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: 2224 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=1776472850; bh=VuvQ2mNpRFnM6bLt7GxxVqucJt2DcG+N8wlShANqhyY=; 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=la5wYcBKucLtlKlYcejmUUtfTgeyzkC/HVzAzn4yhxLgUCAwCZGcfx8jYbwj+L1b0 byIYLMTZThZQc96DzXzw7VcCvxSTtLeBRduyfX6fJlJxsRG9sBi7Ln3saqBeZGjCkF 49i9Tw+YTnNWNnWcrucSuYX77qMtgj7bK8mo2D6s= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 325DE6A546 for ; Fri, 17 Apr 2026 18:40:50 -0600 (MDT) 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 SZO9ojxfE1hn for ; Fri, 17 Apr 2026 18:40:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472849; bh=VuvQ2mNpRFnM6bLt7GxxVqucJt2DcG+N8wlShANqhyY=; 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=fMjpwlLts4AiRKVJ6iHwIaETKLNOngCd37r+43KUNq7SLzwUbcE9vf9UYB1HYY/fE F+X/Uy/82Kb36zkVP6HTn/EwTOYNU7GEIPeQoTzsI0Wz+u6dkDgf+wQbtTZVMHGHFB j5FEv1LYVKpkLouBf/YT1ngY5K5P+NW9Bt8KE8bc= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B838A6A53A for ; Fri, 17 Apr 2026 18:40:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472847; bh=/lZeuu/RDKkVpbkd8pSy4ELfFpwzDqb76MRjHcbWUug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bntHC53ZxBI2WJGKnPbvTwI1yTPbF99Yxclukw6tXyvsxSJ8KkH+BkXX1Kf8LvrNU lzoq+zAE9xzf4pyy2GQ63xUOPuNzdWU/0WtGl+ZLvsVebv6m9Okkz8CM0Ll1yXN5il YHE1Ag3twbzwVpafs+3ZBw7+ExstOm86EPZ81VCQ= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C1AC46A547; Fri, 17 Apr 2026 18:40:47 -0600 (MDT) 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 WWWcuJ2otGr5; Fri, 17 Apr 2026 18:40:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472845; bh=t3GuqMgsof+GPUOUHUXi6bt+30ZwTHOZnqWQ74FA+l8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eA5SLQe81XVu/UHz8wncNG6ChUhWb/1/vVIZiNLPZyepnicHN0u3/sFhjifJqQc8y NFRgz6cn72/MRV0D+O/GIiB6ek5OGnV1p3+vWrecS+2khrSbCIAa+aD19IBNcD82vp hXzc+w4S/Ns+bL7SXEPvQ/7cILG/5e1ykGuipLRg= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 17AFA6A53C; Fri, 17 Apr 2026 18:40:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:40:02 -0600 Message-ID: <20260418004014.1889749-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6OFOBCOCSX4S7DEXMIELGIV7HX2VNGA2 X-Message-ID-Hash: 6OFOBCOCSX4S7DEXMIELGIV7HX2VNGA2 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/10] efi-x86_app64: Enable ISO 9660 filesystem support 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 Live distribution images such as Ubuntu's casper ISOs place the kernel and initrd on an ISO 9660 filesystem with Joliet extensions for long filenames. Without FS_ISOFS U-Boot can only reach those files by first copying them onto an auxiliary FAT partition. Enable CONFIG_FS=y, CONFIG_FS_ISOFS=y and CONFIG_JOLIET=y so the standard boot flow can read ISO 9660 media directly, e.g. when re-packing an Ubuntu live ISO behind a U-Boot bootloader. Signed-off-by: Simon Glass --- configs/efi-x86_app64_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 787059aa2e6..50c700e20c5 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -52,6 +52,9 @@ CONFIG_CONSOLE_TRUETYPE_UBUNTU_BOLD=y CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y +CONFIG_FS=y +CONFIG_FS_ISOFS=y +CONFIG_JOLIET=y CONFIG_CMD_DHRYSTONE=y CONFIG_TPM=y # CONFIG_GZIP is not set From patchwork Sat Apr 18 00:40: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: 2226 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=1776472854; bh=+WyhX6hS7KMZR4GSSmTb6DQzDJ8tqkvLJNW4re31FGU=; 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=e2UJNKoPEehElp0ljyIFEepeg9Bxe8i1ZJDivpUU9LOhGVRRBF7pnkikuCgXqZ2cW q9kXv6AGVD2fwYhlMh7riOB5j786dCzZQLcnwu8FMfU9Ce0SCAR3eHDKzctj3s9eAz 4YhQSqvdr71Wnz8sIPVQR6MWUOTXQZsPce3IKcMw= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DDD996A516 for ; Fri, 17 Apr 2026 18:40:54 -0600 (MDT) 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 rUituNSoX63y for ; Fri, 17 Apr 2026 18:40:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472854; bh=+WyhX6hS7KMZR4GSSmTb6DQzDJ8tqkvLJNW4re31FGU=; 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=e2UJNKoPEehElp0ljyIFEepeg9Bxe8i1ZJDivpUU9LOhGVRRBF7pnkikuCgXqZ2cW q9kXv6AGVD2fwYhlMh7riOB5j786dCzZQLcnwu8FMfU9Ce0SCAR3eHDKzctj3s9eAz 4YhQSqvdr71Wnz8sIPVQR6MWUOTXQZsPce3IKcMw= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CB62D6A539 for ; Fri, 17 Apr 2026 18:40:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472852; bh=b7BXrbTadpEGPnrZkGVYFw5s4q/wnkc6uGrJG1ljSQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+Gyw+fNNap6+0JFGor5JVG3vW7wzsZSLC4aFuZlsan7fQwDlf3i5IxCwWAYZsAVh LohH5nrF2yJWrjbO/eyWaUaUU/a4g5vYyVnHTwhz7etsWESoeFRqf1BsKDyt7H7viM YSeKz0rB/zDgGaBmwD035pyYlo0KTJDVhOfAdu5w= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BB6376A539; Fri, 17 Apr 2026 18:40:52 -0600 (MDT) 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 cCc_5Y-A5q5W; Fri, 17 Apr 2026 18:40:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472846; bh=sOehOekCX0IoeEaj3bwoGpRwKCAo6iIZ4Hb0m0I4zGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BlKh7VXrqq53JX+W/yvrjXFzvriESEaZcYg2tf/JH/0lfK80YGoi2YhCBihy/pzKK b1kXP8/CYpK0b+7LODvlvD4v+Rfr2fmSjKaqSzHYJwWDHsKDGiccVHQ397af9AjfNL P32wCMRLCLYiiMmOdqhKrwSUO1b6tKxmb7AAISbc= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4787A6A516; Fri, 17 Apr 2026 18:40:46 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:40:03 -0600 Message-ID: <20260418004014.1889749-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RWW3T6ZDCNXM7JFDZD2E5MYSSDFHLV4C X-Message-ID-Hash: RWW3T6ZDCNXM7JFDZD2E5MYSSDFHLV4C 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/10] scripts: Add a script to modify an Ubuntu ISO for BLS 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 Rewrite an Ubuntu live ISO so that its appended EFI system partition boots U-Boot instead of shim/grub. The script extracts the casper kernel and initrd from the input ISO, builds a fresh FAT32 ESP with u-boot-app.efi, a matching /loader/entry.conf and the kernel and initrd copied across, then uses xorriso to stream the original ISO to a new one with the ESP replaced in place. Every other boot record (BIOS El Torito, grub2 MBR, GPT layout) is preserved verbatim, and the ISO9660 tree is not touched, so casper still finds its squashfs by disc label at runtime. Intended to be used with the efi-x86_app64 target, which now enables CONFIG_BOOTMETH_BLS=y, CONFIG_FS_ISOFS=y and CONFIG_JOLIET=y by default. Signed-off-by: Simon Glass --- scripts/ubuntu-iso-to-uboot.py | 250 +++++++++++++++++++++++++++++++++ 1 file changed, 250 insertions(+) create mode 100755 scripts/ubuntu-iso-to-uboot.py diff --git a/scripts/ubuntu-iso-to-uboot.py b/scripts/ubuntu-iso-to-uboot.py new file mode 100755 index 00000000000..ec32ac7b0dd --- /dev/null +++ b/scripts/ubuntu-iso-to-uboot.py @@ -0,0 +1,250 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0+ +"""Turn an Ubuntu live ISO into one that boots via U-Boot + BLS. + +BLS (Boot Loader Specification) is a freedesktop.org standard for +describing boot menu entries as small files under /loader/entries/ on +the EFI system partition. Each entry names a kernel, initrd and command +line; U-Boot's BOOTMETH_BLS scans the ESP and presents them in its boot +menu, replacing the shim/grub chain that Ubuntu ships by default. + +The ISO's appended EFI System Partition is replaced with a fresh ESP +containing: + + /EFI/BOOT/BOOTX64.EFI U-Boot EFI app (built with CONFIG_BOOTMETH_BLS=y) + /casper/vmlinuz copied from the input ISO + /casper/initrd copied from the input ISO + /loader/entry.conf BLS Type #1 entry pointing at the above + +The ISO9660 tree is preserved unchanged, so casper still finds its squashfs +by disc label at runtime. All other boot records (BIOS El Torito, grub2 MBR, +GPT layout) are preserved by xorriso's -boot_image any replay. + +Quick start (run from the root of the U-Boot tree):: + + # 1. Install host tools + sudo apt install xorriso mtools dosfstools qemu-system-x86 ovmf + + # 2. Download an Ubuntu live ISO (desktop or server both work) + curl -LO https://releases.ubuntu.com/24.04.1/ubuntu-24.04.1-desktop-amd64.iso + + # 3. Build U-Boot as an x86_64 EFI application. The defconfig enables + # BOOTMETH_BLS, FS_ISOFS and JOLIET. If rustc is not installed, + # also pass -d RUST_EXAMPLES -d EXAMPLES to scripts/config and + # re-run olddefconfig before building. + make O=/tmp/b/efi-x86_app64 efi-x86_app64_defconfig + make O=/tmp/b/efi-x86_app64 -j$(nproc) + # produces /tmp/b/efi-x86_app64/u-boot-app.efi + + # 4. Rewrite the ISO to boot via U-Boot + scripts/ubuntu-iso-to-uboot.py ubuntu-24.04.1-desktop-amd64.iso \\ + -u /tmp/b/efi-x86_app64/u-boot-app.efi \\ + -o ubuntu-uboot.iso + + # 5. Try it under QEMU + OVMF + cp /usr/share/OVMF/OVMF_VARS_4M.fd /tmp/OVMF_VARS.fd + qemu-system-x86_64 -machine q35 -m 4096 -smp 2 \\ + -drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \\ + -drive if=pflash,format=raw,file=/tmp/OVMF_VARS.fd \\ + -drive if=virtio,file=ubuntu-uboot.iso,format=raw,readonly=on + +Assumptions: + - Ubuntu-style live ISO with casper/vmlinuz and casper/initrd. + - Input ISO has an appended GPT EFI System Partition + (-append_partition 2 in xorriso's report). + - U-Boot EFI app is built with CONFIG_BOOTMETH_BLS=y, + CONFIG_CMD_ZBOOT=y and FAT support (efi-x86_app64_defconfig is + the reference config). + - xorriso, mtools and dosfstools are installed on the host +""" + +from __future__ import annotations + +import argparse +import os +import re +import shutil +import sys +import tempfile +from pathlib import Path + +# Add the tools directory to the path for u_boot_pylib +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'tools')) + +# pylint: disable=wrong-import-position,import-error +from u_boot_pylib import command +from u_boot_pylib import tout + +DEFAULT_CMDLINE = 'console=ttyS0,115200 console=tty0 --- quiet' +REQUIRED_TOOLS = ('xorriso', 'mcopy', 'mmd', 'mkfs.vfat') +MIB = 1024 * 1024 + + +def check_tools() -> None: + missing = [t for t in REQUIRED_TOOLS if not shutil.which(t)] + if missing: + tout.fatal( + f'missing tools: {" ".join(missing)}\n' + f'try: apt install xorriso mtools dosfstools' + ) + + +def parse_boot_report(iso: Path) -> tuple[str, str]: + """Return (volume_label, esp_partition_guid) from xorriso's mkisofs report. + + Raises SystemExit if the ISO does not have an appended EFI System + Partition on slot 2 + """ + # xorriso prints the report on stdout; stderr carries progress/status. + report = command.output( + 'xorriso', '-indev', str(iso), '-report_el_torito', 'as_mkisofs', + ) + + m_vol = re.search(r"^-V '([^']*)'", report, re.MULTILINE) + m_esp = re.search( + r'^-append_partition 2 ([0-9a-fA-F]+) ', report, re.MULTILINE, + ) + if not m_vol: + tout.fatal('could not find volume label in xorriso report') + if not m_esp: + tout.fatal( + 'could not find appended partition 2 in xorriso report ' + '(is this an Ubuntu-style hybrid ISO?)' + ) + return m_vol.group(1), m_esp.group(1) + + +def extract_from_iso(iso: Path, src: str, dst: Path) -> None: + """Pull a single file out of the ISO9660 tree via xorriso -osirrox""" + dst.parent.mkdir(parents=True, exist_ok=True) + command.run( + 'xorriso', '-osirrox', 'on', '-indev', str(iso), + '-extract', f'/{src.lstrip("/")}', str(dst), + ) + + +def build_esp( + esp_path: Path, + size_mib: int, + uboot_efi: Path, + vmlinuz: Path, + initrd: Path, + entry_conf: str, +) -> None: + """Create a fresh FAT32 ESP at esp_path populated with BLS + kernel. + + Args: + esp_path (Path): Output file to hold the new ESP image + size_mib (int): Size of the ESP in mebibytes + uboot_efi (Path): U-Boot EFI app to install as /EFI/BOOT/BOOTX64.EFI + vmlinuz (Path): Kernel image to install under /casper/vmlinuz + initrd (Path): Initrd image to install under /casper/initrd + entry_conf (str): Contents for /loader/entry.conf (BLS Type #1) + """ + with esp_path.open('wb') as f: + f.truncate(size_mib * MIB) + command.output('mkfs.vfat', '-F32', '-n', 'ESP', str(esp_path)) + command.run('mmd', '-i', str(esp_path), + '::EFI', '::EFI/BOOT', '::loader', '::casper') + + def put(src: Path, dst: str) -> None: + command.run('mcopy', '-i', str(esp_path), str(src), f'::{dst}') + + put(uboot_efi, 'EFI/BOOT/BOOTX64.EFI') + put(vmlinuz, 'casper/vmlinuz') + put(initrd, 'casper/initrd') + + entry = Path(esp_path.parent) / 'entry.conf' + entry.write_text(entry_conf) + put(entry, 'loader/entry.conf') + + +def auto_esp_size(files: list[Path], headroom_mib: int = 16) -> int: + """Sum file sizes + headroom, round up to MiB, floor at 64 MiB (FAT32)""" + total = sum(f.stat().st_size for f in files) + headroom_mib * MIB + mib = (total + MIB - 1) // MIB + return max(mib, 64) + + +def repack_iso( + in_iso: Path, out_iso: Path, esp_img: Path, esp_guid: str, +) -> None: + """Stream the input ISO to a new ISO, replacing partition 2's data. + + -boot_image any replay preserves every other boot record (BIOS El Torito, + grub2 MBR, GPT layout); only the bytes behind partition 2 are rewritten + """ + command.run( + 'xorriso', + '-indev', str(in_iso), + '-outdev', str(out_iso), + '-boot_image', 'any', 'replay', + '-append_partition', '2', esp_guid, str(esp_img), + '-commit', + ) + + +def main() -> None: + p = argparse.ArgumentParser( + description='Rewrite an Ubuntu live ISO to boot via U-Boot + BLS.', + ) + p.add_argument('iso', type=Path, help='input Ubuntu live ISO') + p.add_argument('-u', '--uboot', type=Path, required=True, + help='U-Boot EFI app (e.g. u-boot-app.efi)') + p.add_argument('-o', '--out', type=Path, required=True, + help='output ISO path') + p.add_argument('-k', '--kernel', default='casper/vmlinuz', + help='kernel path inside the input ISO') + p.add_argument('-i', '--initrd', default='casper/initrd', + help='initrd path inside the input ISO') + p.add_argument('-a', '--cmdline', default=DEFAULT_CMDLINE, + help='kernel command line written into loader/entry.conf') + p.add_argument('-t', '--title', default=None, + help='BLS entry title (default: derived from volume label)') + p.add_argument('-s', '--esp-size', type=int, default=None, + help='ESP size in MiB (default: auto-size to fit)') + args = p.parse_args() + + if not args.iso.is_file(): + tout.fatal(f'ISO not found: {args.iso}') + if not args.uboot.is_file(): + tout.fatal(f'EFI app not found: {args.uboot}') + check_tools() + + print(f'=> Reading boot config from {args.iso}') + # Extract the volume label and ESP partition GUID from xorriso's report + vol_id, esp_guid = parse_boot_report(args.iso) + title = args.title or f'U-Boot BLS boot ({vol_id})' + print(f' Volume label: {vol_id}') + print(f' ESP GUID: {esp_guid}') + + with tempfile.TemporaryDirectory(prefix='iso2uboot.') as td: + work = Path(td) + vmlinuz = work / 'vmlinuz' + initrd = work / 'initrd' + + print(f'=> Extracting /{args.kernel} and /{args.initrd}') + extract_from_iso(args.iso, args.kernel, vmlinuz) + extract_from_iso(args.iso, args.initrd, initrd) + + esp_mib = args.esp_size or auto_esp_size([vmlinuz, initrd, args.uboot]) + print(f'=> Building {esp_mib} MiB ESP') + + entry_conf = f'''\ +title {title} +linux /casper/vmlinuz +initrd /casper/initrd +options {args.cmdline} +''' + esp = work / 'esp.img' + build_esp(esp, esp_mib, args.uboot, vmlinuz, initrd, entry_conf) + + print(f'=> Repacking to {args.out}') + repack_iso(args.iso, args.out, esp, esp_guid) + + size_mib = args.out.stat().st_size / MIB + print(f'=> Done: {args.out} ({size_mib:.1f} MiB)') + + +if __name__ == '__main__': + main() From patchwork Sat Apr 18 00:40:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2227 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=1776472859; bh=vo4q02veWDTfD1qQCR1BrvdVIg5J/DydT0PuwZrAgdI=; 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=UeDOFEDPRMjCxrs5M4S0e/pDNlOQ+8WwMSIGI44ugYWOjmfjoHPT3LXzy9sSgyt8D xSfmstbIGf6IPUKQZ/xaXjMptTjtzNm580cXx4d11xW9OjjR7aAvIDztT67lAg6uqa 9c4GaUAKPM4yxDkIaiR+PSUo9ZwyBRlJz1VTwH0w= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 87A056A53A for ; Fri, 17 Apr 2026 18:40:59 -0600 (MDT) 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 uK2pPFcADLIR for ; Fri, 17 Apr 2026 18:40:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472859; bh=vo4q02veWDTfD1qQCR1BrvdVIg5J/DydT0PuwZrAgdI=; 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=UeDOFEDPRMjCxrs5M4S0e/pDNlOQ+8WwMSIGI44ugYWOjmfjoHPT3LXzy9sSgyt8D xSfmstbIGf6IPUKQZ/xaXjMptTjtzNm580cXx4d11xW9OjjR7aAvIDztT67lAg6uqa 9c4GaUAKPM4yxDkIaiR+PSUo9ZwyBRlJz1VTwH0w= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7589E6A538 for ; Fri, 17 Apr 2026 18:40:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472857; bh=f0V89MX7/7o0G7Iha238Ar9hsbYuVtSulg265XLJ1IY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JbVlNTw2XgjTMPiTHijSRAWTUwsWo1zHbqnbPqasaap8H524hu/Q1yIYAfc2ezVhA FrgYa27CBnSZ4ax4etNG6zGwMxd76ZGwHLfPQWXSDfIGP/lvZ/SGn0rFZP4g+tnjhv KFCJIV6uzmIadb5bGR8XcPF7U837aOLkOcRO4/JM= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 551BB6A516; Fri, 17 Apr 2026 18:40:57 -0600 (MDT) 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 qW6CN4PMo9Bk; Fri, 17 Apr 2026 18:40:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776472851; bh=7GVhqgsIUfisTnG6WP2UEiVSlizx6QlMaOBl+xHV7ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAFK4A7nFha83uv3alk0xAaKjO7suXEcY+wI8ke/iYdRE5ttDvkdzQngGqymQ5Ye+ diDC3btai2Of5NfUBk0n1VGXvUg8VV4NpN2x4Z8XExPPkIK2F0GGGWqN3jE4Wz6OkR hYgHTt9c1H97m9NOH0THUighAVnSRZQUbXWOrLTw= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 71CD76A538; Fri, 17 Apr 2026 18:40:51 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 17 Apr 2026 18:40:04 -0600 Message-ID: <20260418004014.1889749-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260418004014.1889749-1-sjg@u-boot.org> References: <20260418004014.1889749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7JCNRJXLOYFPVSOSO3NCDL2RZSLKL5WV X-Message-ID-Hash: 7JCNRJXLOYFPVSOSO3NCDL2RZSLKL5WV 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/10] doc: usage: Describe booting Ubuntu live ISOs via U-Boot 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 Document the end-to-end flow of turning an Ubuntu live ISO into one that boots through U-Boot plus BLS instead of shim and GRUB: the required defconfig, building the EFI application, invoking the new scripts/ubuntu-iso-to-uboot.py helper, and running the result under QEMU and OVMF. Also note why the kernel and initrd end up on the EFI system partition rather than on the ISO 9660 tree (OVMF only exposes the ESP as an EFI_BLOCK_IO handle on CD media). Signed-off-by: Simon Glass --- doc/usage/index.rst | 1 + doc/usage/os/ubuntu-live.rst | 154 +++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 doc/usage/os/ubuntu-live.rst -- 2.43.0 diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 9345b79c4c0..30ec3bc29df 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -42,6 +42,7 @@ Booting OS :maxdepth: 1 os/plan9 + os/ubuntu-live os/vxworks File Systems diff --git a/doc/usage/os/ubuntu-live.rst b/doc/usage/os/ubuntu-live.rst new file mode 100644 index 00000000000..bd4e85e4c8a --- /dev/null +++ b/doc/usage/os/ubuntu-live.rst @@ -0,0 +1,154 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Booting Ubuntu live ISOs via U-Boot +=================================== + +U-Boot can replace GRUB as the bootloader on an Ubuntu live ISO. The +stock ISO has an appended EFI system partition (ESP) containing shim, +GRUB and their configuration. ``scripts/ubuntu-iso-to-uboot.py`` rewrites +that ESP with a U-Boot EFI application, a :doc:`Boot Loader Specification +Type #1 ` entry and the casper kernel and initrd, leaving the +rest of the ISO untouched so casper still finds its squashfs by disc +label at runtime. + +The flow only touches the appended partition. BIOS El Torito, the +grub2 MBR, the GPT layout and the ISO 9660 tree are preserved verbatim +by xorriso's ``-boot_image any replay`` + +Host prerequisites +------------------ + +:: + + sudo apt install xorriso mtools dosfstools qemu-system-x86 ovmf + +Building the U-Boot EFI application +----------------------------------- + +The ``efi-x86_app64`` target enables ``CONFIG_BOOTMETH_BLS=y``, +``CONFIG_FS_ISOFS=y`` and ``CONFIG_JOLIET=y`` by default, so no +Kconfig tweaks are required. Build with:: + + make O=/tmp/b/efi-x86_app64 efi-x86_app64_defconfig + make O=/tmp/b/efi-x86_app64 -j$(nproc) + +The output is ``/tmp/b/efi-x86_app64/u-boot-app.efi``, a PE32+ x86_64 EFI +application. + +If ``rustc`` is not installed, also disable the rust example build +before ``make``:: + + scripts/config --file /tmp/b/efi-x86_app64/.config \\ + -d RUST_EXAMPLES -d EXAMPLES + make O=/tmp/b/efi-x86_app64 olddefconfig + +Rewriting an Ubuntu ISO +----------------------- + +Fetch the ISO (desktop and server images both work) and run the +helper:: + + curl -LO https://releases.ubuntu.com/24.04.1/ubuntu-24.04.1-desktop-amd64.iso + + scripts/ubuntu-iso-to-uboot.py ubuntu-24.04.1-desktop-amd64.iso \\ + -u /tmp/b/efi-x86_app64/u-boot-app.efi \\ + -o ubuntu-uboot.iso + +The script: + +1. Reads the input ISO's boot record with ``xorriso -report_el_torito`` + to pick up the volume label and the EFI system partition GUID. +2. Extracts ``/casper/vmlinuz`` and ``/casper/initrd`` via ``xorriso -osirrox`` +3. Builds a fresh FAT32 ESP (auto-sized to fit) containing + ``/EFI/BOOT/BOOTX64.EFI`` (the U-Boot app), ``/casper/vmlinuz``, + ``/casper/initrd`` and ``/loader/entry.conf`` +4. Writes a new ISO with ``xorriso -indev ... -outdev ... -boot_image + any replay -append_partition 2 ...``, replacing the original ESP + while preserving all other boot metadata. + +Relevant options: + +* ``-u PATH`` -- the U-Boot EFI application (required). +* ``-o PATH`` -- the output ISO (required). +* ``-a ARGS`` -- override the kernel command line written to + ``loader/entry.conf``. The default is + ``console=ttyS0,115200 console=tty0 --- quiet``, which logs the kernel output + serial and video. Duplicate the ``console=`` arguments after ``---`` as well + if you want casper and the running system logged to serial too. +* ``-k PATH`` / ``-i PATH`` -- override the kernel and initrd paths + inside the ISO if a distribution uses something other than + ``casper/vmlinuz`` and ``casper/initrd``. +* ``-s MiB`` -- force an ESP size; the default auto-sizes to fit the + kernel, initrd and U-Boot app with 16 MiB of headroom. +* ``-t TITLE`` -- override the BLS entry title. + +Testing under QEMU + OVMF +------------------------- + +:: + + cp /usr/share/OVMF/OVMF_VARS_4M.fd /tmp/OVMF_VARS.fd + qemu-system-x86_64 -machine q35 -m 4096 -smp 2 -enable-kvm \\ + -drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \\ + -drive if=pflash,format=raw,file=/tmp/OVMF_VARS.fd \\ + -drive if=virtio,file=ubuntu-uboot.iso,format=raw,readonly=on + +The expected boot trace on the serial console is roughly:: + + BdsDxe: loading Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x3,0x0) + BdsDxe: starting Boot0001 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x3,0x0) + Laceboot EFI App (using allocated RAM address 6beef000) starting + + + U-Boot Concept 2026.02 + + CPU: x86_64, vendor , device 0h + Model: EFI x86 Application + DRAM: 256 MiB + Core: 22 devices, 13 uclasses, devicetree: separate + EFI: disks 2, partitions 3 + Loading Environment from FAT... Unable to use efi 0:0... + Video: 1280x800x32 @ 0 + Hit any key to stop autoboot: 2 + Hit any key to stop autoboot: 1 + Hit any key to stop autoboot: 0 + Scanning for bootflows in all bootdevs + Seq Method State Uclass Part Ent E Name Filename + --- ----------- ------ -------- ---- --- - ------------------------ ---------------- + Hunting with: fs + Scanning bootdev 'efi_media_0.bootdev': + 0 bls ready pci 2 0 efi_media_0.bootdev.part_ /loader/entry.conf + ** Booting bootflow 'efi_media_0.bootdev.part_2' with bls + Retrieving file: /casper/vmlinuz + Retrieving file: /casper/initrd + Valid Boot Flag + Magic signature found + Linux kernel version 6.8.0-41-generic (buildd@lcy02-amd64-100) #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 2 20:41:06 UTC 2024 + Building boot_params at 90000 + Loading bzImage at address 100000 (14926336 bytes) + Initial RAM disk at linear address 8000000, size 47a003e (75104318 bytes) + Kernel command line: "console=ttyS0,115200 console=tty0 --- console=ttyS0,115200 quiet" + + Starting kernel ... + + ... + + +Why the kernel and initrd live on the ESP +----------------------------------------- + +BLS paths are resolved against the partition holding ``loader/entry.conf`` + +OVMF only exposes the EFI system partition as an ``EFI_BLOCK_IO`` protocol +handle on CD media, so U-Boot's ``efi_media`` bootdev cannot see the ISO 9660 +partition directly and would fail to resolve ``/casper/vmlinuz`` if the entry +were placed there. Copying the kernel and initrd onto the ESP sidesteps this; +the ISO 9660 side remains bootable in its own right, and casper finds its +squashfs on the original media at runtime. + +See also +-------- + +* :doc:`/usage/bls` — the U-Boot Boot Loader Specification bootmeth. +* `Boot Loader Specification + `_.