1 | #
|
---|
2 | # PC BIOS Makefile
|
---|
3 | #
|
---|
4 |
|
---|
5 | # Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
6 | #
|
---|
7 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | # available from http://www.virtualbox.org. This file is free software;
|
---|
9 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | # General Public License as published by the Free Software Foundation,
|
---|
11 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
12 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
13 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 | #
|
---|
15 | # If you received this file as part of a commercial VirtualBox
|
---|
16 | # distribution, then only the terms of your commercial VirtualBox
|
---|
17 | # license agreement apply instead of the previous paragraph.
|
---|
18 | #
|
---|
19 |
|
---|
20 | DEPTH = ../../../../../
|
---|
21 | include $(PATH_KBUILD)/header.kmk
|
---|
22 |
|
---|
23 | BLDPROGS = biossums
|
---|
24 | LIBRARIES = PcBiosBin PcDefBiosLogo
|
---|
25 |
|
---|
26 | OTHERS = $(PATH_TARGET)/bios.bin
|
---|
27 |
|
---|
28 | OTHER_CLEAN = \
|
---|
29 | $(PATH_TARGET)/_rombios_.c \
|
---|
30 | $(PATH_TARGET)/rombios0.s \
|
---|
31 | $(PATH_TARGET)/rombios1.s \
|
---|
32 | $(PATH_TARGET)/bios.lst \
|
---|
33 | $(PATH_TARGET)/bios.tmp \
|
---|
34 | $(PATH_TARGET)/bios.bin \
|
---|
35 | $(PATH_TARGET)/PcBiosBin.c \
|
---|
36 | $(PATH_TARGET)/PcDefBiosLogo.c \
|
---|
37 | $(PATH_TARGET)/bios-syms.h
|
---|
38 |
|
---|
39 | TEMPLATE = VBOXBLDPROG
|
---|
40 | biossums_SOURCES = biossums.c
|
---|
41 |
|
---|
42 | PcBiosBin_TEMPLATE = VBOXR3
|
---|
43 | PcBiosBin_DEFS = IN_VBOXDD2
|
---|
44 | PcBiosBin_INCS = ../..
|
---|
45 | PcBiosBin_SOURCES = $(PATH_TARGET)/PcBiosBin.c
|
---|
46 | $(PATH_TARGET)/PcBiosBin.c_DEPS = $(PATH_TARGET)/bios-syms.h
|
---|
47 |
|
---|
48 | PcDefBiosLogo_TEMPLATE = VBOXR3
|
---|
49 | PcDefBiosLogo_INCS = ../..
|
---|
50 | PcDefBiosLogo_SOURCES = $(PATH_TARGET)/PcDefBiosLogo.c
|
---|
51 |
|
---|
52 |
|
---|
53 | include $(PATH_KBUILD)/footer.kmk
|
---|
54 |
|
---|
55 |
|
---|
56 | #
|
---|
57 | # Rule for making the bios.
|
---|
58 | #
|
---|
59 | $(PATH_TARGET)/PcBiosBin.c: $(PATH_TARGET)/bios.bin $(VBOX_BIN2C)
|
---|
60 | $(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
|
---|
61 | $(QUIET)$(VBOX_BIN2C) -min 64 -max 256 -mask 0xffff -ascii -export PcBiosBinary $< $@
|
---|
62 |
|
---|
63 | #
|
---|
64 | # Rule for making the bios logo.
|
---|
65 | #
|
---|
66 | $(PATH_TARGET)/PcDefBiosLogo.c: innotek_logo.bmp $(VBOX_BIN2C)
|
---|
67 | $(call MSG_TOOL,bin2c,PcBiosBin,$<,$@)
|
---|
68 | $(QUIET)$(VBOX_BIN2C) -max 64 PcDefBiosLogo $< $@
|
---|
69 |
|
---|
70 | #
|
---|
71 | # Six steps to bios.bin and bios-syms.h
|
---|
72 | #
|
---|
73 |
|
---|
74 | # 1. precompile rombios.c
|
---|
75 | $(PATH_TARGET)/_rombios_.c: rombios.c logo.c apmbios.S | $(call DIRDEP,$(TARGET_PATH))
|
---|
76 | $(call MSG_TOOL,cpp,PcBiosBin,$<,$@)
|
---|
77 | $(QUIET)$(TOOL_$(VBOX_GCC_TOOL)_CC) -E -I$(PATH_TARGET) -I$(PATH_CURRENT)/.. -I$(PATH_ROOT)/include -I$(PATH_OUT) -DBX_SMP_PROCESSORS=1 -DVBOX $(addprefix -D,$(DEFS) $(DEFS.$(BUILD_TYPE))) -P $< > $@
|
---|
78 |
|
---|
79 | # 2. compile to intermediate asm file.
|
---|
80 | $(PATH_TARGET)/rombios0.s: $(PATH_TARGET)/_rombios_.c
|
---|
81 | $(call MSG_COMPILE,PcBiosBin,$<,$@,C)
|
---|
82 | $(QUIET)$(VBOX_BCC) -o $@ -C-c -D__i86__ -0 -S $^
|
---|
83 |
|
---|
84 | # 3. post process intermediate asm file.
|
---|
85 | $(PATH_TARGET)/rombios1.s: $(PATH_TARGET)/rombios0.s
|
---|
86 | $(call MSG_TOOL,Adjusting BCC Assembly,PcBiosBin,$<,$@)
|
---|
87 | $(QUIET)$(SED) -e 's/^\.text//' -e 's/^\.data//' $^ > $@
|
---|
88 |
|
---|
89 | # 4. assemble the intermediate asm file. (also creates a listing rombios.lst)
|
---|
90 | $(PATH_TARGET)/bios.tmp $(PATH_TARGET)/bios.lst: $(PATH_TARGET)/rombios1.s
|
---|
91 | $(call MSG_COMPILE,PcBiosBin,$<,$@,AS)
|
---|
92 | $(QUIET)$(VBOX_AS86) -b $(PATH_TARGET)/bios.tmp -u- -w- -g -0 -j -O -l $(PATH_TARGET)/bios.lst - < $^
|
---|
93 |
|
---|
94 | # 5. calculate checksums for the final BIOS image.
|
---|
95 | $(PATH_TARGET)/bios.bin: $(PATH_TARGET)/bios.tmp $(TARGET_biossums)
|
---|
96 | $(call MSG_TOOL,biossums,PcBiosBin,$<,$@)
|
---|
97 | $(QUIET)$(CP) -f $(PATH_TARGET)/bios.tmp $(PATH_TARGET)/bios.bin
|
---|
98 | $(QUIET)$(TARGET_biossums) $(PATH_TARGET)/bios.bin
|
---|
99 |
|
---|
100 | # 6. create the symbol table.
|
---|
101 | $(PATH_TARGET)/bios-syms.h: $(PATH_TARGET)/bios.lst Makefile
|
---|
102 | $(call MSG_TOOL,symtable,PcBiosBin,$<,$@)
|
---|
103 | $(QUIET)$(SED) \
|
---|
104 | -e '/^[0-9][0-9][0-9][0-9][0-9] 000[0-9A-F]* [[:space:]]*[a-zA-Z0-9_]*:/!d' \
|
---|
105 | -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"),/' \
|
---|
106 | $(PATH_TARGET)/bios.lst > $@
|
---|
107 |
|
---|