VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk@ 59245

Last change on this file since 59245 was 59245, checked in by vboxsync, 9 years ago

bs3kit: Implemented switching to long mode.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.9 KB
Line 
1# $Id: Makefile.kmk 59245 2016-01-04 01:57:26Z vboxsync $
2## @file
3# VirtualBox Validation Kit - Bootsector Kit v3
4#
5
6#
7# Copyright (C) 2006-2015 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# The contents of this file may alternatively be used under the terms
18# of the Common Development and Distribution License Version 1.0
19# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20# VirtualBox OSE distribution, in which case the provisions of the
21# CDDL are applicable instead of those of the GPL.
22#
23# You may elect to license modified versions of this file under the
24# terms and conditions of either the GPL or the CDDL or both.
25#
26
27SUB_DEPTH = ../../../../..
28include $(KBUILD_PATH)/subheader.kmk
29
30
31#
32# ----- Config.kmk: start -----
33#
34
35# The bs3kit source directory.
36VBOX_PATH_BS3KIT_SRC = $(VBOX_PATH_VALIDATIONKIT_SRC)/bootsectors/bs3kit
37
38# Boot Sector post-link tool used below.
39BLDPROGS += VBoxBs3Linker
40VBoxBs3Linker_TEMPLATE = VBoxBldProg
41VBoxBs3Linker_SOURCES = $(VBOX_PATH_BS3KIT_SRC)/VBoxBs3Linker.cpp
42
43# 64-bit relocation conversion tool
44BLDPROGS += VBoxBs3ObjConverter
45VBoxBs3ObjConverter_TEMPLATE = VBoxBldProg
46VBoxBs3ObjConverter_SOURCES = $(VBOX_PATH_BS3KIT_SRC)/VBoxBs3ObjConverter.cpp
47
48# Dummy CP "linker" tool.
49TOOL_VBoxBsCpLd = Dummy copy linker.
50TOOL_VBoxBsCpLd_LINK_MISCBIN_OUTPUT =
51TOOL_VBoxBsCpLd_LINK_MISCBIN_DEPEND =
52TOOL_VBoxBsCpLd_LINK_MISCBIN_DEPORD =
53define TOOL_VBoxBsCpLd_LINK_MISCBIN_CMDS
54 $(CP) -- $(objs) $(othersrc) "$(out)"
55endef
56
57# Dummy exit 1 "linker" tool.
58TOOL_VBoxBsUnusedLd = Dummy unused linker.
59TOOL_VBoxBsUnusedLd_LINK_MISCBIN_OUTPUT =
60TOOL_VBoxBsUnusedLd_LINK_MISCBIN_DEPEND =
61TOOL_VBoxBsUnusedLd_LINK_MISCBIN_DEPORD =
62define TOOL_VBoxBsUnusedLd_LINK_MISCBIN_CMDS
63 echo "cannot use this template for linking"
64 exit 1
65endef
66
67#
68# elf cross compiling 64-bit gcc (mac): sudo port install x86_64-elf-gcc
69#
70TOOL_Bs3Gcc64Elf64 := AMD64/ELF64 gcc/g++ cross compiler for mac.
71TOOL_Bs3Gcc64Elf64_CC ?= x86_64-elf-gcc$(HOSTSUFF_EXE) -m64
72TOOL_Bs3Gcc64Elf64_CXX ?= x86_64-elf-g++$(HOSTSUFF_EXE) -m64
73ifdef SLKRUNS
74 TOOL_Bs3Gcc64Elf64_CC += -fmessage-length=0
75 TOOL_Bs3Gcc64Elf64_CXX += -fmessage-length=0
76endif
77TOOL_Bs3Gcc64Elf64_COBJSUFF ?= .o
78TOOL_Bs3Gcc64Elf64_CFLAGS ?=
79TOOL_Bs3Gcc64Elf64_CFLAGS.debug ?= -g
80TOOL_Bs3Gcc64Elf64_CFLAGS.profile ?= -O2 #-g -pg
81TOOL_Bs3Gcc64Elf64_CFLAGS.release ?= -O2
82TOOL_Bs3Gcc64Elf64_CINCS ?=
83TOOL_Bs3Gcc64Elf64_CDEFS ?=
84TOOL_Bs3Gcc64Elf64_COMPILE_C_DEPEND = $(VBoxBs3ObjConverter_1_TARGET)
85TOOL_Bs3Gcc64Elf64_COMPILE_C_DEPORD =
86TOOL_Bs3Gcc64Elf64_COMPILE_C_OUTPUT =
87define TOOL_Bs3Gcc64Elf64_COMPILE_C_CMDS
88 $(QUIET)$(TOOL_Bs3Gcc64Elf64_CC) -c\
89 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
90 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
91 -o $(obj)\
92 $(abspath $(source))
93 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
94 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
95endef
96
97TOOL_Bs3Gcc64Elf64_CXXOBJSUFF ?= .o
98TOOL_Bs3Gcc64Elf64_CXXOBJSUFF ?= .o
99TOOL_Bs3Gcc64Elf64_CXXFLAGS ?=
100TOOL_Bs3Gcc64Elf64_CXXFLAGS.debug ?= -g0 # no debug info, thank you
101TOOL_Bs3Gcc64Elf64_CXXFLAGS.profile ?= -O2 #-g -pg
102TOOL_Bs3Gcc64Elf64_CXXFLAGS.release ?= -O2
103TOOL_Bs3Gcc64Elf64_CXXINCS ?=
104TOOL_Bs3Gcc64Elf64_CXXDEFS ?=
105TOOL_Bs3Gcc64Elf64_COMPILE_CXX_DEPEND = $(VBoxBs3ObjConverter_1_TARGET)
106TOOL_Bs3Gcc64Elf64_COMPILE_CXX_DEPORD =
107TOOL_Bs3Gcc64Elf64_COMPILE_CXX_OUTPUT =
108define TOOL_Bs3Gcc64Elf64_COMPILE_CXX_CMDS
109 $(QUIET)$(TOOL_Bs3Gcc64Elf64_CXX) -c\
110 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
111 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
112 -o $(obj)\
113 $(abspath $(source))
114 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
115 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
116endef
117
118#
119# Visual C++ tool variant that runs the object converter afterwards.
120#
121TOOL_Bs3Vcc64 := Visual C++ 64-bit
122TOOL_Bs3Vcc64_CC = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CC)
123TOOL_Bs3Vcc64_CXX = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXX)
124TOOL_Bs3Vcc64_COBJSUFF = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COBJSUFF)
125TOOL_Bs3Vcc64_CFLAGS = $(filter-out -TC,$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CFLAGS)) -TP # compile as C++
126TOOL_Bs3Vcc64_CFLAGS.debug =
127TOOL_Bs3Vcc64_CFLAGS.dbgopt = -O1
128TOOL_Bs3Vcc64_CFLAGS.profile = -O1
129TOOL_Bs3Vcc64_CFLAGS.release = -O1
130TOOL_Bs3Vcc64_CINCS = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_INC)
131TOOL_Bs3Vcc64_CDEFS =
132TOOL_Bs3Vcc64_COMPILE_C_DEPEND = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
133TOOL_Bs3Vcc64_COMPILE_C_DEPORD = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_DEPORD)
134TOOL_Bs3Vcc64_COMPILE_C_OUTPUT = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT)
135TOOL_Bs3Vcc64_COMPILE_C_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_OUTPUT_MAYBE)
136define TOOL_Bs3Vcc64_COMPILE_C_CMDS
137$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_C_CMDS)
138 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
139endef
140
141TOOL_Bs3Vcc64_CXXOBJSUFF = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXXOBJSUFF)
142TOOL_Bs3Vcc64_CXXFLAGS = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_CXXFLAGS)
143TOOL_Bs3Vcc64_CXXFLAGS.debug =
144TOOL_Bs3Vcc64_CXXFLAGS.dbgopt = -O1
145TOOL_Bs3Vcc64_CXXFLAGS.profile = -O1
146TOOL_Bs3Vcc64_CXXFLAGS.release = -O1
147TOOL_Bs3Vcc64_CXXINCS = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_INC)
148TOOL_Bs3Vcc64_CXXDEFS =
149TOOL_Bs3Vcc64_COMPILE_CXX_DEPEND = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
150TOOL_Bs3Vcc64_COMPILE_CXX_DEPORD = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_DEPORD)
151TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT)
152TOOL_Bs3Vcc64_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_OUTPUT_MAYBE)
153define TOOL_Bs3Vcc64_COMPILE_CXX_CMDS
154$(TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_COMPILE_CXX_CMDS)
155 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
156endef
157
158#
159# 32-bit OpenWatcom C/C++ tool variant that runs the object converter afterwards
160# to rename intrinsic functions so they don't clash with the 16-bit compiler.
161#
162TOOL_Bs3Ow32 := OpenWatcom C/C++ 32-bit with object convertsion
163TOOL_Bs3Ow32_CC = $(TOOL_OPENWATCOM_CC)
164TOOL_Bs3Ow32_CXX = $(TOOL_OPENWATCOM_CXX)
165TOOL_Bs3Ow32_COBJSUFF = $(TOOL_OPENWATCOM_COBJSUFF)
166TOOL_Bs3Ow32_CFLAGS = $(TOOL_OPENWATCOM_CFLAGS)
167TOOL_Bs3Ow32_CFLAGS.debug = $(TOOL_OPENWATCOM_CFLAGS.debug)
168TOOL_Bs3Ow32_CFLAGS.dbgopt = $(TOOL_OPENWATCOM_CFLAGS.dbgopt)
169TOOL_Bs3Ow32_CFLAGS.profile = $(TOOL_OPENWATCOM_CFLAGS.profile)
170TOOL_Bs3Ow32_CFLAGS.release = $(TOOL_OPENWATCOM_CFLAGS.release)
171TOOL_Bs3Ow32_CINCS = $(TOOL_OPENWATCOM_CINCS)
172TOOL_Bs3Ow32_CDEFS =
173TOOL_Bs3Ow32_COMPILE_C_DEPEND = $(TOOL_OPENWATCOM_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
174TOOL_Bs3Ow32_COMPILE_C_DEPORD = $(TOOL_OPENWATCOM_COMPILE_C_DEPORD)
175TOOL_Bs3Ow32_COMPILE_C_OUTPUT = $(TOOL_OPENWATCOM_COMPILE_C_OUTPUT)
176TOOL_Bs3Ow32_COMPILE_C_OUTPUT_MAYBE = $(TOOL_OPENWATCOM_COMPILE_C_OUTPUT_MAYBE)
177define TOOL_Bs3Ow32_COMPILE_C_CMDS
178$(TOOL_OPENWATCOM_COMPILE_C_CMDS)
179 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
180endef
181
182TOOL_Bs3Ow32_CXXOBJSUFF = $(TOOL_OPENWATCOM_CXXOBJSUFF)
183TOOL_Bs3Ow32_CXXFLAGS = $(TOOL_OPENWATCOM_CXXFLAGS)
184TOOL_Bs3Ow32_CXXFLAGS.debug = $(TOOL_OPENWATCOM_CXXFLAGS.debug)
185TOOL_Bs3Ow32_CXXFLAGS.dbgopt = $(TOOL_OPENWATCOM_CXXFLAGS.dbgopt)
186TOOL_Bs3Ow32_CXXFLAGS.profile = $(TOOL_OPENWATCOM_CXXFLAGS.profile)
187TOOL_Bs3Ow32_CXXFLAGS.release = $(TOOL_OPENWATCOM_CXXFLAGS.release)
188TOOL_Bs3Ow32_CXXINCS = $(TOOL_OPENWATCOM_CXXINCS)
189TOOL_Bs3Ow32_CXXDEFS =
190TOOL_Bs3Ow32_COMPILE_CXX_DEPEND = $(TOOL_OPENWATCOM_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
191TOOL_Bs3Ow32_COMPILE_CXX_DEPORD = $(TOOL_OPENWATCOM_COMPILE_CXX_DEPORD)
192TOOL_Bs3Ow32_COMPILE_CXX_OUTPUT = $(TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT)
193TOOL_Bs3Ow32_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT_MAYBE)
194define TOOL_Bs3Ow32_COMPILE_CXX_CMDS
195$(TOOL_OPENWATCOM_COMPILE_CXX_CMDS)
196 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
197endef
198
199
200#
201# 16-bit OpenWatcom C/C++ tool variant that runs the object converter afterwards
202# to rename intrinsic functions so they don't clash with the 16-bit compiler.
203#
204TOOL_Bs3Ow16 := OpenWatcom C/C++ 16-bit with object convertsion
205TOOL_Bs3Ow16_CC = $(TOOL_OPENWATCOM-16_CC)
206TOOL_Bs3Ow16_CXX = $(TOOL_OPENWATCOM-16_CXX)
207TOOL_Bs3Ow16_COBJSUFF = $(TOOL_OPENWATCOM-16_COBJSUFF)
208TOOL_Bs3Ow16_CFLAGS = $(TOOL_OPENWATCOM-16_CFLAGS)
209TOOL_Bs3Ow16_CFLAGS.debug = $(TOOL_OPENWATCOM-16_CFLAGS.debug)
210TOOL_Bs3Ow16_CFLAGS.dbgopt = $(TOOL_OPENWATCOM-16_CFLAGS.dbgopt)
211TOOL_Bs3Ow16_CFLAGS.profile = $(TOOL_OPENWATCOM-16_CFLAGS.profile)
212TOOL_Bs3Ow16_CFLAGS.release = $(TOOL_OPENWATCOM-16_CFLAGS.release)
213TOOL_Bs3Ow16_CINCS = $(TOOL_OPENWATCOM-16_CINCS)
214TOOL_Bs3Ow16_CDEFS =
215TOOL_Bs3Ow16_COMPILE_C_DEPEND = $(TOOL_OPENWATCOM-16_COMPILE_C_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
216TOOL_Bs3Ow16_COMPILE_C_DEPORD = $(TOOL_OPENWATCOM-16_COMPILE_C_DEPORD)
217TOOL_Bs3Ow16_COMPILE_C_OUTPUT = $(TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT)
218TOOL_Bs3Ow16_COMPILE_C_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-16_COMPILE_C_OUTPUT_MAYBE)
219define TOOL_Bs3Ow16_COMPILE_C_CMDS
220$(TOOL_OPENWATCOM-16_COMPILE_C_CMDS)
221 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
222endef
223
224TOOL_Bs3Ow16_CXXOBJSUFF = $(TOOL_OPENWATCOM-16_CXXOBJSUFF)
225TOOL_Bs3Ow16_CXXFLAGS = $(TOOL_OPENWATCOM-16_CXXFLAGS)
226TOOL_Bs3Ow16_CXXFLAGS.debug = $(TOOL_OPENWATCOM-16_CXXFLAGS.debug)
227TOOL_Bs3Ow16_CXXFLAGS.dbgopt = $(TOOL_OPENWATCOM-16_CXXFLAGS.dbgopt)
228TOOL_Bs3Ow16_CXXFLAGS.profile = $(TOOL_OPENWATCOM-16_CXXFLAGS.profile)
229TOOL_Bs3Ow16_CXXFLAGS.release = $(TOOL_OPENWATCOM-16_CXXFLAGS.release)
230TOOL_Bs3Ow16_CXXINCS = $(TOOL_OPENWATCOM-16_CXXINCS)
231TOOL_Bs3Ow16_CXXDEFS =
232TOOL_Bs3Ow16_COMPILE_CXX_DEPEND = $(TOOL_OPENWATCOM-16_COMPILE_CXX_DEPEND) $(VBoxBs3ObjConverter_1_TARGET)
233TOOL_Bs3Ow16_COMPILE_CXX_DEPORD = $(TOOL_OPENWATCOM-16_COMPILE_CXX_DEPORD)
234TOOL_Bs3Ow16_COMPILE_CXX_OUTPUT = $(TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT)
235TOOL_Bs3Ow16_COMPILE_CXX_OUTPUT_MAYBE = $(TOOL_OPENWATCOM-16_COMPILE_CXX_OUTPUT_MAYBE)
236define TOOL_Bs3Ow16_COMPILE_CXX_CMDS
237$(TOOL_OPENWATCOM-16_COMPILE_CXX_CMDS)
238 $(QUIET)$(VBoxBs3ObjConverter_1_TARGET) "$(obj)"
239endef
240
241# Debug info format depends on what we use for 64-bit.
242if1of ($(KBUILD_HOST), win)
243 BS3_OW_DBG_OPT = -hc
244 BS3_OW_DBG_LDOPT = codeview
245else
246 BS3_OW_DBG_OPT = -hd
247 BS3_OW_DBG_LDOPT = dwarf
248endif
249
250#
251# BS3Kit template for assembly and 16-bit code.
252#
253# Note! Using -d1 as -d1+ and -d2 causes suboptimal code to be generated (strlen
254# reloading string pointer argument all the time).
255# Note! Optimization options should come after debug stuff as -d2 for instance
256# disables all optimziations.
257#
258# Compiler options explained:
259# -nt=xxxx Sets the text segment name.
260# -nc=xxxx Sets the text segment class name.
261# -nd=xxxx Sets the data segment name.
262# -ecc Sets the default calling convension to __cdecl
263# Update: We don't use this in 16-bit code as it causes unfavorable reloading of DS before calling
264# inlined functions (e.g. iprt/asm.h). Instead we use -ecw and __cdecl where needed.
265# -ecw Sets the default calling convension to __watcall ()
266# -q Quiet, no logos or stuff.
267# -3 Use 386 instruction set (16-bit only).
268# -wx Maxium warning level.
269# -zl Don't emit default library information.
270# -zu Assume SS != DS.
271# -mc Compact memory model, far data, small code.
272# -mf Flat memory model (32-bit).
273# -d1 Debug info: Globals and line numbers.
274# -s No stack overflow checks.
275# -oa Relaxed aliasing constraints.
276# -ob Branch prediction.
277# -of Generate stack frames when needed.
278# -oi Inline instrinsics functions.
279# -ol Loop optimizations.
280# -or Reorder for best pipeline.
281# -os Favor size over speed.
282#
283TEMPLATE_VBoxBS3KitImg = Template for building BS3Kit test images.
284TEMPLATE_VBoxBS3KitImg_BLD_TRG = os-agnostic
285TEMPLATE_VBoxBS3KitImg_BLD_TRG_ARCH = x86
286TEMPLATE_VBoxBS3KitImg_INST = $(INST_VALIDATIONKIT)bootsectors/
287TEMPLATE_VBoxBS3KitImg_BINSUFF = .img
288TEMPLATE_VBoxBS3KitImg_MODE = 0644
289TEMPLATE_VBoxBS3KitImg_ASTOOL = NASM
290TEMPLATE_VBoxBS3KitImg_ASFLAGS = -f obj -g --allow-64bit-code-anywhere -w+orphan-labels
291TEMPLATE_VBoxBS3KitImg_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__
292TEMPLATE_VBoxBS3KitImg_DEFS = ARCH_BITS=16 IN_BS3KIT
293TEMPLATE_VBoxBS3KitImg_DEFS.debug = BS3_STRICT
294TEMPLATE_VBoxBS3KitImg_ARTOOL = OPENWATCOM-16
295TEMPLATE_VBoxBS3KitImg_CTOOL = Bs3Ow16
296TEMPLATE_VBoxBS3KitImg_CXXTOOL = Bs3Ow16
297TEMPLATE_VBoxBS3KitImg_CFLAGS = \
298 -nt=BS3TEXT16 -nd=BS3DATA16 -nc=BS3CODE16 -ecw -q -3 -wx -zl -zu -mc $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
299TEMPLATE_VBoxBS3KitImg_CXXFLAGS = \
300 -nt=BS3TEXT16 -nd=BS3DATA16 -nc=BS3CODE16 -ecw -q -3 -wx -zl -zu -mc $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
301TEMPLATE_VBoxBS3KitImg_INCS = $(VBOX_PATH_BS3KIT_SRC) .
302TEMPLATE_VBoxBS3KitImg_LDTOOL = OPENWATCOM-WL
303# option quiet, nofarcalls\
304# disable 1014, 1023, 2120, 1080
305
306# linker options:
307# system dos: Link a 16-bit DOS binary.
308# output raw ...: Produce a raw DOS binary for loading at flat address 10000h.
309# The following is for ordering segments.
310# option start=_start: The start symbol in bs3-first-xxx.asm.
311# debug codeview/dwarf all: Full debug information either in codeview or dwarf.
312# option symfile: Produce a separate symbol file with the debug info.
313# option map: Produce a map file.
314# option statics: ?
315# option verbose: Verbose map file?
316# option disable 1014: Disable warning about
317# option disable 1080: Disable warning about
318# option disable 1150: Disable warning about
319#
320# Note! We're pushing DATA16 to 0x20000 because it's impossible to force wlink
321# to give us a real-mode + GDT compatible alignment (0ffffff80h), i.e.
322# real-mode address on the form 0fff8:0000.
323TEMPLATE_VBoxBS3KitImg_LDFLAGS = system dos \
324 debug $(BS3_OW_DBG_LDOPT) all \
325 option quiet, map, statics, verbose, symfile, start=_start \
326 disable 1014, 1080, 1150 \
327 \
328 output raw offset=0x10000 \
329 order \
330 clname BS3FLAT segaddr=0x0000 \
331 segment BS3FLAT segaddr=0x0000 \
332 clname BS3CODE16 segaddr=0x1000 \
333 segment BS3TEXT16 \
334 segment BS3TEXT16_END \
335 clname BS3SYSTEM16 segaddr=0x2000 \
336 segment BS3SYSTEM16 \
337 clname FAR_DATA \
338 segment BS3DATA16 segaddr=0x2700 \
339 segment BS3DATA16CONST \
340 segment BS3DATA16CONST2 \
341 segment BS3DATA16_DATA \
342 segment BS3DATA16_END \
343 segment BS3DATA32 \
344 segment BS3DATA32_CONST \
345 segment BS3DATA32_CONST2 \
346 segment BS3DATA32_DATA \
347 segment DATA32 \
348 clname BS3CODE32 \
349 segment BS3TEXT32 \
350 segment TEXT32 \
351 clname CODE \
352 segment BS3TEXT64 \
353 segment TEXT64 \
354 segment .text \
355 segment .rdata \
356 clname DATA \
357 segment BS3DATA64 \
358 segment DATA64 \
359 segment .data \
360 segment .pdata \
361 segment .xdata \
362
363TEMPLATE_VBoxBS3KitImg_DEPS = \
364 $(bs3-bootsector_1_TARGET) \
365 $(VBoxBs3Linker_1_TARGET)
366TEMPLATE_VBoxBS3KitImg_POST_CMDS = $(if $(eq $(tool_do),LINK_LIBRARY)\
367 ,,$(QUIET)$(MV_EXT) -f -- "$(out)" "$(out).tmp" \
368 $$(NLTAB)$(QUIET)$(VBoxBs3Linker_1_TARGET) -o $(out) $(bs3-bootsector_1_TARGET) $(out).tmp \
369 $$(NLTAB)$(QUIET)$(RM_EXT) -f -- "$(out).tmp")
370
371TEMPLATE_VBoxBS3KitImg_LIBS = \
372 $(PATH_OBJ)/bs3kit-common-16/bs3kit-common-16.lib \
373 $(PATH_OBJ)/bs3kit-common-32/bs3kit-common-32.lib \
374 $(PATH_OBJ)/bs3kit-common-64-asm/bs3kit-common-64-asm.lib \
375 $(PATH_OBJ)/bs3kit-common-64-c/bs3kit-common-64-c.lib \
376 \
377 $(PATH_OBJ)/bs3kit-rm/bs3kit-rm.lib \
378 $(PATH_OBJ)/bs3kit-pe16/bs3kit-pe16.lib \
379 $(PATH_OBJ)/bs3kit-pe32/bs3kit-pe32.lib \
380 $(PATH_OBJ)/bs3kit-pev86/bs3kit-pev86.lib \
381 $(PATH_OBJ)/bs3kit-pp16/bs3kit-pp16.lib \
382 $(PATH_OBJ)/bs3kit-pp32/bs3kit-pp32.lib \
383 $(PATH_OBJ)/bs3kit-ppv86/bs3kit-ppv86.lib \
384 $(PATH_OBJ)/bs3kit-pae16/bs3kit-pae16.lib \
385 $(PATH_OBJ)/bs3kit-pae32/bs3kit-pae32.lib \
386 $(PATH_OBJ)/bs3kit-paev86/bs3kit-paev86.lib \
387 $(PATH_OBJ)/bs3kit-lm16/bs3kit-lm16.lib \
388 $(PATH_OBJ)/bs3kit-lm32/bs3kit-lm32.lib \
389 $(PATH_OBJ)/bs3kit-lm64-asm/bs3kit-lm64-asm.lib \
390 $(PATH_OBJ)/bs3kit-lm64-c/bs3kit-lm64-c.lib
391
392# BS3Kit template for 32-bit code.
393TEMPLATE_VBoxBS3KitImg32 = Template for building BS3Kit test images.
394TEMPLATE_VBoxBS3KitImg32_BLD_TRG = os-agnostic
395TEMPLATE_VBoxBS3KitImg32_BLD_TRG_ARCH = x86
396TEMPLATE_VBoxBS3KitImg32_INSTTYPE = none
397TEMPLATE_VBoxBS3KitImg32_ASTOOL = NASM
398TEMPLATE_VBoxBS3KitImg32_ASFLAGS = -f obj -g --allow-64bit-code-anywhere -w+orphan-labels
399TEMPLATE_VBoxBS3KitImg32_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__
400TEMPLATE_VBoxBS3KitImg32_DEFS = ARCH_BITS=32 IN_BS3KIT
401TEMPLATE_VBoxBS3KitImg32_DEFS.debug = BS3_STRICT
402TEMPLATE_VBoxBS3KitImg32_ARTOOL = OPENWATCOM
403TEMPLATE_VBoxBS3KitImg32_CTOOL = Bs3Ow32
404TEMPLATE_VBoxBS3KitImg32_CXXTOOL = Bs3Ow32
405TEMPLATE_VBoxBS3KitImg32_CFLAGS = \
406 -nt=BS3TEXT32 -nd=BS3DATA32 -nc=BS3CODE32 -ecc -q -wx -zl -mf $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
407TEMPLATE_VBoxBS3KitImg32_CXXFLAGS = \
408 -nt=BS3TEXT32 -nd=BS3DATA32 -nc=BS3CODE32 -ecc -q -wx -zl -mf $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
409TEMPLATE_VBoxBS3KitImg32_INCS = $(VBOX_PATH_BS3KIT_SRC) .
410TEMPLATE_VBoxBS3KitImg32_LDTOOL = VBoxBsUnusedLd
411
412# BS3Kit template for 64-bit code.
413TEMPLATE_VBoxBS3KitImg64 = Template for building BS3Kit test images.
414TEMPLATE_VBoxBS3KitImg64_BLD_TRG = os-agnostic
415TEMPLATE_VBoxBS3KitImg64_BLD_TRG_ARCH = amd64
416TEMPLATE_VBoxBS3KitImg64_INSTTYPE = none
417TEMPLATE_VBoxBS3KitImg64_ASTOOL = NASM
418TEMPLATE_VBoxBS3KitImg64_ASFLAGS = -f obj -g --allow-64bit-code-anywhere -w+orphan-labels
419TEMPLATE_VBoxBS3KitImg64_ASDEFS = ASM_FORMAT_OMF RT_NOINC_SEGMENTS __NASM__
420TEMPLATE_VBoxBS3KitImg64_DEFS = IN_BS3KIT ARCH_BITS=64
421TEMPLATE_VBoxBS3KitImg64_DEFS.debug = BS3_STRICT
422TEMPLATE_VBoxBS3KitImg64_ARTOOL = OPENWATCOM
423TEMPLATE_VBoxBS3KitImg64_INCS = $(VBOX_PATH_BS3KIT_SRC) .
424if1of ($(KBUILD_HOST), win)
425 TEMPLATE_VBoxBS3KitImg64_CTOOL := Bs3Vcc64
426 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := Bs3Vcc64
427 TEMPLATE_VBoxBS3KitImg64_CFLAGS = -Zi -O1 -Oi -GF -GS- -Gy -Gs65536
428 TEMPLATE_VBoxBS3KitImg64_CXXFLAGS = -Zi -O1 -Oi -GF -GS- -Gy -Gs65536
429else
430 if1of ($(KBUILD_HOST), darwin)
431 TEMPLATE_VBoxBS3KitImg64_CTOOL := Bs3Gcc64Elf64
432 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := Bs3Gcc64Elf64
433 else
434 TEMPLATE_VBoxBS3KitImg64_CTOOL := $(VBOX_GCC_TOOL)
435 TEMPLATE_VBoxBS3KitImg64_CXXTOOL := $(VBOX_GCC_TOOL)
436 endif
437 TEMPLATE_VBoxBS3KitImg64_CFLAGS = -m64 -maccumulate-outgoing-args -g -Os -fno-omit-frame-pointer $(VBOX_GCC_WARN_PEDANTIC_C)
438 TEMPLATE_VBoxBS3KitImg64_CXXFLAGS = -m64 -maccumulate-outgoing-args -g -Os -fno-omit-frame-pointer $(VBOX_GCC_WARN_PEDANTIC_CXX)
439endif
440TEMPLATE_VBoxBS3KitImg64_LDTOOL = VBoxBsUnusedLd
441
442# BS3Kit template for the bootsector.
443TEMPLATE_VBoxBS3KitBS = Template for building BS3Kit test images.
444TEMPLATE_VBoxBS3KitBS_BLD_TRG = os-agnostic
445TEMPLATE_VBoxBS3KitBS_BLD_TRG_ARCH = x86
446TEMPLATE_VBoxBS3KitBS_INST = $(INST_VALIDATIONKIT)bootsectors/
447TEMPLATE_VBoxBS3KitBS_INSTTYPE = none
448TEMPLATE_VBoxBS3KitBS_BINSUFF = .img
449TEMPLATE_VBoxBS3KitBS_MODE = 0644
450TEMPLATE_VBoxBS3KitBS_ASTOOL = YASM
451TEMPLATE_VBoxBS3KitBS_ASFLAGS = -f bin --mapfile
452TEMPLATE_VBoxBS3KitBS_ASDEFS = ASM_FORMAT_BIN RT_NOINC_SEGMENTS ARCH_BITS=16 __YASM__
453TEMPLATE_VBoxBS3KitBS_INCS = $(VBOX_PATH_BS3KIT_SRC) .
454TEMPLATE_VBoxBS3KitBS_LDTOOL = VBoxBsCpLd
455
456#
457# ----- Config.kmk: end -----
458#
459
460
461# The boot sector.
462MISCBINS += bs3-bootsector
463bs3-bootsector_TEMPLATE = VBoxBS3KitBS
464bs3-bootsector_SOURCES = bs3-bootsector.asm
465
466#
467# Common sources to be compiled into _p16, _p32 and _p64 versions.
468#
469VBOX_BS3KIT_COMMON_SOURCES = \
470 bs3-cmn-A20Disable.asm \
471 bs3-cmn-A20Enable.asm \
472 bs3-cmn-KbdRead.asm \
473 bs3-cmn-KbdWait.asm \
474 bs3-cmn-KbdWrite.asm \
475 bs3-cmn-Shutdown.asm \
476 bs3-cmn-Panic.asm \
477 bs3-cmn-PrintChr.asm \
478 bs3-cmn-Printf.c \
479 bs3-cmn-PrintU32.asm \
480 bs3-cmn-PrintX32.asm \
481 bs3-cmn-PrintStr.c \
482 bs3-cmn-PrintStrColonSpaces.asm \
483 bs3-cmn-PrintStrSpacesColonSpace.c \
484 bs3-cmn-StrFormatV.c \
485 bs3-cmn-StrPrintf.c \
486 bs3-cmn-StrLen.c \
487 bs3-cmn-StrNLen.c \
488 bs3-cmn-StrCpy.c \
489 bs3-cmn-MemCpy.c \
490 bs3-cmn-MemPCpy.c \
491 bs3-cmn-MemMove.c \
492 bs3-cmn-MemZero.asm \
493 bs3-cmn-MemAlloc.c \
494 bs3-cmn-MemAllocZ.c \
495 bs3-cmn-MemFree.c \
496 bs3-cmn-PagingData.c \
497 bs3-cmn-PagingInitRootForPP.c \
498 bs3-cmn-PagingInitRootForPAE.c \
499 bs3-cmn-PagingInitRootForLM.c \
500 bs3-cmn-SlabInit.c \
501 bs3-cmn-SlabAlloc.c \
502 bs3-cmn-SlabAllocEx.c \
503 bs3-cmn-SlabFree.c \
504 bs3-cmn-SlabListInit.c \
505 bs3-cmn-SlabListAdd.c \
506 bs3-cmn-SlabListAlloc.c \
507 bs3-cmn-SlabListAllocEx.c \
508 bs3-cmn-SlabListFree.c \
509 bs3-cmn-SwitchToRing0.asm \
510 bs3-cmn-SwitchToRing1.asm \
511 bs3-cmn-SwitchToRing2.asm \
512 bs3-cmn-SwitchToRing3.asm \
513 bs3-cmn-SwitchTo16Bit.asm \
514 bs3-cmn-SwitchTo32Bit.asm \
515 bs3-cmn-SwitchTo64Bit.asm \
516 bs3-cmn-TestData.c \
517 bs3-cmn-TestInit.c \
518 bs3-cmn-TestSendStrCmd.asm \
519 bs3-cmn-TestIsVmmDevTestingPresent.asm \
520 ../../../Runtime/common/asm/ASMBitFirstClear.asm \
521 ../../../Runtime/common/asm/ASMBitFirstSet.asm \
522 ../../../Runtime/common/asm/ASMBitNextClear.asm \
523 ../../../Runtime/common/asm/ASMBitNextSet.asm
524
525# The 16-bit BS3Kit library.
526LIBRARIES += bs3kit-common-16
527bs3kit-common-16_TEMPLATE = VBoxBS3KitImg
528bs3kit-common-16_DEFS = TMPL_PE16 BS3_CMN_ONLY
529bs3kit-common-16_ASDEFS = RT_ASMDEFS_INC_FIRST_FILE
530bs3kit-common-16_SOURCES = $(VBOX_BS3KIT_COMMON_SOURCES) \
531 bs3-system-data.asm \
532 bs3-rm-InitMemory.c \
533 bs3-cmn-hexdigits.c \
534 bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm \
535 bs3-wc16-U8DR.asm \
536 bs3-wc16-U8DQ.asm \
537 bs3-wc16-I8DR.asm \
538 bs3-wc16-I8DQ.asm \
539 bs3-wc16-I8RS.asm \
540 bs3-wc16-U8RS.asm \
541 bs3-wc16-U8LS.asm \
542 bs3-wc16-U4D.asm \
543 bs3-wc16-I4D.asm \
544
545# The 32-bit BS3Kit library.
546LIBRARIES += bs3kit-common-32
547bs3kit-common-32_TEMPLATE = VBoxBS3KitImg32
548bs3kit-common-32_DEFS = TMPL_PE32 BS3_CMN_ONLY
549bs3kit-common-32_ASDEFS = RT_ASMDEFS_INC_FIRST_FILE
550bs3kit-common-32_SOURCES = $(VBOX_BS3KIT_COMMON_SOURCES) \
551 bs3-wc32-U8D.asm \
552 bs3-wc32-I8D.asm \
553 bs3-wc32-I8RS.asm \
554 bs3-wc32-U8RS.asm \
555 bs3-wc32-U8LS.asm \
556
557# The 64-bit BS3Kit library.
558LIBRARIES += bs3kit-common-64-asm
559bs3kit-common-64-asm_TEMPLATE = VBoxBS3KitImg64
560bs3kit-common-64-asm_DEFS = TMPL_LM64 BS3_CMN_ONLY
561bs3kit-common-64-asm_ASDEFS = RT_ASMDEFS_INC_FIRST_FILE
562bs3kit-common-64-asm_SOURCES = $(filter %.asm,$(VBOX_BS3KIT_COMMON_SOURCES))
563
564# The 64-bit BS3Kit library.
565LIBRARIES += bs3kit-common-64-c
566bs3kit-common-64-c_TEMPLATE = VBoxBS3KitImg64
567bs3kit-common-64-c_DEFS = TMPL_LM64 BS3_CMN_ONLY
568bs3kit-common-64-c_SOURCES = $(filter-out %.asm,$(VBOX_BS3KIT_COMMON_SOURCES))
569
570
571#
572# Common sources to be compiled for each CPU mode.
573#
574VBOX_BS3KIT_MODE_SOURCES = \
575 bs3-mode-SwitchToRM.asm \
576 bs3-mode-SwitchToPE16.asm \
577 bs3-mode-SwitchToPE32.asm \
578 bs3-mode-SwitchToPP16.asm \
579 bs3-mode-SwitchToPP32.asm \
580 bs3-mode-SwitchToPAE16.asm \
581 bs3-mode-SwitchToPAE32.asm \
582 bs3-mode-SwitchToLM64.asm \
583 bs3-mode-EnteredMode.asm \
584 bs3-mode-PagingGetRootForPP16.asm \
585 bs3-mode-PagingGetRootForPP32.asm \
586 bs3-mode-PagingGetRootForPAE16.asm \
587 bs3-mode-PagingGetRootForPAE32.asm \
588 bs3-mode-PagingGetRootForLM64.asm \
589
590# The 16-bit real mode BS3Kit library.
591LIBRARIES += bs3kit-rm
592bs3kit-rm_TEMPLATE = VBoxBS3KitImg
593bs3kit-rm_DEFS = TMPL_RM
594bs3kit-rm_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
595 bs3-first-rm.asm
596
597
598# The 16-bit protected mode BS3Kit library.
599LIBRARIES += bs3kit-pe16
600bs3kit-pe16_TEMPLATE = VBoxBS3KitImg
601bs3kit-pe16_DEFS = TMPL_PE16
602bs3kit-pe16_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
603 bs3-first-pe16.asm
604
605# The virtual 8086 under protected mode BS3Kit library.
606LIBRARIES += bs3kit-pev86
607bs3kit-pev86_TEMPLATE = VBoxBS3KitImg
608bs3kit-pev86_DEFS = TMPL_PEV86
609bs3kit-pev86_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
610
611# The 32-bit protected mode BS3Kit library.
612LIBRARIES += bs3kit-pe32
613bs3kit-pe32_TEMPLATE = VBoxBS3KitImg
614bs3kit-pe32_DEFS = TMPL_PE32
615bs3kit-pe32_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES)
616
617
618# The 16-bit paged protected mode BS3Kit library.
619LIBRARIES += bs3kit-pp16
620bs3kit-pp16_TEMPLATE = VBoxBS3KitImg
621bs3kit-pp16_DEFS = TMPL_PP16
622bs3kit-pp16_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
623
624# The 32-bit paged protected mode BS3Kit library.
625LIBRARIES += bs3kit-pp32
626bs3kit-pp32_TEMPLATE = VBoxBS3KitImg
627bs3kit-pp32_DEFS = TMPL_PP32
628bs3kit-pp32_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES)
629
630# The virtual 8086 under protected mode BS3Kit library.
631LIBRARIES += bs3kit-ppv86
632bs3kit-ppv86_TEMPLATE = VBoxBS3KitImg
633bs3kit-ppv86_DEFS = TMPL_PPV86
634bs3kit-ppv86_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
635
636
637# The 16-bit paged protected mode BS3Kit library.
638LIBRARIES += bs3kit-pae16
639bs3kit-pae16_TEMPLATE = VBoxBS3KitImg
640bs3kit-pae16_DEFS = TMPL_PAE16
641bs3kit-pae16_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES)
642
643# The 32-bit paged protected mode BS3Kit library.
644LIBRARIES += bs3kit-pae32
645bs3kit-pae32_TEMPLATE = VBoxBS3KitImg
646bs3kit-pae32_DEFS = TMPL_PAE32
647bs3kit-pae32_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES)
648
649# The virtual 8086 under protected mode BS3Kit library.
650LIBRARIES += bs3kit-paev86
651bs3kit-paev86_TEMPLATE = VBoxBS3KitImg
652bs3kit-paev86_DEFS = TMPL_PAEV86
653bs3kit-paev86_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
654
655
656# The 16-bit long mode BS3Kit library.
657LIBRARIES += bs3kit-lm16
658bs3kit-lm16_TEMPLATE = VBoxBS3KitImg
659bs3kit-lm16_DEFS = TMPL_LM16
660bs3kit-lm16_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
661
662# The 32-bit long mode BS3Kit library.
663LIBRARIES += bs3kit-lm32
664bs3kit-lm32_TEMPLATE = VBoxBS3KitImg
665bs3kit-lm32_DEFS = TMPL_LM32
666bs3kit-lm32_SOURCES = $(VBOX_BS3KIT_MODE_SOURCES) \
667
668# The 64-bit long mode BS3Kit library.
669LIBRARIES += bs3kit-lm64-asm
670bs3kit-lm64-asm_TEMPLATE = VBoxBS3KitImg
671bs3kit-lm64-asm_DEFS = TMPL_LM64
672bs3kit-lm64-asm_SOURCES = $(filter %.asm,$(VBOX_BS3KIT_MODE_SOURCES)) \
673
674# The 64-bit long mode BS3Kit library.
675LIBRARIES += bs3kit-lm64-c
676bs3kit-lm64-c_TEMPLATE = VBoxBS3KitImg
677bs3kit-lm64-c_DEFS = TMPL_LM64
678bs3kit-lm64-c_SOURCES = $(filter-out %.asm, $(VBOX_BS3KIT_MODE_SOURCES)) \
679
680
681#
682# shutdown example.
683#
684MISCBINS += bs3-shutdown
685bs3-shutdown_TEMPLATE = VBoxBS3KitImg
686bs3-shutdown_SOURCES = \
687 bs3-first-pe16.asm \
688 bs3-shutdown.c
689
690
691include $(FILE_KBUILD_SUB_FOOTER)
692
693.PRECIOUS: $(PATH_OBJ)/bs3-shutdown/bs3-shutdown.map
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