public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] omap: Correct the fastboot product var
@ 2019-07-25 17:11 Sam Protsenko
  2019-07-25 17:17 ` Andrew F. Davis
  2019-08-01  3:35 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Sam Protsenko @ 2019-07-25 17:11 UTC (permalink / raw)
  To: u-boot

"fastboot flashall" expects "fastboot getvar product" value to be one of
values provided in android-info.txt file (in AOSP), from "require
board=" list. Before this patch, "am57xx" is returned for all AM57xx
based boards, as it's set in $board env var from SYS_BOARD in
board/ti/am57xx/Kconfig file, which is used for default implementation
of "fastboot getvar product".

In order to fix that inconsistency, let's do next:
  1. In U-Boot: override fastboot.product, reusing the value from
     $board_name
  2. In AOSP: provide values for all AM57xx boards we can use to
     device/ti/beagle_x15/board-info.txt file

This way requirements check in "fastboot flashall" will work as
expected, verifying that user tries to flash images to the board which
those images were built for.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
Changes in v2:
  - reuse the value from $board_name instead of hard-coding it to
    "beagle_x15board" (corresponding changes will be done in AOSP)

 arch/arm/mach-omap2/utils.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index edf5edcb68..7d01446940 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -129,12 +129,25 @@ static inline void omap_set_fastboot_userdata_size(void)
 {
 }
 #endif /* CONFIG_FASTBOOT_FLASH_MMC */
+
+static void omap_set_fastboot_product(void)
+{
+	const char *board_name;
+
+	board_name = env_get("board_name");
+	if (board_name == NULL)
+		printf("Warning: fastboot.product: unknown board\n");
+
+	env_set("fastboot.product", board_name);
+}
+
 void omap_set_fastboot_vars(void)
 {
 	omap_set_fastboot_cpu();
 	omap_set_fastboot_secure();
 	omap_set_fastboot_board_rev();
 	omap_set_fastboot_userdata_size();
+	omap_set_fastboot_product();
 }
 #endif /* CONFIG_FASTBOOT_FLASH */
 
-- 
2.20.1

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

* [U-Boot] [PATCH v2] omap: Correct the fastboot product var
  2019-07-25 17:11 [U-Boot] [PATCH v2] omap: Correct the fastboot product var Sam Protsenko
@ 2019-07-25 17:17 ` Andrew F. Davis
  2019-08-01  3:35 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew F. Davis @ 2019-07-25 17:17 UTC (permalink / raw)
  To: u-boot

On 7/25/19 1:11 PM, Sam Protsenko wrote:
> "fastboot flashall" expects "fastboot getvar product" value to be one of
> values provided in android-info.txt file (in AOSP), from "require
> board=" list. Before this patch, "am57xx" is returned for all AM57xx
> based boards, as it's set in $board env var from SYS_BOARD in
> board/ti/am57xx/Kconfig file, which is used for default implementation
> of "fastboot getvar product".
> 
> In order to fix that inconsistency, let's do next:
>   1. In U-Boot: override fastboot.product, reusing the value from
>      $board_name
>   2. In AOSP: provide values for all AM57xx boards we can use to
>      device/ti/beagle_x15/board-info.txt file
> 
> This way requirements check in "fastboot flashall" will work as
> expected, verifying that user tries to flash images to the board which
> those images were built for.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---

Much cleaner like this, thanks,

Acked-by: Andrew F. Davis <afd@ti.com>

> Changes in v2:
>   - reuse the value from $board_name instead of hard-coding it to
>     "beagle_x15board" (corresponding changes will be done in AOSP)
> 
>  arch/arm/mach-omap2/utils.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
> index edf5edcb68..7d01446940 100644
> --- a/arch/arm/mach-omap2/utils.c
> +++ b/arch/arm/mach-omap2/utils.c
> @@ -129,12 +129,25 @@ static inline void omap_set_fastboot_userdata_size(void)
>  {
>  }
>  #endif /* CONFIG_FASTBOOT_FLASH_MMC */
> +
> +static void omap_set_fastboot_product(void)
> +{
> +	const char *board_name;
> +
> +	board_name = env_get("board_name");
> +	if (board_name == NULL)
> +		printf("Warning: fastboot.product: unknown board\n");
> +
> +	env_set("fastboot.product", board_name);
> +}
> +
>  void omap_set_fastboot_vars(void)
>  {
>  	omap_set_fastboot_cpu();
>  	omap_set_fastboot_secure();
>  	omap_set_fastboot_board_rev();
>  	omap_set_fastboot_userdata_size();
> +	omap_set_fastboot_product();
>  }
>  #endif /* CONFIG_FASTBOOT_FLASH */
>  
> 

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

* [U-Boot] [PATCH v2] omap: Correct the fastboot product var
  2019-07-25 17:11 [U-Boot] [PATCH v2] omap: Correct the fastboot product var Sam Protsenko
  2019-07-25 17:17 ` Andrew F. Davis
@ 2019-08-01  3:35 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2019-08-01  3:35 UTC (permalink / raw)
  To: u-boot

On Thu, Jul 25, 2019 at 08:11:53PM +0300, Sam Protsenko wrote:

> "fastboot flashall" expects "fastboot getvar product" value to be one of
> values provided in android-info.txt file (in AOSP), from "require
> board=" list. Before this patch, "am57xx" is returned for all AM57xx
> based boards, as it's set in $board env var from SYS_BOARD in
> board/ti/am57xx/Kconfig file, which is used for default implementation
> of "fastboot getvar product".
> 
> In order to fix that inconsistency, let's do next:
>   1. In U-Boot: override fastboot.product, reusing the value from
>      $board_name
>   2. In AOSP: provide values for all AM57xx boards we can use to
>      device/ti/beagle_x15/board-info.txt file
> 
> This way requirements check in "fastboot flashall" will work as
> expected, verifying that user tries to flash images to the board which
> those images were built for.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> Acked-by: Andrew F. Davis <afd@ti.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/20190731/e2579651/attachment.sig>

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

end of thread, other threads:[~2019-08-01  3:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-25 17:11 [U-Boot] [PATCH v2] omap: Correct the fastboot product var Sam Protsenko
2019-07-25 17:17 ` Andrew F. Davis
2019-08-01  3:35 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox