From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 2/3] cmd: Add 'bcb' command to read/modify/write BCB fields
Date: Thu, 11 Jul 2019 18:06:25 -0400 [thread overview]
Message-ID: <20190711220625.GU5621@bill-the-cat> (raw)
In-Reply-To: <20190523153223.18185-3-erosca@de.adit-jv.com>
On Thu, May 23, 2019 at 05:32:22PM +0200, Eugeniu Rosca wrote:
> 'Bootloader Control Block' (BCB) is a well established term/acronym in
> the Android namespace which refers to a location in a dedicated raw
> (i.e. FS-unaware) flash (e.g. eMMC) partition, usually called "misc",
> which is used as media for exchanging messages between Android userspace
> (particularly recovery [1]) and an Android-capable bootloader.
>
> On higher level, this allows implementing a subset of Android Bootloader
> Requirements [2], amongst which is the Android-specific bootloader
> flow [3]. Regardless how the latter is implemented in U-Boot ([3] being
> the most memorable example), reading/writing/dumping the BCB fields in
> the development process from inside the U-Boot is a convenient feature.
> Hence, make it available to the users.
>
> Some usage examples of the new command recorded on R-Car H3ULCB-KF
> ('>>>' is an overlay on top of the original console output):
>
> => bcb
> bcb - Load/set/clear/test/dump/store Android BCB fields
>
> Usage:
> bcb load <dev> <part> - load BCB from mmc <dev>:<part>
> bcb set <field> <val> - set BCB <field> to <val>
> bcb clear [<field>] - clear BCB <field> or all fields
> bcb test <field> <op> <val> - test BCB <field> against <val>
> bcb dump <field> - dump BCB <field>
> bcb store - store BCB back to mmc
>
> Legend:
> <dev> - MMC device index containing the BCB partition
> <part> - MMC partition index or name containing the BCB
> <field> - one of {command,status,recovery,stage,reserved}
> <op> - the binary operator used in 'bcb test':
> '=' returns true if <val> matches the string stored in <field>
> '~' returns true if <val> matches a subset of <field>'s string
> <val> - string/text provided as input to bcb {set,test}
> NOTE: any ':' character in <val> will be replaced by line feed
> during 'bcb set' and used as separator by upper layers
>
> => bcb dump command
> Error: Please, load BCB first!
> >>> Users must specify mmc device and partition before any other call
>
> => bcb load 1 misc
> => bcb load 1 1
> >>> The two calls are equivalent (assuming "misc" has index 1)
>
> => bcb dump command
> 00000000: 62 6f 6f 74 6f 6e 63 65 2d 73 68 65 6c 6c 00 72 bootonce-shell.r
> 00000010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00 y.r.............
> >>> The output is in binary/string format for convenience
> >>> The output size matches the size of inspected BCB field
> >>> (32 bytes in case of 'command')
>
> => bcb test command = bootonce-shell && echo true
> true
> => bcb test command = bootonce-shell- && echo true
> => bcb test command = bootonce-shel && echo true
> >>> The '=' operator returns 'true' on perfect match
>
> => bcb test command ~ bootonce-shel && echo true
> true
> => bcb test command ~ bootonce-shell && echo true
> true
> >>> The '~' operator returns 'true' on substring match
>
> => bcb set command recovery
> => bcb dump command
> 00000000: 72 65 63 6f 76 65 72 79 00 73 68 65 6c 6c 00 72 recovery.shell.r
> 00000010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00 y.r.............
> >>> The new value is NULL-terminated and stored in the BCB field
>
> => bcb set recovery "msg1:msg2:msg3"
> => bcb dump recovery
> 00000040: 6d 73 67 31 0a 6d 73 67 32 0a 6d 73 67 33 00 00 msg1.msg2.msg3..
> 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> >>> --- snip ---
> >>> Every ':' is replaced by line-feed '\n' (0xA). The latter is used
> >>> as separator between individual commands by Android userspace
>
> => bcb store
> >>> Flush/store the BCB structure to MMC
>
> [1] https://android.googlesource.com/platform/bootable/recovery
> [2] https://source.android.com/devices/bootloader
> [3] https://patchwork.ozlabs.org/patch/746835/
> ("[U-Boot,5/6] Initial support for the Android Bootloader flow")
>
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/f74ee731/attachment.sig>
next prev parent reply other threads:[~2019-07-11 22:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 15:32 [U-Boot] [PATCH v3 0/3] Add 'bcb' command to read/modify/write Android BCB Eugeniu Rosca
2019-05-23 15:32 ` [U-Boot] [PATCH v3 1/3] include: android_bootloader_message.h: Minimize the diff to AOSP Eugeniu Rosca
2019-06-22 19:09 ` Simon Glass
2019-07-11 22:06 ` Tom Rini
2019-05-23 15:32 ` [U-Boot] [PATCH v3 2/3] cmd: Add 'bcb' command to read/modify/write BCB fields Eugeniu Rosca
2019-06-22 19:09 ` Simon Glass
2019-07-06 16:18 ` Eugeniu Rosca
2019-07-11 22:06 ` Tom Rini [this message]
2019-05-23 15:32 ` [U-Boot] [PATCH v3 3/3] doc: relocate/rename Android README and add BCB overview Eugeniu Rosca
2019-06-22 19:09 ` Simon Glass
2019-07-02 21:25 ` Eugeniu Rosca
2019-07-02 18:11 ` Sam Protsenko
2019-07-02 21:22 ` Eugeniu Rosca
2019-07-11 22:06 ` Tom Rini
2019-05-23 22:58 ` [U-Boot] [PATCH v3 0/3] Add 'bcb' command to read/modify/write Android BCB Sam Protsenko
2019-05-27 15:26 ` Eugeniu Rosca
2019-06-04 12:36 ` Sam Protsenko
2019-06-04 13:25 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190711220625.GU5621@bill-the-cat \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox