From patchwork Wed May 6 08:12:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Bisson X-Patchwork-Id: 1284191 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=boundarydevices.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=Mk9AG+Om; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49H8Wh30gsz9sSr for ; Wed, 6 May 2020 18:14:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 74E8D82155; Wed, 6 May 2020 10:12:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=boundarydevices.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=boundarydevices-com.20150623.gappssmtp.com header.i=@boundarydevices-com.20150623.gappssmtp.com header.b="Mk9AG+Om"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2545E82155; Wed, 6 May 2020 10:12:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1D3B582143 for ; Wed, 6 May 2020 10:12:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=boundarydevices.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=gary.bisson@boundarydevices.com Received: by mail-wr1-x443.google.com with SMTP id k1so1049390wrx.4 for ; Wed, 06 May 2020 01:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gziAQGVEUhDagulq5xNxltmX0Ux0cT0UCdJaAVw0VoY=; b=Mk9AG+Omy+woIQ5CwjntLswBiQJa1ze1MceolcHwhndRwbMjFtNyaX/4bdEKijNowN IeIQdQt/ufi6TAoTpI5NsoDBVPXRcCDW/q1M/8pFY/IhQMxRCT4660yeEQWOqsCwxR6z ZQlByjGGDWK6je6FFusr0acdsjgAjapvf+RIHVIQJiDJzRZBn/A+K4sJD0L1zi7XV9CD eCqgoiZfHuoymEPDlbKOKjZ3Dzm9nCr+eFanUN+9kDGWwNnRIM0/+njsLrlmeBHrok3X 5JHMbZ1fQeaQHOug2MuuxjdgjrlMgZysCHV0ZI+K4z6aN9pkZdG5yalT3986pkBAjLch ZQyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gziAQGVEUhDagulq5xNxltmX0Ux0cT0UCdJaAVw0VoY=; b=IaQVBJlsFAO49RPE+ZlyaKze87Og6nVJBJ3rA0UC36nrF6a7EaGxUxKUWyTSwqLdVZ oXKmAvWRZvSk0tfTHeN0gpEMuXlaA3TgmorjjivHQ/AWohKGuC8LV2U4mcpmEIA399t3 sB0FCcDZKsSXRvfI7YN5/3ddETyRrFTWH9OuP0iExQNFTY8vyIM5jw2TmdVRokAetpXI E4vUuwMJGiW4W4yI5L9skiigNageNruzRMWeohhaeRTfm2ZtVQrkQQ57c1quPXf5Vu78 FJarG95dB8TdQB8mxPzRQwkwQ2rth6PiRf1ofU1BfWVtRh5uhmfrKdIApuWBw+DavyfI 2ekA== X-Gm-Message-State: AGi0PubpjxX+i0FTFmRmEUSXBha7/QCQvewK6xzwq49TU3vpyu46oLoJ KIThAXrJt1D0DGFgC9pCI0A3GkIhOyo= X-Google-Smtp-Source: APiQypLEewp9qLtAcvOUw1hNhtO9FmS8K5oWp0Y0ffUvYLk5YCmvX3rYPzqjNA5knVHFnUdpTIeODw== X-Received: by 2002:adf:fa92:: with SMTP id h18mr4706061wrr.260.1588752751455; Wed, 06 May 2020 01:12:31 -0700 (PDT) Received: from p1g2.home (2a01cb000f89b400cc883edd44ec4519.ipv6.abo.wanadoo.fr. [2a01:cb00:f89:b400:cc88:3edd:44ec:4519]) by smtp.gmail.com with ESMTPSA id e13sm1511916wrw.88.2020.05.06.01.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 01:12:30 -0700 (PDT) From: Gary Bisson To: u-boot@lists.denx.de Cc: semen.protsenko@linaro.org, erosca@de.adit-jv.com, lukma@denx.de, Gary Bisson Subject: [PATCH] fastboot: getvar: fix partition-size return value Date: Wed, 6 May 2020 10:12:28 +0200 Message-Id: <20200506081228.8669-1-gary.bisson@boundarydevices.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean The size returned by 'getvar partition-size' should be in bytes, not in blocks as fastboot uses that value to generate empty partition when running format [1]. [1] https://android.googlesource.com/platform/system/core/+/refs/heads/android10-release/fastboot/fastboot.cpp#1500 Signed-off-by: Gary Bisson --- Hi, Another test was to run 'fastboot getvar partition-size:system' on a shipping Android phone, it will give you the size in bytes as well. Regards, Gary --- drivers/fastboot/fb_getvar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c index 95cb434189..51a2bea86d 100644 --- a/drivers/fastboot/fb_getvar.c +++ b/drivers/fastboot/fb_getvar.c @@ -94,7 +94,7 @@ static const struct { * * @param[in] part_name Info for which partition name to look for * @param[in,out] response Pointer to fastboot response buffer - * @param[out] size If not NULL, will contain partition size (in blocks) + * @param[out] size If not NULL, will contain partition size * @return Partition number or negative value on error */ static int getvar_get_part_info(const char *part_name, char *response, @@ -108,13 +108,13 @@ static int getvar_get_part_info(const char *part_name, char *response, r = fastboot_mmc_get_part_info(part_name, &dev_desc, &part_info, response); if (r >= 0 && size) - *size = part_info.size; + *size = part_info.size * part_info.blksz; # elif CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND) struct part_info *part_info; r = fastboot_nand_get_part_info(part_name, &part_info, response); if (r >= 0 && size) - *size = part_info->size; + *size = part_info->size * part_info.blksz; # else fastboot_fail("this storage is not supported in bootloader", response); r = -ENODEV;