summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2012-04-20 15:01:23 +0000
committermarcel <marcel@FreeBSD.org>2012-04-20 15:01:23 +0000
commit58d2e125c4d6dc16535d5d50b8fa3eab9b287353 (patch)
treee441a6211ccc260a51d31fd5c650d98b87b5fdd9 /sys/boot
parent3463f3d087f68b3d32ecd9ccc77f8a2f8aef482d (diff)
downloadFreeBSD-src-58d2e125c4d6dc16535d5d50b8fa3eab9b287353.zip
FreeBSD-src-58d2e125c4d6dc16535d5d50b8fa3eab9b287353.tar.gz
Build a 32-bit EFI loader on amd64. This to match the rest of the
code that is used to construct a loader (e.g. libstand, ficl, etc). There is such a thing as a 64-bit EFI application, but it's not as standard as 32-bit is. Let's make the 32-bit functional (as in we can load and actualy boot a kernel) before solving the 64-bit loader problem.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/efi/Makefile.inc7
-rw-r--r--sys/boot/i386/efi/Makefile11
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/boot/efi/Makefile.inc b/sys/boot/efi/Makefile.inc
index fdfd59c..7e75a6c 100644
--- a/sys/boot/efi/Makefile.inc
+++ b/sys/boot/efi/Makefile.inc
@@ -2,6 +2,13 @@
BINDIR?= /boot
+.if ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+= -m32 -march=i386
+ACFLAGS+= -m32
+LDFLAGS+= -m elf_i386_fbsd
+AFLAGS+= --32
+.endif
+
# Options used when building app-specific efi components
CFLAGS+= -ffreestanding -fshort-wchar -Wformat
LDFLAGS+= -nostdlib
diff --git a/sys/boot/i386/efi/Makefile b/sys/boot/i386/efi/Makefile
index 943de11..95c219d 100644
--- a/sys/boot/i386/efi/Makefile
+++ b/sys/boot/i386/efi/Makefile
@@ -35,7 +35,7 @@ CFLAGS+= -I${.CURDIR}/../../common
FILES= loader.efi
FILESMODE_loader.efi= ${BINMODE}
-LDSCRIPT= ${.CURDIR}/ldscript.${MACHINE_ARCH}
+LDSCRIPT= ${.CURDIR}/ldscript.i386
LDFLAGS= -Wl,-T${LDSCRIPT} -shared -symbolic
${PROG}: ${LDSCRIPT}
@@ -64,6 +64,13 @@ CFLAGS+= -I${.CURDIR}/../libi386
CFLAGS+= -I${.CURDIR}/../btx/lib
DPADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBEFI} -lstand
+LDADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND}
.include <bsd.prog.mk>
+
+.if ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+= -I.
+beforedepend ${OBJS}: machine
+machine:
+ ln -sf ${.CURDIR}/../../../i386/include machine
+.endif
OpenPOWER on IntegriCloud