summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/Makefile.inc11
-rw-r--r--sys/boot/i386/boot2/Makefile12
-rw-r--r--sys/boot/i386/btx/Makefile.inc2
-rw-r--r--sys/boot/i386/btx/btxldr/Makefile1
-rw-r--r--sys/boot/i386/gptboot/Makefile12
-rw-r--r--sys/boot/i386/loader/Makefile2
6 files changed, 38 insertions, 2 deletions
diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
index 6aced18..f8c00de 100644
--- a/sys/boot/i386/Makefile.inc
+++ b/sys/boot/i386/Makefile.inc
@@ -4,3 +4,14 @@
LOADER_ADDRESS?= 0x200000
CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2
+
+.if ${MACHINE_ARCH} == "amd64"
+.MAKEFLAGS: MACHINE_ARCH=i386 MACHINE=i386 REALLY_AMD64=true
+.endif
+
+.if defined(REALLY_AMD64) && !defined(__been_to_Makefile_inc)
+__been_to_Makefile_inc= 1
+CFLAGS+= -m32
+LDFLAGS+= -m elf_i386_fbsd
+AFLAGS+= --32
+.endif
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index 95fec08b..aa8c0cd 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -109,3 +109,15 @@ install:
boot2 ${DESTDIR}${BINDIR}/boot2
.include <bsd.prog.mk>
+
+.if defined(REALLY_AMD64)
+boot2.o: machine
+
+beforedepend ${OBJS}: machine
+
+machine:
+ ln -sf ${.CURDIR}/../../../i386/include machine
+
+CLEANFILES+= machine
+.endif
+
diff --git a/sys/boot/i386/btx/Makefile.inc b/sys/boot/i386/btx/Makefile.inc
new file mode 100644
index 0000000..5a83d8d
--- /dev/null
+++ b/sys/boot/i386/btx/Makefile.inc
@@ -0,0 +1,2 @@
+# $FreeBSD$
+.include <${.CURDIR}/../../Makefile.inc>
diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile
index bd69850..c89af62 100644
--- a/sys/boot/i386/btx/btxldr/Makefile
+++ b/sys/boot/i386/btx/btxldr/Makefile
@@ -19,5 +19,4 @@ btxldr.o: btxldr.s
CLEANFILES+= btxldr btxldr.out btxldr.o
-.include <${.CURDIR}/../../Makefile.inc>
.include <bsd.prog.mk>
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
index 95fec08b..aa8c0cd 100644
--- a/sys/boot/i386/gptboot/Makefile
+++ b/sys/boot/i386/gptboot/Makefile
@@ -109,3 +109,15 @@ install:
boot2 ${DESTDIR}${BINDIR}/boot2
.include <bsd.prog.mk>
+
+.if defined(REALLY_AMD64)
+boot2.o: machine
+
+beforedepend ${OBJS}: machine
+
+machine:
+ ln -sf ${.CURDIR}/../../../i386/include machine
+
+CLEANFILES+= machine
+.endif
+
diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile
index b92fcd6..670bd9f 100644
--- a/sys/boot/i386/loader/Makefile
+++ b/sys/boot/i386/loader/Makefile
@@ -85,7 +85,7 @@ CFLAGS+= -elf
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
- ${CC} -c vers.c
+ ${CC} ${CFLAGS} -c vers.c
${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
OpenPOWER on IntegriCloud