summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386/boot2/Makefile
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-10-07 21:36:06 +0000
committerphk <phk@FreeBSD.org>2002-10-07 21:36:06 +0000
commit881f1b527c4f798178c2788babc8b0faae40e1b5 (patch)
treeda55d98ee3373c49090ec99d0a43298cb9b76394 /sys/boot/i386/boot2/Makefile
parent981ed72beb07b0fb850b85d0874740b8f80b564a (diff)
downloadFreeBSD-src-881f1b527c4f798178c2788babc8b0faae40e1b5.zip
FreeBSD-src-881f1b527c4f798178c2788babc8b0faae40e1b5.tar.gz
Conditionalize the number of sectors loaded by boot1.s on UFS1/UFS12.
Conditionalize the "XX bytes left" checks reference on UFS1/UFS12. Conditionally build the necessary 64bit math for boot2 if UFS12. Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/boot/i386/boot2/Makefile')
-rw-r--r--sys/boot/i386/boot2/Makefile33
1 files changed, 30 insertions, 3 deletions
diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
index 4526d15..05567c1 100644
--- a/sys/boot/i386/boot2/Makefile
+++ b/sys/boot/i386/boot2/Makefile
@@ -7,7 +7,7 @@ BINDIR?= /boot
BINMODE= 444
CLEANFILES+= boot1 boot1.out boot1.o \
boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \
- boot2.s sio.o
+ boot2.s sio.o divdi3.o moddi3.o qdivrem.o
NM?= nm
@@ -27,6 +27,10 @@ BTX= ${.CURDIR}/../btx
ORG1= 0x7c00
ORG2= 0x1000
+# Setting this to anything else gives UFS1+2 support and larger
+# boot2 binary.
+BOOT2_UFS?= UFS1_ONLY
+
CFLAGS= -elf -ffreestanding -Os -fno-builtin \
-fno-guess-branch-probability \
-mrtd \
@@ -36,7 +40,11 @@ CFLAGS= -elf -ffreestanding -Os -fno-builtin \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
-CFLAGS+= -DUFS1_ONLY
+.if ${BOOT2_UFS} == "UFS1_ONLY"
+CFLAGS+= -D${BOOT2_UFS}
+.else
+
+.endif
LDFLAGS=-nostdlib -static -N
@@ -66,9 +74,15 @@ boot2.h: boot1.out
boot2: boot2.ldr boot2.bin ${BTX}/btx/btx
btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \
-o boot2.ld -P 1 boot2.bin
+.if ${BOOT2_UFS} == "UFS1_ONLY"
@ls -l boot2.ld | awk '{ x = 7680 - $$5; \
print x " bytes available"; if (x < 0) exit 1 }'
dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null
+.else
+ @ls -l boot2.ld | awk '{ x = 9728 - $$5; \
+ print x " bytes available"; if (x < 0) exit 1 }'
+ dd if=boot2.ld of=${.TARGET} obs=9728 conv=osync 2>/dev/null
+.endif
boot2.ldr:
dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null
@@ -76,9 +90,13 @@ boot2.ldr:
boot2.bin: boot2.out
objcopy -S -O binary boot2.out ${.TARGET}
+.if ${BOOT2_UFS} == "UFS1_ONLY"
boot2.out: boot2.o sio.o
+.else
+boot2.out: boot2.o sio.o divdi3.o moddi3.o qdivrem.o
+.endif
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \
- ${BTX}/lib/crt0.o boot2.o sio.o
+ ${BTX}/lib/crt0.o ${.ALLSRC}
boot2.o: boot2.h
@@ -88,6 +106,15 @@ sio.o: sio.s
--defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
${.IMPSRC} -o ${.TARGET}
+moddi3.o: ${.CURDIR}/../../../libkern/moddi3.c
+ ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC}
+
+divdi3.o: ${.CURDIR}/../../../libkern/divdi3.c
+ ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC}
+
+qdivrem.o: ${.CURDIR}/../../../libkern/qdivrem.c
+ ${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC}
+
install:
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
boot1 ${DESTDIR}${BINDIR}/boot1
OpenPOWER on IntegriCloud