1.PATH: ${LDRSRC} ${BOOTSRC}/libsa 2 3CFLAGS+=-I${LDRSRC} 4 5SRCS+= boot.c commands.c console.c devopen.c interp.c 6SRCS+= interp_backslash.c interp_parse.c ls.c misc.c 7SRCS+= modinfo.c 8SRCS+= module.c nvstore.c pnglite.c tslog.c 9 10CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite 11 12.PATH: ${SRCTOP}/contrib/pnglite 13CFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite 14CFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib 15 16.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 17SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 18SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 19.elif ${MACHINE_CPUARCH} == "aarch64" 20SRCS+= load_elf64.c reloc_elf64.c 21.elif ${MACHINE_CPUARCH} == "arm" 22SRCS+= load_elf32.c reloc_elf32.c 23.elif ${MACHINE_CPUARCH} == "powerpc" 24SRCS+= load_elf32.c reloc_elf32.c 25SRCS+= load_elf64.c reloc_elf64.c 26SRCS+= metadata.c 27.elif ${MACHINE_CPUARCH} == "riscv" 28SRCS+= load_elf64.c reloc_elf64.c 29SRCS+= metadata.c 30.endif 31 32# 33# LOADER_*_SUPPORT variables are used to subset the boot loader in the various 34# configurations each platform supports. These are typically used to omit broken 35# options, or to size optimize for space constrained instances. These are set in 36# loader Makefiles (which include loader.mk) to control which subset of features 37# are enabled. These cannot generally be set in src.conf since that would affect 38# all loaders, but also not all loaders are setup for overrides like that and 39# not all combinations of the following have been tested or even work. Sometimes 40# non-default values won't work due to buggy support for that component being 41# optional. 42# 43# LOADER_BZIP2_SUPPORT Add support for bzip2 compressed files 44# LOADER_CD9660_SUPPORT Add support for iso9660 filesystems 45# LOADER_DISK_SUPPORT Adds support for disks and mounting filesystems on it 46# LOADER_EXT2FS_SUPPORT Add support for ext2 Linux filesystems 47# LOADER_GPT_SUPPORT Add support for GPT partitions 48# LOADER_GZIP_SUPPORT Add support for gzip compressed files 49# LOADER_INSTALL_SUPPORT Add support for booting off of installl ISOs 50# LOADER_MBR_SUPPORT Add support for MBR partitions 51# LOADER_MSDOS_SUPPORT Add support for FAT filesystems 52# LOADER_NET_SUPPORT Adds networking support (useless w/o net drivers sometimes) 53# LOADER_NFS_SUPPORT Add NFS support 54# LOADER_TFTP_SUPPORT Add TFTP support 55# LOADER_UFS_SUPPORT Add support for UFS filesystems 56# LOADER_XZ_SUPPORT Add support for xz compressed files 57# LOADER_ZFS_SUPPORT Add support for ZFS filesystems 58# 59 60.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 61CFLAGS.part.c+= ${ZLIB_CFLAGS} 62SRCS+= disk.c part.c vdisk.c 63.endif 64 65.if ${LOADER_NET_SUPPORT:Uno} == "yes" 66SRCS+= dev_net.c 67.endif 68 69.if defined(HAVE_BCACHE) 70SRCS+= bcache.c 71.endif 72 73.if defined(MD_IMAGE_SIZE) 74CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} 75SRCS+= md.c 76.else 77CLEANFILES+= md.o 78.endif 79 80# Machine-independent ISA PnP 81.if defined(HAVE_ISABUS) 82SRCS+= isapnp.c 83.endif 84.if defined(HAVE_PNP) 85SRCS+= pnp.c 86.endif 87 88.if ${LOADER_INTERP} == "lua" 89SRCS+= interp_lua.c 90.include "${BOOTSRC}/lua.mk" 91LDR_INTERP= ${LIBLUA} 92LDR_INTERP32= ${LIBLUA32} 93CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/lfs 94.elif ${LOADER_INTERP} == "4th" 95SRCS+= interp_forth.c 96.include "${BOOTSRC}/ficl.mk" 97LDR_INTERP= ${LIBFICL} 98LDR_INTERP32= ${LIBFICL32} 99.elif ${LOADER_INTERP} == "simp" 100SRCS+= interp_simple.c 101.else 102.error Unknown interpreter ${LOADER_INTERP} 103.endif 104 105.if defined(BOOT_PROMPT_123) 106CFLAGS+= -DBOOT_PROMPT_123 107.endif 108 109.if defined(LOADER_INSTALL_SUPPORT) 110SRCS+= install.c 111.endif 112 113# Filesystem support 114.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 115CFLAGS+= -DLOADER_CD9660_SUPPORT 116.endif 117.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 118CFLAGS+= -DLOADER_EXT2FS_SUPPORT 119.endif 120.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 121CFLAGS+= -DLOADER_MSDOS_SUPPORT 122.endif 123.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 124CFLAGS+= -DLOADER_UFS_SUPPORT 125.endif 126 127# Compression 128.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 129CFLAGS+= -DLOADER_GZIP_SUPPORT 130.endif 131.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 132CFLAGS+= -DLOADER_BZIP2_SUPPORT 133.endif 134.if ${LOADER_XZ_SUPPORT:Uno} == "yes" 135CFLAGS+= -DLOADER_XZ_SUPPORT 136.endif 137 138# Network related things 139.if ${LOADER_NET_SUPPORT:Uno} == "yes" 140CFLAGS+= -DLOADER_NET_SUPPORT 141.endif 142.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 143CFLAGS+= -DLOADER_NFS_SUPPORT 144.endif 145.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 146CFLAGS+= -DLOADER_TFTP_SUPPORT 147.endif 148 149# Partition support 150.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 151CFLAGS+= -DLOADER_GPT_SUPPORT 152.endif 153.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 154CFLAGS+= -DLOADER_MBR_SUPPORT 155.endif 156 157.if ${HAVE_ZFS:Uno} == "yes" 158CFLAGS+= -DLOADER_ZFS_SUPPORT 159CFLAGS+= -I${SAZFSSRC} 160CFLAGS+= -I${SYSDIR}/cddl/boot/zfs 161CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common 162SRCS+= zfs_cmd.c 163.endif 164 165LIBFICL= ${BOOTOBJ}/ficl/libficl.a 166.if ${MACHINE} == "i386" 167LIBFICL32= ${LIBFICL} 168.else 169LIBFICL32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/ficl32efi:ficl32}/libficl.a 170.endif 171 172LIBLUA= ${BOOTOBJ}/liblua/liblua.a 173.if ${MACHINE} == "i386" 174LIBLUA32= ${LIBLUA} 175.else 176LIBLUA32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/liblua32efi:liblua32}/liblua.a 177.endif 178 179CLEANFILES+= vers.c 180VERSION_FILE?= ${.CURDIR}/version 181.if ${MK_REPRODUCIBLE_BUILD} != no 182REPRO_FLAG= -r 183.endif 184vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 185 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 186 ${NEWVERSWHAT} 187 188.if ${MK_LOADER_VERBOSE} != "no" 189CFLAGS+= -DELF_VERBOSE 190.endif 191 192# Each loader variant defines their own help filename. Optional or 193# build-specific commands are included by augmenting HELP_FILES. 194.if !defined(HELP_FILENAME) 195.error Define HELP_FILENAME before including loader.mk 196.endif 197 198HELP_FILES+= ${LDRSRC}/help.common 199 200CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\" 201.if ${INSTALL_LOADER_HELP_FILE:Uyes} == "yes" 202CLEANFILES+= ${HELP_FILENAME} 203FILES+= ${HELP_FILENAME} 204.endif 205 206${HELP_FILENAME}: ${HELP_FILES} 207 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 208