VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/ipxe/Makefile.kmk@ 98770

Last change on this file since 98770 was 98770, checked in by vboxsync, 2 years ago

Devices/PC/ipxe: Use -Oz instead of -Os to hopefully get the final ROM size inside boundaries on the ubuntu buildbox, bugref:10254

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.4 KB
Line 
1# $Id: Makefile.kmk 98770 2023-02-28 09:51:42Z vboxsync $
2## @file
3# Sub-makefile for iPXE.
4#
5
6#
7# Copyright (C) 2012-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28SUB_DEPTH = ../../../../..
29include $(KBUILD_PATH)/subheader.kmk
30
31#
32# Globals.
33#
34VBOX_PATH_IPXE_SRC := $(PATH_SUB_CURRENT)
35
36
37#
38# iPxeBiosBin - Library containing the iPXE ROM as a data blob.
39# Will be linked into VBoxDD2.
40#
41LIBRARIES += iPxeBiosBin
42iPxeBiosBin_TEMPLATE = VBoxR3Dll
43iPxeBiosBin_DEFS = IN_VBOXDD2
44iPxeBiosBin_SOURCES = $(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c
45iPxeBiosBin_CLEAN = \
46 $(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c \
47
48if1of ($(KBUILD_TARGET), darwin os2 solaris win)
49 $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c: $(PATH_SUB_CURRENT)/iPxeBiosBin.rom $(VBOX_BIN2C) | $$(dir $$@)
50 $(call MSG_TOOL,bin2c,iPxeBiosBin,$<,$@)
51 $(QUIET)$(VBOX_BIN2C) -min 32 -max 56 -mask 0x1ff -export NetBiosBinary $< $@
52
53else
54 iPxeBiosBin_CLEAN += \
55 $(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.rom \
56 $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.bin \
57 $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.zinfo
58
59 $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c: $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.rom $(VBOX_BIN2C)
60 $(call MSG_TOOL,bin2c,iPxeBiosBin,$<,$@)
61 $(QUIET)$(VBOX_BIN2C) -min 32 -max 56 -mask 0x1ff -export NetBiosBinary $< $@
62
63
64 $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.rom: \
65 $$(iPxeBaseBin_1_TARGET) \
66 $$(ipxezbin_1_TARGET) \
67 $(VBOX_PATH_IPXE_SRC)/src/util/padimg.pl \
68 $(VBOX_PATH_IPXE_SRC)/src/util/fixrom.pl \
69 | $$(dir $$@)
70 $(call MSG_TOOL,zbin,iPxeBiosBin,$<,$@)
71 $(TOOL_$(VBOX_GCC32_TOOL)_OBJCOPY) -O binary -R .zinfo $< $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.bin
72 $(TOOL_$(VBOX_GCC32_TOOL)_OBJCOPY) -O binary -j .zinfo $< $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.zinfo
73 $(ipxezbin_1_TARGET) \
74 $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.bin \
75 $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.zinfo \
76 > $@
77 perl $(VBOX_PATH_IPXE_SRC)/src/util/padimg.pl --blksize=512 --byte=0xff $@
78 perl $(VBOX_PATH_IPXE_SRC)/src/util/fixrom.pl $@
79 $(RM) -- \
80 $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.bin \
81 $(iPxeBiosBin_0_OUTDIR)/iPxeBaseBin.rom.zinfo
82
83 #
84 # iPxeLinker - Linker tool used to link the ROM binary.
85 #
86 TOOL_iPxeLinker = iPXE LD tool.
87 TOOL_iPxeLinker_LINK_PROGRAM_OUTPUT =
88 TOOL_iPxeLinker_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
89 TOOL_iPxeLinker_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
90 TOOL_iPxeLinker_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
91 TOOL_iPxeLinker_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
92 $(filter %.def, $(othersrc))
93 TOOL_iPxeLinker_LINK_PROGRAM_DEPORD =
94 define TOOL_iPxeLinker_LINK_PROGRAM_CMDS
95 $(QUIET)ld $(flags) -o $(out) $(objs)\
96 $(foreach p,$(libpath), -L$(p))\
97 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
98 endef
99
100 #
101 # iPXE - Template used to build the ROM binary.
102 #
103 TEMPLATE_iPxe = iPXE code
104 TEMPLATE_iPxe_TOOL = $(VBOX_GCC32_TOOL)
105 TEMPLATE_iPxe_LDTOOL = iPxeLinker
106 TEMPLATE_iPxe_LDFLAGS = \
107 -N \
108 --no-check-sections \
109 --gc-sections \
110 -T $(VBOX_PATH_IPXE_SRC)/src/arch/x86/scripts/pcbios.lds \
111 -u _rom_start --defsym check__rom_start=_rom_start \
112 -u obj_config --defsym check_obj_config=obj_config \
113 -u _build_id --defsym _build_id=0xaffeaffe \
114 --defsym pci_vendor_id=0x8086 \
115 --defsym pci_device_id=0x100E \
116 -e _rom_start
117ifeq ($(KBUILD_TARGET), freebsd)
118 TEMPLATE_iPxe_LDFLAGS += -m elf_i386_fbsd
119else
120 TEMPLATE_iPxe_LDFLAGS += -m elf_i386
121endif
122 TEMPLATE_iPxe_LNK_DEPS = $(VBOX_PATH_IPXE_SRC)/src/arch/x86/scripts/pcbios.lds
123 TEMPLATE_iPxe_CFLAGS = \
124 -fno-pie \
125 -fcommon \
126 -ffreestanding \
127 -ffunction-sections \
128 -march=i386 \
129 -fomit-frame-pointer \
130 -fstrength-reduce \
131 -falign-jumps=1 \
132 -falign-loops=1 \
133 -Oz \
134 -falign-functions=1 \
135 -mpreferred-stack-boundary=2 \
136 -mregparm=3 \
137 -mrtd \
138 -freg-struct-return \
139 -fshort-wchar \
140 -Ui386 \
141 -Ulinux \
142 -include compiler.h \
143 -Wall \
144 -W \
145 -Wformat-nonliteral \
146 $(VBOX_GCC_fno-stack-protector) \
147 $(VBOX_GCC_fno-dwarf2-cfi-asm) \
148 $(VBOX_GCC_Wno-address)
149 TEMPLATE_iPxe_ASFLAGS = \
150 -ffreestanding \
151 -ffunction-sections \
152 -march=i386 \
153 -fomit-frame-pointer \
154 -fstrength-reduce \
155 -falign-jumps=1 \
156 -falign-loops=1 \
157 -falign-functions=1 \
158 -mpreferred-stack-boundary=2 \
159 -mregparm=3 \
160 -mrtd \
161 -freg-struct-return \
162 -fshort-wchar \
163 -Ui386 \
164 -Ulinux \
165 -include compiler.h \
166 -Wall \
167 -W \
168 -Wformat-nonliteral \
169 $(VBOX_GCC_fno-stack-protector) \
170 $(VBOX_GCC_fno-dwarf2-cfi-asm) \
171 $(VBOX_GCC_Wno-address) \
172 -DASSEMBLY \
173 -DASM_TCHAR=@ \
174 -DASM_TCHAR_OPS=@
175 TEMPLATE_iPxe_DEFS = \
176 ARCH=i386 \
177 PLATFORM=pcbios \
178 VERSION_MAJOR=1 \
179 VERSION_MINOR=21 \
180 VERSION_PATCH=1 \
181 ASM_TCHAR=@ \
182 ASM_TCHAR_OPS=@
183 ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
184 TEMPLATE_iPxe_DEFS += \
185 VERSION="1.21.1" \
186 BUILD_NAME="VBox"
187 else
188 TEMPLATE_iPxe_DEFS += \
189 VERSION=\"1.21.1\" \
190 BUILD_NAME=\"VBox\"
191 endif
192
193 #
194 # iPxeBaseBin - The iPXE ROM base binary.
195 #
196 PROGRAMS += iPxeBaseBin
197
198 iPxeBaseBin_TEMPLATE = iPxe
199
200 iPxeBaseBin_INCS = \
201 vbox \
202 src \
203 src/include \
204 src/arch/x86/include \
205 src/arch/i386/include \
206 src/arch/i386/include/pcbios
207
208 iPxeBaseBin_SOURCES = \
209 src/arch/x86/core/basemem_packet.c \
210 src/arch/x86/core/relocate.c \
211 src/arch/x86/interface/pcbios/basemem.c \
212 src/arch/x86/interface/pcbios/bios_console.c \
213 src/arch/x86/interface/pcbios/hidemem.c \
214 src/arch/x86/interface/pcbios/memmap.c \
215 src/arch/x86/hci/commands/pxe_cmd.c \
216 src/arch/x86/image/bootsector.c \
217 src/arch/x86/image/pxe_image.c \
218 src/arch/x86/interface/pcbios/bios_nap.c \
219 src/arch/x86/interface/pcbios/bios_smbios.c \
220 src/arch/x86/interface/pcbios/bios_timer.c \
221 src/arch/x86/interface/pcbios/biosint.c \
222 src/arch/x86/interface/pcbios/int13.c \
223 src/arch/x86/interface/pcbios/memtop_umalloc.c \
224 src/arch/x86/interface/pcbios/pcibios.c \
225 src/arch/x86/interface/pcbios/rtc_time.c \
226 src/arch/x86/interface/pxe/pxe_call.c \
227 src/arch/x86/interface/pxe/pxe_file.c \
228 src/arch/x86/interface/pxe/pxe_loader.c \
229 src/arch/x86/interface/pxe/pxe_preboot.c \
230 src/arch/x86/interface/pxe/pxe_tftp.c \
231 src/arch/x86/interface/pxe/pxe_udp.c \
232 src/arch/x86/interface/pxe/pxe_undi.c \
233 src/arch/x86/core/pci_autoboot.c \
234 src/arch/x86/core/pit8254.c \
235 src/arch/x86/core/x86_string.c \
236 src/config/config.c \
237 src/config/config_ethernet.c \
238 src/config/config_http.c \
239 src/config/config_romprefix.c \
240 src/config/config_route.c \
241 src/config/config_timer.c \
242 src/core/acpi.c \
243 src/core/ansicol.c \
244 src/core/ansiesc.c \
245 src/core/asprintf.c \
246 src/core/base16.c \
247 src/core/base64.c \
248 src/core/basename.c \
249 src/core/bitmap.c \
250 src/core/blockdev.c \
251 src/core/blocktrans.c \
252 src/core/console.c \
253 src/core/ctype.c \
254 src/core/cwuri.c \
255 src/core/device.c \
256 src/core/downloader.c \
257 src/core/edd.c \
258 src/core/exec.c \
259 src/core/errno.c \
260 src/core/getkey.c \
261 src/core/getopt.c \
262 src/core/image.c \
263 src/core/init.c \
264 src/core/interface.c \
265 src/core/iobuf.c \
266 src/core/job.c \
267 src/core/linebuf.c \
268 src/core/list.c \
269 src/core/main.c \
270 src/core/malloc.c \
271 src/core/menu.c \
272 src/core/monojob.c \
273 src/core/nvo.c \
274 src/core/null_sanboot.c \
275 src/core/open.c \
276 src/core/params.c \
277 src/core/parseopt.c \
278 src/core/pending.c \
279 src/core/pool.c \
280 src/core/posix_io.c \
281 src/core/process.c \
282 src/core/quiesce.c \
283 src/core/random.c \
284 src/core/refcnt.c \
285 src/core/resolv.c \
286 src/core/sanboot.c \
287 src/core/settings.c \
288 src/core/string.c \
289 src/core/time.c \
290 src/core/timer.c \
291 src/core/uri.c \
292 src/core/uuid.c \
293 src/core/version.c \
294 src/core/vsprintf.c \
295 src/core/xfer.c \
296 src/core/xferbuf.c \
297 src/crypto/chap.c \
298 src/crypto/md5.c \
299 src/drivers/bitbash/bitbash.c \
300 src/drivers/bitbash/spi_bit.c \
301 src/drivers/block/ata.c \
302 src/drivers/block/ibft.c \
303 src/drivers/block/scsi.c \
304 src/drivers/bus/pci.c \
305 src/drivers/bus/pciextra.c \
306 src/drivers/bus/pci_settings.c \
307 src/drivers/bus/virtio-ring.c \
308 src/drivers/bus/virtio-pci.c \
309 src/drivers/net/mii.c \
310 src/drivers/net/ne.c \
311 src/drivers/net/intel.c \
312 src/drivers/net/pcnet32.c \
313 src/drivers/net/virtio-net.c \
314 src/drivers/nvs/nvs.c \
315 src/drivers/nvs/spi.c \
316 src/drivers/nvs/threewire.c \
317 src/hci/commands/autoboot_cmd.c \
318 src/hci/commands/config_cmd.c \
319 src/hci/commands/ifmgmt_cmd.c \
320 src/hci/commands/dhcp_cmd.c \
321 src/hci/commands/image_cmd.c \
322 src/hci/editstring.c \
323 src/hci/keymap/keymap_us.c \
324 src/hci/mucurses/ansi_screen.c \
325 src/hci/mucurses/clear.c \
326 src/hci/mucurses/colour.c \
327 src/hci/mucurses/mucurses.c \
328 src/hci/mucurses/print.c \
329 src/hci/mucurses/widgets/editbox.c \
330 src/hci/mucurses/winattrs.c \
331 src/hci/mucurses/wininit.c \
332 src/hci/readline.c \
333 src/hci/jumpscroll.c \
334 src/hci/shell.c \
335 src/hci/strerror.c \
336 src/hci/tui/login_ui.c \
337 src/hci/tui/menu_ui.c \
338 src/hci/tui/settings_ui.c \
339 src/image/segment.c \
340 src/interface/smbios/smbios.c \
341 src/interface/smbios/smbios_settings.c \
342 src/libgcc/implicit.c \
343 src/net/arp.c \
344 src/net/dhcpopts.c \
345 src/net/dhcppkt.c \
346 src/net/eth_slow.c \
347 src/net/ethernet.c \
348 src/net/fakedhcp.c \
349 src/net/fragment.c \
350 src/net/icmp.c \
351 src/net/icmpv4.c \
352 src/net/icmpv6.c \
353 src/net/iobpad.c \
354 src/net/ipv4.c \
355 src/net/neighbour.c \
356 src/net/netdev_settings.c \
357 src/net/netdevice.c \
358 src/net/nullnet.c \
359 src/net/rarp.c \
360 src/net/retry.c \
361 src/net/socket.c \
362 src/net/tcp.c \
363 src/net/tcpip.c \
364 src/net/udp.c \
365 src/net/udp/dhcp.c \
366 src/net/udp/dns.c \
367 src/net/udp/tftp.c \
368 src/usr/autoboot.c \
369 src/usr/dhcpmgmt.c \
370 src/usr/ifmgmt.c \
371 src/usr/imgmgmt.c \
372 src/usr/prompt.c \
373 src/usr/pxemenu.c \
374 src/usr/route.c \
375 src/usr/route_ipv4.c \
376 src/arch/x86/core/x86_tcpip.c \
377 src/arch/x86/core/patch_cf.S \
378 src/arch/i386/core/setjmp.S \
379 src/arch/x86/core/stack.S \
380 src/arch/x86/core/stack16.S \
381 src/arch/x86/interface/pcbios/e820mangler.S \
382 src/arch/x86/interface/pxe/pxe_entry.S \
383 src/arch/x86/prefix/unlzma16.S \
384 src/arch/x86/prefix/romprefix.S \
385 src/arch/x86/prefix/undiloader.S \
386 src/arch/x86/transitions/liba20.S \
387 src/arch/x86/transitions/librm.S \
388 src/arch/x86/transitions/librm_mgmt.c \
389 src/arch/i386/core/gdbidt.S \
390 src/arch/x86/prefix/libprefix.S
391
392 define def_iPxeBaseBinDefs
393 $(file)_DEFS += OBJECT=$(subst -,_,$(basename $(notdir $(file))))
394 endef
395
396 $(foreach file,$(iPxeBaseBin_SOURCES),$(eval $(call def_iPxeBaseBinDefs)))
397
398 #
399 # ipxezbin - Compressor?
400 #
401 BLDPROGS += ipxezbin
402 ipxezbin_TEMPLATE = VBoxBldProg
403 ipxezbin_CFLAGS = -Wno-format -Wno-unused-function -Wno-pointer-arith
404 ipxezbin_SOURCES = src/util/zbin.c
405 ifdef VBOX_WITH_LIBLZMA
406 ipxezbin_INCS = $(SDK_VBoxLibLzma_INCS) # Can't use the proper SDK here as link order matters and liblzma depends on our runtime.
407 ipxezbin_LIBS = \
408 $(SDK_VBoxLibLzma_LIBS) \
409 $(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_HOSTSUFF_LIB)
410 else
411 ipxezbin_LIBS = lzma # Assume it is installed on the system ready for linking
412 endif
413
414endif
415
416
417include $(FILE_KBUILD_SUB_FOOTER)
418
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette