X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=disk%2Fpart_efi.c;h=fdca91a69747c24bf1c36903f712aec8d5387135;hb=bbcacdf4cd23f2e5deb9ef916096c956c955243d;hp=2f922662e6e65212ca516614f16590ac6bc3aeef;hpb=31ce367cd10087b532431c023e4a95513ecdee5d;p=platform%2Fkernel%2Fu-boot.git diff --git a/disk/part_efi.c b/disk/part_efi.c index 2f92266..fdca91a 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -28,12 +29,13 @@ DECLARE_GLOBAL_DATA_PTR; -/* - * GUID for basic data partions. - */ +#ifdef CONFIG_HAVE_BLOCK_DEVICE + +/* GUID for basic data partitons */ +#if CONFIG_IS_ENABLED(EFI_PARTITION) static const efi_guid_t partition_basic_data_guid = PARTITION_BASIC_DATA_GUID; +#endif -#ifdef CONFIG_HAVE_BLOCK_DEVICE /** * efi_crc32() - EFI version of crc32 function * @buf: buffer to calculate crc32 of @@ -691,6 +693,15 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, /* Free pte before allocating again */ free(*gpt_pte); + /* + * Check that the alternate_lba entry points to the last LBA + */ + if (le64_to_cpu(gpt_head->alternate_lba) != (dev_desc->lba - 1)) { + printf("%s: *** ERROR: Misplaced Backup GPT ***\n", + __func__); + return -1; + } + if (is_gpt_valid(dev_desc, (dev_desc->lba - 1), gpt_head, gpt_pte) != 1) { printf("%s: *** ERROR: Invalid Backup GPT ***\n", @@ -867,6 +878,9 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf) return 1; } + /* Update the partition table entries*/ + part_init(dev_desc); + return 0; } #endif @@ -1113,4 +1127,4 @@ U_BOOT_PART_TYPE(a_efi) = { .print = part_print_ptr(part_print_efi), .test = part_test_efi, }; -#endif +#endif /* CONFIG_HAVE_BLOCK_DEVICE */