summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2012-10-02 04:41:43 +0000
committergrehan <grehan@FreeBSD.org>2012-10-02 04:41:43 +0000
commitc17623c804ffef4eb832614f4e0c8806e8a06696 (patch)
tree099ac1de477c5e597f0600b8e34695be4eb72eb3
parentdd517bc79305495fff46170a4c43275a5e8bef37 (diff)
downloadFreeBSD-src-c17623c804ffef4eb832614f4e0c8806e8a06696.zip
FreeBSD-src-c17623c804ffef4eb832614f4e0c8806e8a06696.tar.gz
Fix the error return in disk_readslicetab() when an MBR/GPT partition
wasn't found, and use that in userdisk_open() to allow raw disks and ISO images to be read. This is a temporary fix - disk.c has changed a lot in CURRENT so this code may be reworked or made redundant on the next IFC. It is useful to be able to boot from CD in the meantime.
-rw-r--r--sys/boot/common/disk.c1
-rw-r--r--sys/boot/userboot/userboot/userboot_disk.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/sys/boot/common/disk.c b/sys/boot/common/disk.c
index 81902c0..6dad222 100644
--- a/sys/boot/common/disk.c
+++ b/sys/boot/common/disk.c
@@ -192,6 +192,7 @@ disk_readslicetab(struct disk_devdesc *dev,
*/
if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) {
DEBUG("no slice table/MBR (no magic)");
+ rc = EEXIST;
return (rc);
}
diff --git a/sys/boot/userboot/userboot/userboot_disk.c b/sys/boot/userboot/userboot/userboot_disk.c
index 074d3e1..ee2baef 100644
--- a/sys/boot/userboot/userboot/userboot_disk.c
+++ b/sys/boot/userboot/userboot/userboot_disk.c
@@ -103,6 +103,7 @@ userdisk_open(struct open_file *f, ...)
{
va_list ap;
struct disk_devdesc *dev;
+ int rc;
va_start(ap, f);
dev = va_arg(ap, struct disk_devdesc *);
@@ -111,7 +112,15 @@ userdisk_open(struct open_file *f, ...)
if (dev->d_unit < 0 || dev->d_unit >= userboot_disk_maxunit)
return (EIO);
- return (disk_open(dev));
+ rc = disk_open(dev);
+
+ /*
+ * No MBR/GPT - assume a raw disk image
+ */
+ if (rc)
+ dev->d_offset = 0;
+
+ return (0);
}
static int
OpenPOWER on IntegriCloud