xref: /freebsd/stand/i386/pxeldr/Makefile (revision 7937bfbc0ca53fe7cdd0d54414f9296e273a518e)
1.include <bsd.init.mk>
2
3PROG=	${LDR}
4INTERNALPROG=
5FILES=	${BOOT}
6MAN=	${BOOT}.8
7SRCS=	${LDR}.S
8CLEANFILES+= ${BOOT}
9
10BOOT=	pxeboot
11LDR=	pxeldr
12ORG=	0x7c00
13LOADER=	loader
14
15.if defined(BOOT_PXELDR_PROBE_KEYBOARD)
16CFLAGS+=-DPROBE_KEYBOARD
17.endif
18
19.if defined(BOOT_PXELDR_ALWAYS_SERIAL)
20CFLAGS+=-DALWAYS_SERIAL
21.endif
22
23CFLAGS+=-I${BOOTSRC}/i386/common
24
25.if defined(PXEBOOT_DEFAULT_INTERP)
26L=${PXEBOOT_DEFAULT_INTERP}
27.else
28L=${LOADER_DEFAULT_INTERP}
29.endif
30LOADERBIN= ${BOOTOBJ}/i386/loader_${L}/loader_${L}.bin
31# pxeboot runs in an environment where there's 500k or less of space available
32# due to space for packet buffers, network drivers, etc. While some environments
33# may have a bit more, the limit of 500,000 (488k) provides enough margin to
34# work in a huge array of environments. Larger values may work for specific
35# environments.
36PXEBOOTSIZE?=500000
37
38CLEANFILES+= ${BOOT}.tmp
39
40${BOOT}: ${LDR} ${LOADER}
41	cat ${LDR} ${LOADER} > ${.TARGET}.tmp
42	${DD} if=${.TARGET}.tmp of=${.TARGET} bs=2048 conv=sync
43	rm ${.TARGET}.tmp
44
45LDFLAGS+=${LDFLAGS_BIN}
46
47CLEANFILES+= ${LOADER}
48
49# Note: pxeldr.S assumes a.out and will require changes for ELF if the output
50# format is changed to ELF.
51${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN}
52	@set -- `ls -l ${LOADERBIN}` ; x=$$((${PXEBOOTSIZE}-$$5)); \
53	    echo "$$x bytes available"; test $$x -ge 0
54	btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
55	    -b ${BTXKERN} ${LOADERBIN}
56
57.include <bsd.prog.mk>
58