gpt: return 1 directly when test the mbr sector
In sd-update card, we use RKPARM partition in bootloader to load firmware, and use MS-DOS partition in recovery to update system. Now, we want to use gpt in bootloader and abandon the RKPARM partition. So in new sd-update card, we write the MS-DOS partition table and gpt to sd card. Then we must return 1 directly when test the mbr sector otherwise the gpt is unavailable. Change-Id: I994a0cb86e7829c6edadfe357cbf51ad00b65cec Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
parent
6383df2b7b
commit
3bdef7e642
|
|
@ -429,6 +429,7 @@ static int part_efi_repair(struct blk_desc *dev_desc, gpt_entry *gpt_pte,
|
|||
static int part_test_efi(struct blk_desc *dev_desc)
|
||||
{
|
||||
ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz);
|
||||
int ret = 0;
|
||||
|
||||
/* Read legacy MBR from block 0 and validate it */
|
||||
if ((blk_dread(dev_desc, 0, 1, (ulong *)legacymbr) != 1)
|
||||
|
|
@ -460,7 +461,10 @@ static int part_test_efi(struct blk_desc *dev_desc)
|
|||
if (part_efi_repair(dev_desc, b_gpt_pte, b_gpt_head,
|
||||
head_gpt_valid, backup_gpt_valid))
|
||||
printf("Primary GPT repair fail!\n");
|
||||
} else if (head_gpt_valid == 0 && backup_gpt_valid == 0) {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
free(h_gpt_pte);
|
||||
h_gpt_pte = NULL;
|
||||
free(h_gpt_head);
|
||||
|
|
@ -470,7 +474,7 @@ static int part_test_efi(struct blk_desc *dev_desc)
|
|||
free(b_gpt_head);
|
||||
b_gpt_head = NULL;
|
||||
#endif
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1044,6 +1048,17 @@ static int is_pmbr_valid(legacy_mbr * mbr)
|
|||
if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE)
|
||||
return 0;
|
||||
|
||||
#ifdef CONFIG_ARCH_ROCKCHIP
|
||||
/*
|
||||
* In sd-update card, we use RKPARM partition in bootloader to load
|
||||
* firmware, and use MS-DOS partition in recovery to update system.
|
||||
* Now, we want to use gpt in bootloader and abandon the RKPARM
|
||||
* partition. So in new sd-update card, we write the MS-DOS partition
|
||||
* table and gpt to sd card. Then we must return 1 directly when test
|
||||
* the mbr sector otherwise the gpt is unavailable.
|
||||
*/
|
||||
return 1;
|
||||
#endif
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (pmbr_part_valid(&mbr->partition_record[i])) {
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue