1 | # $Id: Makefile.kmk 11364 2008-08-12 15:17:42Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # PC BIOS Sub-Makefile.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | # additional information or have any questions.
|
---|
20 | #
|
---|
21 |
|
---|
22 | ifdef VBOX_KBUILD_HACKING
|
---|
23 | SUB_DEPTH = ../../../../..
|
---|
24 | else
|
---|
25 | SUB_DEPTH = ../..
|
---|
26 | DEPTH ?= ../../../../..
|
---|
27 | endif
|
---|
28 | include $(KBUILD_PATH)/subheader.kmk
|
---|
29 |
|
---|
30 | VBOX_PATH_DEVICES_SRC ?= $(PATH_ROOT)/src/VBox/Devices
|
---|
31 |
|
---|
32 | #
|
---|
33 | # Build program for calculating the PC BIOS checksums.
|
---|
34 | #
|
---|
35 | BLDPROGS += pcbiossums
|
---|
36 | pcbiossums_TEMPLATE = VBOXBLDPROG
|
---|
37 | pcbiossums_SOURCES = biossums.c
|
---|
38 |
|
---|
39 |
|
---|
40 | #
|
---|
41 | # The library containing the PC BIOS image.
|
---|
42 | #
|
---|
43 | LIBRARIES += PcBiosBin
|
---|
44 | PcBiosBin_TEMPLATE = VBOXR3
|
---|
45 | PcBiosBin_DEFS = IN_VBOXDD2
|
---|
46 | PcBiosBin_INCS = $(VBOX_PATH_DEVICES_SRC)
|
---|
47 | PcBiosBin_SOURCES = $(PATH_TARGET)/PcBiosBin.c
|
---|
48 | $(PATH_TARGET)/PcBiosBin.c_DEPS = $(PATH_TARGET)/pcbios-syms.h
|
---|
49 | PcBiosBin_CLEAN = \
|
---|
50 | $(PATH_TARGET)/_rombios_.c \
|
---|
51 | $(PATH_TARGET)/rombios0.s \
|
---|
52 | $(PATH_TARGET)/rombios1.s \
|
---|
53 | $(PATH_TARGET)/pcbios.lst \
|
---|
54 | $(PATH_TARGET)/pcbios.tmp \
|
---|
55 | $(PATH_TARGET)/pcbios.bin \
|
---|
56 | $(PATH_TARGET)/PcBiosBin.c \
|
---|
57 | $(PATH_TARGET)/pcbios-syms.h
|
---|
58 |
|
---|
59 | #
|
---|
60 | # Rule for making the bios.
|
---|
61 | #
|
---|
62 | $(PATH_TARGET)/PcBiosBin.c: $(PATH_TARGET)/pcbios.bin $(VBOX_BIN2C)
|
---|
63 | $(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
|
---|
64 | $(QUIET)$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary $< $@
|
---|
65 |
|
---|
66 | #
|
---|
67 | # Six steps to pcbios.bin and pcbios-syms.h
|
---|
68 | #
|
---|
69 |
|
---|
70 | # 1. precompile rombios.c
|
---|
71 | $(PATH_TARGET)/_rombios_.c: $(PATH_SUB_CURRENT)/rombios.c $(PATH_SUB_CURRENT)/logo.c $(PATH_SUB_CURRENT)/apmbios.S \
|
---|
72 | $(PATH_SUB_CURRENT)/../DevPcBios.h $(PATH_ROOT)/include/VBox/bioslogo.h | $(call DIRDEP,$(PATH_TARGET))
|
---|
73 | $(call MSG_TOOL,cpp,PcBiosBin,$<,$@)
|
---|
74 | $(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 -DVBOX_PC_BIOS $(addprefix -D,$(DEFS) $(DEFS.$(KBUILD_TYPE))) -P -o $@ $<
|
---|
75 |
|
---|
76 | # 2. compile to intermediate asm file.
|
---|
77 | # BCC tempfile clashes, order the BCC jobs to make sure they don't interfere with one another.
|
---|
78 | $(PATH_TARGET)/rombios0.s: $(PATH_TARGET)/_rombios_.c $(VBOX_VERSION_STAMP) | $(VBOX_BCC_JOBS)
|
---|
79 | $(call MSG_COMPILE,PcBiosBin,$<,$@,C)
|
---|
80 | $(QUIET)$(VBOX_BCC) -o $@ -C-c -D__i86__ -0 -S $<
|
---|
81 | VBOX_BCC_JOBS += $(PATH_TARGET)/rombios0.s
|
---|
82 |
|
---|
83 | # 3. post process intermediate asm file.
|
---|
84 | $(PATH_TARGET)/rombios1.s: $(PATH_TARGET)/rombios0.s
|
---|
85 | $(call MSG_TOOL,Adjusting BCC Assembly,PcBiosBin,$<,$@)
|
---|
86 | $(QUIET)$(SED) -e 's/^\.text//' -e 's/^\.data//' --output $@ $^
|
---|
87 |
|
---|
88 | # 4. assemble the intermediate asm file. (also creates a listing rombios.lst)
|
---|
89 | $(PATH_TARGET)/pcbios.tmp $(PATH_TARGET)/pcbios.lst: $(PATH_TARGET)/rombios1.s
|
---|
90 | $(call MSG_COMPILE,PcBiosBin,$<,$@,AS)
|
---|
91 | $(QUIET)$(REDIRECT) -ri $^ -- $(VBOX_AS86) -b $(PATH_TARGET)/pcbios.tmp -u- -w- -g -0 -j -O -l $(PATH_TARGET)/pcbios.lst
|
---|
92 |
|
---|
93 | # 5. calculate checksums for the final BIOS image.
|
---|
94 | $(PATH_TARGET)/pcbios.bin: $(PATH_TARGET)/pcbios.tmp $$(TARGET_pcbiossums)
|
---|
95 | $(call MSG_TOOL,pcbiossums,PcBiosBin,$<,$@)
|
---|
96 | $(QUIET)$(CP) -f $(PATH_TARGET)/pcbios.tmp $(PATH_TARGET)/pcbios.bin
|
---|
97 | $(QUIET)$(TARGET_pcbiossums) $(PATH_TARGET)/pcbios.bin
|
---|
98 |
|
---|
99 | # 6. create the symbol table.
|
---|
100 | $(PATH_TARGET)/pcbios-syms.h: $(PATH_TARGET)/pcbios.lst $(MAKEFILE_CURRENT)
|
---|
101 | $(call MSG_GENERATE,PcBiosBin,$<,$@)
|
---|
102 | $(QUIET)$(SED) \
|
---|
103 | -e '/^[0-9][0-9][0-9][0-9][0-9] 000[0-9A-F]* [[:space:]]*[a-zA-Z0-9_]*:/!d' \
|
---|
104 | -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"),/' \
|
---|
105 | --output $@ \
|
---|
106 | $(PATH_TARGET)/pcbios.lst
|
---|
107 |
|
---|
108 |
|
---|
109 | include $(KBUILD_PATH)/subfooter.kmk
|
---|
110 |
|
---|