UPDATING: add note that API/ABI for RPC services for the kernel has changed
[freebsd/src.git] / stand / loader.mk
blob0f2ff31a53432193f2d2fe5096d1041e65a4c3a5
1 .PATH: ${LDRSRC} ${BOOTSRC}/libsa
3 CFLAGS+=-I${LDRSRC}
5 SRCS+= boot.c commands.c console.c devopen.c interp.c
6 SRCS+= interp_backslash.c interp_parse.c ls.c misc.c
7 SRCS+= modinfo.c
8 SRCS+= module.c nvstore.c pnglite.c tslog.c
10 CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
12 .PATH: ${SRCTOP}/contrib/pnglite
13 CFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite
14 CFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
16 .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
17 SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
18 SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c
19 .elif ${MACHINE_CPUARCH} == "aarch64"
20 SRCS+= load_elf64.c reloc_elf64.c
21 .elif ${MACHINE_CPUARCH} == "arm"
22 SRCS+= load_elf32.c reloc_elf32.c
23 .elif ${MACHINE_CPUARCH} == "powerpc"
24 SRCS+= load_elf32.c reloc_elf32.c
25 SRCS+= load_elf64.c reloc_elf64.c
26 SRCS+= metadata.c
27 .elif ${MACHINE_CPUARCH} == "riscv"
28 SRCS+= load_elf64.c reloc_elf64.c
29 SRCS+= metadata.c
30 .endif
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.
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_ZFS_SUPPORT Add support for ZFS filesystems
59 .if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
60 CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
61 SRCS+= disk.c part.c vdisk.c
62 .endif
64 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
65 SRCS+= dev_net.c
66 .endif
68 .if defined(HAVE_BCACHE)
69 SRCS+= bcache.c
70 .endif
72 .if defined(MD_IMAGE_SIZE)
73 CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
74 SRCS+= md.c
75 .else
76 CLEANFILES+= md.o
77 .endif
79 # Machine-independent ISA PnP
80 .if defined(HAVE_ISABUS)
81 SRCS+= isapnp.c
82 .endif
83 .if defined(HAVE_PNP)
84 SRCS+= pnp.c
85 .endif
87 .if ${LOADER_INTERP} == "lua"
88 SRCS+= interp_lua.c
89 .include "${BOOTSRC}/lua.mk"
90 LDR_INTERP= ${LIBLUA}
91 LDR_INTERP32= ${LIBLUA32}
92 CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules
93 .elif ${LOADER_INTERP} == "4th"
94 SRCS+= interp_forth.c
95 .include "${BOOTSRC}/ficl.mk"
96 LDR_INTERP= ${LIBFICL}
97 LDR_INTERP32= ${LIBFICL32}
98 .elif ${LOADER_INTERP} == "simp"
99 SRCS+= interp_simple.c
100 .else
101 .error Unknown interpreter ${LOADER_INTERP}
102 .endif
104 .include "${BOOTSRC}/veriexec.mk"
106 .if defined(BOOT_PROMPT_123)
107 CFLAGS+= -DBOOT_PROMPT_123
108 .endif
110 .if defined(LOADER_INSTALL_SUPPORT)
111 SRCS+= install.c
112 .endif
114 # Filesystem support
115 .if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
116 CFLAGS+= -DLOADER_CD9660_SUPPORT
117 .endif
118 .if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes"
119 CFLAGS+= -DLOADER_EXT2FS_SUPPORT
120 .endif
121 .if ${LOADER_MSDOS_SUPPORT:Uno} == "yes"
122 CFLAGS+= -DLOADER_MSDOS_SUPPORT
123 .endif
124 .if ${LOADER_UFS_SUPPORT:Uyes} == "yes"
125 CFLAGS+= -DLOADER_UFS_SUPPORT
126 .endif
128 # Compression
129 .if ${LOADER_GZIP_SUPPORT:Uno} == "yes"
130 CFLAGS+= -DLOADER_GZIP_SUPPORT
131 .endif
132 .if ${LOADER_BZIP2_SUPPORT:Uno} == "yes"
133 CFLAGS+= -DLOADER_BZIP2_SUPPORT
134 .endif
136 # Network related things
137 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
138 CFLAGS+= -DLOADER_NET_SUPPORT
139 .endif
140 .if ${LOADER_NFS_SUPPORT:Uno} == "yes"
141 CFLAGS+= -DLOADER_NFS_SUPPORT
142 .endif
143 .if ${LOADER_TFTP_SUPPORT:Uno} == "yes"
144 CFLAGS+= -DLOADER_TFTP_SUPPORT
145 .endif
147 # Partition support
148 .if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
149 CFLAGS+= -DLOADER_GPT_SUPPORT
150 .endif
151 .if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
152 CFLAGS+= -DLOADER_MBR_SUPPORT
153 .endif
155 .if ${HAVE_ZFS:Uno} == "yes"
156 CFLAGS+= -DLOADER_ZFS_SUPPORT
157 CFLAGS+= -I${ZFSSRC}
158 CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
159 CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
160 SRCS+= zfs_cmd.c
161 .endif
163 LIBFICL= ${BOOTOBJ}/ficl/libficl.a
164 .if ${MACHINE} == "i386"
165 LIBFICL32= ${LIBFICL}
166 .else
167 LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a
168 .endif
170 LIBLUA= ${BOOTOBJ}/liblua/liblua.a
171 .if ${MACHINE} == "i386"
172 LIBLUA32= ${LIBLUA}
173 .else
174 LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a
175 .endif
177 CLEANFILES+= vers.c
178 VERSION_FILE?= ${.CURDIR}/version
179 .if ${MK_REPRODUCIBLE_BUILD} != no
180 REPRO_FLAG= -r
181 .endif
182 vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE}
183 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
184 ${NEWVERSWHAT}
186 .if ${MK_LOADER_VERBOSE} != "no"
187 CFLAGS+= -DELF_VERBOSE
188 .endif
190 # Each loader variant defines their own help filename. Optional or
191 # build-specific commands are included by augmenting HELP_FILES.
192 .if !defined(HELP_FILENAME)
193 .error Define HELP_FILENAME before including loader.mk
194 .endif
196 HELP_FILES+= ${LDRSRC}/help.common
198 CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\"
199 .if ${INSTALL_LOADER_HELP_FILE:Uyes} == "yes"
200 CLEANFILES+= ${HELP_FILENAME}
201 FILES+= ${HELP_FILENAME}
202 .endif
204 ${HELP_FILENAME}: ${HELP_FILES}
205 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}