omap: Correct the fastboot product var
authorSam Protsenko <semen.protsenko@linaro.org>
Thu, 25 Jul 2019 17:11:53 +0000 (20:11 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 31 Jul 2019 17:08:07 +0000 (13:08 -0400)
"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>
arch/arm/mach-omap2/utils.c

index edf5edcb6808c86c35fb8a1fee183287c3fd0a89..7d014469409eb56a72d2152425595aafdf0f054f 100644 (file)
@@ -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 */