From patchwork Tue Feb 2 15:23:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1434790 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-secospa-onmicrosoft-com header.b=KDmcCIxS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DVTDT1D1Wz9vFB for ; Wed, 3 Feb 2021 02:26:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CEB082751; Tue, 2 Feb 2021 16:24:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.b="KDmcCIxS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8604A82709; Tue, 2 Feb 2021 16:24:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20603.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::603]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B5FE0826D4 for ; Tue, 2 Feb 2021 16:24:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dqyyp27HIopTQKo1FiHK2gxD1UpLCGOXXyOKYahOkBD8/7OvgNmtjI6Wzsy/tLSHF+d0oY6Hpafyc6WBi+jHT2nq/1/k6s27a4//CMAXKZggnWOoftgnQLyD9o0WKVqMxqqEqUN3tlZF3AmN2Mhrt189R9q2Ljydc8JDOx6zb9hu52Fgw+tNbBTFMfzhegwRJYs370qUd9E6xDSv2yYRcz3lJuHr3NjZqM4VHszWW+0G42CaDGfMNEMlTtB+u//WVx/dMkHBeocifQME10XMeRAy6x2WsfiwvGIVUZedIb8TycEttcIdzkbvqDBsymAss9AuQDFnUqQHYz6jrVWzyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4v1CxFNl+qnzB+E17/+HiHaniyCq5Aos6F43ScE7S/I=; b=lW6Jz7hBSK0myz4fK4pX60/ZEb4ozB7uZ13BB/gSW9IM8OKBAZxTLL+OAHKWL5FxYJpltL1VzQ06BgKgnMLdFcSBkdS4rxGHXLSD3S0+IFOqyh+rWcrRJL19LlOWYIwQfGfGXsMHWc/ALtNhsQ3NMJsUUSl2By2CShWHVZwbRpAQ7u8q6i6knV1xCP+KgLxAtFfGrO4wfgZbVdmt0pb9Jc8+tztYAeROIOCwRhkBSgdloMNACXeldDXXO+/vGPIDO0V+QrVKC70fHcANiDSWtnR5zZJVN9pKVTHH1xzzQk/HutuV5hP6EDeWSfF79hXSrO7oOJGDLKrRhmrFwqO7Cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4v1CxFNl+qnzB+E17/+HiHaniyCq5Aos6F43ScE7S/I=; b=KDmcCIxSWiG7DNUZgKaUKj7wAJMi8Gu0ifbAZaCEm1FpRkzsz5XMJaPUgYmvzfy93ZbwYdfqg6tkzxz6BWR0DSccBCen5gvO38wOmyI8oSSkzbi15MdfbTNUBTbV0G46ydB6QAthzBk62w9mv5bOvAyug+HcNT2gBNd6S4g1Qiw= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=seco.com; Received: from AM9PR03MB7251.eurprd03.prod.outlook.com (2603:10a6:20b:26e::16) by VI1PR0302MB2816.eurprd03.prod.outlook.com (2603:10a6:800:e4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.19; Tue, 2 Feb 2021 15:24:33 +0000 Received: from AM9PR03MB7251.eurprd03.prod.outlook.com ([fe80::a8f2:7dd:46e5:8526]) by AM9PR03MB7251.eurprd03.prod.outlook.com ([fe80::a8f2:7dd:46e5:8526%6]) with mapi id 15.20.3805.028; Tue, 2 Feb 2021 15:24:33 +0000 From: Sean Anderson To: u-boot@lists.denx.de Cc: Lukasz Majewski , Simon Glass , Sean Anderson , Filip Brozovic , Heinrich Schuchardt , Marek Szyprowski , =?utf-8?q?Pali_Roh=C3=A1r?= , Patrick Delaunay , Sam Protsenko Subject: [PATCH v4 9/9] fastboot: Partition specification Date: Tue, 2 Feb 2021 10:23:52 -0500 Message-Id: <20210202152352.33245-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202152352.33245-1-sean.anderson@seco.com> References: <20210202152352.33245-1-sean.anderson@seco.com> X-Originating-IP: [50.195.82.171] X-ClientProxiedBy: BL1PR13CA0432.namprd13.prod.outlook.com (2603:10b6:208:2c3::17) To AM9PR03MB7251.eurprd03.prod.outlook.com (2603:10a6:20b:26e::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from plantagenet.inhand.com (50.195.82.171) by BL1PR13CA0432.namprd13.prod.outlook.com (2603:10b6:208:2c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.16 via Frontend Transport; Tue, 2 Feb 2021 15:24:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce299185-beb7-4008-da6f-08d8c78ea4c3 X-MS-TrafficTypeDiagnostic: VI1PR0302MB2816: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /jg5uG7IRwPHnsH4M840DdD8ATb8rMPPD+s/jPvIBpVE92oehnNr1fEM715dDrHdkTuk4ssKXdwypuH9N3NyUtGk11vsU/beXX6BwQ29cG1qILMD3Cra8EeTQ0bwCm8cP9IGXAjwVgtXin/ehAR0yrcCMfSyoYtt6u/1rAgbYqkFbLUf5ohLfnPd9zyoK1QdDprwDkWvjfznMLkBiib5Vc7tVEOm5JZBBOquCfW1FHRgVKGd6wKG9HyVH/JyKa/oJU51mdqyvc8sWSPnYxNlScx+v5lMT7oZr9Eb5f+iAx84rhqIH+bGBFZy/HBtavOE1QPWd6GeLRuxkjcr4xyvZMF4Wz9IHKUEOCMK4KyXKkaXXkS6mg/Gm0OUoyFUN3HvGhuOoGbCeSdokRKHjFkLLfP1Bcyic0tvROx1lAp/uYSpuLdHvUaZAZNOX2pTX0WjGQWvggb0flKawvybCZldQiiQ0LAddcqy/9xD+0vwiRNBkkKScBL4sGKWxkyDQ/4/BWK+qiktGPzv3ZB25teIXg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR03MB7251.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(396003)(346002)(39850400004)(366004)(136003)(54906003)(6512007)(1076003)(6916009)(316002)(478600001)(66476007)(66556008)(6666004)(5660300002)(16526019)(66946007)(2616005)(83380400001)(6506007)(2906002)(6486002)(52116002)(186003)(44832011)(4326008)(956004)(36756003)(8676002)(8936002)(86362001)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: XNxzjzR3fEdW0TyWHtoZMQLFLxxf1Rg+3LMYY1BHCvgTrQFpqdc7cBVLxqx1m6MmvCtekqeb/mhnY+tyr2mDffFlrowBRsHkmxIjAOXPAItJXQLr36vWP2LGXcw8Us7huh28opbjmKceqaPoXycnBmknSe3iYp5ZuUFxoDP9qvrBP+3APwy6xj9L7nqt73StWkXcxdoDJ4AA/RVMtyzAf1LrXI7ZpTk6guS9Sgnmsh6OXP/Zs8MxUlNUB7/74a7dIoS78EWhdGCk+AGaM3gZ5na424W+7hmkQPfBwcNDhIHCOZ5hg4pfW4vv0dBmrt1YFq1ErJdpVb97o6XzhnavsJ7/20kgpSl1sx/vfRPFnvx8tOR6Adq1LYnkMapJjuWHmzO9dUlxH1nOj62+vLPvHqBiTLNx7SOGFa3sMKYJfVpeBOOgdbPb7ZFw2AApGiPkOCCw+2kvJnwU/Ix6VGvhKBTWPsrd31j1dA/ETttu+EV3hq8kelP822YDRcfvhvsgJV1V+mdG4oSIKYdMh6jAYhMyKeZ3XUIFwzFkexHw2yhLwTKArbi4mFvm6YcGQnjLYaNxPncQ3+vt2EzUiLzrSixDGowJstTkRVciV/BY8+NcLbmeBAAW0ksgxOEy0/BKR6/Q36QAcWJrmsbw2O4N+X7YqwJ6YDAw8TJ5R13ZEMf+3MGSwZciMgtV/hCde/6hIPmFpFtsn0g8btNILepEquzvAiMAT4ZDNJ/3NqGCF13Qucf4Nbea2zlQKkoRMtlxezciHgfh9afh8Fa2j6tQ47eL6F0CVM8QTKpN13GU0iVoGoW1eJEExk4ev+z/+s/7Fg13jl2t+GZILZlV1E1MXSyOMbZL+XUZHME38LaxKeu4zpbLC8BpOjuSIaAaWdHc1uJ16LlS6bU6m6jhmYSvdGfrHLqgHMoB9hF3nfukR51zzbrY+QTUdc+c5BhFLNlbH66lAgIVbvQHnQfFWDYq782ZZiQret9yHs3luEjIB+esNlfuTS8QJqW0T0nwRPnQ7RnCG2dn9lYcFc+TePhQ9cl1rfilFsJzTN+Z8Q2PZZ2YPZikQT/tGE81QPgvm8ra X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce299185-beb7-4008-da6f-08d8c78ea4c3 X-MS-Exchange-CrossTenant-AuthSource: AM9PR03MB7251.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2021 15:24:33.7463 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kFpI4sPSXF8FOB5U1hYYucEX8MLyLaAaCmK8WdKnttN3HVYfPF7VX9uhJeCGoHdl4cV/Yg0ueyQLmpKtIKq4+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0302MB2816 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This documents the way U-Boot understands partitions specifications. This also updates the fastboot documentation for the changes in the previous commit. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- Changes in v4: - Expand documentation, making it more man-page-like Changes in v2: - Move partition documentation under doc/usage doc/android/fastboot.rst | 4 ++ doc/usage/index.rst | 1 + doc/usage/partitions.rst | 80 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 doc/usage/partitions.rst diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst index 16b11399b3..ce513a2a0f 100644 --- a/doc/android/fastboot.rst +++ b/doc/android/fastboot.rst @@ -154,6 +154,10 @@ The device index starts from ``a`` and refers to the interface (e.g. USB controller, SD/MMC controller) or disk index. The partition index starts from ``1`` and describes the partition number on the particular device. +Alternatively, partition types may be specified using :ref:`U-Boot's partition +syntax `. This allows specifying partitions like ``0.1``, +``0#boot``, or ``:3``. The interface is always ``mmc``. + Writing Partition Table ----------------------- diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 83cfbafd90..d45467caf2 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -6,6 +6,7 @@ Use U-Boot fdt_overlays netconsole + partitions Shell commands -------------- diff --git a/doc/usage/partitions.rst b/doc/usage/partitions.rst new file mode 100644 index 0000000000..cbf8ae34f1 --- /dev/null +++ b/doc/usage/partitions.rst @@ -0,0 +1,80 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. _partitions: + +Partitions +========== + +Synopsis +-------- + +:: + + [devnum][.hwpartnum][:partnum|#partname] + +Description +----------- + +Many U-Boot commands allow specifying partitions (or whole disks) using a +generic syntax. + +interface + The interface used to access the partition's device, like ``mmc`` or + ``scsi``. For a full list of supported interfaces, consult the + ``if_typename_str`` array in ``drivers/block/blk-uclass.c`` + +devnum + The device number. This defaults to 0. + +hwpartnum + The hardware partition number. All devices have at least one hardware + partition. On most devices, hardware partition 0 specifies the whole + device. On eMMC devices, hardware partition 0 is the user partition, + hardware partitions 1 and 2 are the boot partitions, hardware partition + 3 is the RPMB partition, and further partitions are general-purpose + user-created partitions. The default hardware partition number is 0. + +partnum + The partition number, starting from 1. The partition number 0 specifies + that the whole device is to be used as one "partition." + +partname + The partition name. This is the partition label for GPT partitions. For + MBR partitions, the following syntax is used:: + + + + mbr_interface + A device type like ``mmcsd`` or ``hd``. See the + ``part_set_generic_name`` function in ``disk/part.c`` for a + complete list. + + devletter + The device number as an offset from ``a``. For example, device + number 2 would have a device letter of ``c``. + + partnum + The partition number. This is the same as above. + +If neither ``partname`` nor ``partnum`` is specified and there is a partition +table, then partition 1 is used. If there is no partition table, then the whole +device is used as one "partition." If none of ``devnum``, ``hwpartnum``, +``partnum``, or ``partname`` is specified, or only ``-`` is specified, then +``devnum`` defaults to the value of the ``bootdevice`` environmental variable. + +Examples +-------- + +List the root directory contents on MMC device 2, hardware partition 1, +and partition number 3:: + + ls mmc 2.1:3 / + +Load ``/kernel.itb`` to address ``0x80000000`` from SCSI device 0, hardware partition +0, and the partition labeled ``boot``:: + + load scsi #boot 0x80000000 /kernel.itb + +Print the partition UUID of the SATA device ``$bootdevice``, hardware partition +0, and partition number 0:: + + part uuid sata -