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