All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: cmd: part: add part block command
@ 2020-06-01 10:20 razvan.becheriu at gmail.com
  2020-06-01 10:20 ` [PATCH] cmd: part: Add 'block' sub-command razvan.becheriu at gmail.com
  2020-06-02 17:55 ` [PATCH]: cmd: part: add part block command Tom Rini
  0 siblings, 2 replies; 10+ messages in thread
From: razvan.becheriu at gmail.com @ 2020-06-01 10:20 UTC (permalink / raw)
  To: u-boot


    The Intel Edison OTA process requires a conversion of data size
    from bytes to number of blocks. The following functions are used:

    # function ota_conv_sizes
    # Convert a bytes size to a block size
    # input  bytesize : size in bytes to convert
    # input  blksize  : size of a block in bytes
    # output num_blk  : converted size in blocks

    # function ota_mmc_write
    # Write a memory buffer to mmc drive
    # input floadaddr    : address of buffer to write
    # input u_part_start : block start in mmc
    # input num_blk      : number of block to write

    This patch adds the cmd part sub-command 'block' which returns
    the partition block size in bytes.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] cmd: part: Add 'block' sub-command
  2020-06-01 10:20 [PATCH]: cmd: part: add part block command razvan.becheriu at gmail.com
@ 2020-06-01 10:20 ` razvan.becheriu at gmail.com
  2020-06-02 17:55   ` Tom Rini
  2020-06-02 17:55 ` [PATCH]: cmd: part: add part block command Tom Rini
  1 sibling, 1 reply; 10+ messages in thread
From: razvan.becheriu at gmail.com @ 2020-06-01 10:20 UTC (permalink / raw)
  To: u-boot

From: Razvan Becheriu <razvan.becheriu@gmail.com>

    Add part block sub-command which returns block size.

    e.g.:
     part block mmc $mmcdev system_a system_a_index

Signed-off-by: Razvan Becheriu <razvan.becheriu@gmail.com>
---
 cmd/part.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/cmd/part.c b/cmd/part.c
index 5e4e45ca6d..d78d914e7a 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -25,6 +25,7 @@
 enum cmd_part_info {
 	CMD_PART_INFO_START = 0,
 	CMD_PART_INFO_SIZE,
+	CMD_PART_INFO_BLOCK,
 	CMD_PART_INFO_NUMBER
 };
 
@@ -151,6 +152,9 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param)
 	case CMD_PART_INFO_SIZE:
 		snprintf(buf, sizeof(buf), LBAF, info.size);
 		break;
+	case CMD_PART_INFO_BLOCK:
+		snprintf(buf, sizeof(buf), LBAF, info.blksz);
+		break;
 	case CMD_PART_INFO_NUMBER:
 		snprintf(buf, sizeof(buf), "0x%x", part);
 		break;
@@ -177,6 +181,11 @@ static int do_part_size(int argc, char * const argv[])
 	return do_part_info(argc, argv, CMD_PART_INFO_SIZE);
 }
 
+static int do_part_block(int argc, char * const argv[])
+{
+	return do_part_info(argc, argv, CMD_PART_INFO_BLOCK);
+}
+
 static int do_part_number(int argc, char * const argv[])
 {
 	return do_part_info(argc, argv, CMD_PART_INFO_NUMBER);
@@ -195,6 +204,8 @@ static int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return do_part_start(argc - 2, argv + 2);
 	else if (!strcmp(argv[1], "size"))
 		return do_part_size(argc - 2, argv + 2);
+	else if (!strcmp(argv[1], "block"))
+		return do_part_block(argc - 2, argv + 2);
 	else if (!strcmp(argv[1], "number"))
 		return do_part_number(argc - 2, argv + 2);
 
@@ -219,6 +230,9 @@ U_BOOT_CMD(
 	"part size <interface> <dev> <part> <varname>\n"
 	"    - set environment variable to the size of the partition (in blocks)\n"
 	"      part can be either partition number or partition name\n"
+	"part block <interface> <dev> <part> <varname>\n"
+	"    - set environment variable to the size of the partition block\n"
+	"      part can be either partition number or partition name\n"
 	"part number <interface> <dev> <part> <varname>\n"
 	"    - set environment variable to the partition number using the partition name\n"
 	"      part must be specified as partition name"
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-01 10:20 [PATCH]: cmd: part: add part block command razvan.becheriu at gmail.com
  2020-06-01 10:20 ` [PATCH] cmd: part: Add 'block' sub-command razvan.becheriu at gmail.com
