ODROID-C5: amlogic/mmc: check Amlogic bootloader signature
Amlogic U-Boot overwrites the second LBA with the secondary GPT partition when
MMC is initiated, since it always thinks that the GPT partition table is being
used. An OS with non-GPT partition and U-Boot is placed at the second partition
will have a boot problem since the U-Boot will be removed when it's flashed to
the memory card that has a GPT partition with a prior OS.
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Idf17a2c791c791371b0e8df3757969677444e8e9
diff --git a/drivers/amlogic/mmc/aml_emmc_partition.c b/drivers/amlogic/mmc/aml_emmc_partition.c
index 84a373c..ea50f9a 100644
--- a/drivers/amlogic/mmc/aml_emmc_partition.c
+++ b/drivers/amlogic/mmc/aml_emmc_partition.c
@@ -1761,6 +1761,20 @@
return -1;
}
+#ifdef CONFIG_S7D_ODROIDC5
+ {
+ const char *sign = "@ML";
+ int len = strlen(sign);
+ char buf[512];
+
+ ret = blk_dread(mmc_get_blk_desc(mmc), 1, 1, buf);
+ if (ret) {
+ if (!memcmp(buf, sign, len))
+ return 0;
+ }
+ }
+#endif
+
iptbl_inh.count = get_emmc_partition_arraysize();
if (iptbl_inh.count) {
iptbl_inh.partitions = emmc_partition_table;