1 # Works like the normal loader except the kernel, modules, and other loader
2 # files are loaded via TFTP instead of NFS.
4 # $DragonFly: src/sys/boot/pc32/loader_tftp/Makefile,v 1.2 2005/09/04 12:20:46 swildner Exp $
8 NEWVERSWHAT= "bootstrap loader" i386
12 # Notes: the 'loader' client is brought in with a virtual base of (typically)
13 # 0xa000 and a code offset of 0x0. The btxldr is loaded at 0x200000 (?).
15 # MEM_BTX_USR_ARG is not used in the boot2->loader stage, only in the
16 # boot1->boot2 stage (XXX what about the use in cdboot and pxeboot?)
20 .PATH: ${.CURDIR}/../loader
21 # architecture-specific loader code
24 CFLAGS+= -ffreestanding
25 CFLAGS+= -DLOADER_TFTP_SUPPORT
26 #CFLAGS+= -DLOADER_NFS_SUPPORT
28 # Enable PnP and ISA-PnP code.
33 CFLAGS+= -I${.CURDIR}/../../dloader -I${.CURDIR}/../../dloader/i386
34 .if exists(${.OBJDIR}/../../dloader/libdloader.a)
35 LIBDLOADER= ${.OBJDIR}/../../dloader/libdloader.a
37 LIBDLOADER= ${.CURDIR}/../../dloader/libdloader.a
40 .if defined(LOADER_BZIP2_SUPPORT)
41 CFLAGS+= -DLOADER_BZIP2_SUPPORT
43 .if !defined(LOADER_NO_GZIP_SUPPORT)
44 CFLAGS+= -DLOADER_GZIP_SUPPORT
47 # Always add MI sources
48 .PATH: ${.CURDIR}/../../common
49 .include <${.CURDIR}/../../common/Makefile.inc>
50 CFLAGS+= -I${.CURDIR}/../../common
51 CFLAGS+= -I${.CURDIR}/../../.. -I.
53 CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help
56 LDFLAGS= -nostdlib -static -Ttext ${ORG}
58 # i386 standalone support library
59 LIBI386= ${.OBJDIR}/../libi386/libi386.a
60 CFLAGS+= -I${.CURDIR}/..
62 # where to get libstand from
63 #XXX need a better way to do this
64 LIBSTAND= ${.CURDIR}/../../../../lib/libstand/libstand.a
65 .if !exists(${LIBSTAND})
66 LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
67 .if !exists(${LIBSTAND})
71 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
74 .if exists(${.OBJDIR}/../btx)
75 BTXDIR= ${.OBJDIR}/../btx
77 BTXDIR= ${.CURDIR}/../btx
79 BTXLDR= ${BTXDIR}/btxldr/btxldr
80 BTXKERN= ${BTXDIR}/btx/btx
81 BTXCRT= ${BTXDIR}/lib/crt0.o
82 CFLAGS+= -I${.CURDIR}/../btx/lib
84 # BTX is expecting ELF components
91 vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
92 sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
93 ${CC} ${CFLAGS} -c vers.c
95 ${PROG}: ${PROG}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
96 btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
97 -b ${BTXKERN} ${PROG}.bin
98 # /usr/bin/kzip ${.TARGET}
99 # mv ${.TARGET}.kz ${.TARGET}
101 ${PROG}.bin: ${PROG}.sym
102 cp ${.ALLSRC} ${.TARGET}
103 strip -R .comment -R .note ${.TARGET}
105 ${PROG}.help: help.common help.i386
106 cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
108 .PATH: ${.CURDIR}/../../dloader
109 FILES= ${PROG}.help loader.conf loader-bootp.conf
110 FILESDIR_loader.conf= /boot/defaults
111 FILESDIR_loader-bootp.conf= /boot/defaults
113 .if !exists(${DESTDIR}/boot/dloader.rc)
114 FILES+= ${.CURDIR}/../loader/dloader.rc
117 .include "../Makefile.inc"
119 # Cannot use ${OBJS} above this line
120 .include <bsd.prog.mk>
122 ${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBDLOADER} vers.o
123 ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
124 ${LIBDLOADER} ${LIBI386} ${LIBSTAND}
126 # If it's not there, don't consider it a target
127 .if exists(${.CURDIR}/../../../i386/include)
128 beforedepend ${OBJS}: machine
131 ${LN} -sf ${.CURDIR}/../../../i386/include machine