]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/loader.mk
Import device-tree files from Linux 6.1
[FreeBSD/FreeBSD.git] / stand / loader.mk
1 # $FreeBSD$
2
3 .PATH: ${LDRSRC} ${BOOTSRC}/libsa
4
5 CFLAGS+=-I${LDRSRC}
6
7 SRCS+=  boot.c commands.c console.c devopen.c interp.c 
8 SRCS+=  interp_backslash.c interp_parse.c ls.c misc.c 
9 SRCS+=  modinfo.c
10 SRCS+=  module.c nvstore.c pnglite.c tslog.c
11
12 CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
13
14 .PATH: ${SRCTOP}/contrib/pnglite
15 CFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite
16 CFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
17
18 .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
19 SRCS+=  load_elf32.c load_elf32_obj.c reloc_elf32.c
20 SRCS+=  load_elf64.c load_elf64_obj.c reloc_elf64.c
21 .elif ${MACHINE_CPUARCH} == "aarch64"
22 SRCS+=  load_elf64.c reloc_elf64.c
23 .elif ${MACHINE_CPUARCH} == "arm"
24 SRCS+=  load_elf32.c reloc_elf32.c
25 .elif ${MACHINE_CPUARCH} == "powerpc"
26 SRCS+=  load_elf32.c reloc_elf32.c
27 SRCS+=  load_elf64.c reloc_elf64.c
28 SRCS+=  metadata.c
29 .elif ${MACHINE_CPUARCH} == "riscv"
30 SRCS+=  load_elf64.c reloc_elf64.c
31 SRCS+=  metadata.c
32 .endif
33
34 .if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
35 CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
36 SRCS+=  disk.c part.c vdisk.c
37 .endif
38
39 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
40 SRCS+= dev_net.c
41 .endif
42
43 .if defined(HAVE_BCACHE)
44 SRCS+=  bcache.c
45 .endif
46
47 .if defined(MD_IMAGE_SIZE)
48 CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
49 SRCS+=  md.c
50 .else
51 CLEANFILES+=    md.o
52 .endif
53
54 # Machine-independent ISA PnP
55 .if defined(HAVE_ISABUS)
56 SRCS+=  isapnp.c
57 .endif
58 .if defined(HAVE_PNP)
59 SRCS+=  pnp.c
60 .endif
61
62 .if ${LOADER_INTERP} == "lua"
63 SRCS+=  interp_lua.c
64 .include "${BOOTSRC}/lua.mk"
65 LDR_INTERP=     ${LIBLUA}
66 LDR_INTERP32=   ${LIBLUA32}
67 CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules
68 .elif ${LOADER_INTERP} == "4th"
69 SRCS+=  interp_forth.c
70 .include "${BOOTSRC}/ficl.mk"
71 LDR_INTERP=     ${LIBFICL}
72 LDR_INTERP32=   ${LIBFICL32}
73 .elif ${LOADER_INTERP} == "simp"
74 SRCS+=  interp_simple.c
75 .else
76 .error Unknown interpreter ${LOADER_INTERP}
77 .endif
78
79 .include "${BOOTSRC}/veriexec.mk"
80
81 .if defined(BOOT_PROMPT_123)
82 CFLAGS+=        -DBOOT_PROMPT_123
83 .endif
84
85 .if defined(LOADER_INSTALL_SUPPORT)
86 SRCS+=  install.c
87 .endif
88
89 # Filesystem support
90 .if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
91 CFLAGS+=        -DLOADER_CD9660_SUPPORT
92 .endif
93 .if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes"
94 CFLAGS+=        -DLOADER_EXT2FS_SUPPORT
95 .endif
96 .if ${LOADER_MSDOS_SUPPORT:Uno} == "yes"
97 CFLAGS+=        -DLOADER_MSDOS_SUPPORT
98 .endif
99 .if ${LOADER_UFS_SUPPORT:Uyes} == "yes"
100 CFLAGS+=        -DLOADER_UFS_SUPPORT
101 .endif
102
103 # Compression
104 .if ${LOADER_GZIP_SUPPORT:Uno} == "yes"
105 CFLAGS+=        -DLOADER_GZIP_SUPPORT
106 .endif
107 .if ${LOADER_BZIP2_SUPPORT:Uno} == "yes"
108 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
109 .endif
110
111 # Network related things
112 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
113 CFLAGS+=        -DLOADER_NET_SUPPORT
114 .endif
115 .if ${LOADER_NFS_SUPPORT:Uno} == "yes"
116 CFLAGS+=        -DLOADER_NFS_SUPPORT
117 .endif
118 .if ${LOADER_TFTP_SUPPORT:Uno} == "yes"
119 CFLAGS+=        -DLOADER_TFTP_SUPPORT
120 .endif
121
122 # Partition support
123 .if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
124 CFLAGS+= -DLOADER_GPT_SUPPORT
125 .endif
126 .if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
127 CFLAGS+= -DLOADER_MBR_SUPPORT
128 .endif
129
130 .if ${HAVE_ZFS:Uno} == "yes"
131 CFLAGS+=        -DLOADER_ZFS_SUPPORT
132 CFLAGS+=        -I${ZFSSRC}
133 CFLAGS+=        -I${SYSDIR}/cddl/boot/zfs
134 CFLAGS+=        -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
135 SRCS+=          zfs_cmd.c
136 .endif
137
138 LIBFICL=        ${BOOTOBJ}/ficl/libficl.a
139 .if ${MACHINE} == "i386"
140 LIBFICL32=      ${LIBFICL}
141 .else
142 LIBFICL32=      ${BOOTOBJ}/ficl32/libficl.a
143 .endif
144
145 LIBLUA=         ${BOOTOBJ}/liblua/liblua.a
146 .if ${MACHINE} == "i386"
147 LIBLUA32=       ${LIBLUA}
148 .else
149 LIBLUA32=       ${BOOTOBJ}/liblua32/liblua.a
150 .endif
151
152 CLEANFILES+=    vers.c
153 VERSION_FILE?=  ${.CURDIR}/version
154 .if ${MK_REPRODUCIBLE_BUILD} != no
155 REPRO_FLAG=     -r
156 .endif
157 vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE}
158         sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
159             ${NEWVERSWHAT}
160
161 .if ${MK_LOADER_VERBOSE} != "no"
162 CFLAGS+=        -DELF_VERBOSE
163 .endif
164
165 # Each loader variant defines their own help filename. Optional or
166 # build-specific commands are included by augmenting HELP_FILES.
167 .if !defined(HELP_FILENAME)
168 .error Define HELP_FILENAME before including loader.mk
169 .endif
170
171 HELP_FILES+=    ${LDRSRC}/help.common
172
173 CFLAGS+=        -DHELP_FILENAME=\"${HELP_FILENAME}\"
174 .if ${INSTALL_LOADER_HELP_FILE:Uyes} == "yes"
175 CLEANFILES+=    ${HELP_FILENAME}
176 FILES+=         ${HELP_FILENAME}
177 .endif
178
179 ${HELP_FILENAME}: ${HELP_FILES}
180         cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}