@ 2020-06-02 17:55 ` Tom Rini
  2020-06-02 18:08   ` razvan becheriu
  1 sibling, 1 reply; 10+ messages in thread
From: Tom Rini @ 2020-06-02 17:55 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 01, 2020 at 01:20:25PM +0300, razvan.becheriu at gmail.com wrote:
> 
>     The Intel Edison OTA process requires a conversion of data size
>     from bytes to number of blocks. The following functions are used:
> 
>     # function ota_conv_sizes
>     # Convert a bytes size to a block size
>     # input  bytesize : size in bytes to convert
>     # input  blksize  : size of a block in bytes
>     # output num_blk  : converted size in blocks
> 
>     # function ota_mmc_write
>     # Write a memory buffer to mmc drive
>     # input floadaddr    : address of buffer to write
>     # input u_part_start : block start in mmc
>     # input num_blk      : number of block to write
> 
>     This patch adds the cmd part sub-command 'block' which returns
>     the partition block size in bytes.

This is usually done with the setexpr command today, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/45b0f8be/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] cmd: part: Add 'block' sub-command
  2020-06-01 10:20 ` [PATCH] cmd: part: Add 'block' sub-command razvan.becheriu at gmail.com
@ 2020-06-02 17:55   ` Tom Rini
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2020-06-02 17:55 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 01, 2020 at 01:20:26PM +0300, razvan.becheriu at gmail.com wrote:
> From: Razvan Becheriu <razvan.becheriu@gmail.com>
> 
>     Add part block sub-command which returns block size.
> 
>     e.g.:
>      part block mmc $mmcdev system_a system_a_index
> 
> Signed-off-by: Razvan Becheriu <razvan.becheriu@gmail.com>
> ---
>  cmd/part.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/cmd/part.c b/cmd/part.c
> index 5e4e45ca6d..d78d914e7a 100644
> --- a/cmd/part.c
> +++ b/cmd/part.c
> @@ -25,6 +25,7 @@
>  enum cmd_part_info {
>  	CMD_PART_INFO_START = 0,
>  	CMD_PART_INFO_SIZE,
> +	CMD_PART_INFO_BLOCK,
>  	CMD_PART_INFO_NUMBER
>  };
>  
> @@ -151,6 +152,9 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param)
>  	case CMD_PART_INFO_SIZE:
>  		snprintf(buf, sizeof(buf), LBAF, info.size);
>  		break;
> +	case CMD_PART_INFO_BLOCK:
> +		snprintf(buf, sizeof(buf), LBAF, info.blksz);
> +		break;
>  	case CMD_PART_INFO_NUMBER:
>  		snprintf(buf, sizeof(buf), "0x%x", part);
>  		break;
> @@ -177,6 +181,11 @@ static int do_part_size(int argc, char * const argv[])
>  	return do_part_info(argc, argv, CMD_PART_INFO_SIZE);
>  }
>  
> +static int do_part_block(int argc, char * const argv[])
> +{
> +	return do_part_info(argc, argv, CMD_PART_INFO_BLOCK);
> +}
> +
>  static int do_part_number(int argc, char * const argv[])
>  {
>  	return do_part_info(argc, argv, CMD_PART_INFO_NUMBER);
> @@ -195,6 +204,8 @@ static int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  		return do_part_start(argc - 2, argv + 2);
>  	else if (!strcmp(argv[1], "size"))
>  		return do_part_size(argc - 2, argv + 2);
> +	else if (!strcmp(argv[1], "block"))
> +		return do_part_block(argc - 2, argv + 2);
>  	else if (!strcmp(argv[1], "number"))
>  		return do_part_number(argc - 2, argv + 2);
>  
> @@ -219,6 +230,9 @@ U_BOOT_CMD(
>  	"part size <interface> <dev> <part> <varname>\n"
>  	"    - set environment variable to the size of the partition (in blocks)\n"
>  	"      part can be either partition number or partition name\n"
> +	"part block <interface> <dev> <part> <varname>\n"
> +	"    - set environment variable to the size of the partition block\n"
> +	"      part can be either partition number or partition name\n"
>  	"part number <interface> <dev> <part> <varname>\n"
>  	"    - set environment variable to the partition number using the partition name\n"
>  	"      part must be specified as partition name"

I believe you can solve the problems mentioned in the cover letter with
setexpr to do the conversion so nak on this patch, thanks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/efed1ccb/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-02 17:55 ` [PATCH]: cmd: part: add part block command Tom Rini
@ 2020-06-02 18:08   ` razvan becheriu
  2020-06-02 18:30     ` Tom Rini
  2020-06-02 18:36     ` razvan becheriu
  0 siblings, 2 replies; 10+ messages in thread
From: razvan becheriu @ 2020-06-02 18:08 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

setexpr can compute the divide/multiply part, but we still need to get the
partition block size somehow.

I know that this is 0x200 by default, but we can not hardcode that in the
scripts. we should read that from the partition info.

On 2020-06-02 at 17:55, trini at konsulko.com wrote:
> On Mon, Jun 01, 2020 at 01:20:25PM +0300, razvan.becheriu at gmail.com
wrote:
> >
> >     The Intel Edison OTA process requires a conversion of data size
> >     from bytes to number of blocks. The following functions are used:
> >
> >     # function ota_conv_sizes
> >     # Convert a bytes size to a block size
> >     # input  bytesize : size in bytes to convert
> >     # input  blksize  : size of a block in bytes
> >     # output num_blk  : converted size in blocks
> >
> >     # function ota_mmc_write
> >     # Write a memory buffer to mmc drive
> >     # input floadaddr    : address of buffer to write
> >     # input u_part_start : block start in mmc
> >     # input num_blk      : number of block to write
> >
> >     This patch adds the cmd part sub-command 'block' which returns
> >     the partition block size in bytes.
>
> This is usually done with the setexpr command today, thanks!
>
> --
> Tom
-----BEGIN PGP SIGNATURE-----
Version: FlowCrypt 7.7.7 Gmail Encryption
Comment: Seamlessly send and receive encrypted email

wsFcBAEBCAAGBQJe1pWTAAoJECfW4OyT2xPzMlgQAJVisTh8t9wGyC0vGmt0
B3vdRqbo2KyHILomQffFSvPxw2s3KiXSCYzL7rXe+rnSQhVAylnCoM2NQSxi
66alVw6yQzxdLSmOddQmemuH5AEpVV3XFRfG4t78upRarfDffQn2xAy0OFs4
/1jrAktvxcXvaZetwu3Idi/lzoFynqT44Nbv1xpjRJgGyTseZh9xXCB5f6rr
sxQTAq5H7Ez+v2XkXtQLoJJnO51N4lBjjoXv+nbWYYBwBOLgOlQMXDNVpY4W
mY4Dc71GEl2YH7tF7mpzKNZuOKUUpLlMh5FOm17QsL3XjuORIUhwUjKYKzIR
kWRi/Inr4MoYH7eIlK/CCzXEMkrLSAkforcrN2kuolY229vGVuDiSUsrFawV
xfsqGTLGKJmYnYXiBDNSrqOQGSk4UDLydP/EAGxyvwq4m2pVLRQlVxttfejU
aD0eh1x6QLBTC2B55VlASyg8KFnobpUMJEWiMJMa3lcytbGLahqSbEax9ZF3
5rdsxWXuW6rv4zJvKzAnSt6dz3qI6vDJy3/5RoE0Zoxp9O5p7uSsTMPxpu2b
bDYoJY4+Th5MNXQYb7F2WAj1G42a1J6QNM3RsTFbDULYCSLPxqa5dOhLJI+U
Fv9ezGedKkAAhmeKhfFVqCX1O5UGIPrYfV5NRDRFVpmNXd4GjhRfSs0Ozfdw
D0ty
=Nf5n
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x27D6E0EC93DB13F3.asc
Type: application/pgp-keys
Size: 3236 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/5df7ca30/attachment.key>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-02 18:08   ` razvan becheriu
@ 2020-06-02 18:30     ` Tom Rini
  2020-06-02 18:36     ` razvan becheriu
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2020-06-02 18:30 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 02, 2020 at 11:08:19AM -0700, razvan becheriu wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> setexpr can compute the divide/multiply part, but we still need to get the
> partition block size somehow.
> 
> I know that this is 0x200 by default, but we can not hardcode that in the
> scripts. we should read that from the partition info.

So there's plenty of examples today of hard-coding that value.  Are you
worried about a potential future change or an exists today problem you
can't otherwise determine the hardware revision of at run-time?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/97f83999/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-02 18:08   ` razvan becheriu
  2020-06-02 18:30     ` Tom Rini
@ 2020-06-02 18:36     ` razvan becheriu
  2020-06-02 18:51       ` Tom Rini
  1 sibling, 1 reply; 10+ messages in thread
From: razvan becheriu @ 2020-06-02 18:36 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

here is the implementation of the functions:

# function ota_conv_sizes
# Convert a bytes size to a block size
# input  bytesize : size in bytes to convert
# input  blksize  : size of a block in bytes
# output num_blk  : converted size in blocks
setenv ota_conv_sizes 'setexpr num_blk $bytesize / $blksize ; setexpr
mod_blk $bytesize % $blksize ; if itest $mod_blk > 0 ; then setexpr num_blk
$num_blk + 1; fi;'

# function ota_mmc_write
# Write a memory buffer to mmc drive
# input floadaddr    : address of buffer to write
# input u_part_start : block start in mmc
# input num_blk      : number of block to write
setenv ota_mmc_write 'if itest $ota_verbose == 1 ; then echo "mmc write
${floadaddr} ${u_part_start} ${num_blk};"; fi; mmc write $floadaddr
$u_part_start $num_blk; ret=$?; if itest $ret != 0 ; then setenv
ota_abort_reason "mmc write ${floadaddr} ${u_part_start} ${num_blk}
failed"; setenv ota_abort 1; fi;'

the old u-boot version supported 'part info mmc 0:${u_part_num}
u_part_start u_part_sz u_part_blksz;' to get the block size.

# function ota_get_partition_attributes
# Retrieve partition attribute
# input  u_part_num   : partition number
# output u_part_start : partition start block number
# output u_part_sz    : partition size in blocks
# output u_part_blksz : partition block size in bytes
setenv ota_get_partition_attributes 'if itest $ota_verbose == 1 ; then echo
"part info mmc 0:${u_part_num} u_part_start u_part_sz u_part_blksz;"; fi;
part info mmc 0:${u_part_num} u_part_start u_part_sz u_part_blksz;ret=$?;
if itest $ret != 0 ; then setenv ota_abort_reason "part info mmc
0:${u_part_num} u_part_start u_part_sz u_part_blksz failed: ${ret}"; setenv
ota_abort 1; fi;'

the new u-boot does not, so we need an explicit command 'part block mmc 0
${u_part_lbl} u_part_blksz;'

# function ota_get_partition_attributes_alternative
# Retrieve partition attribute
# input  u_part_lbl   : partition label
# output u_part_start : partition start block number
# output u_part_sz    : partition size in blocks
# output u_part_blksz : partition block size in bytes
setenv ota_get_partition_attributes_alternative 'if itest $ota_verbose == 1
; then echo "part start mmc 0 ${u_part_lbl} u_part_start; part size mmc 0
${u_part_lbl} u_part_sz; part block mmc 0 ${u_part_lbl} u_part_blksz;"; fi;
part start mmc 0 ${u_part_lbl} u_part_start;ret=$?; if itest $ret != 0 ;
then setenv ota_abort_reason "part start mmc 0 ${u_part_lbl} u_part_start
failed: ${ret}"; setenv ota_abort 1; fi; part size mmc 0 ${u_part_lbl}
u_part_sz;ret=$?; if itest $ret != 0 ; then setenv ota_abort_reason "part
size mmc 0 ${u_part_lbl} u_part_sz failed: ${ret}"; setenv ota_abort 1; fi;
part block mmc 0 ${u_part_lbl} u_part_blksz;ret=$?; if itest $ret != 0 ;
then setenv ota_abort_reason "part block mmc 0 ${u_part_lbl} u_part_blksz
failed: ${ret}"; setenv ota_abort 1; fi;'

On 2020-06-02 at 18:08, razvan.becheriu at gmail.com wrote:
> setexpr can compute the divide/multiply part, but we still need to get
the
> partition block size somehow.
>
> I know that this is 0x200 by default, but we can not hardcode that in the
> scripts. we should read that from the partition info.
>
> On 2020-06-02 at 17:55, trini at konsulko.com wrote:
> > On Mon, Jun 01, 2020 at 01:20:25PM +0300, razvan.becheriu at gmail.com
> wrote:
> > >
> > >     The Intel Edison OTA process requires a conversion of data size
> > >     from bytes to number of blocks. The following functions are used:
> > >
> > >     # function ota_conv_sizes
> > >     # Convert a bytes size to a block size
> > >     # input  bytesize : size in bytes to convert
> > >     # input  blksize  : size of a block in bytes
> > >     # output num_blk  : converted size in blocks
> > >
> > >     # function ota_mmc_write
> > >     # Write a memory buffer to mmc drive
> > >     # input floadaddr    : address of buffer to write
> > >     # input u_part_start : block start in mmc
> > >     # input num_blk      : number of block to write
> > >
> > >     This patch adds the cmd part sub-command 'block' which returns
> > >     the partition block size in bytes.
> >
> > This is usually done with the setexpr command today, thanks!
> >
> > --
> > Tom
-----BEGIN PGP SIGNATURE-----
Version: FlowCrypt 7.7.7 Gmail Encryption
Comment: Seamlessly send and receive encrypted email

wsFcBAEBCAAGBQJe1pxAAAoJECfW4OyT2xPzxxwQAI5G7KPEypB2gBNWNKIt
pH1MBgqMFC90mG8OtLjmCESVmiHZig/fzmEBbTIvyvE1KrEZfy4crjbrkkv3
gwv+Ro26HqtyuuuP0XjO/owWdDuAfdodwRb++YLnV8SgDvZhrf9ttcMX+OpT
kxXunxw1OsAP7Y2S9TxL0ujkKjTxgVW9oRPwWus8c7IRzKrq9SEcob0BFkRV
WrpiEa5K9RrXtsbRyw0OCY8vMr78f/6LJ91kNgGK0orYZF/gCEIw4gCHVopP
1x+O4JRhvxa7FGItB6Odrar01tqmIrSIFKfnyw7bzIXrxa/RLMU5nBLTPxUu
8rQkAGiuM2RwX+zK3odcczL1zXn1aXS+TJAvUYIJWpw1LxiGMc7SMBpegnov
lp6J6imZ2MYMsQ9s0yrpkRST45Qid6qWsYspXu5ZJoEsX+rnmb72drm3PXbs
6Blu5H612nmsnuVAqtyR8H6ElvETpQtC9jFyD66LWXmRZyaeuywXxubiSW54
/VL2JiPC9Rm2weHASTyT1O9+IHyKU9uCBryvpMsf0geHiyaHxDEwIUfUuHiS
DFCwbtxoG/nslEmw4CUZZ6dS22mPdAkUuc8oVPBTIf1mrF8AOM04XZHvYqNP
GEPjWdGYnRLSB4WFxwxT4/5eSm76K72otMVsFPuUT4XvuUbMTSIpSNAh24az
9Q90
=sNXc
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-02 18:36     ` razvan becheriu
@ 2020-06-02 18:51       ` Tom Rini
  2020-06-02 19:23         ` razvan becheriu
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Rini @ 2020-06-02 18:51 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 02, 2020 at 11:36:48AM -0700, razvan becheriu wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> here is the implementation of the functions:
> 
> # function ota_conv_sizes
> # Convert a bytes size to a block size
> # input  bytesize : size in bytes to convert
> # input  blksize  : size of a block in bytes
> # output num_blk  : converted size in blocks
> setenv ota_conv_sizes 'setexpr num_blk $bytesize / $blksize ; setexpr
> mod_blk $bytesize % $blksize ; if itest $mod_blk > 0 ; then setexpr num_blk
> $num_blk + 1; fi;'
> 
> # function ota_mmc_write
> # Write a memory buffer to mmc drive
> # input floadaddr    : address of buffer to write
> # input u_part_start : block start in mmc
> # input num_blk      : number of block to write
> setenv ota_mmc_write 'if itest $ota_verbose == 1 ; then echo "mmc write
> ${floadaddr} ${u_part_start} ${num_blk};"; fi; mmc write $floadaddr
> $u_part_start $num_blk; ret=$?; if itest $ret != 0 ; then setenv
> ota_abort_reason "mmc write ${floadaddr} ${u_part_start} ${num_blk}
> failed"; setenv ota_abort 1; fi;'
> 
> the old u-boot version supported 'part info mmc 0:${u_part_num}
> u_part_start u_part_sz u_part_blksz;' to get the block size.

Old upstream U-Boot?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/cac556f5/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-02 18:51       ` Tom Rini
@ 2020-06-02 19:23         ` razvan becheriu
  2020-06-05 18:01           ` Tom Rini
  0 siblings, 1 reply; 10+ messages in thread
From: razvan becheriu @ 2020-06-02 19:23 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

hm...

It seems that the changes never reached upstream:

git://github.com/01org/edison-u-boot.git branch edison-v2014.04

this branch was implementing 'part info' sub-command which was useful to
retrieve partition info.

the new repo:

git://github.com/edison-fw/u-boot.git branch acpi-v2020.04 does implement
'part number' but does not implement neither 'info' or 'block'.

I do not insist for you to take this patch, but I think it is useful (it is
the simplest version which supports all needed functionality).

If you think the same, let me know. I can change name of the sub-command or
implement this in a different way, if needed.

Thank you,
Razvan

On 2020-06-02 at 18:51, trini at konsulko.com wrote:
> On Tue, Jun 02, 2020 at 11:36:48AM -0700, razvan becheriu wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> >
> > here is the implementation of the functions:
> >
> > # function ota_conv_sizes
> > # Convert a bytes size to a block size
> > # input  bytesize : size in bytes to convert
> > # input  blksize  : size of a block in bytes
> > # output num_blk  : converted size in blocks
> > setenv ota_conv_sizes 'setexpr num_blk $bytesize / $blksize ; setexpr
> > mod_blk $bytesize % $blksize ; if itest $mod_blk > 0 ; then setexpr
num_blk
> > $num_blk + 1; fi;'
> >
> > # function ota_mmc_write
> > # Write a memory buffer to mmc drive
> > # input floadaddr    : address of buffer to write
> > # input u_part_start : block start in mmc
> > # input num_blk      : number of block to write
> > setenv ota_mmc_write 'if itest $ota_verbose == 1 ; then echo "mmc write
> > ${floadaddr} ${u_part_start} ${num_blk};"; fi; mmc write $floadaddr
> > $u_part_start $num_blk; ret=$?; if itest $ret != 0 ; then setenv
> > ota_abort_reason "mmc write ${floadaddr} ${u_part_start} ${num_blk}
> > failed"; setenv ota_abort 1; fi;'
> >
> > the old u-boot version supported 'part info mmc 0:${u_part_num}
> > u_part_start u_part_sz u_part_blksz;' to get the block size.
>
> Old upstream U-Boot?
>
> --
> Tom
-----BEGIN PGP SIGNATURE-----
Version: FlowCrypt 7.7.7 Gmail Encryption
Comment: Seamlessly send and receive encrypted email

wsFcBAEBCAAGBQJe1qdHAAoJECfW4OyT2xPzjDsQAMJXfApPKklwOEWoUXdV
NslWt02UhJrdgg5kztuPxiaHH5sdTEwBj98Ub6B8guhBDeIIoHPp8NYEyRLj
MrCQTsAaM5+QyB1V2BVm7ZYEcTFrpAoaXy0gwKFKllzixpsGEv+99PqT5wDV
ihGLwYWjoTZXCEVazYSoGPWp10s0qpkWmXsCHhGp8GYl1t5Ut0oif8RIx6jl
xGIFXs9vpKi2jsklx4SYSNdpdMPjzB0y+ssG1T5VjovAmb6O/0y0Cv+i+ZYS
UaoJRRMSpwHQ3UNVfuB4TdH7CRiDl8QX2mPCK28JYJSRqxHj7cyD8urp6brE
8xOzIcbb873I3BLXcITkIkcHBRvkp3durqWrmPcSRn0UtqdXaSKv1q9c3LeV
9rQNhE6vF2KmuKm8P5BuLNFUUlkRcf9umRDXm22e8Fah/S82WD08Uh+o5GBB
YzLuXjFfKYCcyi/aQDl3OYpQ3fBZUrmAzJQpPJ/RpsmFAQTJH1QIq98P21Kx
qTUCQPKpctgXlDxx3UgCitN/NXbGTXUVQmBvLZm62Ch750VaBtYf70tSzQYE
n+p5P+EhEfy5MQmU9XWnJ1LIc9TirOGn7IUzu0p+BxT4b+qpazkWQUvhkNB5
R4rfUwr0wcouMi1jzgEinriYAhU90ezKZOBA2ENsr6aPnhgXwdG9nGEcCX4A
UpZA
=OUpE
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH]: cmd: part: add part block command
  2020-06-02 19:23         ` razvan becheriu
@ 2020-06-05 18:01           ` Tom Rini
  0 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2020-06-05 18:01 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 02, 2020 at 12:23:52PM -0700, razvan becheriu wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> hm...
> 
> It seems that the changes never reached upstream:
> 
> git://github.com/01org/edison-u-boot.git branch edison-v2014.04
> 
> this branch was implementing 'part info' sub-command which was useful to
> retrieve partition info.

Ah, I thought it might be something like this, thanks for digging in to
it.

> the new repo:
> 
> git://github.com/edison-fw/u-boot.git branch acpi-v2020.04 does implement
> 'part number' but does not implement neither 'info' or 'block'.
> 
> I do not insist for you to take this patch, but I think it is useful (it is
> the simplest version which supports all needed functionality).
> 
> If you think the same, let me know. I can change name of the sub-command or
> implement this in a different way, if needed.

I think for now I just want to defer on this.  We just aren't at the
point where we can't solve this by knowing ahead of time what the
blocksize is.  I'm sure it will be a problem at some point, but the
other part of the problem is figuring out how to add this functionality
in an opt-in way that still looks clean when written.  If you have some
ideas on that however, I'd be happy to review. Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200605/11f1a986/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-05 18:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 10:20 [PATCH]: cmd: part: add part block command razvan.becheriu at gmail.com
2020-06-01 10:20 ` [PATCH] cmd: part: Add 'block' sub-command razvan.becheriu at gmail.com
2020-06-02 17:55   ` Tom Rini
2020-06-02 17:55 ` [PATCH]: cmd: part: add part block command Tom Rini
2020-06-02 18:08   ` razvan becheriu
2020-06-02 18:30     ` Tom Rini
2020-06-02 18:36     ` razvan becheriu
2020-06-02 18:51       ` Tom Rini
2020-06-02 19:23         ` razvan becheriu
2020-06-05 18:01           ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.