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
This commit is contained in:
parent
cb4cb93f58
commit
a4a62f5d1f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125537
@ -103,6 +103,7 @@ LIBSDP?= ${DESTDIR}${LIBDIR}/libsdp.a
|
||||
LIBSMB?= ${DESTDIR}${LIBDIR}/libsmb.a
|
||||
LIBSSH?= ${DESTDIR}${LIBDIR}/libssh.a
|
||||
LIBSSL?= ${DESTDIR}${LIBDIR}/libssl.a
|
||||
LIBSTAND?= ${DESTDIR}${LIBDIR}/libstand.a
|
||||
LIBSTDCPLUSPLUS?= ${DESTDIR}${LIBDIR}/libstdc++.a
|
||||
LIBTACPLUS?= ${DESTDIR}${LIBDIR}/libtacplus.a
|
||||
LIBTERMCAP?= ${DESTDIR}${LIBDIR}/libtermcap.a
|
||||
|
@ -4,15 +4,25 @@
|
||||
|
||||
BINDIR?= /boot
|
||||
|
||||
LOADER_ADDRESS?= 0x200000
|
||||
CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2
|
||||
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)
|
||||
CFLAGS+= -m32
|
||||
LDFLAGS+= -m elf_i386_fbsd
|
||||
AFLAGS+= --32
|
||||
CFLAGS+= -m32
|
||||
LDFLAGS+= -m elf_i386_fbsd
|
||||
AFLAGS+= --32
|
||||
.endif
|
||||
|
||||
# BTX components
|
||||
.if exists(${.OBJDIR}/../btx)
|
||||
BTXDIR= ${.OBJDIR}/../btx
|
||||
.else
|
||||
BTXDIR= ${.CURDIR}/../btx
|
||||
.endif
|
||||
BTXLDR= ${BTXDIR}/btxldr/btxldr
|
||||
BTXKERN= ${BTXDIR}/btx/btx
|
||||
BTXCRT= ${BTXDIR}/lib/crt0.o
|
||||
|
@ -1,11 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG?= boot0
|
||||
NOMAN=
|
||||
STRIP=
|
||||
BINMODE= 444
|
||||
FILES= ${BOOT}
|
||||
CLEANFILES= ${BOOT} ${BOOT}.out ${BOOT}.o
|
||||
|
||||
M4?= m4
|
||||
BOOT?= boot0
|
||||
|
||||
# The default set of flags compiled into boot0. This enables update (writing
|
||||
# the modified boot0 back to disk after running so that the selection made is
|
||||
@ -28,16 +26,14 @@ BOOT_BOOT0_ORG?= 0x600
|
||||
# command line
|
||||
BOOT_BOOT0_COMCONSOLE_SPEED?= 0xE3
|
||||
|
||||
${PROG}: ${PROG}.o
|
||||
${LD} -N -e start -Ttext ${BOOT_BOOT0_ORG} -o ${PROG}.out ${PROG}.o
|
||||
objcopy -S -O binary ${PROG}.out ${.TARGET}
|
||||
AFLAGS+=--defsym FLAGS=${BOOT_BOOT0_FLAGS} \
|
||||
--defsym TICKS=${BOOT_BOOT0_TICKS} \
|
||||
--defsym COMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED}
|
||||
|
||||
${PROG}.o: ${PROG}.s
|
||||
${AS} ${AFLAGS} --defsym FLAGS=${BOOT_BOOT0_FLAGS} \
|
||||
--defsym TICKS=${BOOT_BOOT0_TICKS} \
|
||||
--defsym COMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED} \
|
||||
${.IMPSRC} -o ${.TARGET}
|
||||
${BOOT}: ${BOOT}.out
|
||||
objcopy -S -O binary ${BOOT}.out ${.TARGET}
|
||||
|
||||
CLEANFILES+= ${PROG}.out ${PROG}.o
|
||||
${BOOT}.out: ${BOOT}.o
|
||||
${LD} -N -e start -Ttext ${BOOT_BOOT0_ORG} -o ${.TARGET} ${BOOT}.o
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
.PATH: ${.CURDIR}/../boot0
|
||||
|
||||
PROG= boot0sio
|
||||
BOOT= boot0sio
|
||||
|
||||
.include "${.CURDIR}/../boot0/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.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: 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.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.out: ${BTXCRT} boot2.o sio.o
|
||||
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
|
||||
|
||||
boot2.o: boot2.h
|
||||
boot2.o: boot2.s
|
||||
|
||||
sio.o: sio.s
|
||||
${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
|
||||
--defsym SIOFMT=${B2SIOFMT} \
|
||||
--defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
||||
${.IMPSRC} -o ${.TARGET}
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
.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>
|
||||
|
@ -1,2 +1,3 @@
|
||||
# $FreeBSD$
|
||||
.include <${.CURDIR}/../../Makefile.inc>
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
@ -1,17 +1,15 @@
|
||||
# $FreeBSD$
|
||||
|
||||
MAINTAINER=jhb@FreeBSD.org
|
||||
FILES= ${BOOT}
|
||||
CLEANFILES= ${BOOT} ${BOOT}.out ${BOOT}.o
|
||||
|
||||
ORG= 0x7c00
|
||||
BOOT= cdboot
|
||||
ORG= 0x7c00
|
||||
|
||||
PROG= cdboot
|
||||
NOMAN=
|
||||
STRIP=
|
||||
${BOOT}: ${BOOT}.out
|
||||
objcopy -S -O binary ${BOOT}.out ${.TARGET}
|
||||
|
||||
${PROG}: ${PROG}.o
|
||||
${LD} -N -e start -Ttext ${ORG} -o ${PROG}.out ${PROG}.o
|
||||
objcopy -S -O binary ${PROG}.out ${.TARGET}
|
||||
|
||||
CLEANFILES+= ${PROG}.o ${PROG}.out
|
||||
${BOOT}.out: ${BOOT}.o
|
||||
${LD} -N -e start -Ttext ${ORG} -o ${.TARGET} ${BOOT}.o
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -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.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: 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.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.out: ${BTXCRT} boot2.o sio.o
|
||||
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
|
||||
|
||||
boot2.o: boot2.h
|
||||
boot2.o: boot2.s
|
||||
|
||||
sio.o: sio.s
|
||||
${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
|
||||
--defsym SIOFMT=${B2SIOFMT} \
|
||||
--defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
|
||||
${.IMPSRC} -o ${.TARGET}
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
.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>
|
||||
|
@ -1,5 +1,12 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FILES= kgzldr.o
|
||||
FILESOWN= ${LIBOWN}
|
||||
FILESGRP= ${LIBGRP}
|
||||
FILESMODE= ${LIBMODE}
|
||||
FILESDIR= ${LIBDIR}
|
||||
CLEANFILES= kgzldr.o
|
||||
|
||||
SRCS= start.s boot.c inflate.c lib.c crt.s sio.s
|
||||
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
CFLAGS= -ffreestanding
|
||||
@ -8,18 +15,10 @@ CFLAGS+=-DKZIP
|
||||
LDFLAGS=-nostdlib -static -Wl,-r
|
||||
.PATH: ${.CURDIR}/../../../kern
|
||||
|
||||
CLEANFILES=kgzldr.o
|
||||
|
||||
BOOT_COMCONSOLE_PORT?= 0x3f8
|
||||
AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT}
|
||||
|
||||
all: kgzldr.o
|
||||
|
||||
kgzldr.o: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS}
|
||||
|
||||
realinstall:
|
||||
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
kgzldr.o ${DESTDIR}${LIBDIR}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -31,18 +31,11 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \
|
||||
# the location of libstand
|
||||
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
|
||||
|
||||
# Make "machine" required for all objects
|
||||
# (based on the more complete case in sys/i386/boot/Makefile.inc)
|
||||
${SRCS:M*.c:R:S/$/.o/g}: machine
|
||||
|
||||
# If it's not there, don't consider it a target
|
||||
.if exists(${.CURDIR}/../../../i386/include)
|
||||
beforedepend ${OBJS}: machine
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
.if defined(REALLY_AMD64)
|
||||
${OBJS}: machine
|
||||
CLEANFILES+= machine
|
||||
machine:
|
||||
ln -sf ${.CURDIR}/../../../i386/include machine
|
||||
|
||||
.endif
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
@ -1,12 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= loader
|
||||
STRIP=
|
||||
NEWVERSWHAT= "bootstrap loader" i386
|
||||
INSTALLFLAGS= -b
|
||||
|
||||
# architecture-specific loader code
|
||||
SRCS= main.c conf.c
|
||||
SRCS= main.c conf.c vers.c
|
||||
|
||||
CFLAGS+= -ffreestanding
|
||||
# Enable PXE TFTP or NFS support, not both.
|
||||
@ -42,9 +39,9 @@ CFLAGS+= -DLOADER_GZIP_SUPPORT
|
||||
.PATH: ${.CURDIR}/../../common
|
||||
.include "${.CURDIR}/../../common/Makefile.inc"
|
||||
CFLAGS+= -I${.CURDIR}/../../common
|
||||
CFLAGS+= -I${.CURDIR}/../../.. -I.
|
||||
CFLAGS+= -I.
|
||||
|
||||
CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help
|
||||
CLEANFILES= vers.c loader loader.list loader.bin loader.sym loader.help
|
||||
|
||||
CFLAGS+= -Wall
|
||||
LDFLAGS= -nostdlib -static -Ttext 0x0
|
||||
@ -53,26 +50,7 @@ LDFLAGS= -nostdlib -static -Ttext 0x0
|
||||
LIBI386= ${.OBJDIR}/../libi386/libi386.a
|
||||
CFLAGS+= -I${.CURDIR}/..
|
||||
|
||||
# where to get libstand from
|
||||
#XXX need a better way to do this
|
||||
LIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a
|
||||
.if !exists(${LIBSTAND})
|
||||
LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
|
||||
.if !exists(${LIBSTAND})
|
||||
LIBSTAND= -lstand
|
||||
.endif
|
||||
.endif
|
||||
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
|
||||
|
||||
# BTX components
|
||||
.if exists(${.OBJDIR}/../btx)
|
||||
BTXDIR= ${.OBJDIR}/../btx
|
||||
.else
|
||||
BTXDIR= ${.CURDIR}/../btx
|
||||
.endif
|
||||
BTXLDR= ${BTXDIR}/btxldr/btxldr
|
||||
BTXKERN= ${BTXDIR}/btx/btx
|
||||
BTXCRT= ${BTXDIR}/lib/crt0.o
|
||||
CFLAGS+= -I${.CURDIR}/../btx/lib
|
||||
|
||||
# BTX is expecting ELF components
|
||||
@ -82,46 +60,47 @@ CFLAGS+= -elf
|
||||
#CFLAGS+= -g
|
||||
#LDFLAGS+= -g
|
||||
|
||||
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
|
||||
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
|
||||
${CC} ${CFLAGS} -c vers.c
|
||||
# Pick up ../Makefile.inc early.
|
||||
.include <bsd.init.mk>
|
||||
|
||||
${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
|
||||
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
|
||||
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
|
||||
|
||||
loader: loader.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
|
||||
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
|
||||
-b ${BTXKERN} ${PROG}.bin
|
||||
-b ${BTXKERN} loader.bin
|
||||
# /usr/bin/kzip ${.TARGET}
|
||||
# mv ${.TARGET}.kz ${.TARGET}
|
||||
|
||||
${PROG}.bin: ${PROG}.sym
|
||||
loader.bin: loader.sym
|
||||
cp ${.ALLSRC} ${.TARGET}
|
||||
strip -R .comment -R .note ${.TARGET}
|
||||
|
||||
${PROG}.help: help.common help.i386
|
||||
loader.help: help.common help.i386
|
||||
cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
|
||||
|
||||
.PATH: ${.CURDIR}/../../forth
|
||||
FILES= ${PROG}.help loader.4th support.4th loader.conf
|
||||
FILES= loader loader.help loader.4th support.4th loader.conf
|
||||
FILES+= screen.4th frames.4th beastie.4th
|
||||
# XXX INSTALLFLAGS_loader= -b
|
||||
FILESMODE_loader= ${BINMODE} -b
|
||||
FILESDIR_loader.conf= /boot/defaults
|
||||
|
||||
.if !exists(${DESTDIR}/boot/loader.rc)
|
||||
FILES+= ${.CURDIR}/loader.rc
|
||||
.endif
|
||||
|
||||
# Cannot use ${OBJS} above this line
|
||||
.include <bsd.prog.mk>
|
||||
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
|
||||
${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBFICL} vers.o
|
||||
${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
|
||||
loader.sym: ${OBJS} ${LIBFICL} ${LIBI386} ${LIBSTAND}
|
||||
${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} \
|
||||
${LIBFICL} ${LIBI386} ${LIBSTAND}
|
||||
|
||||
# If it's not there, don't consider it a target
|
||||
.if exists(${.CURDIR}/../../../i386/include)
|
||||
beforedepend ${OBJS}: machine
|
||||
|
||||
.if defined(REALLY_AMD64)
|
||||
${OBJS}: machine
|
||||
CLEANFILES+= machine
|
||||
machine:
|
||||
ln -sf ${.CURDIR}/../../../i386/include machine
|
||||
|
||||
.endif
|
||||
|
||||
CLEANFILES+= machine
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,16 +1,15 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= mbr
|
||||
NOMAN=
|
||||
STRIP=
|
||||
BINMODE= 444
|
||||
FILES= ${BOOT}
|
||||
CLEANFILES= ${BOOT} ${BOOT}.out ${BOOT}.o
|
||||
|
||||
BOOT= mbr
|
||||
ORG= 0x600
|
||||
|
||||
mbr: mbr.o
|
||||
${LD} -N -e start -Ttext ${ORG} -o mbr.out mbr.o
|
||||
objcopy -S -O binary mbr.out ${.TARGET}
|
||||
${BOOT}: ${BOOT}.out
|
||||
objcopy -S -O binary ${BOOT}.out ${.TARGET}
|
||||
|
||||
CLEANFILES+= mbr.out mbr.o
|
||||
${BOOT}.out: ${BOOT}.o
|
||||
${LD} -N -e start -Ttext ${ORG} -o ${.TARGET} ${BOOT}.o
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,59 +1,55 @@
|
||||
# $FreeBSD$
|
||||
|
||||
MAINTAINER=jhb@FreeBSD.org
|
||||
# Pick up ../Makefile.inc early.
|
||||
.include <bsd.init.mk>
|
||||
|
||||
ORG= 0x7c00
|
||||
FILES= ${BOOT}
|
||||
MAN= ${BOOT}.8
|
||||
CLEANFILES= ${BOOT}
|
||||
|
||||
LDR= pxeldr
|
||||
BOOT= pxeboot
|
||||
LOADER= loader
|
||||
PROG= ${BOOT}
|
||||
MAN= ${BOOT}.8
|
||||
STRIP=
|
||||
M4?= m4
|
||||
BOOT= pxeboot
|
||||
LDR= pxeldr
|
||||
ORG= 0x7c00
|
||||
LOADER= loader
|
||||
M4?= m4
|
||||
|
||||
.if defined(BOOT_PXELDR_PROBE_KEYBOARD)
|
||||
M4FLAGS+= -DPROBE_KEYBOARD
|
||||
M4FLAGS+= -DPROBE_KEYBOARD
|
||||
.endif
|
||||
|
||||
.if defined(BOOT_PXELDR_ALWAYS_SERIAL)
|
||||
M4FLAGS+= -DALWAYS_SERIAL
|
||||
M4FLAGS+= -DALWAYS_SERIAL
|
||||
.endif
|
||||
|
||||
|
||||
.if exists(${.OBJDIR}/../loader)
|
||||
LOADERBIN= ${.OBJDIR}/../loader/loader.bin
|
||||
LOADERBIN= ${.OBJDIR}/../loader/loader.bin
|
||||
.else
|
||||
LOADERBIN= ${.CURDIR}/../loader/loader.bin
|
||||
LOADERBIN= ${.CURDIR}/../loader/loader.bin
|
||||
.endif
|
||||
|
||||
# BTX components
|
||||
.if exists(${.OBJDIR}/../btx)
|
||||
BTXDIR= ${.OBJDIR}/../btx
|
||||
.else
|
||||
BTXDIR= ${.CURDIR}/../btx
|
||||
.endif
|
||||
BTXLDR= ${BTXDIR}/btxldr/btxldr
|
||||
BTXKERN= ${BTXDIR}/btx/btx
|
||||
BTXCRT= ${BTXDIR}/lib/crt0.o
|
||||
CLEANFILES+= ${BOOT}.tmp
|
||||
|
||||
${BOOT}: ${LDR} ${LOADER}
|
||||
cat ${LDR} ${LOADER} > ${.TARGET}.tmp
|
||||
dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync
|
||||
rm ${.TARGET}.tmp
|
||||
|
||||
${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN} ${BTXCRT}
|
||||
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
|
||||
-b ${BTXKERN} ${LOADERBIN}
|
||||
CLEANFILES+= ${LDR} ${LDR}.out ${LDR}.o
|
||||
|
||||
${LDR}: ${LDR}.o
|
||||
${LD} -N -e start -Ttext ${ORG} -o ${LDR}.out ${LDR}.o
|
||||
${LDR}: ${LDR}.out
|
||||
objcopy -S -O binary ${LDR}.out ${.TARGET}
|
||||
|
||||
${LDR}.out: ${LDR}.o
|
||||
${LD} -N -e start -Ttext ${ORG} -o ${.TARGET} ${LDR}.o
|
||||
|
||||
${LDR}.o: ${LDR}.s
|
||||
(cd ${.CURDIR}; ${M4} ${M4FLAGS} ${LDR}.s) | \
|
||||
${AS} ${AFLAGS} -o ${.TARGET}
|
||||
${AS} ${AFLAGS} -o ${.TARGET}
|
||||
|
||||
CLEANFILES+= ${LDR} ${LDR}.out ${LDR}.o ${BOOT}.tmp ${LOADER}
|
||||
CLEANFILES+= ${LOADER}
|
||||
|
||||
${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN}
|
||||
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
|
||||
-b ${BTXKERN} ${LOADERBIN}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user