[48674] | 1 | # $Id: Config.kmk 102909 2024-01-16 23:59:08Z vboxsync $
|
---|
| 2 | ## @file
|
---|
| 3 | # kBuild configuration for the VBox EFI firmware.
|
---|
| 4 | #
|
---|
| 5 | # Note! kBuild is only used for the build tools, the rest is handled by the
|
---|
| 6 | # very custom EFI build system.
|
---|
| 7 | #
|
---|
| 8 |
|
---|
| 9 | #
|
---|
[98103] | 10 | # Copyright (C) 2013-2023 Oracle and/or its affiliates.
|
---|
[48674] | 11 | #
|
---|
[96407] | 12 | # This file is part of VirtualBox base platform packages, as
|
---|
| 13 | # available from https://www.virtualbox.org.
|
---|
[48674] | 14 | #
|
---|
[96407] | 15 | # This program is free software; you can redistribute it and/or
|
---|
| 16 | # modify it under the terms of the GNU General Public License
|
---|
| 17 | # as published by the Free Software Foundation, in version 3 of the
|
---|
| 18 | # License.
|
---|
| 19 | #
|
---|
| 20 | # This program is distributed in the hope that it will be useful, but
|
---|
| 21 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 23 | # General Public License for more details.
|
---|
| 24 | #
|
---|
| 25 | # You should have received a copy of the GNU General Public License
|
---|
| 26 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 27 | #
|
---|
[48674] | 28 | # The contents of this file may alternatively be used under the terms
|
---|
| 29 | # of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 30 | # (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 31 | # in the VirtualBox distribution, in which case the provisions of the
|
---|
[48674] | 32 | # CDDL are applicable instead of those of the GPL.
|
---|
| 33 | #
|
---|
| 34 | # You may elect to license modified versions of this file under the
|
---|
| 35 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
| 36 | #
|
---|
[96407] | 37 | # SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
| 38 | #
|
---|
[48674] | 39 |
|
---|
| 40 | VBOX_EFI_FIRMWARE_CONFIG_KMK_INCLUDED = 1
|
---|
| 41 |
|
---|
| 42 | # Include the next configure file above us.
|
---|
| 43 | ifndef VBOX_DEVICES_CONFIG_KMK_INCLUDED
|
---|
| 44 | include $(PATH_ROOT)/src/VBox/Devices/Config.kmk
|
---|
| 45 | endif
|
---|
| 46 |
|
---|
| 47 | #
|
---|
| 48 | # Globals.
|
---|
| 49 | #
|
---|
[101297] | 50 | VBOX_PATH_EFI_FIRMWARE = $(PATH_ROOT)/src/VBox/Devices/EFI/Firmware
|
---|
[48674] | 51 | VBOX_PATH_STAGE_EFI_BLDPROGS = $(PATH_STAGE)/EfiBldProgs
|
---|
| 52 | VBOX_EFI_BUILD_TARGET = $(if-expr $(intersects release profile, $(KBUILD_TYPE)),RELEASE,DEBUG)
|
---|
| 53 | VBOX_EFI_OUTPUT_SUBDIR = $(VBOX_EFI_BUILD_TARGET)_$(VBOX_EFI_TOOL_CHAIN)
|
---|
| 54 |
|
---|
[58460] | 55 | # VBox Yasm command
|
---|
[84957] | 56 | ## @todo r=andy Is this still needed? Or can we just use TOOL_YASM_AS?
|
---|
[58460] | 57 | VBOX_YASMCMD ?= $(firstword $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/yasm$(HOSTSUFF_EXE)) yasm$(HOSTSUFF_EXE))
|
---|
[48674] | 58 |
|
---|
[100529] | 59 | # VBox nasm command (we share this with ValKit/bootsector/Config.kmk, thus the TOOL-style variable name).
|
---|
[77669] | 60 | include $(KBUILD_PATH)/tools/NASM.kmk
|
---|
| 61 | ifndef TOOL_VBoxNasm_PATH
|
---|
| 62 | TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
|
---|
| 63 | if "$(TOOL_VBoxNasm_PATH)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
|
---|
| 64 | TOOL_VBoxNasm_PATH := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
|
---|
| 65 | endif
|
---|
| 66 | endif
|
---|
| 67 | ifneq ($(TOOL_VBoxNasm_PATH),)
|
---|
| 68 | VBOX_NASMCMD ?= $(TOOL_VBoxNasm_PATH)/nasm$(HOSTSUFF_EXE)
|
---|
| 69 | else
|
---|
| 70 | VBOX_NASMCMD ?= nasm$(HOSTSUFF_EXE)
|
---|
| 71 | endif
|
---|
| 72 |
|
---|
[72800] | 73 |
|
---|
[48674] | 74 | #
|
---|
| 75 | # Decide which tool chain to use for the EFI binaries.
|
---|
[48754] | 76 | # Note! We're using our own stripped down tools_def.txt: vbox-tools_def.txt.
|
---|
[48674] | 77 | #
|
---|
| 78 | ifeq ($(KBUILD_HOST),win)
|
---|
[84676] | 79 | ifdef VBOX_WITH_NEW_VCC # ACtually using VS2019, but no config for it, so VS2017 will have to do for now.
|
---|
| 80 | VBOX_EFI_TOOL_CHAIN := VS2017
|
---|
| 81 | else
|
---|
| 82 | VBOX_EFI_TOOL_CHAIN := VS2010
|
---|
| 83 | endif
|
---|
[48674] | 84 | else
|
---|
[80935] | 85 | VBOX_EFI_TOOL_CHAIN = GCC48
|
---|
[48674] | 86 | endif
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | #
|
---|
| 90 | # Make a build program template of our own.
|
---|
| 91 | #
|
---|
| 92 | TEMPLATE_VBoxEfiBldProg = EFI build program.
|
---|
[49116] | 93 | TEMPLATE_VBoxEfiBldProg_EXTENDS = VBoxBldProg
|
---|
[48674] | 94 | TEMPLATE_VBoxEfiBldProg_INST = EfiBldProgs/
|
---|
| 95 | TEMPLATE_VBoxEfiBldProg_INSTTYPE = stage
|
---|
[63388] | 96 | TEMPLATE_VBoxEfiBldProg_DEFS.win = $(TEMPLATE_VBoxBldProg_DEFS.win) \
|
---|
| 97 | __STDC_VERSION__=199409L
|
---|
| 98 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win = $(TEMPLATE_VBoxBldProg_CFLAGS.win)
|
---|
| 99 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4100 # warning C4100: '_text' : unreferenced formal parameter
|
---|
| 100 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4189 # warning C4189: 'zzpf' : local variable is initialized but not referenced
|
---|
| 101 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4255 # warning C4255: 'AllocateMemory' : no function prototype given: converting '()' to '(void)'
|
---|
| 102 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4267 # warning C4267: '=' : conversion from 'size_t' to 'UINT32', possible loss of data
|
---|
| 103 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4287 # warning C4287: '>' : unsigned/negative constant mismatch
|
---|
| 104 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4334 # warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
---|
| 105 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4555 # warning C4555: expression has no effect; expected expression with side-effect
|
---|
| 106 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4701 # warning C4701: potentially uninitialized local variable 'save_line' used
|
---|
| 107 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4702 # warning C4702: unreachable code
|
---|
[84676] | 108 | if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
|
---|
[98410] | 109 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4456 # antlr\gen.c(3000): warning C4456: declaration of 'f' hides previous local declaration
|
---|
| 110 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4774 # antlr\main.c(1244): warning C4774: 'sprintf' : format string expected in argument 2 is not a string literal
|
---|
| 111 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4703 # antlr\antlr.c(1403) : warning C4703: potentially uninitialized local pointer variable 'p' used
|
---|
| 112 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4477 # dlg\dlg_p.c(874): warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 1 has type '_nfa_node *'
|
---|
| 113 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4313 # dlg\dlg_p.c(874): warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type '_nfa_node *'
|
---|
| 114 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4459 # antlr\gen.c(756): warning C4459: declaration of 'output' hides global declaration
|
---|
[101296] | 115 | TEMPLATE_VBoxEfiBldProg_CFLAGS.win += -wd4668 # winioctl.h(10983): warning C4668: '_WIN32_WINNT_WIN10_TH2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
|
---|
[84676] | 116 | endif
|
---|
[63388] | 117 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win = $(TEMPLATE_VBoxBldProg_CXXFLAGS.win)
|
---|
[77662] | 118 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4018 # warning C4018: '>' : signed/unsigned mismatch
|
---|
[63388] | 119 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4101 # warning C4101: 'LineBuf' : unreferenced local variable
|
---|
[63622] | 120 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4102 # warning C4102: 'fail' : unreferenced label
|
---|
[63388] | 121 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4189 # warning C4189: 'zzpf' : local variable is initialized but not referenced
|
---|
| 122 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4267 # warning C4267: '=' : conversion from 'size_t' to 'UINT32', possible loss of data
|
---|
| 123 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4370 # warning C4370: 'ANTLRParser' : layout of class has changed from a previous version of the compiler due to better packing
|
---|
| 124 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4555 # warning C4555: expression has no effect; expected expression with side-effect
|
---|
[77662] | 125 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4625 # warning C4625: 'EfiVfrParser' : copy constructor could not be generated because a base class copy constructor is inaccessible
|
---|
| 126 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4626 # warning C4626: 'EfiVfrParser' : assignment operator could not be generated because a base class assignment operator is inaccessible
|
---|
[63388] | 127 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4701 # warning C4701: potentially uninitialized local variable 'save_line' used
|
---|
| 128 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4702 # warning C4702: unreachable code
|
---|
[84676] | 129 | if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
|
---|
[98410] | 130 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd5204 # Pccts\h\ATokenStream.h(49): warning C5204: 'ANTLRTokenStream': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
|
---|
| 131 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4774 # Pccts\h\AParser.cpp(653): warning C4774: 'sprintf' : format string expected in argument 2 is not a string literal
|
---|
| 132 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd4703 # VfrCompile\VfrFormPkg.cpp(1344) : warning C4703: potentially uninitialized local pointer variable 'pNodeBeforeAdjust' used
|
---|
| 133 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.win += -wd5033 # DLexer.h(68): warning C5033: 'register' is no longer a supported storage class (in c++17 or later mode)
|
---|
[84676] | 134 | endif
|
---|
[63388] | 135 |
|
---|
[99404] | 136 | TEMPLATE_VBoxEfiBldProg_CFLAGS.linux = $(TEMPLATE_VBoxBldProg_CFLAGS.linux)
|
---|
| 137 | TEMPLATE_VBoxEfiBldProg_CFLAGS.linux += -Wno-misleading-indentation
|
---|
[100506] | 138 | TEMPLATE_VBoxEfiBldProg_CFLAGS.linux += -Wno-error=stringop-truncation # VfrCompile/Pccts/antlr/mrhoist.c:2216:5: error: 'strncpy' specified bound 50 equals destination size
|
---|
[99404] | 139 |
|
---|
[99474] | 140 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.darwin.arm64 = $(TEMPLATE_VBoxBldProg_CXXFLAGS.darwin.arm64)
|
---|
| 141 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS.darwin.arm64 += -Wno-register # BaseTools/Source/C/VfrCompile/Pccts/h/AParser.cpp:475:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
|
---|
| 142 |
|
---|
[49116] | 143 | TEMPLATE_VBoxEfiBldProg_INCS = $(TEMPLATE_VBoxBldProg_INCS) \
|
---|
[48674] | 144 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Common \
|
---|
| 145 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C/Include \
|
---|
[101291] | 146 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/C \
|
---|
[101292] | 147 | $(VBOX_PATH_EFI_FIRMWARE)/MdePkg/Include
|
---|
[48674] | 148 |
|
---|
[49116] | 149 | TEMPLATE_VBoxEfiBldProg_INCS.x86 = $(TEMPLATE_VBoxBldProg_INCS.x86) \
|
---|
[101291] | 150 | $(VBOX_PATH_EFI_FIRMWARE)/MdePkg/Include/Ia32
|
---|
[48674] | 151 |
|
---|
[49116] | 152 | TEMPLATE_VBoxEfiBldProg_INCS.amd64 = $(TEMPLATE_VBoxBldProg_INCS.amd64) \
|
---|
[101291] | 153 | $(VBOX_PATH_EFI_FIRMWARE)/MdePkg/Include/X64
|
---|
[48674] | 154 |
|
---|
[99474] | 155 | TEMPLATE_VBoxEfiBldProg_INCS.arm = $(TEMPLATE_VBoxBldProg_INCS.arm) \
|
---|
[101291] | 156 | $(VBOX_PATH_EFI_FIRMWARE)/MdePkg/Include/Arm
|
---|
[99474] | 157 |
|
---|
| 158 | TEMPLATE_VBoxEfiBldProg_INCS.arm64 = $(TEMPLATE_VBoxBldProg_INCS.arm64) \
|
---|
[101291] | 159 | $(VBOX_PATH_EFI_FIRMWARE)/MdePkg/Include/AArch64
|
---|
[99474] | 160 |
|
---|
[48674] | 161 | TEMPLATE_VBoxEfiBldProg_LIBS = \
|
---|
| 162 | $(VBOX_PATH_STAGE_EFI_BLDPROGS)/EfiBldCommonLib$(VBOX_SUFF_LIB) \
|
---|
[49116] | 163 | $(TEMPLATE_VBoxBldProg_LIBS)
|
---|
[98410] | 164 | ifn1of ($(KBUILD_HOST), win) # This stuff isn't up to our standard at all! :/
|
---|
[49116] | 165 | TEMPLATE_VBoxEfiBldProg_CFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBoxBldProg_CFLAGS)) \
|
---|
[48674] | 166 | -Wno-sign-compare -Wno-missing-prototypes -Wno-strict-prototypes \
|
---|
[98410] | 167 | -Wno-implicit-function-declaration -Wno-missing-declarations -Wno-shadow -Wno-format \
|
---|
| 168 | -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable -Wno-unused-label
|
---|
[49116] | 169 | TEMPLATE_VBoxEfiBldProg_CXXFLAGS = $(filter-out -pedantic,$(TEMPLATE_VBoxBldProg_CXXFLAGS)) \
|
---|
[63622] | 170 | -Wno-all -Wno-shadow -Wno-empty-body -Wno-unused-parameter -Wno-unused-variable \
|
---|
[98410] | 171 | -Wno-unused-label
|
---|
[48674] | 172 | endif
|
---|
| 173 |
|
---|
| 174 |
|
---|
| 175 | # There isn't a BLDLIBRARIES target group, so we have to override the build
|
---|
| 176 | # target for libraries used by build programs and keep them in LIBRARIES.
|
---|
| 177 | TEMPLATE_VBoxEfiBldLib = Library for an EFI build program.
|
---|
| 178 | TEMPLATE_VBoxEfiBldLib_EXTENDS = VBoxEfiBldProg
|
---|
| 179 | TEMPLATE_VBoxEfiBldLib_BLD_TRG := $(KBUILD_HOST)
|
---|
| 180 | TEMPLATE_VBoxEfiBldLib_BLD_TRG_ARCH := $(KBUILD_HOST_ARCH)
|
---|
| 181 | TEMPLATE_VBoxEfiBldLib_BLD_TRG_CPU := $(KBUILD_HOST_CPU)
|
---|
| 182 |
|
---|
| 183 |
|
---|
[48754] | 184 | #
|
---|
[58529] | 185 | # The debug info suffix.
|
---|
[48754] | 186 | #
|
---|
[58528] | 187 | if1of ($(KBUILD_TARGET), win)
|
---|
| 188 | VBOX_EFI_DBG_SUFF := .pdb
|
---|
| 189 | else
|
---|
| 190 | VBOX_EFI_DBG_SUFF := .debug
|
---|
| 191 | endif
|
---|
| 192 |
|
---|
[58529] | 193 | include $(VBOX_PATH_EFI_FIRMWARE)/EfiModules.kmk
|
---|