[{"id":3683641,"web_url":"http://patchwork.ozlabs.org/comment/3683641/","msgid":"<CAFLszTgkMQUv93VFTEzj_dNyjFsQntyG+9zAbnNtjQDTg4Y45Q@mail.gmail.com>","list_archive_url":null,"date":"2026-04-28T18:21:52","subject":"Re: [PATCH v2 3/4] fastboot: block: Add GPT/MBR partition table\n flashing support","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"Hi Balaji,\n\nOn 2026-04-27T12:06:41, Balaji Selvanathan\n<balaji.selvanathan@oss.qualcomm.com> wrote:\n> fastboot: block: Add GPT/MBR partition table flashing support\n>\n> Add support for flashing GPT and MBR partition tables to the\n> fastboot block backend. This enables operations like \"fastboot flash\n> gpt gpt.img\" and \"fastboot flash mbr mbr.img\" for block devices.\n>\n> The implementation validates partition table names and rejects\n> invalid input formats such as ':gpt' or ':mbr' where the device\n> prefix is missing. Valid formats include 'gpt', 'mbr', '0:gpt',\n> and '1:mbr'.\n>\n> Update Kconfig dependencies to allow FASTBOOT_GPT_NAME and\n> FASTBOOT_MBR_NAME to work with both MMC and block backends.\n>\n> Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>\n>\n> drivers/fastboot/Kconfig    |  4 ++--\n>  drivers/fastboot/fb_block.c | 49 +++++++++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 51 insertions(+), 2 deletions(-)\n\n> diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig\n> @@ -227,7 +227,7 @@ config FASTBOOT_FLASH_BLOCK_DEVICE_ID\n> +Update Kconfig dependencies to allow FASTBOOT_GPT_NAME and\n> +FASTBOOT_MBR_NAME to work with both MMC and block backends.`\n\nStray backtick at the end of this paragraph - please drop it.\n\n> diff --git a/drivers/fastboot/fb_block.c b/drivers/fastboot/fb_block.c\n> @@ -361,6 +382,34 @@ void fastboot_block_flash_write(const char *part_name, void *download_buffer,\n> +#if CONFIG_IS_ENABLED(EFI_PARTITION)\n> +     if (is_partition_table_name(part_name, CONFIG_FASTBOOT_GPT_NAME)) {\n> +             int device;\n> +             const char *interface = config_opt_enabled(CONFIG_FASTBOOT_FLASH_BLOCK,\n> +                                                        CONFIG_FASTBOOT_FLASH_BLOCK_INTERFACE_NAME,\n> +                                                        NULL);\n> +\n> +             parse_device_partition(part_name, &device, NULL);\n> +             fastboot_flash_gpt_partition_table(interface, device,\n> +                                                download_buffer, response);\n> +             return;\n> +     }\n> +#endif\n> +\n> +#if CONFIG_IS_ENABLED(DOS_PARTITION)\n> +     if (is_partition_table_name(part_name, CONFIG_FASTBOOT_MBR_NAME)) {\n> +             int device;\n> +             const char *interface = config_opt_enabled(CONFIG_FASTBOOT_FLASH_BLOCK,\n> +                                                        CONFIG_FASTBOOT_FLASH_BLOCK_INTERFACE_NAME,\n> +                                                        NULL);\n> +\n> +             parse_device_partition(part_name, &device, NULL);\n> +             fastboot_flash_mbr_partition_table(interface, device,\n> +                                                download_buffer, response);\n> +             return;\n> +     }\n> +#endif\n\nThe two arms are near-identical and both repeat the interface lookup\nthat fastboot_block_get_part_info() already does. Please factor the\ninterface/device resolution into a small helper (or move it above the\n#ifs) so the GPT and MBR branches reduce to the\nis_partition_table_name() check and the helper call.\n\n> diff --git a/drivers/fastboot/fb_block.c b/drivers/fastboot/fb_block.c\n> @@ -361,6 +382,34 @@ void fastboot_block_flash_write(const char *part_name, void *download_buffer,\n> +             parse_device_partition(part_name, &device, NULL);\n> +             fastboot_flash_gpt_partition_table(interface, device,\n> +                                                download_buffer, response);\n\nThe return value of parse_device_partition() is\ndiscarded...is_partition_table_name() happens to filter out ':gpt'\ntoday, so this is safe by construction, but the coupling is pretty\nfragile - please check the return and fastboot_fail() on -EINVAL, or\nadd a comment explaining why it cannot fail. Same in the MBR branch.\n\nRegards,\nSimon","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=SdLlZgKd;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"SdLlZgKd\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org","phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4pgV0vN2z1xrS\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 04:22:13 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id D982C846BD;\n\tTue, 28 Apr 2026 20:22:11 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 6340A846B5; Tue, 28 Apr 2026 20:22:10 +0200 (CEST)","from mail-ej1-x634.google.com (mail-ej1-x634.google.com\n [IPv6:2a00:1450:4864:20::634])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id A7859846C8\n for <u-boot@lists.denx.de>; Tue, 28 Apr 2026 20:22:05 +0200 (CEST)","by mail-ej1-x634.google.com with SMTP id\n a640c23a62f3a-b936331786dso1538111366b.3\n for <u-boot@lists.denx.de>; Tue, 28 Apr 2026 11:22:05 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","ARC-Seal":"i=1; a=rsa-sha256; t=1777400525; cv=none;\n d=google.com; s=arc-20240605;\n b=X7/WZTOdvSuKRI4Rje/Outkg40jqp91TC2MRn6ln31I0Cv/9XJOqTC7WgUKBak3zch\n vQUebSZCLiV1bzwSg63kNcu8yRwBCtVhTloVbb9VOYBQGZXBN2CPXCxux7Mw/NzXdupt\n x7IKNHe0iRRMeB5kaxiq7gytAT889w2xvHgKYg7oPI9GLbOLK+yzpPLCW3WCe5Ynw3eX\n z7bfVNhtiBxT+Av3DmOymquf771DFjciMWqBFBsWHh+qQYI1PyJ8p2dv54+44fGNnFs2\n iDuic/j6oBKtzr0lHTJguLxILmsQSqlsHMPXPI8SIk4p6Pmtt9muKPfAmzLTb9N78Hhi\n aqvg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:dkim-signature;\n bh=SE0Zte92CpuqqUMOpPNVtCIS0sqSGUR4iR6n6hS8FGA=;\n fh=FSZLg1kBZKtmq7hkO96s8J8bywdf/NrVlQg027zGQAY=;\n b=Mz/pkpj87w0uNWko2btQ5ccnXPHynFC9TvVBxLyN7FnT6quN+xJqXCTV4xr0oBELfu\n Aw0KllFIiLxaG1XQ2qdtinPYpqzY1Rvz+SEPNwUs18HCpbWi7qZD2ycSTg6cDxcrbt8f\n fe9Y0Lg/k0FXkLDuyGxspr5x3Waj2FhYcZunnLlJfeZnRBzueYh3oj6VIm3Uu410XY27\n ir+s1axmIUvtPIATv4ngeasQqHILtLMvRdGxxzFmoDA2ZqKQVGtcAKXEjd1KLW78Sq9b\n T6JiNYqT84nLlRW3NHKmFFiBiKy5bl+hnhtZUMswb/Xrm1EUQfo3FDZL08OgOPZBOsm8\n q5hg==; darn=lists.denx.de","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=chromium.org; s=google; t=1777400525; x=1778005325; darn=lists.denx.de;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:from:to:cc:subject:date:message-id:reply-to;\n bh=SE0Zte92CpuqqUMOpPNVtCIS0sqSGUR4iR6n6hS8FGA=;\n b=SdLlZgKdSBuyLlk69BYkIBp0Ns/SxBHoQtpKBdVlQ4kC4IwwcTwS7OfEB/rl4H+3IP\n 4JY15od2LTbOIVIY0tLzQfmrZ2rnt+YkLqlRQbSTZukNfbW/5cY/pQdn/8ZGUQUc6W1v\n geR7KC8TonK+5RVUmHNHNouGFby6bG38sFfqU=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777400525; x=1778005325;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=SE0Zte92CpuqqUMOpPNVtCIS0sqSGUR4iR6n6hS8FGA=;\n b=FrwE8I3Qjx06T5DODAygFP7K8RZ6I47lrMqFq4v5d4HjgOb/a7KKyf9KvLHXsEVmo/\n 85POr3bLXEmq+YS7cfTMrHTE+iBxFDYB9UE8PfF7nkpq/Rv1COIcXVeaOQ4/yW5zhJUM\n 6MIlPN4Blb379dDRFuiNPqN/Qk3W1EoxDP7WOhn9O2+vgG8brfPfYInLecC8h9ceOFjJ\n L7Ijf1McmbEr4xevf1iFlp0lHbcfDufFu711KTqNIDg5QtWLdqXmWBkt7c12bCEGimWe\n FeFx6J5dFKMddlVac09soTxSvuB+lZyq86bqCEbTA17bhhNS4dd5CURFtiPv6mzlQYLn\n 3jGg==","X-Gm-Message-State":"AOJu0YygTX41GPMKg0qT/HTZdB7ojAgTZBXmbt0jvvT0ecqifYz9nIi6\n DRKoMPC5UsbFpGmavI2MlkPSLULpPIw9fZQjhGyAKOV2Z3P8LLUlCljpHj4RlGPs/aQqynhXZQ1\n WMxPoi/1MJVUttPc9+I3YhYKTMJd7jGwl65/gsRm8","X-Gm-Gg":"AeBDieu52LOIudW3NeM1dQNWwtBW3U1Kx2dTzsEoqhapILjW5VAILxCNwSZbrgqHNy9\n sCWYYP9XfxNnn987Y0VV8yofAUE4t8xHS993CLQxmXfv4PlZwh85b5POAvRz8qNxxOgeR3dEoxe\n B0ebwiesLA9eq5i5N0iOPpadyk4K4xSqr7Qr8YQ6dAW+qPCHHKWz6f/Bd+hk8otdtjbYsb9uZYm\n CNHmWMfMkO2PL+PhTTtzzpKfi2h3Nf2sh+JJJMH9H4LyBREhKqGFOqehl4vvv+0zTDxzDbeoyBp\n nQVWbYjmHMN/BPyK","X-Received":"by 2002:a17:907:c007:b0:ba6:4e0f:e3a8 with SMTP id\n a640c23a62f3a-bb8022c2c58mr303032766b.12.1777400525059; Tue, 28 Apr 2026\n 11:22:05 -0700 (PDT)","MIME-Version":"1.0","References":"<20260427-fb_gpt-v2-0-9e7fe3c1649a@oss.qualcomm.com>\n <20260427-fb_gpt-v2-3-9e7fe3c1649a@oss.qualcomm.com>","In-Reply-To":"<20260427-fb_gpt-v2-3-9e7fe3c1649a@oss.qualcomm.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Tue, 28 Apr 2026 12:21:52 -0600","X-Gm-Features":"AVHnY4JQTsF6msTLoDdqZZsJQQwleTjVwLYihIX7Jx5HcN2HalaW_sh5ZpssktY","Message-ID":"\n <CAFLszTgkMQUv93VFTEzj_dNyjFsQntyG+9zAbnNtjQDTg4Y45Q@mail.gmail.com>","Subject":"Re: [PATCH v2 3/4] fastboot: block: Add GPT/MBR partition table\n flashing support","To":"balaji.selvanathan@oss.qualcomm.com","Cc":"u-boot@lists.denx.de, Mattijs Korpershoek <mkorpershoek@kernel.org>,\n Tom Rini <trini@konsulko.com>, Heiko Schocher <hs@nabladev.com>,\n Neil Armstrong <neil.armstrong@linaro.org>,\n Dmitrii Merkurev <dimorinny@google.com>,\n Adrian Freihofer <adrian.freihofer@siemens.com>, Peng Fan <peng.fan@nxp.com>,\n Jaehoon Chung <jh80.chung@samsung.com>,\n \"Ariel D'Alessandro\" <ariel.dalessandro@collabora.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"}}]