summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386/gptboot/Makefile
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-02-06 21:58:32 +0000
committerru <ru@FreeBSD.org>2004-02-06 21:58:32 +0000
commit21fda7ee48f465c5fc64f99bf64397595d205484 (patch)
tree77a2225b4e0eca9d79fcb1ab7afde8fa690843f6 /sys/boot/i386/gptboot/Makefile
parent55923d02028e15a90b63351ec63715c3a5350090 (diff)
downloadFreeBSD-src-21fda7ee48f465c5fc64f99bf64397595d205484.zip
FreeBSD-src-21fda7ee48f465c5fc64f99bf64397595d205484.tar.gz
First round of cleanups to sys/boot/ makefiles:
- do not use PROG for what's not a real C program, - use sys.mk transformation rules where possible, - only create the "machine" symlink on AMD64, - removed MAINTAINER lines in individual makefiles, - added the LIBSTAND defitinion to <bsd.libnames.mk>, - somewhat better contents in .depend files. Tested on: i386, amd64 Prodded by: bde
Diffstat (limited to 'sys/boot/i386/gptboot/Makefile')
-rw-r--r--sys/boot/i386/gptboot/Makefile103
1 files changed, 43 insertions, 60 deletions
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
index 4c884a4..66f1352 100644
--- a/sys/boot/i386/gptboot/Makefile
+++ b/sys/boot/i386/gptboot/Makefile
@@ -1,12 +1,6 @@
# $FreeBSD$
-PROG= boot2
-NOMAN=
-STRIP=
-BINMODE= 444
-CLEANFILES= boot boot1 boot1.out boot1.o \
- boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \
- boot2.s sio.o
+FILES= boot boot1 boot2
NM?= nm
@@ -17,21 +11,19 @@ BOOT_COMCONSOLE_PORT?= 0x3f8
BOOT_COMCONSOLE_SPEED?= 9600
B2SIOFMT?= 0x3
-.if exists(${.OBJDIR}/../btx)
-BTX= ${.OBJDIR}/../btx
-.else
-BTX= ${.CURDIR}/../btx
-.endif
-
REL1= 0x700
ORG1= 0x7c00
ORG2= 0x2000
-# Decide Level of UFS support. UFS1_AND_UFS2 doesn't fit.
-
-# BOOT2_UFS?= UFS2_ONLY
+# Decide level of UFS support.
BOOT2_UFS?= UFS1_AND_UFS2
-# BOOT2_UFS?= UFS1_ONLY
+#BOOT2_UFS?= UFS2_ONLY
+#BOOT2_UFS?= UFS1_ONLY
+
+AFLAGS+=--defsym FLAGS=${B1FLAGS} \
+ --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
+ --defsym SIOFMT=${B2SIOFMT} \
+ --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED}
CFLAGS= -elf -ffreestanding -Os -fno-builtin \
-fno-guess-branch-probability -fomit-frame-pointer\
@@ -46,11 +38,16 @@ CFLAGS= -elf -ffreestanding -Os -fno-builtin \
LDFLAGS=-nostdlib -static -N --gc-sections
-all: boot1 boot2 boot
+# Pick up ../Makefile.inc early.
+.include <bsd.init.mk>
+
+CLEANFILES= boot
boot: boot1 boot2
cat boot1 boot2 > boot
+CLEANFILES+= boot1 boot1.out boot1.o
+
boot1: boot1.out
objcopy -S -O binary boot1.out ${.TARGET}
@@ -58,61 +55,46 @@ boot1.out: boot1.o
${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
boot1.o: boot1.s
- ${CPP} ${CFLAGS} ${.IMPSRC} | \
- ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} -o ${.TARGET}
+ ${CPP} ${CFLAGS} ${.CURDIR}/boot1.s | \
+ ${AS} ${AFLAGS} -o ${.TARGET}
-boot2.o: boot2.c ${.CURDIR}/../../common/ufsread.c
- ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC}
- sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
- rm -f boot2.s.tmp
- ${AS} ${AFLAGS} -o boot2.o boot2.s
+CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
+ boot2.s boot2.s.tmp boot2.h sio.o
-boot2.h: boot1.out
- ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
- { x = $$1 - ORG1; \
- printf("#define XREADORG %#x\n", REL1 + x) }' \
- ORG1=`printf "%d" ${ORG1}` \
- REL1=`printf "%d" ${REL1}` > boot2.h
-
-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
- @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
+boot2: boot2.ld
+ @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
+ echo "$$x bytes available"; test $$x -ge 0
+ dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
+
+boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
+ btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
+ -o ${.TARGET} -P 1 boot2.bin
boot2.ldr:
- dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null
+ dd if=/dev/zero of=${.TARGET} bs=276 count=1
boot2.bin: boot2.out
objcopy -S -O binary boot2.out ${.TARGET}
-boot2.out: boot2.o sio.o
- ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \
- ${BTX}/lib/crt0.o ${.ALLSRC}
-
-boot2.o: boot2.h
+boot2.out: ${BTXCRT} boot2.o sio.o
+ ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
-sio.o: sio.s
- ${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
- --defsym SIOFMT=${B2SIOFMT} \
- --defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
- ${.IMPSRC} -o ${.TARGET}
+boot2.o: boot2.s
-install:
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- boot ${DESTDIR}${BINDIR}/boot
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- boot1 ${DESTDIR}${BINDIR}/boot1
- ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- boot2 ${DESTDIR}${BINDIR}/boot2
+boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
+ ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
+ sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
+ rm -f boot2.s.tmp
-.include <bsd.prog.mk>
+boot2.h: boot1.out
+ ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
+ { x = $$1 - ORG1; \
+ printf("#define XREADORG %#x\n", REL1 + x) }' \
+ ORG1=`printf "%d" ${ORG1}` \
+ REL1=`printf "%d" ${REL1}` > ${.TARGET}
.if defined(REALLY_AMD64)
-boot2.o: machine
-
-beforedepend ${OBJS}: machine
+boot2.s: machine
machine:
ln -sf ${.CURDIR}/../../../i386/include machine
@@ -120,3 +102,4 @@ machine:
CLEANFILES+= machine
.endif
+.include <bsd.prog.mk>
OpenPOWER on IntegriCloud