aboutsummaryrefslogtreecommitdiff
path: root/sys/boot
diff options
context:
space:
mode:
authorRafal Jaworowski <raj@FreeBSD.org>2010-03-04 20:12:12 +0000
committerRafal Jaworowski <raj@FreeBSD.org>2010-03-04 20:12:12 +0000
commitc1e213930348ef4ec466fba5d10ef7d5561e9223 (patch)
tree34c8992d224a3409aa989a0bdb3405ed6b8b27e2 /sys/boot
parent17b7e3fbec8efb9aa1e15b47869934786fa86482 (diff)
Notes
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/uboot/lib/disk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/boot/uboot/lib/disk.c b/sys/boot/uboot/lib/disk.c
index 4cbdbea445fe..3af4c7956942 100644
--- a/sys/boot/uboot/lib/disk.c
+++ b/sys/boot/uboot/lib/disk.c
@@ -376,6 +376,14 @@ stor_open_gpt(struct open_dev *od, struct uboot_devdesc *dev)
}
dev->d_disk.ptype = PTYPE_GPT;
+ /*
+ * If index of partition to open (dev->d_disk.pnum) is not defined
+ * we set it to the index of the first existing partition. This
+ * handles cases when only a disk device is specified (without full
+ * partition information) by the caller.
+ */
+ if ((od->od_nparts > 0) && (dev->d_disk.pnum == 0))
+ dev->d_disk.pnum = od->od_partitions[0].gp_index;
for (i = 0; i < od->od_nparts; i++)
if (od->od_partitions[i].gp_index == dev->d_disk.pnum)