diff options
author | Peter Jones | 2017-09-13 18:05:25 -0400 |
---|---|---|
committer | Alexander Graf | 2017-09-20 10:20:19 +0200 |
commit | ff98cb90514d9b787ddc097c203ac8db2941efe1 (patch) | |
tree | 18c1894c6eb53cd60889d6044a87f9b1f81a8afe /disk/part_dos.c | |
parent | 0d6ab32e3712fe7bc2e3aaf3d93e0d5910264df3 (diff) |
part: extract MBR signature from partitions
EFI client programs need the signature information from the partition
table to determine the disk a partition is on, so we need to fill that
in here.
Signed-off-by: Peter Jones <pjones@redhat.com>
[separated from efi_loader part, and fixed build-errors for non-
CONFIG_EFI_PARTITION case]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'disk/part_dos.c')
-rw-r--r-- | disk/part_dos.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/disk/part_dos.c b/disk/part_dos.c index 7aff73d6f8c..1a36be0446a 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -89,14 +89,20 @@ static int test_block_type(unsigned char *buffer) static int part_test_dos(struct blk_desc *dev_desc) { - ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz); - if (blk_dread(dev_desc, 0, 1, (ulong *)buffer) != 1) + if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) return -1; - if (test_block_type(buffer) != DOS_MBR) + if (test_block_type((unsigned char *)mbr) != DOS_MBR) return -1; + if (dev_desc->sig_type == SIG_TYPE_NONE && + mbr->unique_mbr_signature != 0) { + dev_desc->sig_type = SIG_TYPE_MBR; + dev_desc->mbr_sig = mbr->unique_mbr_signature; + } + return 0; } |