[PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
Angus Ainslie
angus at akkea.ca
Fri Dec 17 16:41:59 CET 2021
uuu uses the blocksize to determine the upload size
Signed-off-by: Angus Ainslie <angus at akkea.ca>
---
drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index d43f2cfee6..ff5f0d3d40 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -31,6 +31,7 @@ static void getvar_partition_type(char *part_name, char *response);
static void getvar_partition_size(char *part_name, char *response);
#endif
static void getvar_is_userspace(char *var_parameter, char *response);
+static void getvar_logical_blocksize(char *var_parameter, char *response);
static const struct {
const char *variable;
@@ -81,6 +82,9 @@ static const struct {
}, {
.variable = "is-userspace",
.dispatch = getvar_is_userspace
+ }, {
+ .variable = "logical-block-size",
+ .dispatch = getvar_logical_blocksize
}
};
@@ -140,6 +144,29 @@ static void getvar_downloadsize(char *var_parameter, char *response)
fastboot_response("OKAY", response, "0x%08x", fastboot_buf_size);
}
+static int fb_get_block_size(void)
+{
+ int dev_no = 0;
+ struct blk_desc *dev_desc;
+
+ dev_desc = blk_get_dev("mmc", 0);
+
+ if (!dev_desc) {
+ printf("** Block device %s %d not supported\n",
+ "mmc", 0);
+ return 0;
+ }
+ return dev_desc->blksz;
+}
+
+static void getvar_logical_blocksize(char *var_parameter, char *response)
+{
+ u32 blksz;
+
+ blksz = fb_get_block_size();
+ fastboot_response("OKAY", response, "0x%08x", blksz);
+}
+
static void getvar_serialno(char *var_parameter, char *response)
{
const char *tmp = env_get("serial#");
--
2.25.1
More information about the U-Boot
mailing list