configs: meson64_android: use boot part label instead of index
authorMattijs Korpershoek <mkorpershoek@baylibre.com>
Thu, 29 Jul 2021 07:21:11 +0000 (09:21 +0200)
committerNeil Armstrong <narmstrong@baylibre.com>
Thu, 29 Jul 2021 09:37:20 +0000 (11:37 +0200)
To boot Android, we read the gpt and assume that the partition with
index "1" will be the "boot" partition.

This might not always be the case, as there are no requirements from
Android on the partition order.

However, Android does seem to use the "boot" label quite a lot on their
public documentation [1]

Load the boot partition by label instead of by index

[1] https://source.android.com/devices/bootloader/partitions
Signed-off-by: Guillaume La Roque <mkorpershoek@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
include/configs/meson64_android.h

index 4027a7f..e22f05c 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef __MESON64_ANDROID_CONFIG_H
 #define __MESON64_ANDROID_CONFIG_H
 
+#ifndef BOOT_PARTITION
+#define BOOT_PARTITION "boot"
+#endif
 
 #define BOOTENV_DEV_FASTBOOT(devtypeu, devtypel, instance) \
        "bootcmd_fastboot=" \
 
 #define BOOTENV_DEV_SYSTEM(devtypeu, devtypel, instance) \
        "bootcmd_system=" \
-               "echo Loading Android boot partition...;" \
+               "echo Loading Android " BOOT_PARTITION " partition...;" \
                "mmc dev ${mmcdev};" \
                "setenv bootargs ${bootargs} console=${console} androidboot.serialno=${serial#};" \
-               "part start mmc ${mmcdev} ${bootpart} boot_start;" \
-               "part size mmc ${mmcdev} ${bootpart} boot_size;" \
+               "part start mmc ${mmcdev} " BOOT_PARTITION " boot_start;" \
+               "part size mmc ${mmcdev} " BOOT_PARTITION " boot_size;" \
                "if mmc read ${loadaddr} ${boot_start} ${boot_size}; then " \
                        "echo Running Android...;" \
                        "bootm ${loadaddr};" \
 #define CONFIG_EXTRA_ENV_SETTINGS                                     \
        "partitions=" PARTS_DEFAULT "\0"                              \
        "mmcdev=2\0"                                                  \
-       "bootpart=1\0"                                                \
        "logopart=2\0"                                                \
        "gpio_recovery=88\0"                                          \
        "check_button=gpio input ${gpio_recovery};test $? -eq 0;\0"   \