From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37DD7C433F5 for ; Mon, 9 May 2022 10:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=893mw/hUeHmSQzR76ULMFme0XV++Ms8jEc454G2ytY4=; b=brpXGqlBkNMF73 Dpj7SEqNqhOOujC5SQdq71DHXfbQYv4cFI1iakkx0tOTGYQxEYmsJkwKAuFGsDDOOvmZQDHXOyjHJ AlbyOtAcnfg921MW7vw4WoVqI6XHmO/q16qyyjLq1HF6EWExBtETwFz9fngNsWn1Sqt1DlyavXEGo l0wK+7VjqbeHT1vxYJF+ilI4j6iykLUgVa/9fdhRUHur00Fur1HyoFxIQsEuS3SxaxNnWgBRYkSV1 1EXg1ZNlZERp9z3ofIaqCJcUEIvrRQO+vvkHL+j7qXM7eSg0Ox+haMNJ1OikTo7XjoAo17GSbidpC A43UFueZElClsjUA7pZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1no0wV-00DrYu-1p; Mon, 09 May 2022 10:48:43 +0000 Received: from fudo.makrotopia.org ([2a07:2ec0:3002::71]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1no0wS-00DrXk-Ia for linux-mtd@lists.infradead.org; Mon, 09 May 2022 10:48:41 +0000 Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1no0wR-0000I0-04; Mon, 09 May 2022 12:48:39 +0200 Date: Mon, 9 May 2022 11:48:33 +0100 From: Daniel Golle To: linux-block@vger.kernel.org, linux-efi@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tom Rini , Jens Axboe , Davidlohr Bueso , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Masahiro Yamada Subject: [PATCH v2 3/5] partitions/efi: add support for uImage.FIT sub-partitions Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220509_034840_667309_C359CE4F X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.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 5e9be13a56a82a..bf87893eabe41d 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 = 64; +#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; +#ifdef CONFIG_FIT_PARTITION + /* If this is a U-Boot FIT volume it may have subpartitions */ + 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 84b9f36b9e4797..06c11f6ae3989c 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.36.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/