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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E680FC433F5 for ; Mon, 25 Apr 2022 14:57:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242623AbiDYPAh (ORCPT ); Mon, 25 Apr 2022 11:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235655AbiDYPAe (ORCPT ); Mon, 25 Apr 2022 11:00:34 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34843119ED0 for ; Mon, 25 Apr 2022 07:57:30 -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 1nj09V-0000nn-AS; Mon, 25 Apr 2022 16:57:25 +0200 Date: Mon, 25 Apr 2022 15:57: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 0/5] partition parser for U-Boot's uImage.FIT Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add uImage.FIT partition parser and wire it up to allow mounting filesystem sub-images from uImage.FIT in GPT partitions as well as mtdblock and ubiblock devices within Linux (e.g. as root filesystem). Using uImage.FIT to store the root filesystem besides kernel and dtb has several obvious advantages which are hard to obtain in any other way: * single image accross different storage types * dynamically sized partitions for kernel and rootfs * hash also for rootfs checked by U-Boot before launching kernel * images may include additional filesystems e.g. for localization or brandinge For this to work, the image has to be created with external data and sub-images aligned to the system's memory page boundaries, ie. mkimage -E -B 0x1000 -p 0x1000 ... Booting such images has been supported by U-Boot since v2018.01. A previous version of this partition parser is in production use on some OpenWrt devices, eg. the BananaPi R64 where using the FIT parser allows booting the very same image from eMMC, SD Card or SPI-NAND/UBI and also using it as a firmware-upgrade image at the same time. Most recently U-Boot now also passes down the selected configuration node name via device tree to allow the partition parser (or userspace process via sysfs) to identify the image configuration. Device Tree schema for that: https://github.com/devicetree-org/dt-schema/commit/a24d97d43491e55d4def006213213a6c4045b646 Daniel Golle (5): block: add new flag to add partitions read-only block: add partition parser for U-Boot uImage.FIT partitions/efi: add support for uImage.FIT sub-partitions mtd_blkdevs: scan partitions on mtdblock if FIT_PARTITION is set mtd/ubi/block: scan for partitions in case FIT_PARTITION is set MAINTAINERS | 6 + block/blk.h | 1 + block/partitions/Kconfig | 14 ++ block/partitions/Makefile | 1 + block/partitions/check.h | 5 + block/partitions/core.c | 6 + block/partitions/efi.c | 9 + block/partitions/efi.h | 3 + block/partitions/fit.c | 352 ++++++++++++++++++++++++++++++++++++++ drivers/mtd/mtd_blkdevs.c | 2 + drivers/mtd/ubi/block.c | 2 + 11 files changed, 401 insertions(+) create mode 100644 block/partitions/fit.c -- 2.36.0