Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7574939rwb; Tue, 15 Nov 2022 14:34:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5luBWkIsLES25kWqqyTpA4toR67fAodfBH1ofi4kap/lvjXXezOJJuniDFfKDbUNBmBJtC X-Received: by 2002:a05:6402:b61:b0:461:ed40:c2f2 with SMTP id cb1-20020a0564020b6100b00461ed40c2f2mr16393436edb.404.1668551677170; Tue, 15 Nov 2022 14:34:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668551677; cv=none; d=google.com; s=arc-20160816; b=SB2PXIBj8JO3v3RBrvaWssS/xrc6oXl0qwvOppSL4ZdHk2/CB/Xe4BL20APuXjJk4U IhO6cfySvn9YOynlEJH5N0EGOayeH3KYOxZnyzsfFrX35AiLoHV34b1J3vddB5S3uSez J/ESBm6drxrS0LWKEaxZZhiMuj7SfyUP9wFRPppROCk9Wh2/WajXihkEjrJBqf+UW598 guGcof22YqXwK50S3Le9OlCAOp9gsLIg+DnnmB33YxQK1hn3oFgRL5T9mFPm6PJSYi+1 gMsLo+3jwr0+DwT/s91KZD+d5vekUA586l2Y3R/qbxILedG6T20AINP7Xi0jYA/NJUVp OQ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date; bh=hSZi5QRdPDDviI5ZDNgYy4bFj8rimMdXcbfby/fdbd0=; b=g4WKlgV7t5zeYyYYTlD03WYhqHH2R77+qf3rHCxKFmj5XjPbr7pvy9kWWEnbh747Qj mK410DASRyNj//bmz9xk8iOFomNC0ja+cs57fp4gv7Viq0R/aGtnoFL6nUJagAiYSgih qixmh0iQl91GVVJ3yxrxziIWDyqoL/MspP9JocwDMTAmlXBBP5tjYDUe9h63QyrXaF8H +U0D/j+2ggB29ZElExQohBXQxUe96f9dtTN6UX9aOnyo72gmrc95tKs3Qwh2bNHtlgWo JrwyIP9FYAf2IhWqqBcQfoplkoOtpFBrNQvJWyxtRK4KqqQetLPf30CM14XYegiZCMWX pG/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp27-20020a1709071b1b00b007aea9dfb4f5si15907144ejc.511.2022.11.15.14.34.15; Tue, 15 Nov 2022 14:34:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbiKOVsu (ORCPT + 90 others); Tue, 15 Nov 2022 16:48:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbiKOVsl (ORCPT ); Tue, 15 Nov 2022 16:48:41 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18CD1B1EF; Tue, 15 Nov 2022 13:48:41 -0800 (PST) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1ov3nD-0005Jl-C3; Tue, 15 Nov 2022 22:48:31 +0100 Date: Tue, 15 Nov 2022 21:47:06 +0000 From: Daniel Golle To: Jens Axboe , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Matthew Wilcox , Daniel Golle , "Martin K. Petersen" , Chaitanya Kulkarni , Michal Orzel , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH v5 3/4] partitions/efi: add support for uImage.FIT sub-partitions Message-ID: <7526fc5a461a0d68eb1dab575f9c1950638fc21a.1668548123.git.daniel@makrotopia.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,PDS_OTHER_BAD_TLD, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new GUID allowing to parse uImage.FIT stored in a GPT partition and map filesystem sub-image as sub-partitions. Signed-off-by: Daniel Golle --- block/partitions/efi.c | 9 +++++++++ block/partitions/efi.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/block/partitions/efi.c b/block/partitions/efi.c index 5e9be13a56a8..f4406b443f04 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c @@ -716,6 +716,9 @@ int efi_partition(struct parsed_partitions *state) gpt_entry *ptes = NULL; u32 i; unsigned ssz = queue_logical_block_size(state->disk->queue) / 512; +#ifdef CONFIG_FIT_PARTITION + u32 extra_slot = 65; +#endif if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) { kfree(gpt); @@ -749,6 +752,12 @@ int efi_partition(struct parsed_partitions *state) ARRAY_SIZE(ptes[i].partition_name)); utf16_le_to_7bit(ptes[i].partition_name, label_max, info->volname); state->parts[i + 1].has_info = true; + /* If this is a U-Boot FIT volume it may have subpartitions */ +#ifdef CONFIG_FIT_PARTITION + if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_FIT_GUID)) + (void) parse_fit_partitions(state, start * ssz, size * ssz, + &extra_slot, 127, 1); +#endif } kfree(ptes); kfree(gpt); diff --git a/block/partitions/efi.h b/block/partitions/efi.h index 84b9f36b9e47..06c11f6ae398 100644 --- a/block/partitions/efi.h +++ b/block/partitions/efi.h @@ -51,6 +51,9 @@ #define PARTITION_LINUX_LVM_GUID \ EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \ 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28) +#define PARTITION_LINUX_FIT_GUID \ + EFI_GUID( 0xcae9be83, 0xb15f, 0x49cc, \ + 0x86, 0x3f, 0x08, 0x1b, 0x74, 0x4a, 0x2d, 0x93) typedef struct _gpt_header { __le64 signature; -- 2.38.1