changed the kvm version to kvm-63
[kvm-coreboot.git] / Makefile
blobd10f4e50303ff79a62e1851a7079adce6a007f39
1 BASE_DIR:=$(shell pwd)
3 SCRIPT_DIR=$(BASE_DIR)/scripts
4 KCONFIG_DIR=$(SCRIPT_DIR)/kconfig
5 CONFIG_DIR=$(BASE_DIR)/config
7 SOURCE_DIR=$(BASE_DIR)/sources
8 BUILD_DIR=$(BASE_DIR)/work
9 INITRD_DIR=$(BASE_DIR)/initrd-rootfs
10 STAGING_DIR=$(BASE_DIR)/staging
11 SKELETON_DIR=$(BASE_DIR)/skeleton
12 OUTPUT_DIR=$(BASE_DIR)/deploy
13 PACKAGE_DIR=$(BASE_DIR)/packages
14 BIN_DIR=$(BASE_DIR)/bin
15 ROM_DIR=$(OUTPUT_DIR)/roms
17 ifeq (.config, $(wildcard .config))
18 dot-config := 1
19 else
20 dot-config := 0
21 config-targets := 1
22 endif
24 ifneq ($(filter textconfig oldconfig defconfig menuconfig,$(MAKECMDGOALS)),)
25 config-targets := 1
26 dot-config := 0
27 endif
29 ifeq ($(dot-config),0)
30 all: .config
32 .config: oldconfig
33 @echo "Configuration completed - type make to build your ROM"
34 else
35 -include .config
37 # Pass -q to wget if the user doesn't want to see a download progressbar.
38 ifeq ($(CONFIG_SHOW_DOWNLOAD_PROGRESSBAR),y)
39 WGET_Q = ""
40 else
41 WGET_Q = "-q"
42 endif
44 DEPENDS-y=
45 include $(CONFIG_DIR)/platforms/platforms.conf
46 include $(CONFIG_DIR)/payloads/payloads.conf
48 # Include the global settings and other checks
49 include $(SCRIPT_DIR)/Build.settings
51 # TARGET_ROM is what we are ultimately building - this should be
52 # specified by the platform files
54 TARGET_ROM ?= coreboot.rom
55 TARGET_ROM_FILE=$(OUTPUT_DIR)/$(TARGET_ROM)
57 # Choose the version of coreboot to build - this might be better
58 # elsewhere, but what the heck - its easy.
60 COREBOOT-$(CONFIG_COREBOOT_V2) = coreboot
61 COREBOOT-$(CONFIG_COREBOOT_V3) = coreboot-v3
63 # Add openvsa as a dependency if it is configured to be used; this makes sure
64 # that make distclean will clear out work/openvsa (see below)
65 ifeq ($(CONFIG_VSA_OPENVSA),y)
66 DEPENDS-y+=openvsa
67 endif
69 # Construct the list of packages we will be building
71 PKGLIST = $(COREBOOT-y) $(DEPENDS-y) $(PAYLOAD-y) $(HOSTTOOLS-y)
73 # Construct the various targets
75 PKG_clean=$(patsubst %, %-clean, $(PKGLIST))
76 PKG_distclean=$(patsubst %, %-distclean, $(PKGLIST))
77 PKG_extract=$(patsubst %, %-extract, $(PKGLIST))
79 # This is the top level target - for v2, the final deliverable is built
80 # by coreboot, for v3 it is built by us, so we have ifdef magic here
82 ifeq ($(CONFIG_COREBOOT_V2),y)
83 rom: $(HOSTTOOLS-y) payload $(COREBOOT-y)
84 else
86 # If compressing the payload in v3, parse the elf and tell lar to compress it.
87 # Parsing the elf without compression bloats the ROM with bss zeroes.
89 LAR_PAYLOAD_FLAGS-y=-a -e
90 LAR_PAYLOAD_FLAGS-$(CONFIG_USE_LZMA) += -C lzma
92 rom: $(HOSTTOOLS-y) payload $(COREBOOT-y)
93 @ mkdir -p $(shell dirname $(TARGET_ROM_FILE))
94 @ cp $(CBV3_OUTPUT) $(TARGET_ROM_FILE)
95 @ $(STAGING_DIR)/bin/lar $(LAR_PAYLOAD_FLAGS-y) $(TARGET_ROM_FILE) $(PAYLOAD_TARGET):normal/payload
96 @ if [ -d $(ROM_DIR) ]; then \
97 for file in `find $(ROM_DIR) -type f`; do \
98 b=`echo $$file | sed -e s:^$(ROM_DIR)\/*::`; \
99 $(STAGING_DIR)/bin/lar $(LAR_PAYLOAD_FLAGS-y) \
100 $(TARGET_ROM_FILE) $$file:$$b; \
101 done; \
103 @ $(STAGING_DIR)/bin/lar -z $(TARGET_ROM_FILE)
104 endif
106 # These empty dependencies are for the custom payload.
107 custom:
108 custom-clean:
110 payload: $(DEPENDS-y) $(PAYLOAD_TARGET)
112 extract: $(PKG_extract)
114 clean: $(PKG_clean)
115 @ rm -rf $(INITRD_DIR) $(OUTPUT_DIR)
117 distclean: $(PKG_distclean)
118 @ rm -rf $(OUTPUT_DIR) $(STAGING_DIR) $(INITRD_DIR)
119 @ rm -f $(BASE_DIR).config
121 # Include the payload builder
123 ifneq ($(PAYLOAD_BUILD),)
124 include $(PAYLOAD_BUILD)
125 endif
127 INCMK=$(foreach mk,$(DEPENDS-y) $(PAYLOAD-y) $(HOSTTOOLS-y),$(PACKAGE_DIR)/$(mk)/$(mk).mk)
129 ifeq ($(CONFIG_COREBOOT_V2),y)
130 INCMK += $(PACKAGE_DIR)/coreboot-v2/coreboot-v2.mk
131 else
132 INCMK += $(PACKAGE_DIR)/coreboot-v3/coreboot-v3.mk
133 endif
135 ifneq ($(INCMK),)
136 include $(INCMK)
137 endif
139 endif
141 super-distclean:
142 @ make -C $(KCONFIG_DIR) clean
143 @ rm -rf $(BUILD_DIR)
144 @ rm -f .config tmpconfig.h .kconfig.d .config.old
146 ifeq ($(config-targets),1)
148 $(KCONFIG_DIR)/conf:
149 make -C $(KCONFIG_DIR) conf
151 $(KCONFIG_DIR)/mconf:
152 make -C $(KCONFIG_DIR) mconf
154 $(KCONFIG_DIR)/lxdialog/lxdialog:
155 make -C $(KCONFIG_DIR)/lxdialog lxdialog
158 textconfig: $(KCONFIG_DIR)/conf
159 @$(KCONFIG_DIR)/conf $(BASE_DIR)/Config.in
161 oldconfig: $(KCONFIG_DIR)/conf
162 @$(KCONFIG_DIR)/conf -o $(BASE_DIR)/Config.in
164 defconfig: $(KCONFIG_DIR)/conf
165 @$(KCONFIG_DIR)/conf -d $(BASE_DIR)/Config.in
167 menuconfig: $(KCONFIG_DIR)/lxdialog/lxdialog $(KCONFIG_DIR)/mconf
168 @$(KCONFIG_DIR)/mconf $(BASE_DIR)/Config.in
170 endif
171 test: rom
172 qemu-system-x86_64 -L ~ -hda /dev/null