# $Id$
## @file
# VirtualBox Validation Kit - Bootsector Tests for Test Drivers or standalone testing.
#
#
# Copyright (C) 2006-2014 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# The contents of this file may alternatively be used under the terms
# of the Common Development and Distribution License Version 1.0
# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
# VirtualBox OSE distribution, in which case the provisions of the
# CDDL are applicable instead of those of the GPL.
#
# You may elect to license modified versions of this file under the
# terms and conditions of either the GPL or the CDDL or both.
#
SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk
#
# Boot Sector "Linker" tool.
#
TOOL_VBoxBootSectorLd = Joins one or more BS2 object files into a floppy img.
TOOL_VBoxBootSectorLd_LINK_MISCBIN_OUTPUT =
TOOL_VBoxBootSectorLd_LINK_MISCBIN_DEPEND =
TOOL_VBoxBootSectorLd_LINK_MISCBIN_DEPORD = $(VBoxBs2Linker_1_TARGET)
define TOOL_VBoxBootSectorLd_LINK_MISCBIN_CMDS
$(VBoxBs2Linker_1_TARGET) -o $(out) $(objs) $(othersrc)
endef
BLDPROGS += VBoxBs2Linker
VBoxBs2Linker_TEMPLATE = VBoxBldProg
VBoxBs2Linker_SOURCES = VBoxBs2Linker.cpp
#
# Makes a boot sector test image.
#
TEMPLATE_VBoxBsTestImg = kBuild tool config for building boot sector stuff.
TEMPLATE_VBoxBsTestImg_INST = $(INST_VALIDATIONKIT)bootsectors/
TEMPLATE_VBoxBsTestImg_BINSUFF = .img
TEMPLATE_VBoxBsTestImg_MODE = 0644
TEMPLATE_VBoxBsTestImg_ASTOOL = YASM
TEMPLATE_VBoxBsTestImg_ASFLAGS:= -f bin -P $(PATH_SUB_CURRENT)/bootsector2-first.mac $(VBOX_YASM_Wno-segreg-in-64bit) --mapfile
TEMPLATE_VBoxBsTestImg_ASDEFS = ASM_FORMAT_BIN
TEMPLATE_VBoxBsTestImg_INCS = \
. \
../../VMM/testcase/Instructions
TEMPLATE_VBoxBsTestImg_LDTOOL = VBoxBootSectorLd
#
# The boot sector tests.
#
MISCBINS += bootsector-shutdown
bootsector-shutdown_TEMPLATE = VBoxBsTestImg
bootsector-shutdown_SOURCES = bootsector-shutdown.asm
MISCBINS += bootsector-pae
bootsector-pae_TEMPLATE = VBoxBsTestImg
bootsector-pae_SOURCES = bootsector-pae.asm
MISCBINS += bootsector-empty
bootsector-empty_TEMPLATE = VBoxBsTestImg
bootsector-empty_SOURCES = bootsector-empty.asm
MISCBINS += bootsector2-test1
bootsector2-test1_TEMPLATE = VBoxBsTestImg
bootsector2-test1_SOURCES = bootsector2-test1.asm
MISCBINS += bootsector2-cpu-hidden-regs-1
bootsector2-cpu-hidden-regs-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-hidden-regs-1_SOURCES = bootsector2-cpu-hidden-regs-1.asm
MISCBINS += bootsector2-cpu-instr-1
bootsector2-cpu-instr-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-instr-1_SOURCES = bootsector2-cpu-instr-1.asm
MISCBINS += bootsector2-cpu-pf-1
bootsector2-cpu-pf-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-pf-1_SOURCES = bootsector2-cpu-pf-1.asm
MISCBINS += bootsector2-cpu-xcpt-1
bootsector2-cpu-xcpt-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-xcpt-1_SOURCES = bootsector2-cpu-xcpt-1.asm
MISCBINS += bootsector2-cpu-xcpt-2
bootsector2-cpu-xcpt-2_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-xcpt-2_SOURCES = bootsector2-cpu-xcpt-2.asm
MISCBINS += bootsector2-cpu-a20-1
bootsector2-cpu-a20-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-a20-1_SOURCES = bootsector2-cpu-a20-1.asm
MISCBINS += bootsector2-cpu-basic-1
bootsector2-cpu-basic-1_TEMPLATE = VBoxBsTestImg
bootsector2-cpu-basic-1_SOURCES = bootsector2-cpu-basic-1.asm
MISCBINS += bootsector2-boot-registers-1
bootsector2-boot-registers-1_TEMPLATE = VBoxBsTestImg
bootsector2-boot-registers-1_SOURCES = bootsector2-boot-registers-1.asm
MISCBINS += bootsector2-triple-fault-1
bootsector2-triple-fault-1_TEMPLATE = VBoxBsTestImg
bootsector2-triple-fault-1_SOURCES = bootsector2-triple-fault-1.asm
ifeq ($(USERNAME),birdxx)
if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
#
# Generated instruction tests (work in progress).
#
VBOX_PATH_VBINSTST = $(PATH_ROOT)/src/VBox/VMM/testcase/Instructions
VBOX_VBINSTST_GEN = $(VBOX_PATH_VBINSTST)/InstructionTestGen.py
VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN = $(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) \
--split 3 --target bs2-r0-64 --output-base $(bootsectors_0_OUTDIR)/VBInsTst-64 --test-size tiny
VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES = $(shell $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN) --makefile-mode)
#$$(bootsectors_0_OUTDIR)/VBInsTst.ts + $$(VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES): $(VBOX_VBINSTST_GEN) | $$(dir $$@)
# $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN)
# $(APPEND) -t $@
#
#bootsectors_SOURCES += $(bootsectors_0_OUTDIR)/bootsector2-vbinstst-1.img
#bootsectors_CLEAN += $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES)
#
#$$(bootsectors_0_OUTDIR)/bootsector2-vbinstst-1.img: \
# $(PATH_SUB_CURRENT)/bootsector2-vbinstst-64-1.asm \
# $$(bootsectors_0_OUTDIR)/VBInsTst-64.asm
# $(TOOL_$(VBOX_ASTOOL)_AS) -f bin -D ASM_FORMAT_BIN -I $(dir $@) -I $(PATH_ROOT)/include -I $(VBOX_PATH_VBINSTST) -o $@ -L nasm -l $@.lst $<
MISCBINS += bootsector2-vbinstst-kernel
bootsector2-vbinstst-kernel_TEMPLATE = VBoxBsTestImg
bootsector2-vbinstst-kernel_SOURCES = \
bootsector2-vbinstst-kernel.asm
MISCBINS += bootsector2-vbinstst-64-1
bootsector2-vbinstst-64-1_TEMPLATE = VBoxBsTestImg
bootsector2-vbinstst-64-1_DEFS = \
BS2_BIG_IMAGE_LM64 \
BS2_BIG_IMAGE_GEN_SOURCE_FILE=bs2-vbinstst-64-1.asm \
BS2_BIG_IMAGE_GEN_TEST_NAME=\"bs2-vbinstst-64-1\"
bootsector2-vbinstst-64-1_INCS = $(bootsector2-vbinstst-64-1_0_OUTDIR)/
bootsector2-vbinstst-64-1_SOURCES = \
bootsector2-vbinstst-kernel.asm \
bootsector2-vbinstst-big-template.asm
bootsector2-vbinstst-64-1_INTERMEDIATES = \
$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm
bootsector2-vbinstst-64-1_CLEAN = \
$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm
$$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm: $(VBOX_VBINSTST_GEN) | $$(dir $$@)
$(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) --target bs2-r0-64-big --output-base $(basename $@) --test-size medium
MISCBINS += bootsector2-vbinstst-32-1
bootsector2-vbinstst-32-1_TEMPLATE = VBoxBsTestImg
bootsector2-vbinstst-32-1_DEFS = \
BS2_BIG_IMAGE_PP32 \
BS2_BIG_IMAGE_GEN_SOURCE_FILE=bs2-vbinstst-32-1.asm \
BS2_BIG_IMAGE_GEN_TEST_NAME=\"bs2-vbinstst-32-1\"
bootsector2-vbinstst-32-1_INCS = $(bootsector2-vbinstst-32-1_0_OUTDIR)/
bootsector2-vbinstst-32-1_SOURCES = \
bootsector2-vbinstst-kernel.asm \
bootsector2-vbinstst-big-template.asm
bootsector2-vbinstst-32-1_INTERMEDIATES = \
$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm
bootsector2-vbinstst-32-1_CLEAN = \
$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm
$$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm: $(VBOX_VBINSTST_GEN) | $$(dir $$@)
$(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) --target bs2-r0-32-big --output-base $(basename $@) --test-size medium
endif
endif # bird-only
include $(FILE_KBUILD_SUB_FOOTER)