All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugeniu Rosca <roscaeugeniu@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 3/9] cmd: abootimg: Add abootimg command
Date: Sun, 5 Jan 2020 21:38:58 +0100	[thread overview]
Message-ID: <20200105203858.GA1341@erosca> (raw)
In-Reply-To: <20191224195455.31836-4-semen.protsenko@linaro.org>

Hi,

With below nits, I have provided the Reviewed-by/Tested-by signatures.

On Tue, Dec 24, 2019 at 09:54:49PM +0200, Sam Protsenko wrote:
> This command can be used to extract fields and image payloads from
> Android Boot Image. It can be used for example to implement boot flow
> where dtb is taken from boot.img (as v2 incorporated dtb inside of
> boot.img). Using this command, one can obtain needed dtb blob from
> boot.img in scripting manner, and then apply needed dtbo's (from "dtbo"

FWIW, 'scripted manner' is more common, as suggested by Ngram:
https://tinyurl.com/rck3ysj

> diff --git a/cmd/abootimg.c b/cmd/abootimg.c
> +static int abootimg_get_dtb_by_index(int argc, char * const argv[])
> +{
> +	u32 num;
> +	char *endp;
> +	ulong addr;
> +	u32 size;
> +
> +	if (argc < 1 || argc > 3)
> +		return CMD_RET_USAGE;
> +
> +	num = simple_strtoul(argv[0] + strlen("--index="), &endp, 0);
> +	if (*endp != '\0') {
> +		printf("Error: Wrong num\n");
> +		return CMD_RET_FAILURE;
> +	}

The way '--index=' option is processed right now results in below
inconsistencies:

=> abootimg get dtb --index=0
1980
 `- expected output

=> abootimg get dtb --index=
1980
 `- unexpected output (expected error)

=> abootimg get dtb --index=0 --index=1
=>
 `- unexpected output (expected error)

> +U_BOOT_CMD(
> +	abootimg, CONFIG_SYS_MAXARGS, 0, do_abootimg,
> +	"manipulate Android Boot Image",
> +	"addr <addr>\n"
> +	"    - set the address in RAM where boot image is located\n"
> +	"      ($loadaddr is used by default)\n"
> +	"abootimg dump dtb\n"
> +	"    - print info for all DT blobs in DTB area\n"
> +	"abootimg get ver [varname]\n"
> +	"    - get header version\n"
> +	"abootimg get recovery_dtbo [addr_var [size_var]]\n"
> +	"    - get address and size (hex) of recovery DTBO area in the image\n"
> +	"      [addr_var]: variable name to contain DTBO area address\n"
> +	"      [size_var]: variable name to contain DTBO area size\n"
> +	"abootimg get dtb_load_addr [varname]\n"
> +	"    - get load address (hex) of DTB, from image header\n"
> +	"abootimg get dtb --index=<num> [addr_var [size_var]]\n"
> +	"    - get address and size (hex) of DT blob in the image by index\n"
> +	"      <num>: index number of desired DT blob in DTB area\n"
> +	"      [addr_var]: variable name to contain DT blob address\n"
> +	"      [size_var]: variable name to contain DT blob size\n"

[minor] Superfluous blank line at the end of help.

Apart from the above, testing two Android v2 images containing the
DTB in so called "concat" and DTBO formats didn't reveal any issues.

Reviewed-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com>

-- 
Best Regards,
Eugeniu

  reply	other threads:[~2020-01-05 20:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-24 19:54 [PATCH v3 0/9] am57xx: Implement Android 10 boot flow Sam Protsenko
2019-12-24 19:54 ` [PATCH v3 1/9] image: android: Add functions for handling dtb field Sam Protsenko
2020-01-08 17:39   ` Simon Glass
2020-01-10 15:33     ` Sam Protsenko
2020-03-14 20:35       ` Simon Glass
2019-12-24 19:54 ` [PATCH v3 2/9] image: android: Add routine to get dtbo params Sam Protsenko
2020-01-08 17:39   ` Simon Glass
2019-12-24 19:54 ` [PATCH v3 3/9] cmd: abootimg: Add abootimg command Sam Protsenko
2020-01-05 20:38   ` Eugeniu Rosca [this message]
2020-01-08 17:39   ` Simon Glass
2019-12-24 19:54 ` [PATCH v3 4/9] doc: android: Add documentation for Android Boot Image Sam Protsenko
2020-01-09 19:34   ` Simon Glass
2019-12-24 19:54 ` [PATCH v3 5/9] test/py: android: Add test for abootimg Sam Protsenko
2020-01-09 19:34   ` Simon Glass
2019-12-24 19:54 ` [PATCH v3 6/9] configs: am57xx_evm: Enable Android commands Sam Protsenko
2020-01-09 19:34   ` Simon Glass
2019-12-24 19:54 ` [PATCH v3 7/9] env: ti: boot: Respect slot_suffix in AVB commands Sam Protsenko
2019-12-24 19:54 ` [PATCH v3 8/9] env: ti: boot: Boot Android with dynamic partitions Sam Protsenko
2019-12-24 19:54 ` [PATCH v3 9/9] arm: ti: boot: Use correct dtb and dtbo on Android boot Sam Protsenko
2020-01-22 17:51 ` [PATCH v3 0/9] am57xx: Implement Android 10 boot flow Bajjuri, Praneeth
2020-01-22 17:52   ` Bajjuri, Praneeth

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=20200105203858.GA1341@erosca \
    --to=roscaeugeniu@gmail.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 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.