From beef004c1daa5494f590c3307e7cb28d460a65eb Mon Sep 17 00:00:00 2001 From: "faqiang.zhu" Date: Tue, 14 Apr 2020 15:44:58 +0800 Subject: [PATCH] MA-16954 set partition type to efi after flash gpt partition If the target device have DOS partition, uboot will save the partition type as dos partition at early stage when the driver bind the device. After the gpt partition is flashed, uboot will try to reload the DOS partition, instead of the the EFI partition. In this commit, if the GPT partition is successfully flashed, set the partition type to be PART_TYPE_EFI if necessary, so the EFI partitions will be reloaded. Change-Id: I6095cb56c73aecee24f76d169db89daba3783e29 Signed-off-by: faqiang.zhu (cherry picked from commit 62becd667e5f3ebbefef796818eda78f4d0e167b) (cherry picked from commit 358efa24b714738ce145fa60f0b4d194b68c4c49) --- drivers/fastboot/fb_fsl/fb_fsl_command.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/fastboot/fb_fsl/fb_fsl_command.c b/drivers/fastboot/fb_fsl/fb_fsl_command.c index 2cce088d45..d2086725ad 100644 --- a/drivers/fastboot/fb_fsl/fb_fsl_command.c +++ b/drivers/fastboot/fb_fsl/fb_fsl_command.c @@ -831,6 +831,18 @@ static void flash(char *cmd, char *response) #if defined(CONFIG_FASTBOOT_LOCK) if (strncmp(cmd, "gpt", 3) == 0) { int gpt_valid = 0; + int mmc_no; + struct blk_desc *dev_desc; + mmc_no = fastboot_devinfo.dev_id; + dev_desc = blk_get_dev("mmc", mmc_no); + if (dev_desc) { + if (dev_desc->part_type != PART_TYPE_EFI) + dev_desc->part_type = PART_TYPE_EFI; + } + else { + fastboot_fail("", response); + return; + } gpt_valid = partition_table_valid(); /* If gpt is valid, load partitons table into memory. So if the next command is "fastboot reboot bootloader", -- 2.17.1