Makefile.kmk revision 4730b968fe12c1a6cf2c52a114f2b73373707d75
# $Id$
## @file
# PC BIOS Sub-Makefile.
#
#
# Copyright (C) 2006-2007 innotek GmbH
#
# 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 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.
DEPTH ?= ../../../../../
SUB_DEPTH = ../..
include $(PATH_KBUILD)/subheader.kmk
VBOX_PATH_DEVICES_SRC = $(PATH_SUB_ROOT)
#
# Build program for calculating the PC BIOS checksums.
#
BLDPROGS += pcbiossums
pcbiossums_TEMPLATE = VBOXBLDPROG
pcbiossums_SOURCES = biossums.c
#
# The library containing the PC BIOS image.
#
LIBRARIES += PcBiosBin
PcBiosBin_TEMPLATE = VBOXR3
PcBiosBin_DEFS = IN_VBOXDD2
PcBiosBin_INCS = $(VBOX_PATH_DEVICES_SRC)
PcBiosBin_SOURCES = $(PATH_TARGET)/PcBiosBin.c
$(PATH_TARGET)/PcBiosBin.c_DEPS = $(PATH_TARGET)/pcbios-syms.h
PcBiosBin_CLEAN = \
$(PATH_TARGET)/_rombios_.c \
$(PATH_TARGET)/rombios0.s \
$(PATH_TARGET)/rombios1.s \
$(PATH_TARGET)/pcbios.lst \
$(PATH_TARGET)/pcbios.tmp \
$(PATH_TARGET)/pcbios.bin \
$(PATH_TARGET)/PcBiosBin.c \
$(PATH_TARGET)/PcDefBiosLogo.c \
$(PATH_TARGET)/pcbios-syms.h
#
# Rule for making the bios.
#
$(PATH_TARGET)/PcBiosBin.c: $(PATH_TARGET)/pcbios.bin $(VBOX_BIN2C)
$(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
$(QUIET)$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary $< $@
#
# Six steps to pcbios.bin and pcbios-syms.h
#
# 1. precompile rombios.c
$(PATH_TARGET)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c $(PATH_SUB_CURRENT)/apmbios.S | $(call DIRDEP,$(TARGET_PATH))
$(call MSG_TOOL,cpp,PcBiosBin,$<,$@)
$(QUIET)$(TOOL_$(VBOX_GCC_TOOL)_CC) -E -I$(PATH_TARGET) -I$(VBOX_PATH_DEVICES_SRC)/PC -I$(PATH_ROOT)/include -I$(PATH_OUT) -DBX_SMP_PROCESSORS=1 -DVBOX $(addprefix -D,$(DEFS) $(DEFS.$(BUILD_TYPE))) -P -o $@ $<
# 2. compile to intermediate asm file - tempfile clashes, make sure it's built alone.
.NOTPARALLEL: $(PATH_TARGET)/rombios0.s
$(PATH_TARGET)/rombios0.s: $(PATH_TARGET)/_rombios_.c
$(call MSG_COMPILE,PcBiosBin,$<,$@,C)
$(QUIET)$(VBOX_BCC) -o $@ -C-c -D__i86__ -0 -S $^
# 3. post process intermediate asm file.
$(PATH_TARGET)/rombios1.s: $(PATH_TARGET)/rombios0.s
$(call MSG_TOOL,Adjusting BCC Assembly,PcBiosBin,$<,$@)
$(QUIET)$(SED) -e 's/^\.text//' -e 's/^\.data//' --output $@ $^
# 4. assemble the intermediate asm file. (also creates a listing rombios.lst)
$(call MSG_COMPILE,PcBiosBin,$<,$@,AS)
$(QUIET)$(REDIRECT) -ri $^ -- $(VBOX_AS86) -b $(PATH_TARGET)/pcbios.tmp -u- -w- -g -0 -j -O -l $(PATH_TARGET)/pcbios.lst
# 5. calculate checksums for the final BIOS image.
$(PATH_TARGET)/pcbios.bin: $(PATH_TARGET)/pcbios.tmp $$(TARGET_pcbiossums)
$(call MSG_TOOL,pcbiossums,PcBiosBin,$<,$@)
$(QUIET)$(CP) -f $(PATH_TARGET)/pcbios.tmp $(PATH_TARGET)/pcbios.bin
$(QUIET)$(TARGET_pcbiossums) $(PATH_TARGET)/pcbios.bin
# 6. create the symbol table.
$(PATH_TARGET)/pcbios-syms.h: $(PATH_TARGET)/pcbios.lst $(MAKEFILE_CURRENT)
$(call MSG_GENERATE,PcBiosBin,$<,$@)
$(QUIET)$(SED) \
-e '/^[0-9][0-9][0-9][0-9][0-9] 000[0-9A-F]* [[:space:]]*[a-zA-Z0-9_]*:/!d' \
-e 's/^[0-9][0-9][0-9][0-9][0-9] \(000[0-9A-F]*\) [[:space:]]*\([a-zA-Z0-9_]*\):.*$$/ DEFSYM(0x\1, "\2"),/' \
--output $@ \
$(PATH_TARGET)/pcbios.lst
#
# The PC BIOS Logo.
#
LIBRARIES += PcDefBiosLogo
PcDefBiosLogo_TEMPLATE = VBOXR3
PcDefBiosLogo_INCS = $(VBOX_PATH_DEVICES_SRC)
PcDefBiosLogo_SOURCES = $(PATH_TARGET)/PcDefBiosLogo.c
#
# Rule for making the bios logo.
#
$(PATH_TARGET)/PcDefBiosLogo.c: $(PATH_SUB_CURRENT)/innotek_logo.bmp $(VBOX_BIN2C)
$(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
$(QUIET)$(VBOX_BIN2C) -max 64 PcDefBiosLogo $< $@
include $(PATH_KBUILD)/subfooter.kmk