svn commit: r223712 - in head/sys/boot: common userboot/userboot
Marius Strobl
marius at FreeBSD.org
Fri Jul 1 18:32:00 UTC 2011
Author: marius
Date: Fri Jul 1 18:31:59 2011
New Revision: 223712
URL: http://svn.freebsd.org/changeset/base/223712
Log:
Fix r223695 to compile on architectures which don't use the MBR scheme; wrap
the MBR support in the common part of the loader in #ifdef's and enable it
only for userboot for now.
Modified:
head/sys/boot/common/disk.c
head/sys/boot/userboot/userboot/Makefile
Modified: head/sys/boot/common/disk.c
==============================================================================
--- head/sys/boot/common/disk.c Fri Jul 1 12:30:34 2011 (r223711)
+++ head/sys/boot/common/disk.c Fri Jul 1 18:31:59 2011 (r223712)
@@ -93,6 +93,8 @@ static uuid_t ms_basic_data = GPT_ENT_TY
#endif
+#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT)
+
/* Given a size in 512 byte sectors, convert it to a human-readable number. */
static char *
display_size(uint64_t size)
@@ -116,6 +118,10 @@ display_size(uint64_t size)
return (buf);
}
+#endif
+
+#ifdef LOADER_MBR_SUPPORT
+
static void
disk_checkextended(struct disk_devdesc *dev,
struct dos_partition *slicetab, int slicenum, int *nslicesp)
@@ -469,7 +475,7 @@ disk_printslice(struct disk_devdesc *dev
pager_output(line);
}
-int
+static int
disk_printmbr(struct disk_devdesc *dev, char *prefix, int verbose)
{
struct dos_partition *slicetab;
@@ -488,6 +494,8 @@ disk_printmbr(struct disk_devdesc *dev,
return (0);
}
+#endif
+
#ifdef LOADER_GPT_SUPPORT
static int
@@ -630,7 +638,7 @@ disk_bestgpt(struct gpt_part *gpt, int n
return (prefpart);
}
-int
+static int
disk_opengpt(struct disk_devdesc *dev)
{
struct gpt_part *gpt = NULL, *gp;
@@ -759,6 +767,7 @@ disk_open(struct disk_devdesc *dev)
{
int rc;
+ rc = 0;
/*
* While we are reading disk metadata, make sure we do it relative
* to the start of the disk
@@ -769,7 +778,9 @@ disk_open(struct disk_devdesc *dev)
rc = disk_opengpt(dev);
if (rc)
#endif
+#ifdef LOADER_MBR_SUPPORT
rc = disk_openmbr(dev);
+#endif
return (rc);
}
@@ -777,12 +788,12 @@ disk_open(struct disk_devdesc *dev)
void
disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
{
- int rc;
#ifdef LOADER_GPT_SUPPORT
- rc = disk_printgpt(dev, prefix, verbose);
- if (rc == 0)
+ if (disk_printgpt(dev, prefix, verbose) == 0)
return;
#endif
+#ifdef LOADER_MBR_SUPPORT
disk_printmbr(dev, prefix, verbose);
+#endif
}
Modified: head/sys/boot/userboot/userboot/Makefile
==============================================================================
--- head/sys/boot/userboot/userboot/Makefile Fri Jul 1 12:30:34 2011 (r223711)
+++ head/sys/boot/userboot/userboot/Makefile Fri Jul 1 18:31:59 2011 (r223712)
@@ -32,7 +32,7 @@ CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../..
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
CFLAGS+= -ffreestanding -I.
-CFLAGS+= -DLOADER_GPT_SUPPORT
+CFLAGS+= -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT
LDFLAGS+= -nostdlib -Wl,-Bsymbolic
More information about the svn-src-all
mailing list