diff options
author | szhou <none@none> | 2006-10-05 11:31:43 -0700 |
---|---|---|
committer | szhou <none@none> | 2006-10-05 11:31:43 -0700 |
commit | f2be51489e45daeb2c91d227fa1691c74cc3ea97 (patch) | |
tree | 3b385a81fc80fd9d9e0549aac3c4da9c5f3ec0af /usr/src/lib/libefi/common | |
parent | ccbf80fa3b6bf6b986dca9037e5ad9d6c9f9fa65 (diff) | |
download | illumos-joyent-f2be51489e45daeb2c91d227fa1691c74cc3ea97.tar.gz |
PSARC 2006/340 Solaris Boot Support for EFI and LinuxBIOS
6434157 libefi sometimes gets the wrong gpt partition location
6475349 Boot Support for EFI and LinuxBIOS
Diffstat (limited to 'usr/src/lib/libefi/common')
-rw-r--r-- | usr/src/lib/libefi/common/rdwr_efi.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/usr/src/lib/libefi/common/rdwr_efi.c b/usr/src/lib/libefi/common/rdwr_efi.c index 0ca4445b71..d366be1448 100644 --- a/usr/src/lib/libefi/common/rdwr_efi.c +++ b/usr/src/lib/libefi/common/rdwr_efi.c @@ -66,7 +66,9 @@ static struct uuid_to_ptag { { EFI_DELL_RAID }, { EFI_DELL_SWAP }, { EFI_DELL_LVM }, - { EFI_DELL_RESV } + { EFI_DELL_RESV }, + { EFI_AAPL_HFS }, + { EFI_AAPL_UFS } }; /* @@ -437,9 +439,9 @@ efi_read(int fd, struct dk_gpt *vtoc) return (rval); } - /* partitions start in the next block */ /* LINTED -- always longlong aligned */ - efi_parts = (efi_gpe_t *)(((char *)efi) + disk_info.dki_lbsize); + efi_parts = (efi_gpe_t *)(((char *)efi) + + LE_64(efi->efi_gpt_PartitionEntryLBA) * disk_info.dki_lbsize); /* * Assemble this into a "dk_gpt" struct for easier @@ -583,7 +585,10 @@ check_input(struct dk_gpt *vtoc) return (VT_EINVAL); } if (vtoc->efi_parts[i].p_tag == V_UNASSIGNED) { - continue; + if (uuid_is_null((uchar_t *)&vtoc->efi_parts[i].p_guid)) + continue; + /* we have encountered an unknown uuid */ + vtoc->efi_parts[i].p_tag = 0xff; } if (vtoc->efi_parts[i].p_tag == V_RESERVED) { if (resv_part != -1) { @@ -739,8 +744,21 @@ efi_write(int fd, struct dk_gpt *vtoc) UUID_LE_CONVERT( efi_parts[i].efi_gpe_PartitionTypeGUID, conversion_array[j].uuid); + break; } } + + if (j == sizeof (conversion_array) / sizeof (struct uuid_to_ptag)) { + /* + * If we didn't have a matching uuid match, bail here. + * Don't write a label with unknown uuid. + */ + if (efi_debug) + (void) fprintf(stderr, "Unknown uuid for p_tag %d\n", + vtoc->efi_parts[i].p_tag); + return (VT_EINVAL); + } + efi_parts[i].efi_gpe_StartingLBA = LE_64(vtoc->efi_parts[i].p_start); efi_parts[i].efi_gpe_EndingLBA = |