Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1372060rwb; Wed, 16 Nov 2022 16:47:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf69hCs8RoeWPyOeSf+wxIxnWxDHl8SZM4BO9CvRjT6ZUViB2sN8ndBA5tmO5CS4qhI5Yg63 X-Received: by 2002:a17:90b:28b:b0:20a:f006:bf83 with SMTP id az11-20020a17090b028b00b0020af006bf83mr304378pjb.130.1668646059514; Wed, 16 Nov 2022 16:47:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668646059; cv=none; d=google.com; s=arc-20160816; b=r6b9J6JaCIh21oaTxdcnoy9yotLJLyROSOVsGDLzDVcwS2c/XOF4qPWzNEk5HV+eRI nA9pabempCUeMdCnvyd0yra+Ac4ZokANJ87pVH1lTqGXSy0LQ9DGZIZQWkC0HqTkQUDP iZpaXq/B9N8F21rQHbaVBbEy9F+OIav+fPk44JmwGCzSxBk+09IibXveZ+o/sNfGSE+8 q7LZrGy9Bz4LE7V4gNXyzEOJc30ddkcPaYxcXsYjG9kAO7+y/yBX7cAq2rwXQzyhCxhb oD0RUT1Ca1x6ZdcwoymS2M+M2LUVgdV7wFX1Mprz1wSFi27cj3txG/zkJtdk/gY+StHR 7Fnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=tSOc419NVsHR6G4jXFyQXK7zx4zM8l3eJ0Y6Wn1NFjQ=; b=dOxiIWzoDRyeu6Uu5XKWhBBxa1cutuGOol8bZ38J45+DkIUufcIkgktf9bztp3sUe6 0GZ3+FcV0XueYWA4tdA+Y7IRXYu323zAculuDm+qUM0lnF5kzP8wGpkzj6tjBzd4tPC7 EV2pgNvzKhKbXQog4uLWMpmFXocUsdcDUbGNu27sodlugv5ObIUyKv/bz0vytxfQM0xm V2fsNA2vR3qA0Gu8Yn0xMknMDCFKH1fvWfApuSwbZRqCJ8WbPY9/MrpozwU5kB1WRoZS /efp+da+V/6eHDn5opzknNrAnqqeo66oXe4W8uM/pnB4EA7Oaeb93ui6wfUKcKTCvnpM L3zw== 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 u70-20020a638549000000b00477019b4e20si696162pgd.485.2022.11.16.16.47.28; Wed, 16 Nov 2022 16:47:39 -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 S232809AbiKQAmc (ORCPT + 90 others); Wed, 16 Nov 2022 19:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbiKQAma (ORCPT ); Wed, 16 Nov 2022 19:42:30 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83066175B; Wed, 16 Nov 2022 16:42:29 -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 1ovSyx-0002UU-VU; Thu, 17 Nov 2022 01:42:20 +0100 Date: Thu, 17 Nov 2022 00:42:13 +0000 From: Daniel Golle To: Christoph Hellwig , Jens Axboe , "Martin K. Petersen" , Chaitanya Kulkarni , Wolfram Sang , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/4] block: uImage.FIT filesystem image mapper Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 uImage.FIT is the default image format of Das U-Boot bootloader which is used on the great majority of embedded Linux devices. Using uImage.FIT to also 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 (mmcblk, mtdblock, ubiblock) * 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 branding Add uImage.FIT partition parser, this time implemented as a tiny block driver which can be built as a module. Being an early RFC, module unloading by now has only been implemented rudimentary without removing partitions added by the driver on unload. If the overall approach looks acceptable, this can of course be improved. 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 Das 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. The Ubiquiti UniFi 6 LR access point served as a reference board with SPI-NOR flash and use of the partition parser on top of a mtdblock device. As Das U-Boot by now also passes down the selected configuration node name via device tree this allows the partition parser (or userspace process via sysfs) to identify the selected image configuration. Device Tree schema for that has also been merged already[1]. In most cases this partition parser can be used without relying on the bootloader to pass-down the configuration node name. The default configuration node is used then in that case. A check of the chosen/u-boot,version node is used to make sure that Das U-Boot has been used to boot the system and the user (or the bootloader) is required to specify the lower block device to be used by the parser. In case any of the two is missing, this driver won't start. This RFC presents an alternative implementation of the previously posted patch series "partition parser for U-Boot's uImage.FIT"[1]. [1]: https://github.com/devicetree-org/dt-schema/commit/a24d97d43491e55d4def006213213a6c4045b646 [2]: https://patchwork.kernel.org/project/linux-block/list/?series=695709 Daniel Golle (4): init: move block device helpers from init/do_mounts.c block: add new flag to add partitions read-only blkdev: add function to add named read-only partitions block: add uImage.FIT block partition driver MAINTAINERS | 6 + block/bdev.c | 166 ++++++++++++++++++ block/blk.h | 1 + block/partitions/core.c | 37 ++++ drivers/block/Kconfig | 6 + drivers/block/Makefile | 2 + drivers/block/fitblk.c | 364 ++++++++++++++++++++++++++++++++++++++++ include/linux/blkdev.h | 22 +++ init/do_mounts.c | 166 +----------------- 9 files changed, 606 insertions(+), 164 deletions(-) create mode 100644 drivers/block/fitblk.c -- 2.38.1