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
))
24 ifneq ($(filter textconfig oldconfig defconfig menuconfig
,$(MAKECMDGOALS
)),)
29 ifeq ($(dot-config
),0)
33 @echo
"Configuration completed - type make to build your ROM"
37 # Pass -q to wget if the user doesn't want to see a download progressbar.
38 ifeq ($(CONFIG_SHOW_DOWNLOAD_PROGRESSBAR
),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
)
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
)
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; \
103 @
$(STAGING_DIR
)/bin
/lar
-z
$(TARGET_ROM_FILE
)
106 # These empty dependencies are for the custom payload.
110 payload
: $(DEPENDS-y
) $(PAYLOAD_TARGET
)
112 extract
: $(PKG_extract
)
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
)
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
132 INCMK
+= $(PACKAGE_DIR
)/coreboot-v3
/coreboot-v3.mk
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)
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
172 qemu-system-x86_64
-L ~
-hda
/dev
/null