# $Id: Makefile.kmk 36877 2011-04-28 19:38:13Z vboxsync $ ## @file # PC BIOS Sub-Makefile. # # # Copyright (C) 2006-2007 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. # SUB_DEPTH = ../../../../.. include $(KBUILD_PATH)/subheader.kmk # # Globals # VBOX_PATH_DEVICES_SRC ?= $(PATH_ROOT)/src/VBox/Devices # # The library containing the PC BIOS image. # LIBRARIES += PcBiosBin PcBiosBin_TEMPLATE = VBOXR3 PcBiosBin_DEFS = IN_VBOXDD2 PcBiosBin_INCS = $(VBOX_PATH_DEVICES_SRC) PcBiosBin_SOURCES = $(PcBiosBin_0_OUTDIR)/PcBiosBin.c PcBiosBin_DEPS = $(PcBiosBin_0_OUTDIR)/pcbios-syms.h PcBiosBin_CLEAN = \ $(PcBiosBin_0_OUTDIR)/_rombios_.c \ $(PcBiosBin_0_OUTDIR)/rombios0.s \ $(PcBiosBin_0_OUTDIR)/rombios1.s \ $(PcBiosBin_0_OUTDIR)/pcbios.lst \ $(PcBiosBin_0_OUTDIR)/pcbios.tmp \ $(PcBiosBin_0_OUTDIR)/pcbios.bin \ $(PcBiosBin_0_OUTDIR)/PcBiosBin.c \ $(PcBiosBin_0_OUTDIR)/pcbios-syms.h # # Rule for making the bios. # $$(PcBiosBin_0_OUTDIR)/PcBiosBin.c: $$(PcBiosBin_0_OUTDIR)/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 $$(PcBiosBin_0_OUTDIR)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c \ $(PATH_SUB_CURRENT)/apmbios.S $(if $(VBOX_WITH_SCSI),$(PATH_SUB_CURRENT)/scsi.c) \ $(PATH_SUB_CURRENT)/../DevPcBios.h $(PATH_ROOT)/include/VBox/bioslogo.h \ $(if $(VBOX_WITH_BIOS_AHCI),$(PATH_SUB_CURRENT)/ahci.c) \ $(VBOX_VERSION_STAMP) | $$(dir $$@) $(call MSG_TOOL,cpp,PcBiosBin,$<,$@) $(QUIET)$(TOOL_$(VBOX_GCC_TOOL)_CC) -E \ -I$(PcBiosBin_0_OUTDIR) -I$(VBOX_PATH_DEVICES_SRC)/PC -I$(PATH_ROOT)/include -I$(PATH_OUT) \ -DBX_SMP_PROCESSORS=1 -DVBOX -DVBOX_PC_BIOS $(addprefix -D,$(DEFS) $(DEFS.$(KBUILD_TYPE))) \ $(if $(VBOX_WITH_SCSI),-DVBOX_WITH_SCSI) $(if $(VBOX_WITH_BIOS_AHCI),-DVBOX_WITH_BIOS_AHCI) \ -P -o $@ $< # 2. compile to intermediate asm file. # BCC tempfile clashes, order the BCC jobs to make sure they don't interfere with one another. $$(PcBiosBin_0_OUTDIR)/rombios0.s: $$(PcBiosBin_0_OUTDIR)/_rombios_.c | $(VBOX_BCC_JOBS) $(call MSG_COMPILE,PcBiosBin,$<,$@,C) $(QUIET)$(VBOX_BCC) -o $@ -C-c -D__i86__ -0 -S $< VBOX_BCC_JOBS += $(PcBiosBin_0_OUTDIR)/rombios0.s # 3. post process intermediate asm file. $$(PcBiosBin_0_OUTDIR)/rombios1.s: $$(PcBiosBin_0_OUTDIR)/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) $$(PcBiosBin_0_OUTDIR)/pcbios.tmp + $$(PcBiosBin_0_OUTDIR)/pcbios.lst: $$(PcBiosBin_0_OUTDIR)/rombios1.s $(call MSG_COMPILE,PcBiosBin,$<,$@,AS) $(QUIET)$(REDIRECT) -ri $^ -- $(VBOX_AS86) -b $(PcBiosBin_0_OUTDIR)/pcbios.tmp -u- -w- -g -0 -j -O -l $(PcBiosBin_0_OUTDIR)/pcbios.lst # 5. calculate checksums for the final BIOS image. $$(PcBiosBin_0_OUTDIR)/pcbios.bin: $$(PcBiosBin_0_OUTDIR)/pcbios.tmp $$(VBOX_BIOSSUMS) $(call MSG_TOOL,biossums,PcBiosBin,$<,$@) $(QUIET)$(VBOX_BIOSSUMS) $< $@ # 6. create the symbol table. $$(PcBiosBin_0_OUTDIR)/pcbios-syms.h: $$(PcBiosBin_0_OUTDIR)/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 $@ \ $(PcBiosBin_0_OUTDIR)/pcbios.lst include $(KBUILD_PATH)/subfooter.kmk