From patchwork Mon Apr 25 14:59:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 565905 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEB43C433EF for ; Mon, 25 Apr 2022 14:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242639AbiDYPCW (ORCPT ); Mon, 25 Apr 2022 11:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbiDYPCU (ORCPT ); Mon, 25 Apr 2022 11:02:20 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28C4F11BEAE; Mon, 25 Apr 2022 07:59:16 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1nj0BG-0000pW-BT; Mon, 25 Apr 2022 16:59:14 +0200 Date: Mon, 25 Apr 2022 15:59:08 +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: [RFC PATCH 3/5] partitions/efi: add support for uImage.FIT sub-partitions Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-efi@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 5e9be13a56a82a..9999da6f7f8056 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; From patchwork Mon Apr 25 15:00:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 565904 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CCA9C433F5 for ; Mon, 25 Apr 2022 15:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242658AbiDYPDb (ORCPT ); Mon, 25 Apr 2022 11:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242578AbiDYPDa (ORCPT ); Mon, 25 Apr 2022 11:03:30 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72EBA56205; Mon, 25 Apr 2022 08:00:26 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1nj0CO-0000qd-Ii; Mon, 25 Apr 2022 17:00:24 +0200 Date: Mon, 25 Apr 2022 16:00:19 +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: [RFC PATCH 5/5] mtd/ubi/block: scan for partitions in case FIT_PARTITION is set Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Enable partition parsers on plain ubiblock devices in case of CONFIG_FIT_PARTITION being selected. Signed-off-by: Daniel Golle --- drivers/mtd/ubi/block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index 18683d1c1bf501..b0f1f4565c719b 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -431,7 +431,9 @@ int ubiblock_create(struct ubi_volume_info *vi) ret = -ENODEV; goto out_cleanup_disk; } +#ifndef CONFIG_FIT_PARTITION gd->flags |= GENHD_FL_NO_PART; +#endif gd->private_data = dev; sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); set_capacity(gd, disk_capacity);