From patchwork Tue Apr 21 18:34:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2232 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=1776796561; bh=xJArPCOJBn8hED5uv5qWYo9pkX6Iyqgo/vMlJpkOIMI=; 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=XJZr+bEzy2MFllFo5ZJI9Wdkh38xBW3FXhhCcRguaK4skvP8s5oyI3x5mka7B4eCP mA/IxPC6PuM+7kcBT2krhhUJPfwx1mQxWtJHOBmjaRTx8a8rAoy1D/2HOxARKS/mpT 8Spy7NI+0VeJy2Hb+RQluybQHYy5FwZFdJ+BbPss= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EFEE46A608 for ; Tue, 21 Apr 2026 12:36:01 -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 S89UlmCoDI3M for ; Tue, 21 Apr 2026 12:36:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796561; bh=xJArPCOJBn8hED5uv5qWYo9pkX6Iyqgo/vMlJpkOIMI=; 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=XJZr+bEzy2MFllFo5ZJI9Wdkh38xBW3FXhhCcRguaK4skvP8s5oyI3x5mka7B4eCP mA/IxPC6PuM+7kcBT2krhhUJPfwx1mQxWtJHOBmjaRTx8a8rAoy1D/2HOxARKS/mpT 8Spy7NI+0VeJy2Hb+RQluybQHYy5FwZFdJ+BbPss= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DE3E26A603 for ; Tue, 21 Apr 2026 12:36:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796559; bh=GBuHXAZwy4/GjzYFDSY3kQgdqjDKPDodxGSGbegFFPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qR/xFig3wpyZwqSydZ8M8aWlQt8PCvYST20Oj3b0tP6oG+BYekvQ1GjR/vFFX0Ld+ SwiIRK30Ob7qMr958PseByFfRTNG+6HXaDQTYbq6H59t3DXRQLLiBZGD07HibDLJsQ Cuuy84vOEnqIslj738XUiuTPaK9A/ehUN/MR6W78= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C9A66A601; Tue, 21 Apr 2026 12:35: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 10026) with ESMTP id IxsMQKSIV_5j; Tue, 21 Apr 2026 12:35:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776796555; bh=vdxXvwDIo0UG+2150j0KQUWi/CQqCa0PJ6yq7g3PoCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUF4CyMMS/JgnYTAAhlZI8QawryvhbuRQrW/RlOUnYIdsVJ+lJBybMGrgyHbQ2g7o Ukld/vbu1k6JBDN0TE0dsryJvzT8sGb2ojMP4PrWmRgUglSKhl+EQfUf3bhmIYQ2ym TFYXtKcZzj4Ri1oCY2Ry79HL4BOLAegdt/SPQ8go= Received: from u-boot.org (unknown [174.51.25.52]) by mail.u-boot.org (Postfix) with ESMTPSA id 1008D6A528; Tue, 21 Apr 2026 12:35:55 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 21 Apr 2026 12:34:46 -0600 Message-ID: <20260421183511.2044469-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260421183511.2044469-1-sjg@u-boot.org> References: <20260421183511.2044469-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RG46AR6LVDZ6LBNFIN2CF6KGF4MGI63P X-Message-ID-Hash: RG46AR6LVDZ6LBNFIN2CF6KGF4MGI63P 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/16] fs: isofs: Treat the filesystem as starting at block 0 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 isofs_probe() takes a disk_partition and, when present, translates every subsequent block address by the partition's start LBA. That matches ext4 and FAT semantics but not ISO 9660: an ISO 9660 image always places its primary volume descriptor at absolute block 16 (byte 32768), regardless of any surrounding GPT or MBR layout. Hybrid Ubuntu live ISOs emitted by modern xorriso expose the ISO 9660 session as GPT partition 1, starting at LBA 64 to leave room for the protective MBR and GPT header. Mounting such a partition through fs_set_blk_dev_with_part() currently makes isofs_probe() read the 'primary volume descriptor' from partition_start + 16 blocks, miss the "CD001" signature and return -EINVAL. The bootflow iterator then skips partition 1 entirely, so Boot Loader Specification entries placed in the ISO 9660 tree (e.g. the /loader/entry.conf written by scripts/ubuntu-iso-to-uboot.py) are never discovered and the boot silently falls back to an EFI direct boot or fails altogether. Pin bd_part_start and the PVD read offset to 0 so the ISO 9660 driver always sees absolute disk offsets. Interactive 'ls' on a CD drive with no partition table still works because the starting LBA is already 0 in that case. Signed-off-by: Simon Glass --- fs/isofs/interface.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fs/isofs/interface.c b/fs/isofs/interface.c index 5f8cc749e08..9346ce12431 100644 --- a/fs/isofs/interface.c +++ b/fs/isofs/interface.c @@ -107,10 +107,17 @@ int isofs_probe(struct blk_desc *fs_dev_desc, goto err_free_sb; } - /* Initialise super_block fields */ + /* + * ISO 9660 images always start at absolute block 0 of the device, + * even when accessed via a GPT partition whose start LBA is non-zero + * (e.g. a hybrid ISO where partition 1 covers the ISO 9660 session + * but begins at LBA 64 because of the protective MBR + GPT header). + * Pin bd_part_start to 0 so callers that translate filesystem block + * numbers through bd_part_start reach the real data. + */ sb->s_bdev->bd_super = sb; sb->s_bdev->bd_blk = fs_dev_desc->bdev; - sb->s_bdev->bd_part_start = fs_partition ? fs_partition->start : 0; + sb->s_bdev->bd_part_start = 0; sb->s_blocksize = ISOFS_BLOCK_SIZE; sb->s_blocksize_bits = ISOFS_BLOCK_BITS; sb->s_flags = SB_RDONLY; /* ISO 9660 is always read-only */ @@ -123,9 +130,8 @@ int isofs_probe(struct blk_desc *fs_dev_desc, memset(&ifs.partition, '\0', sizeof(ifs.partition)); ifs.mounted = true; - /* Read first sector to verify it's an ISO filesystem */ - part_offset = fs_partition ? - (loff_t)fs_partition->start * fs_dev_desc->blksz : 0; + /* Read the primary volume descriptor at absolute block 16 */ + part_offset = 0; buf = malloc(ISOFS_BLOCK_SIZE); if (!buf) {