diff options
author | marius <marius@FreeBSD.org> | 2011-07-01 18:31:59 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2011-07-01 18:31:59 +0000 |
commit | 88b120a13d424157ae789bb5d4fe4671b11a3e1d (patch) | |
tree | 85cefe074e42ebcf45012f844c81a5f3392ee7c7 | |
parent | d7717a507b09f7de9731276fb39cd69e7407a3bc (diff) | |
download | FreeBSD-src-88b120a13d424157ae789bb5d4fe4671b11a3e1d.zip FreeBSD-src-88b120a13d424157ae789bb5d4fe4671b11a3e1d.tar.gz |
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.
-rw-r--r-- | sys/boot/common/disk.c | 21 | ||||
-rw-r--r-- | sys/boot/userboot/userboot/Makefile | 2 |
2 files changed, 17 insertions, 6 deletions
diff --git a/sys/boot/common/disk.c b/sys/boot/common/disk.c index 40dbc8a..e1de382 100644 --- a/sys/boot/common/disk.c +++ b/sys/boot/common/disk.c @@ -93,6 +93,8 @@ static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA; #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, int slice, 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, char *prefix, int verbose) return (0); } +#endif + #ifdef LOADER_GPT_SUPPORT static int @@ -630,7 +638,7 @@ disk_bestgpt(struct gpt_part *gpt, int ngpt) 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 } diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile index 7271fa7..28ddc12 100644 --- a/sys/boot/userboot/userboot/Makefile +++ b/sys/boot/userboot/userboot/Makefile @@ -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 |