crossgcc: Change 'tar balls' to 'tarballs'
[coreboot.git] / Makefile.inc
blob8f45fc29ce0ba763f93cae6e8c8e84d7ce9ab20c
1 ##
2 ## This file is part of the coreboot project.
3 ##
4 ## Copyright (C) 2011 secunet Security Networks AG
5 ##
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; version 2 of the License.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
16 GIT:=$(shell [ -e "$(top)/.git" ] && command -v git)
18 #######################################################################
19 # normalize Kconfig variables in a central place
20 CONFIG_CBFS_PREFIX:=$(call strip_quotes,$(CONFIG_CBFS_PREFIX))
21 CONFIG_FMDFILE:=$(call strip_quotes,$(CONFIG_FMDFILE))
23 #######################################################################
24 # misleadingly named, this is the coreboot version
25 export KERNELVERSION := $(strip $(if $(GIT),\
26         $(shell git describe --dirty --always || git describe),\
27         $(if $(wildcard $(top)/.coreboot-version),\
28                 $(shell cat $(top)/.coreboot-version),\
29                 coreboot-unknown$(KERNELREVISION))))
31 #######################################################################
32 # Basic component discovery
33 MAINBOARDDIR=$(call strip_quotes,$(CONFIG_MAINBOARD_DIR))
34 export MAINBOARDDIR
36 ## Final build results, which CBFSTOOL uses to create the final
37 ## rom image file, are placed under $(objcbfs).
38 ## These typically have suffixes .debug .elf .bin and .map
39 export objcbfs := $(obj)/cbfs/$(CONFIG_CBFS_PREFIX)
41 ## Based on the active configuration, Makefile conditionally collects
42 ## the required assembly includes and saves them in a file.
43 ## Such files that do not have a clear one-to-one relation to a source
44 ## file under src/ are placed and built under $(objgenerated)
45 export objgenerated := $(obj)/generated
47 #######################################################################
48 # root rule to resolve if in build mode (ie. configuration exists)
49 real-target: $(obj)/config.h coreboot files_added
50 coreboot: build-dirs $(obj)/coreboot.rom $(obj)/cbfstool $(obj)/rmodtool
52 # This target can be used in site local to run scripts or additional
53 # targets after the build completes by creating a Makefile.inc in the
54 # site-local directory with a target named 'build_complete::'
55 build_complete:: coreboot
56         printf "\nBuilt %s (%s)\n" $(CONFIG_MAINBOARD_DIR) \
57                 $(CONFIG_MAINBOARD_PART_NUMBER)
59 # This target can be used to run rules after all files were added to CBFS,
60 # for example to process FMAP regions or the entire image.
61 files_added:: build_complete
63 #######################################################################
64 # our phony targets
65 PHONY+= clean-abuild coreboot lint lint-stable build-dirs build_complete
67 #######################################################################
68 # root source directories of coreboot
69 subdirs-y := src/lib src/commonlib/ src/console src/device src/acpi
70 subdirs-y += src/ec/acpi $(wildcard src/ec/*/*) $(wildcard src/southbridge/*/*)
71 subdirs-y += $(wildcard src/soc/*/*) $(wildcard src/northbridge/*/*)
72 subdirs-y += src/superio $(wildcard src/drivers/*) src/cpu src/vendorcode
73 subdirs-y += util/cbfstool util/sconfig util/nvramtool util/broadcom
74 subdirs-y += util/futility util/marvell
75 subdirs-y += $(wildcard src/arch/*)
76 subdirs-y += src/mainboard/$(MAINBOARDDIR)
77 subdirs-y += payloads/external
79 subdirs-y += site-local
81 #######################################################################
82 # Add source classes and their build options
83 classes-y := ramstage romstage bootblock smm smmstub cpu_microcode libverstage verstage
85 # Add dynamic classes for rmodules
86 $(foreach supported_arch,$(ARCH_SUPPORTED), \
87             $(eval $(call define_class,rmodules_$(supported_arch),$(supported_arch))))
88 # Provide a macro to determine environment for free standing rmodules.
89 $(foreach supported_arch,$(ARCH_SUPPORTED), \
90         $(eval rmodules_$(supported_arch)-generic-ccopts += -D__RMODULE__))
92 #######################################################################
93 # Helper functions for math and various file placement matters.
94 # macros work on all formats understood by printf(1)
95 # values are space separated if using more than one value
97 # int-add:       adds an arbitrary length list of integers
98 # int-subtract:  subtracts the the second of two integers from the first
99 # int-multiply:  multiplies an arbitrary length list of integers
100 # int-divide:    divides the first integer by the second
101 # int-remainder: arithmetic remainder of the first number divided by the second
102 # int-lt:        1 if the first value is less than the second.  0 otherwise
103 # int-gt:        1 if the first values is greater than the second.  0 otherwise
104 # int-eq:        1 if the two values are equal.  0 otherwise
105 # int-align:     align $1 to $2 units
106 # file-size:     returns the filesize of the given file
107 _toint=$(shell printf "%d" $1)
108 _int-add2=$(shell expr $(call _toint,$1) + $(call _toint,$2))
109 int-add=$(if $(filter 1,$(words $1)),$(strip $1),$(call int-add,$(call _int-add2,$(word 1,$1),$(word 2,$1)) $(wordlist 3,$(words $1),$1)))
110 int-subtract=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) - $(call _toint,$(word 2,$1))))
111 _int-multiply2=$(shell expr $(call _toint,$1) \* $(call _toint,$2))
112 int-multiply=$(if $(filter 1,$(words $1)),$(strip $1),$(call int-multiply,$(call _int-multiply2,$(word 1,$1),$(word 2,$1)) $(wordlist 3,$(words $1),$1)))
113 int-divide=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) / $(call _toint,$(word 2,$1))))
114 int-remainder=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) % $(call _toint,$(word 2,$1))))
115 int-lt=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) \< $(call _toint,$(word 2,$1))))
116 int-gt=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) \> $(call _toint,$(word 2,$1))))
117 int-eq=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) = $(call _toint,$(word 2,$1))))
118 int-align=$(shell A=$(call _toint,$1) B=$(call _toint,$2); expr $$A + \( \( $$B - \( $$A % $$B \) \) % $$B \) )
119 file-size=$(shell cat $1 | wc -c)
121 #######################################################################
122 # Helper functions for ramstage postprocess
123 spc :=
124 spc +=
125 $(spc) :=
126 $(spc) +=
127 comma := ,
129 # files-in-dir-recursive,dir,files
130 files-in-dir-recursive=$(filter $(1)%,$(2))
132 # parent-dir,dir/
133 parent-dir=$(dir $(if $(patsubst /%,,$(1)),,/)$(subst $( ),/,$(strip $(subst /, ,$(1)))))
135 # filters out exactly the directory specified
136 # filter-out-dir,dir_to_keep,dirs
137 filter-out-dir=$(filter-out $(1),$(2))
139 # filters out dir_to_keep and all its parents
140 # filter-out-dirs,dir_to_keep,dirs
141 filter-out-dirs=$(if $(filter-out ./ /,$(1)),$(call filter-out-dirs,$(call parent-dir,$(1)),$(call filter-out-dir,$(1),$(2))),$(call filter-out-dir,$(1),$(2)))
143 # dir-wildcards,dirs
144 dir-wildcards=$(addsuffix %,$(1))
146 # files-in-dir,dir,files
147 files-in-dir=$(filter-out $(call dir-wildcards,$(call filter-out-dirs,$(1),$(sort $(dir $(2))))),$(call files-in-dir-recursive,$(1),$(2)))
149 #######################################################################
150 # reduce command line length by linking the objects of each
151 # directory into an intermediate file
152 ramstage-postprocess=$$(eval DEPENDENCIES+=$$(addsuffix .d,$$(basename $(1)))) \
153         $(foreach d,$(sort $(dir $(filter-out %.ld,$(1)))), \
154         $(eval $(d)ramstage.a: $(call files-in-dir,$(d),$(filter-out %.ld,$(1))); rm -f $$@ && $(AR_ramstage) rcsT $$@ $$^ ) \
155         $(eval ramstage-objs:=$(d)ramstage.a $(filter-out $(filter-out %.ld, $(call files-in-dir,$(d),$(1))),$(ramstage-objs))))
157 bootblock-generic-ccopts += -D__PRE_RAM__ -D__BOOTBLOCK__
158 romstage-generic-ccopts += -D__PRE_RAM__ -D__ROMSTAGE__
159 ramstage-generic-ccopts += -D__RAMSTAGE__
160 ifeq ($(CONFIG_TRACE),y)
161 ramstage-c-ccopts += -finstrument-functions
162 endif
163 ifeq ($(CONFIG_COVERAGE),y)
164 ramstage-c-ccopts += -fprofile-arcs -ftest-coverage
165 endif
167 # try to fetch non-optional submodules if the source is under git
168 forgetthis:=$(if $(GIT),$(shell git submodule update --init))
169 ifeq ($(CONFIG_USE_BLOBS),y)
170 # this is necessary because 3rdparty/blobs is update=none, and so is ignored
171 # unless explicitly requested and enabled through --checkout
172 forgetthis:=$(if $(GIT),$(shell git submodule update --init --checkout 3rdparty/blobs))
173 endif
175 ramstage-c-deps:=$$(OPTION_TABLE_H)
176 romstage-c-deps:=$$(OPTION_TABLE_H)
177 libverstage-c-deps:=$$(OPTION_TABLE_H)
178 verstage-c-deps:=$$(OPTION_TABLE_H)
179 bootblock-c-deps:=$$(OPTION_TABLE_H)
181 # Add handler to copy linker scripts
182 define generic-objs_ld_template_gen
183 de$(EMPTY)fine $(1)-objs_ld_template
184 $$(call src-to-obj,$1,$$(1).ld): $$(1).ld $(obj)/config.h
185         @printf "    CP         $$$$(subst $$$$(obj)/,,$$$$(@))\n"
186         $$(CC_$(1)) -MMD $$(CPPFLAGS_$(1)) $$($(1)-ld-ccopts) $(PREPROCESS_ONLY) -include $(obj)/config.h -MT $$$$@ -o $$$$@ $$$$<
187 en$(EMPTY)def
188 endef
190 # Add handler to deal with archives
191 define generic-objs_a_template_gen
192 de$(EMPTY)fine $(1)-objs_a_template
193 $$(call src-to-obj,$1,$$(1).a): $$(1).a
194         @printf "    AR         $$$$(subst $$$$(obj)/,,$$$$(@))\n"
195         $$$$(AR_$(1)) rcsT $$$$@.tmp $$$$<
196         mv $$$$@.tmp $$$$@
197 en$(EMPTY)def
198 endef
200 # Add handler to add no rules for manual files
201 define generic-objs_manual_template_gen
202 # do nothing
203 endef
205 #######################################################################
206 # Add handler to compile ACPI's ASL
207 # arg1: base file name
208 # arg2: y or n for including in cbfs. defaults to y
209 define asl_template
210 $(CONFIG_CBFS_PREFIX)/$(1).aml-file = $(obj)/$(1).aml
211 $(CONFIG_CBFS_PREFIX)/$(1).aml-type = raw
212 $(CONFIG_CBFS_PREFIX)/$(1).aml-compression = none
213 cbfs-files-$(if $(2),$(2),y) += $(CONFIG_CBFS_PREFIX)/$(1).aml
214 -include $(obj)/$(1).d
215 $(obj)/$(1).aml: $(src)/mainboard/$(MAINBOARDDIR)/$(1).asl $(obj)/config.h
216         @printf "    IASL       $$(subst $(top)/,,$$(@))\n"
217         $(CC_ramstage) -x assembler-with-cpp -E -MMD -MT $$(@) $$(CPPFLAGS_ramstage) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-$(ARCH-ramstage-y))/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$@
218 ifeq ($(CONFIG_IASL_WARNINGS_ARE_ERRORS),y)
219         cd $$(dir $$@); $(IASL) -we -p $$(notdir $$@) $$(notdir $$@)
220 else
221         cd $$(dir $$@); $(IASL) -p $$(notdir $$@) $$(notdir $$@)
222 endif
223 endef
225 #######################################################################
226 # Parse plaintext cmos defaults into binary format
227 # arg1: source file
228 # arg2: binary file name
229 cbfs-files-processor-nvramtool= \
230         $(eval $(2): $(1) $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout | $(objutil)/nvramtool/nvramtool ; \
231                 printf "    CREATE     $(2) (from $(1))\n"; \
232                 $(objutil)/nvramtool/nvramtool -y $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout -D $(2).tmp -p $(1) && \
233                 mv $(2).tmp $(2))
235 #######################################################################
236 # Link VSA binary to ELF-ish stage
237 # arg1: source file
238 # arg2: binary file name
239 cbfs-files-processor-vsa= \
240         $(eval $(2): $(1) ; \
241                 printf "    CREATE     $(2) (from $(1))\n"; \
242                 $(OBJCOPY_ramstage) --set-start 0x20 --adjust-vma 0x60000 -I binary -O elf32-i386 -B i386 $(1) $(2).tmp && \
243                 $(LD_ramstage) -m elf_i386 -e 0x60020 --section-start .data=0x60000 $(2).tmp -o $(2))
245 #######################################################################
246 # Reduce a .config file to its minimal representation
247 # arg1: input
248 # arg2: output
249 cbfs-files-processor-defconfig= \
250         $(eval $(2): $(1) $(obj)/build.h; \
251                 printf "    CREATE     $(2) (from $(1))\n"; \
252                 printf "\# This image was built using coreboot " > $(2).tmp && \
253                 grep "\<COREBOOT_VERSION\>" $(obj)/build.h |cut -d\" -f2 >> $(2).tmp && \
254                 $(MAKE) DOTCONFIG=$(1) DEFCONFIG=$(2).tmp2 savedefconfig && \
255                 cat $(2).tmp2 >> $(2).tmp && \
256                 rm -f $(2).tmp2 && \
257                 \mv -f $(2).tmp $(2))
259 #######################################################################
260 # Add handler for arbitrary files in CBFS
261 $(call add-special-class,cbfs-files)
262 cbfs-files-handler= \
263                 $(eval tmp-cbfs-method:=$(word 2, $(subst :, ,$($(2)-file)))) \
264                 $(eval $(2)-file:=$(call strip_quotes,$(word 1, $(subst :, ,$($(2)-file))))) \
265                 $(eval tmp-cbfs-file:= ) \
266                 $(if $($(2)-file), \
267                         $(if $(wildcard $(1)$($(2)-file)), \
268                                 $(eval tmp-cbfs-file:= $(wildcard $(1)$($(2)-file))), \
269                                 $(eval tmp-cbfs-file:= $($(2)-file)))) \
270                 $(if $(strip $($(2)-required)), \
271                         $(if $(wildcard $(tmp-cbfs-file)),, \
272                                 $(info This build configuration requires $($(2)-required)) \
273                                 $(eval FAILBUILD:=1) \
274                         )) \
275                 $(if $(strip $($(2)-align)), \
276                         $(if $(strip $($(2)-position)), \
277                                 $(info ERROR: It is not allowed to specify both alignment and position for $($(2)-file)) \
278                                 $(eval FAILBUILD:=1) \
279                         )) \
280                 $(eval _cbfs-bucket:=regular ) \
281                 $(if $(strip $($(2)-position)), \
282                         $(eval _cbfs-bucket:=fixed)) \
283                 $(if $(strip $($(2)-align)), \
284                         $(eval _cbfs-bucket:=aligned)) \
285                 $(if $(tmp-cbfs-method), \
286                         $(eval tmp-old-cbfs-file:=$(tmp-cbfs-file)) \
287                         $(eval tmp-cbfs-file:=$(shell mkdir -p $(obj)/mainboard/$(MAINBOARDDIR); mktemp $(obj)/mainboard/$(MAINBOARDDIR)/cbfs-file.XXXXXX).out) \
288                         $(call cbfs-files-processor-$(tmp-cbfs-method),$(tmp-old-cbfs-file),$(tmp-cbfs-file))) \
289                 $(if $(tmp-cbfs-file), \
290                         $(eval cbfs-files-$(_cbfs-bucket) += $(subst $(spc),*,$(tmp-cbfs-file)|$(2)|$($(2)-type)|$($(2)-compression)|$(strip $($(2)-position))|$($(2)-align)|$($(2)-options)))) \
291                 $(eval $(2)-name:=) \
292                 $(eval $(2)-type:=) \
293                 $(eval $(2)-compression:=) \
294                 $(eval $(2)-position:=) \
295                 $(eval $(2)-required:=) \
296                 $(eval $(2)-options:=) \
297                 $(eval $(2)-align:=)
299 #######################################################################
300 # a variety of flags for our build
301 CBFS_COMPRESS_FLAG:=none
302 ifeq ($(CONFIG_COMPRESS_RAMSTAGE),y)
303 CBFS_COMPRESS_FLAG:=LZMA
304 endif
306 CBFS_PAYLOAD_COMPRESS_FLAG:=none
307 ifeq ($(CONFIG_COMPRESSED_PAYLOAD_LZMA),y)
308 CBFS_PAYLOAD_COMPRESS_FLAG:=LZMA
309 endif
311 ifneq ($(CONFIG_LOCALVERSION),"")
312 export COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION))
313 endif
315 CPPFLAGS_common := -Isrc -Isrc/include -Isrc/commonlib/include -I$(obj)
316 CPPFLAGS_common += -Isrc/device/oprom/include
317 VB_SOURCE ?= 3rdparty/vboot
318 CPPFLAGS_common += -I$(VB_SOURCE)/firmware/include
319 CPPFLAGS_common += -include $(src)/include/kconfig.h
320 CPPFLAGS_common += -I3rdparty
322 CFLAGS_common += -pipe -g -nostdinc
323 CFLAGS_common += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
324 CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
325 CFLAGS_common += -Wstrict-aliasing -Wshadow
326 CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
327 CFLAGS_common += -ffunction-sections -fdata-sections
329 LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static --emit-relocs
331 ifeq ($(CONFIG_COMPILER_GCC),y)
332 # cf. commit f69a99db (coreboot: x86: enable gc-sections)
333 CFLAGS_common += -Wno-unused-but-set-variable
334 endif
336 ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
337 CFLAGS_common += -Werror
338 endif
339 ifneq ($(GDB_DEBUG),)
340 CFLAGS_common += -Og
341 else
342 CFLAGS_common += -Os
343 endif
345 additional-dirs := $(objutil)/cbfstool $(objutil)/romcc $(objutil)/ifdtool \
346                    $(objutil)/ifdfake $(objutil)/options $(objutil)/amdfwtool \
347                    $(objutil)/cbootimage $(objutil)/bimgtool
349 #######################################################################
350 # generate build support files
351 $(obj)/build.h: .xcompile
352         @printf "    GEN        build.h\n"
353         rm -f $(obj)/build.h
354         util/genbuild_h/genbuild_h.sh > $(obj)/build.ht
355         mv $(obj)/build.ht $(obj)/build.h
357 build-dirs:
358         mkdir -p $(objcbfs) $(objgenerated)
360 #######################################################################
361 # Build the tools
362 CBFSTOOL:=$(objutil)/cbfstool/cbfstool
363 FMAPTOOL:=$(objutil)/cbfstool/fmaptool
364 RMODTOOL:=$(objutil)/cbfstool/rmodtool
366 $(obj)/cbfstool: $(CBFSTOOL)
367         cp $< $@
369 $(obj)/fmaptool: $(FMAPTOOL)
370         cp $< $@
372 $(obj)/rmodtool: $(RMODTOOL)
373         cp $< $@
375 _WINCHECK=$(shell uname -o 2> /dev/null)
376 STACK=
377 ifeq ($(_WINCHECK),Msys)
378         STACK=-Wl,--stack,16384000
379 endif
380 ifeq ($(_WINCHECK),Cygwin)
381         STACK=-Wl,--stack,16384000
382 endif
384 # this allows ccache to prepend itself
385 # (ccache handling happens first)
386 ROMCC_BIN= $(objutil)/romcc/romcc
387 ROMCC?=$(ROMCC_BIN)
388 $(ROMCC_BIN): $(top)/util/romcc/romcc.c
389         @printf "    HOSTCC     $(subst $(obj)/,,$(@)) (this may take a while)\n"
390         @# Note: Adding -O2 here might cause problems. For details see:
391         @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
392         $(HOSTCC) -g $(STACK) -Wall -o $@ $<
394 IFDTOOL:=$(objutil)/ifdtool/ifdtool
395 $(IFDTOOL): $(top)/util/ifdtool/ifdtool.c
396         @printf "    HOSTCC     $(subst $(obj)/,,$(@))\n"
397         $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
399 IFDFAKE:=$(objutil)/ifdfake/ifdfake
400 $(IFDFAKE): $(top)/util/ifdfake/ifdfake.c
401         @printf "    HOSTCC     $(subst $(obj)/,,$(@))\n"
402         $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
404 AMDFWTOOL:=$(objutil)/amdfwtool/amdfwtool
405 $(AMDFWTOOL): $(top)/util/amdfwtool/amdfwtool.c
406         @printf "    HOSTCC     $(subst $(obj)/,,$(@))\n"
407         $(HOSTCC) $(HOSTCFLAGS) -DCONFIG_ROM_SIZE=$(CONFIG_ROM_SIZE) -o $@ $<
409 CBOOTIMAGE:=$(objutil)/cbootimage/cbootimage
411 FUTILITY:=$(objutil)/futility/futility
413 subdirs-y += util/nvidia
415 BIMGTOOL:=$(objutil)/bimgtool/bimgtool
416 $(BIMGTOOL): $(top)/util/bimgtool/bimgtool.c
417         @printf "    HOSTCC     $(subst $(obj)/,,$(@))\n"
418         $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
420 #######################################################################
421 # needed objects that every mainboard uses
422 # Creation of these is architecture and mainboard independent
423 $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb  $(objutil)/sconfig/sconfig
424         @printf "    SCONFIG    $(subst $(src)/,,$(<))\n"
425         mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
426         $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR)
428 ramstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
429 romstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
430 verstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
432 $(objgenerated)/libverstage.a: $$(libverstage-objs)
433         rm -f $@
434         $(AR_libverstage) rcsT $@ $^
436 #######################################################################
437 # Clean up rules
438 clean-abuild:
439         rm -rf coreboot-builds
441 clean-for-update-target:
442         rm -f $(obj)/ramstage?* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a
443         rm -rf $(obj)/bootblock?* $(obj)/romstage?* $(obj)/location.*
444         rm -f $(obj)/option_table.* $(obj)/crt0.S $(obj)/ldscript
445         rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot
446         rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm
447         rm -f $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc
448         rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/dsdt.*
449         rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm
450         $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc clean
452 clean-target:
453         rm -f $(obj)/coreboot*
455 #######################################################################
456 # Development utilities
457 printcrt0s:
458         @echo crt0s=$(crt0s)
459         @echo ldscripts=$(ldscripts)
461 update:
462         dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF
464 lint lint-stable:
465         util/lint/lint $@
467 gitconfig:
468         [ -d .git ]
469         mkdir -p .git/hooks
470         for hook in commit-msg pre-commit ; do                       \
471                 if [ util/gitconfig/$$hook -nt .git/hooks/$$hook -o  \
472                 ! -x .git/hooks/$$hook ]; then                       \
473                         sed -e "s,%MAKE%,$(MAKE),g" util/gitconfig/$$hook > .git/hooks/$$hook;  \
474                         chmod +x .git/hooks/$$hook;                  \
475                 fi;                                                  \
476         done
477         # Now set up thehooks for 3rdparty/blobs
478         if [ -d .git/modules/3rdparty/hooks -a \
479         \( util/gitconfig/commit-msg -nt .git/modules/3rdparty/hooks/commit-msg -o \
480         ! -x .git/modules/3rdparty/hooks/commit-msg \) ]; then \
481                 sed -e "s,%MAKE%,$(MAKE),g" util/gitconfig/commit-msg > .git/modules/3rdparty/hooks/commit-msg; \
482                 chmod +x .git/modules/3rdparty/hooks/commit-msg; \
483         fi
484         [ -d 3rdparty/blobs ] && cd 3rdparty/blobs && git config remote.origin.push HEAD:refs/for/master
485         git config remote.origin.push HEAD:refs/for/master
486         (git config --global user.name >/dev/null && git config --global user.email >/dev/null) || (printf 'Please configure your name and email in git:\n\n git config --global user.name "Your Name Comes Here"\n git config --global user.email your.email@example.com\n'; exit 1)
488 include util/crossgcc/Makefile.inc
490 .PHONY: tools
491 tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(FMAPTOOL) $(RMODTOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(IFDFAKE) $(CBOOTIMAGE) $(AMDFWTOOL) $(FUTILITY)
493 ###########################################################################
494 # Common recipes for all stages
495 ###########################################################################
497 # loadaddr can determine the load address of a stage, which may be needed for
498 # platform-specific image headers (only works *after* the stage has been built)
499 loadaddr = $(shell $(OBJDUMP_$(1)) -p $(objcbfs)/$(1).debug | \
500              sed -ne '/LOAD/s/^.*vaddr 0x\([0-9a-fA-F]\{8\}\).*$$/0x\1/p')
502 # find-substr is required for stages like romstage_null and romstage_xip to
503 # eliminate the _* part of the string
504 find-substr = $(word 1,$(subst _, ,$(1)))
506 # find-class is used to identify the class from the name of the stage
507 # The input to this macro can be something like romstage.x or romstage.x.y
508 # find-class recursively strips off the suffixes to extract the exact class name
509 # e.g.: if romstage.x is provided to find-class, it will remove .x and return romstage
510 # if romstage.x.y is provided, it will first remove .y, call find-class with romstage.x
511 # and remove .x the next time and finally return romstage
512 find-class = $(if $(filter $(1),$(basename $(1))),$(if $(CC_$(1)), $(1), $(call find-substr,$(1))),$(call find-class,$(basename $(1))))
514 # Bootblocks are not CBFS stages. coreboot is currently expecting the bss to
515 # be cleared by the loader of the stage. For ARM SoCs that means one needs to
516 # include the bss section in the binary so the BootROM clears the bss on
517 # loading of the bootblock stage. Achieve this by marking the bss section
518 # loadable,allocatable, and data. Do the same for the .data section in case
519 # it's marked as NOBITS.
520 $(objcbfs)/bootblock.raw.bin: $(objcbfs)/bootblock.elf
521         @printf "    OBJCOPY    $(notdir $(@))\n"
522         $(OBJCOPY_bootblock) --set-section-flags .bss=load,alloc,data --set-section-flags .data=load,alloc,data $< $<.tmp
523         $(OBJCOPY_bootblock) -O binary $<.tmp $@
525 $(objcbfs)/%.bin: $(objcbfs)/%.raw.bin
526         cp $< $@
528 $(objcbfs)/%.elf: $(objcbfs)/%.debug
529         $(eval class := $(call find-class,$(@F)))
530         @printf "    OBJCOPY    $(subst $(obj)/,,$(@))\n"
531         cp $< $@.tmp
532         $(NM_$(class)) -n $@.tmp | sort > $(basename $@).map
533         $(OBJCOPY_$(class)) --strip-debug $@.tmp
534         $(OBJCOPY_$(class)) --add-gnu-debuglink=$< $@.tmp
535         mv $@.tmp $@
537 ###########################################################################
538 # Build the final rom image
539 ###########################################################################
541 # extract_nth - Return a subsection of the $file string
543 # the input string looks like this:
544 # ./build/cbfs/fallback/romstage.elf|fallback/romstage|stage|none||64|--xip*-S*.car.data*-P*0x10000
546 # Sections:
547 # 1 - Path and name of file [FILENAME: Added to cbfs-files-y list variable]
548 # 2 - Name of file in cbfs  [$(FILENAME)-file]
549 # 3 - File type:            [$(FILENAME)-type]
550 #                bootblock, cbfs header, stage, payload, optionrom, bootsplash, raw, vsa,
551 #                mbi, microcode, fsp, mrc, cmos_default, cmos_layout, spd, mrc_cache,
552 #                mma, efi, deleted, null
553 # 4 - Compression type      [$(FILENAME)-compression]
554 #                      none, LZMA
555 # 5 - Base address          [$(FILANAME)-position]
556 # 6 - Alignment             [$(FILENAME)-align]
557 # 7 - cbfstool flags        [$(FILENAME)-options]
559 # Input:
560 #  $(1) = Section to extract
561 #  $(2) = Input string
563 # Steps:
564 # 1) replace all '|' characters with the sequence '- -' within the full string, prepended and appended with the character '-'
565 # 2) extract the specified section from the string - this gets us the section surrounded by '-' characters
566 # 3) remove the leading and trailing '-' characters
567 # 4) replace all '*' characters with spaces
568 extract_nth=$(subst *,$(spc),$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-))))
570 # regions-for-file - Returns a cbfstool regions parameter
571 # $(call regions-for-file,$(filename))
572 # returns "REGION1,REGION2,..."
574 # This is the default implementation. When using a boot strategy employing
575 # multiple CBFSes in fmap regions, override it.
576 regions-for-file ?= COREBOOT
578 # options-for-region
579 # $(call options-for-region,$(filename),$(region),$(options))
581 # Returns potentially modified options, depending on file and region.
582 # Default is to return it unmodified
583 options-for-region ?= $(3)
585 ifeq ($(CONFIG_CBFS_AUTOGEN_ATTRIBUTES),y)
586         cbfs-autogen-attributes=-g
587 endif
589 # cbfs-add-cmd-for-region
590 # $(call cbfs-add-cmd-for-region,file in extract_nth format,region name)
591 define cbfs-add-cmd-for-region
592         $(CBFSTOOL) $@.tmp \
593         add$(if $(filter stage,$(call extract_nth,3,$(1))),-stage)$(if $(filter payload,$(call extract_nth,3,$(1))),-payload) \
594         -f $(call extract_nth,1,$(1)) \
595         -n $(call extract_nth,2,$(1)) \
596         $(if $(filter-out stage,$(call extract_nth,3,$(1))),-t $(call extract_nth,3,$(1))) \
597         $(if $(call extract_nth,4,$(1)),-c $(call extract_nth,4,$(1))) \
598         $(cbfs-autogen-attributes) \
599         -r $(2) \
600         $(call options-for-region,$(call extract_nth,2,$(1)),$(2), \
601                 $(if $(call extract_nth,6,$(1)),-a $(call extract_nth,6,$(file)), \
602                         $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file)))) \
603                 $(call extract_nth,7,$(1)))
605 endef
606 # Empty line before endef is necessary so cbfs-add-cmd-for-region ends in a
607 # newline
609 # cbfs-add-cmd
610 # $(call cbfs-add-cmd,file in extract_nth format,non-empty if file removal requested)
611 define cbfs-add-cmd
612         printf "    CBFS       $(call extract_nth,2,$(1))\n"
613         $(if $(2),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null)
614         $(eval _tmp-cbfs-add-cmd-regions=$(call regions-for-file,$(call extract_nth,2,$(1)))) \
615         $(foreach region,$(subst $(comma),$(spc),$(_tmp-cbfs-add-cmd-regions)), \
616                 $(call cbfs-add-cmd-for-region,$(1),$(region)))
617 endef
619 cbfs-files=$(cbfs-files-fixed) $(cbfs-files-aligned) $(cbfs-files-regular)
620 prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
621 prebuild-files = $(foreach file,$(cbfs-files), $(call cbfs-add-cmd,$(file),$(CONFIG_UPDATE_IMAGE)))
623 ifneq ($(CONFIG_UPDATE_IMAGE),y)
624 ifeq ($(CONFIG_FMDFILE),)
625 # For a description of the flash layout described by these variables, check
626 # the $(DEFAULT_FLASHMAP) .fmd files.
627 ifeq ($(CONFIG_ARCH_X86),y)
628 DEFAULT_FLASHMAP:=$(top)/util/cbfstool/default-x86.fmd
629 # entire flash
630 FMAP_ROM_ADDR := $(call int-subtract, 0x100000000 $(CONFIG_ROM_SIZE))
631 FMAP_ROM_SIZE := $(CONFIG_ROM_SIZE)
632 # entire "BIOS" region (everything directly of concern to the host system)
633 # relative to ROM_BASE
634 FMAP_BIOS_BASE := $(call int-subtract, $(CONFIG_ROM_SIZE) $(CONFIG_CBFS_SIZE))
635 FMAP_BIOS_SIZE := $(shell echo $(CONFIG_CBFS_SIZE) | tr A-F a-f)
636 # position and size of flashmap, relative to BIOS_BASE
637 FMAP_FMAP_BASE := 0
638 FMAP_FMAP_SIZE := 0x100
639 # position and size of CBFS, relative to BIOS_BASE
640 FMAP_CBFS_BASE := $(FMAP_FMAP_SIZE)
641 FMAP_CBFS_SIZE := $(call int-subtract, $(FMAP_BIOS_SIZE) $(FMAP_FMAP_SIZE))
642 else # ifeq ($(CONFIG_ARCH_X86),y)
643 DEFAULT_FLASHMAP:=$(top)/util/cbfstool/default.fmd
644 # entire flash
645 FMAP_ROM_ADDR := 0
646 FMAP_ROM_SIZE := $(CONFIG_ROM_SIZE)
647 # entire "BIOS" region (everything directly of concern to the host system)
648 # relative to ROM_BASE
649 FMAP_BIOS_BASE := 0
650 FMAP_BIOS_SIZE := $(CONFIG_CBFS_SIZE)
651 # position and size of flashmap, relative to BIOS_BASE
652 FMAP_FMAP_BASE := 0x20000
653 FMAP_FMAP_SIZE := 0x100
654 # position and size of CBFS, relative to BIOS_BASE
655 FMAP_CBFS_BASE := $(call int-add,$(FMAP_FMAP_BASE) $(FMAP_FMAP_SIZE))
656 FMAP_CBFS_SIZE := $(call int-subtract,$(FMAP_BIOS_SIZE) $(FMAP_CBFS_BASE))
657 endif # ifeq ($(CONFIG_ARCH_X86),y)
659 $(obj)/fmap.fmd: $(top)/Makefile.inc $(DEFAULT_FLASHMAP) $(obj)/config.h
660         sed -e "s,##ROM_BASE##,$(FMAP_ROM_ADDR)," \
661             -e "s,##ROM_SIZE##,$(FMAP_ROM_SIZE)," \
662             -e "s,##BIOS_BASE##,$(FMAP_BIOS_BASE)," \
663             -e "s,##BIOS_SIZE##,$(FMAP_BIOS_SIZE)," \
664             -e "s,##FMAP_BASE##,$(FMAP_FMAP_BASE)," \
665             -e "s,##FMAP_SIZE##,$(FMAP_FMAP_SIZE)," \
666             -e "s,##CBFS_BASE##,$(FMAP_CBFS_BASE)," \
667             -e "s,##CBFS_SIZE##,$(FMAP_CBFS_SIZE)," \
668                 $(DEFAULT_FLASHMAP) > $@.tmp
669         mv $@.tmp $@
670 else # ifeq ($(CONFIG_FMDFILE),)
671 $(obj)/fmap.fmd: $(CONFIG_FMDFILE) $(obj)/config.h
672         cp $< $@
673 endif # ifeq ($(CONFIG_FMDFILE),)
675 # generated at the same time as fmap.fmap
676 $(obj)/fmap.h: $(obj)/fmap.fmap
677 $(obj)/fmap.desc: $(obj)/fmap.fmap
679 $(obj)/fmap.fmap: $(obj)/fmap.fmd $(FMAPTOOL)
680         echo "    FMAP       $(FMAPTOOL) -h $(obj)/fmap.h $< $@"
681         $(FMAPTOOL) -h $(obj)/fmap.h -R $(obj)/fmap.desc $< $@
683 $(obj)/coreboot.pre: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL) $$(cpu_ucode_cbfs_file) $(obj)/fmap.fmap $(obj)/fmap.desc
684         $(CBFSTOOL) $@.tmp create -M $(obj)/fmap.fmap -r $(shell cat $(obj)/fmap.desc)
685 ifeq ($(CONFIG_ARCH_X86),y)
686         $(CBFSTOOL) $@.tmp add \
687                 -f $(objcbfs)/bootblock.bin \
688                 -n bootblock \
689                 -t bootblock \
690                 -b -$(call file-size,$(objcbfs)/bootblock.bin) $(cbfs-autogen-attributes)
691 else # ifeq ($(CONFIG_ARCH_X86),y)
692         # don't add bootblock to cbfs yet, it's just a waste of space
693         true $(CBFSTOOL) $@.tmp add \
694                 -f $(objcbfs)/bootblock.bin \
695                 -n bootblock \
696                 -t bootblock \
697                 -b 0
698         $(CBFSTOOL) $@.tmp write -u \
699                 -r BOOTBLOCK \
700                 -f $(objcbfs)/bootblock.bin
701         # make space for the CBFS master header pointer. "ptr_" is just
702         # arbitrary 4 bytes that will be overwritten by add-master-header.
703         printf "ptr_" > $@.tmp.2
704         $(CBFSTOOL) $@.tmp add \
705                 -f $@.tmp.2 \
706                 -n "header pointer" \
707                 -t "cbfs header" \
708                 -b -4
709         rm -f $@.tmp.2
710 endif # ifeq ($(CONFIG_ARCH_X86),y)
711         $(CBFSTOOL) $@.tmp add-master-header
712         $(prebuild-files) true
713         mv $@.tmp $@
714 else # ifneq ($(CONFIG_UPDATE_IMAGE),y)
715 .PHONY: $(obj)/coreboot.pre
716 $(obj)/coreboot.pre: $$(prebuilt-files) $(CBFSTOOL)
717         mv $(obj)/coreboot.rom $@.tmp || \
718         (echo "Error: You have UPDATE_IMAGE set in Kconfig, but have no existing image to update." && \
719         echo "Exiting." && \
720         false)
721         $(prebuild-files) true
722         mv $@.tmp $@
723 endif # ifneq ($(CONFIG_UPDATE_IMAGE),y)
725 ifeq ($(CONFIG_PAYLOAD_LINUX),y)
726 ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_COMMAND_LINE))),)
727       ADDITIONAL_PAYLOAD_CONFIG+=-C $(CONFIG_LINUX_COMMAND_LINE)
728 endif
729 ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD))),)
730       ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD)
731 endif
732 endif
734 ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y)
735 REFCODE_BLOB=$(obj)/refcode.rmod
736 $(REFCODE_BLOB): $(RMODTOOL)
737         $(RMODTOOL) -i $(CONFIG_REFCODE_BLOB_FILE) -o $@
738 endif
740 $(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/ramstage.elf $(CBFSTOOL) $$(INTERMEDIATE)
741         @printf "    CBFS       $(subst $(obj)/,,$(@))\n"
742 # The full ROM may be larger than the CBFS part, so create an empty
743 # file (filled with \377 = 0xff) and copy the CBFS image over it.
744         dd if=/dev/zero bs=$(call _toint,$(CONFIG_ROM_SIZE)) count=1 2> /dev/null | tr '\000' '\377' > $@.tmp
745         dd if=$(obj)/coreboot.pre of=$@.tmp bs=8192 conv=notrunc 2> /dev/null
746 ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),)
747 ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),0)
748         @printf "    SeaBIOS    Wait up to $(CONFIG_SEABIOS_PS2_TIMEOUT) ms for PS/2 keyboard controller initialization\n"
749         $(CBFSTOOL) $@.tmp add-int -i $(CONFIG_SEABIOS_PS2_TIMEOUT) -n etc/ps2-keyboard-spinup
750 endif
751 endif
752 ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y)
753 ifeq ($(CONFIG_CPU_MICROCODE_CBFS_GENERATE),y)
754         @printf "    UPDATE-FIT \n"
755         $(CBFSTOOL) $@.tmp update-fit -n cpu_microcode_blob.bin -x $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES)
756 endif
757 endif
758         mv $@.tmp $@
759         @printf "    CBFSPRINT  $(subst $(obj)/,,$(@))\n\n"
760         $(CBFSTOOL) $@ print
761 ifeq ($(CONFIG_IASL_WARNINGS_ARE_ERRORS),)
762         @printf "\n***** WARNING: IASL warnings as errors is disabled!  *****\n"
763         @printf "*****          Please fix the ASL for this platform. *****\n\n"
764 endif
766 cbfs-files-y += $(CONFIG_CBFS_PREFIX)/romstage
767 $(CONFIG_CBFS_PREFIX)/romstage-file := $(objcbfs)/romstage.elf
768 $(CONFIG_CBFS_PREFIX)/romstage-type := stage
769 $(CONFIG_CBFS_PREFIX)/romstage-compression := none
770 ifeq ($(CONFIG_ARCH_ROMSTAGE_ARM),y)
771 $(CONFIG_CBFS_PREFIX)/romstage-options := -b 0
772 endif
773 ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
774 # Use a 64 byte alignment to provide a minimum alignment
775 # requirement for the overall romstage. While the first object within
776 # romstage could have a 4 byte minimum alignment that doesn't mean the linker
777 # won't decide the entire section should be aligned to a larger value. In the
778 # future cbfstool should add XIP files proper and honor the alignment
779 # requirements of the program segment.
781 # Make sure that segment for .car.data is ignored while adding romstage.
782 $(CONFIG_CBFS_PREFIX)/romstage-align := 64
783 $(CONFIG_CBFS_PREFIX)/romstage-options := --xip -S .car.data -P $(CONFIG_XIP_ROM_SIZE)
784 endif
786 cbfs-files-y += $(CONFIG_CBFS_PREFIX)/ramstage
787 $(CONFIG_CBFS_PREFIX)/ramstage-file := $(objcbfs)/ramstage.elf
788 $(CONFIG_CBFS_PREFIX)/ramstage-type := stage
789 $(CONFIG_CBFS_PREFIX)/ramstage-compression := $(CBFS_COMPRESS_FLAG)
791 cbfs-files-y += $(CONFIG_CBFS_PREFIX)/payload
792 $(CONFIG_CBFS_PREFIX)/payload-file := $(CONFIG_PAYLOAD_FILE)
793 $(CONFIG_CBFS_PREFIX)/payload-type := payload
794 $(CONFIG_CBFS_PREFIX)/payload-compression := $(CBFS_PAYLOAD_COMPRESS_FLAG)
795 $(CONFIG_CBFS_PREFIX)/payload-options := $(ADDITIONAL_PAYLOAD_CONFIG)
797 cbfs-files-$(CONFIG_HAVE_REFCODE_BLOB) += $(CONFIG_CBFS_PREFIX)/refcode
798 $(CONFIG_CBFS_PREFIX)/refcode-file := $(REFCODE_BLOB)
799 $(CONFIG_CBFS_PREFIX)/refcode-type := stage
800 $(CONFIG_CBFS_PREFIX)/refcode-compression := $(CBFS_COMPRESS_FLAG)
802 cbfs-files-$(CONFIG_SEABIOS_VGA_COREBOOT) += vgaroms/seavgabios.bin
803 vgaroms/seavgabios.bin-file := $(CONFIG_PAYLOAD_VGABIOS_FILE)
804 vgaroms/seavgabios.bin-type := raw
806 cbfs-files-$(CONFIG_PXE_ROM) += pci$(CONFIG_PXE_ROM_ID).rom
807 pci$(CONFIG_PXE_ROM_ID).rom-file := $(CONFIG_PXE_ROM_FILE)
808 pci$(CONFIG_PXE_ROM_ID).rom-type := raw
810 cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += config
811 config-file := $(DOTCONFIG):defconfig
812 config-type := raw
814 cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += revision
815 revision-file := $(obj)/build.h
816 revision-type := raw
818 cbfs-files-$(CONFIG_BOOTSPLASH_IMAGE) += bootsplash.jpg
819 bootsplash.jpg-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE))
820 bootsplash.jpg-type := bootsplash
822 cbfs-files-$(CONFIG_BOARD_ID_MANUAL) += board_id
823 board_id-file := $(obj)/board_id
824 board_id-type := raw
826 $(obj)/board_id:
827         printf $(CONFIG_BOARD_ID_STRING) > $@
829 junit.xml:
830         echo "Building $(UTIL)"
831         echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp
832         echo "<testcase classname='$(UTIL)' name='$(UTIL)'>" >> $@.tmp
833         -$(MAKE) -j $(CPUS) -C "util/$(UTIL)" clean distclean > $@.tmp.2 2>&1
834         $(MAKE) -j $(CPUS) -C "util/$(UTIL)" >> $@.tmp.2 2>&1 && type="system-out" || type="failure"; \
835         cat $@.tmp.2; \
836         if [ "$$type" = "failure" ]; then \
837                 echo "<failure type='buildFailed'>" >> $@.tmp; \
838                 echo "Building $(UTIL) Failed"; \
839         else \
840                 echo "<$$type>" >> $@.tmp; \
841                 echo "Building $(UTIL) Succeeded"; \
842         fi; \
843         echo '<![CDATA[' >> $@.tmp; \
844         cat $@.tmp.2 >> $@.tmp; \
845         echo "]]></$$type>" >>$@.tmp
846         rm -f $@.tmp.2
847         echo "</testcase>" >> $@.tmp
848         echo "</testsuite>" >> $@.tmp
849         mv $@.tmp "util/$(UTIL)/$@"
850         echo
852 TOOLLIST= \
853         cbmem \
854         ectool \
855         futility \
856         inteltool \
857         intelvbttool \
858         nvramtool \
859         superiotool \
860         viatool
861 JENKINS_PAYLOAD?=none
862 CPUS?=4
863 what-jenkins-does:
864         util/lint/lint lint-stable --junit
865         util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD) -x -X $(top)/abuild-chromeos.xml
866         util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD)
867         (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml)
868         $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) UTIL="$(tool)" MFLAGS= MAKEFLAGS= junit.xml; )