1# $FreeBSD$ 2 3HAVE_ZFS= ${MK_LOADER_ZFS} 4 5LOADER_NET_SUPPORT?= yes 6LOADER_NFS_SUPPORT?= yes 7LOADER_TFTP_SUPPORT?= yes 8LOADER_CD9660_SUPPORT?= yes 9LOADER_EXT2FS_SUPPORT?= yes 10LOADER_MSDOS_SUPPORT?= yes 11LOADER_UFS_SUPPORT?= yes 12LOADER_GZIP_SUPPORT?= yes 13LOADER_BZIP2_SUPPORT?= yes 14 15.include <bsd.init.mk> 16 17LOADER?= loader_${LOADER_INTERP} 18PROG= ${LOADER}.sym 19INTERNALPROG= 20NEWVERSWHAT?= "bootstrap loader" x86 21VERSION_FILE= ${.CURDIR}/../loader/version 22 23.PATH: ${BOOTSRC}/i386/loader 24 25# architecture-specific loader code 26SRCS= main.c conf.c vers.c chain.c gfx_fb.c 8x16.c 27 28CFLAGS.gfx_fb.c += -I${.CURDIR}/../libi386 29CFLAGS.gfx_fb.c += -I$(SRCTOP)/sys/teken 30CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 31CFLAGS.gfx_fb.c += -I${SRCTOP}/contrib/pnglite 32CFLAGS.gfx_fb.c += -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib 33 34# Include bcache code. 35HAVE_BCACHE= yes 36 37# Enable PnP and ISA-PnP code. 38HAVE_PNP= yes 39HAVE_ISABUS= yes 40 41.if ${MK_LOADER_FIREWIRE} == "yes" 42CFLAGS+= -DLOADER_FIREWIRE_SUPPORT 43LIBFIREWIRE= ${BOOTOBJ}/i386/libfirewire/libfirewire.a 44.endif 45 46.if ${MK_LOADER_ZFS} == "yes" 47CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include 48CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs 49.endif 50 51.if exists(${.CURDIR}/help.i386) 52HELP_FILES= ${.CURDIR}/help.i386 53.endif 54 55# Always add MI sources 56.include "${BOOTSRC}/loader.mk" 57 58CLEANFILES+= ${LOADER} ${LOADER}.bin 8x16.c 59 60ORG= 0x0 61 62CFLAGS+= -Wall 63LDFLAGS+= -static ${LDFLAGS_ORG} -Wl,--gc-sections 64 65# i386 standalone support library 66LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a 67CFLAGS+= -I${BOOTSRC}/i386 68 69# Debug me! 70#CFLAGS+= -g 71#LDFLAGS+= -g 72 738x16.c: ${SRCTOP}/contrib/terminus/ter-u16b.bdf 74 vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC} 75 76${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} 77 btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ 78 -b ${BTXKERN} ${LOADER}.bin 79 80${LOADER}.bin: ${LOADER}.sym 81 ${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC} 82 83.if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} 84LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/zfsloader 85.endif 86.if ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} 87LINKS+= ${BINDIR}/${LOADER} ${BINDIR}/loader 88.endif 89FILES+= ${LOADER} 90FILESMODE_${LOADER}= ${BINMODE} -b 91 92# Note: crt0.o needs to be first for pxeboot(8) to work. It assumes that the 93# startup code is located at the start of the loader and will jump 94# there. Although btx is more flexible than this, the emulated boot2 environment 95# that pxeloader provides has none of that flexibility because it lacks access 96# to the a.out/elf headers and assumes an entry point of 0. 97# 98# We must add it to the LDFLAGS instead of the OBJS because the former won't try 99# to clean it. When it is in OBJS, this cleaning can lead to races where 100# btxcrt.o is rebuilt, but boot2 isn't, leading to errors at installation time. 101# LDFLAGS does not have this baggage and will be included first in the list of 102# files. 103LDFLAGS+= ${BTXCRT} 104 105DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} 106LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} 107 108.if ${MACHINE_CPUARCH} == "amd64" 109CFLAGS+= -DLOADER_PREFER_AMD64 110.endif 111 112.include <bsd.prog.mk> 113