Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 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. |
| 14 | ## |
| 15 | ## You should have received a copy of the GNU General Public License |
| 16 | ## along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | ## Foundation, Inc. |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 18 | ## |
| 19 | |
Patrick Georgi | c0e394b | 2015-03-04 15:02:03 +0100 | [diff] [blame] | 20 | GIT:=$(shell [ -d "$(top)/.git" ] && command -v git) |
| 21 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 22 | ####################################################################### |
| 23 | # misleadingly named, this is the coreboot version |
Patrick Georgi | c0e394b | 2015-03-04 15:02:03 +0100 | [diff] [blame] | 24 | export KERNELVERSION := $(strip $(if $(GIT),\ |
| 25 | $(shell git describe --dirty --always || git describe),\ |
Patrick Georgi | 492a075 | 2015-07-13 20:43:28 +0200 | [diff] [blame] | 26 | $(if $(wildcard $(top)/.coreboot-version),\ |
| 27 | $(shell cat $(top)/.coreboot-version),\ |
| 28 | coreboot-unknown$(KERNELREVISION)))) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 29 | |
| 30 | ####################################################################### |
| 31 | # Basic component discovery |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 32 | MAINBOARDDIR=$(call strip_quotes,$(CONFIG_MAINBOARD_DIR)) |
| 33 | export MAINBOARDDIR |
| 34 | |
Kyösti Mälkki | 0db2ae3a | 2012-04-19 12:00:06 +0300 | [diff] [blame] | 35 | ## Final build results, which CBFSTOOL uses to create the final |
| 36 | ## rom image file, are placed under $(objcbfs). |
| 37 | ## These typically have suffixes .debug .elf .bin and .map |
Stefan Reinauer | a60ca36 | 2012-08-09 11:09:44 -0700 | [diff] [blame] | 38 | export objcbfs := $(obj)/cbfs/$(call strip_quotes,$(CONFIG_CBFS_PREFIX)) |
Kyösti Mälkki | 0db2ae3a | 2012-04-19 12:00:06 +0300 | [diff] [blame] | 39 | |
| 40 | ## Based on the active configuration, Makefile conditionally collects |
| 41 | ## the required assembly includes and saves them in a file. |
| 42 | ## Such files that do not have a clear one-to-one relation to a source |
| 43 | ## file under src/ are placed and built under $(objgenerated) |
| 44 | export objgenerated := $(obj)/generated |
| 45 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 46 | ####################################################################### |
| 47 | # root rule to resolve if in build mode (ie. configuration exists) |
| 48 | real-target: $(obj)/config.h coreboot |
Patrick Georgi | 533c119 | 2014-07-10 09:42:03 +0200 | [diff] [blame] | 49 | coreboot: build-dirs $(obj)/coreboot.rom $(obj)/cbfstool $(obj)/rmodtool |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 50 | |
| 51 | ####################################################################### |
| 52 | # our phony targets |
Kyösti Mälkki | 0db2ae3a | 2012-04-19 12:00:06 +0300 | [diff] [blame] | 53 | PHONY+= clean-abuild coreboot lint lint-stable build-dirs |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 54 | |
| 55 | ####################################################################### |
| 56 | # root source directories of coreboot |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 57 | subdirs-y := src/lib src/commonlib/ src/console src/device src/acpi |
Stefan Reinauer | 77c04e9 | 2015-04-27 14:03:47 -0700 | [diff] [blame] | 58 | subdirs-y += src/ec/acpi $(wildcard src/ec/*/*) $(wildcard src/southbridge/*/*) |
Stefan Reinauer | e1133b7 | 2015-04-27 14:04:38 -0700 | [diff] [blame] | 59 | subdirs-y += $(wildcard src/soc/*/*) $(wildcard src/northbridge/*/*) |
Stefan Reinauer | 1d7b9de | 2015-04-19 12:48:25 -0700 | [diff] [blame] | 60 | subdirs-y += src/superio $(wildcard src/drivers/*) src/cpu src/vendorcode |
Daisuke Nojiri | e1741c5 | 2015-02-09 18:15:17 -0800 | [diff] [blame] | 61 | subdirs-y += util/cbfstool util/sconfig util/nvramtool util/broadcom |
Stefan Reinauer | 13e4182 | 2015-04-27 14:02:36 -0700 | [diff] [blame] | 62 | subdirs-y += $(wildcard src/arch/*) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 63 | subdirs-y += src/mainboard/$(MAINBOARDDIR) |
Stefan Reinauer | 0fa5d8f | 2015-06-30 17:09:17 -0700 | [diff] [blame] | 64 | subdirs-y += payloads/external |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 65 | |
Patrick Georgi | a25828d | 2011-09-02 09:57:01 +0200 | [diff] [blame] | 66 | subdirs-y += site-local |
| 67 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 68 | ####################################################################### |
| 69 | # Add source classes and their build options |
Patrick Georgi | 27ef602 | 2015-04-30 14:25:14 +0200 | [diff] [blame] | 70 | classes-y := ramstage romstage bootblock smm smmstub cpu_microcode libverstage verstage secmon |
Furquan Shaikh | 133096b | 2014-07-31 09:28:55 -0700 | [diff] [blame] | 71 | |
| 72 | # Add dynamic classes for rmodules |
| 73 | $(foreach supported_arch,$(ARCH_SUPPORTED), \ |
| 74 | $(eval $(call define_class,rmodules_$(supported_arch),$(supported_arch)))) |
Aaron Durbin | dde7629 | 2015-09-05 12:59:26 -0500 | [diff] [blame] | 75 | # Provide a macro to determine environment for free standing rmodules. |
| 76 | $(foreach supported_arch,$(ARCH_SUPPORTED), \ |
| 77 | $(eval rmodules_$(supported_arch)-generic-ccopts += -D__RMODULE__)) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 78 | |
Patrick Georgi | f33e395 | 2012-11-25 17:10:47 +0100 | [diff] [blame] | 79 | ####################################################################### |
Martin Roth | 47abc54 | 2015-07-03 12:54:14 -0600 | [diff] [blame] | 80 | # Helper functions for math and various file placement matters. |
| 81 | # macros work on all formats understood by printf(1) |
| 82 | # values are space separated if using more than one value |
Patrick Georgi | 3eefeea | 2014-11-12 19:11:50 +0100 | [diff] [blame] | 83 | # |
Martin Roth | 47abc54 | 2015-07-03 12:54:14 -0600 | [diff] [blame] | 84 | # int-add: adds an arbitrary length list of integers |
| 85 | # int-subtract: subtracts the the second of two integers from the first |
| 86 | # int-multiply: multiplies an arbitrary length list of integers |
| 87 | # int-divide: divides the first integer by the second |
| 88 | # int-remainder: arithmetic remainder of the first number divided by the second |
| 89 | # int-lt: 1 if the first value is less than the second. 0 otherwise |
| 90 | # int-gt: 1 if the first values is greater than the second. 0 otherwise |
| 91 | # int-eq: 1 if the two values are equal. 0 otherwise |
| 92 | # int-align: align $1 to $2 units |
| 93 | # file-size: returns the filesize of the given file |
Patrick Georgi | 3eefeea | 2014-11-12 19:11:50 +0100 | [diff] [blame] | 94 | _toint=$(shell printf "%d" $1) |
| 95 | _int-add2=$(shell expr $(call _toint,$1) + $(call _toint,$2)) |
| 96 | 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))) |
Martin Roth | 47abc54 | 2015-07-03 12:54:14 -0600 | [diff] [blame] | 97 | int-subtract=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) - $(call _toint,$(word 2,$1)))) |
| 98 | _int-multiply2=$(shell expr $(call _toint,$1) \* $(call _toint,$2)) |
| 99 | 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))) |
| 100 | int-divide=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) / $(call _toint,$(word 2,$1)))) |
| 101 | int-remainder=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) % $(call _toint,$(word 2,$1)))) |
| 102 | int-lt=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) \< $(call _toint,$(word 2,$1)))) |
| 103 | int-gt=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) \> $(call _toint,$(word 2,$1)))) |
| 104 | int-eq=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) = $(call _toint,$(word 2,$1)))) |
Patrick Georgi | a234f45 | 2014-12-03 11:20:51 +0100 | [diff] [blame] | 105 | int-align=$(shell A=$(call _toint,$1) B=$(call _toint,$2); expr $$A + \( \( $$B - \( $$A % $$B \) \) % $$B \) ) |
Patrick Georgi | 3eefeea | 2014-11-12 19:11:50 +0100 | [diff] [blame] | 106 | file-size=$(shell cat $1 | wc -c) |
| 107 | |
| 108 | ####################################################################### |
Patrick Georgi | f33e395 | 2012-11-25 17:10:47 +0100 | [diff] [blame] | 109 | # Helper functions for ramstage postprocess |
| 110 | spc := |
| 111 | spc += |
| 112 | $(spc) := |
| 113 | $(spc) += |
| 114 | |
| 115 | # files-in-dir-recursive,dir,files |
| 116 | files-in-dir-recursive=$(filter $(1)%,$(2)) |
| 117 | |
| 118 | # parent-dir,dir/ |
Patrick Georgi | 1f94670 | 2014-05-21 22:36:13 +0200 | [diff] [blame] | 119 | parent-dir=$(dir $(if $(patsubst /%,,$(1)),,/)$(subst $( ),/,$(strip $(subst /, ,$(1))))) |
Patrick Georgi | f33e395 | 2012-11-25 17:10:47 +0100 | [diff] [blame] | 120 | |
| 121 | # filters out exactly the directory specified |
| 122 | # filter-out-dir,dir_to_keep,dirs |
| 123 | filter-out-dir=$(filter-out $(1),$(2)) |
| 124 | |
| 125 | # filters out dir_to_keep and all its parents |
| 126 | # filter-out-dirs,dir_to_keep,dirs |
Patrick Georgi | 1f94670 | 2014-05-21 22:36:13 +0200 | [diff] [blame] | 127 | 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))) |
Patrick Georgi | f33e395 | 2012-11-25 17:10:47 +0100 | [diff] [blame] | 128 | |
| 129 | # dir-wildcards,dirs |
| 130 | dir-wildcards=$(addsuffix %,$(1)) |
| 131 | |
| 132 | # files-in-dir,dir,files |
Patrick Georgi | 1f94670 | 2014-05-21 22:36:13 +0200 | [diff] [blame] | 133 | files-in-dir=$(filter-out $(call dir-wildcards,$(call filter-out-dirs,$(1),$(sort $(dir $(2))))),$(call files-in-dir-recursive,$(1),$(2))) |
Patrick Georgi | f33e395 | 2012-11-25 17:10:47 +0100 | [diff] [blame] | 134 | |
| 135 | ####################################################################### |
| 136 | # reduce command line length by linking the objects of each |
| 137 | # directory into an intermediate file |
Julius Werner | f97b88b | 2014-12-05 12:32:09 -0800 | [diff] [blame] | 138 | ramstage-postprocess=$$(eval DEPENDENCIES+=$$(addsuffix .d,$$(basename $(1)))) \ |
| 139 | $(foreach d,$(sort $(dir $(filter-out %.ld,$(1)))), \ |
Patrick Georgi | eec8dfb | 2015-05-07 22:24:41 +0200 | [diff] [blame] | 140 | $(eval $(d)ramstage.a: $(call files-in-dir,$(d),$(filter-out %.ld,$(1))); rm -f $$@ && $(AR_ramstage) rcsT $$@ $$^ ) \ |
| 141 | $(eval ramstage-objs:=$(d)ramstage.a $(filter-out $(filter-out %.ld, $(call files-in-dir,$(d),$(1))),$(ramstage-objs)))) |
Patrick Georgi | f33e395 | 2012-11-25 17:10:47 +0100 | [diff] [blame] | 142 | |
Julius Werner | 015f0ae | 2014-09-15 22:10:33 -0700 | [diff] [blame] | 143 | bootblock-generic-ccopts += -D__PRE_RAM__ -D__BOOTBLOCK__ |
| 144 | romstage-generic-ccopts += -D__PRE_RAM__ -D__ROMSTAGE__ |
| 145 | ramstage-generic-ccopts += -D__RAMSTAGE__ |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 146 | ifeq ($(CONFIG_TRACE),y) |
Julius Werner | 015f0ae | 2014-09-15 22:10:33 -0700 | [diff] [blame] | 147 | ramstage-c-ccopts += -finstrument-functions |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 148 | endif |
Stefan Reinauer | d37ab45 | 2012-12-18 16:23:28 -0800 | [diff] [blame] | 149 | ifeq ($(CONFIG_COVERAGE),y) |
Julius Werner | 015f0ae | 2014-09-15 22:10:33 -0700 | [diff] [blame] | 150 | ramstage-c-ccopts += -fprofile-arcs -ftest-coverage |
Stefan Reinauer | d37ab45 | 2012-12-18 16:23:28 -0800 | [diff] [blame] | 151 | endif |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 152 | |
Martin Roth | 90105d5 | 2015-02-12 19:34:11 -0700 | [diff] [blame] | 153 | # try to fetch non-optional submodules if the source is under git |
Patrick Georgi | c0e394b | 2015-03-04 15:02:03 +0100 | [diff] [blame] | 154 | forgetthis:=$(if $(GIT),$(shell git submodule update --init)) |
Patrick Georgi | 7e9b9d8 | 2012-04-30 21:06:10 +0200 | [diff] [blame] | 155 | ifeq ($(CONFIG_USE_BLOBS),y) |
Patrick Georgi | 26e24cc | 2015-05-05 22:27:25 +0200 | [diff] [blame] | 156 | # this is necessary because 3rdparty/blobs is update=none, and so is ignored |
Patrick Georgi | 8888316 | 2014-10-29 15:50:32 +0100 | [diff] [blame] | 157 | # unless explicitly requested and enabled through --checkout |
Patrick Georgi | 26e24cc | 2015-05-05 22:27:25 +0200 | [diff] [blame] | 158 | forgetthis:=$(if $(GIT),$(shell git submodule update --init --checkout 3rdparty/blobs)) |
Patrick Georgi | 7e9b9d8 | 2012-04-30 21:06:10 +0200 | [diff] [blame] | 159 | endif |
| 160 | |
Patrick Georgi | 57205c7 | 2011-03-08 20:49:18 +0000 | [diff] [blame] | 161 | ramstage-c-deps:=$$(OPTION_TABLE_H) |
| 162 | romstage-c-deps:=$$(OPTION_TABLE_H) |
Patrick Georgi | 27ef602 | 2015-04-30 14:25:14 +0200 | [diff] [blame] | 163 | libverstage-c-deps:=$$(OPTION_TABLE_H) |
Stefan Reinauer | 77b1655 | 2015-01-14 19:51:47 +0100 | [diff] [blame] | 164 | verstage-c-deps:=$$(OPTION_TABLE_H) |
Hung-Te Lin | fe18792 | 2013-02-01 01:09:24 +0800 | [diff] [blame] | 165 | bootblock-c-deps:=$$(OPTION_TABLE_H) |
Patrick Georgi | 57205c7 | 2011-03-08 20:49:18 +0000 | [diff] [blame] | 166 | |
Patrick Georgi | 990e7c9 | 2015-04-03 10:47:15 +0200 | [diff] [blame] | 167 | # Add handler to copy linker scripts |
| 168 | define generic-objs_ld_template_gen |
| 169 | de$(EMPTY)fine $(1)-objs_ld_template |
Patrick Georgi | 828e0e8 | 2015-04-04 15:50:20 +0200 | [diff] [blame] | 170 | $$(call src-to-obj,$1,$$(1).ld): $$(1).ld $(obj)/config.h |
Patrick Georgi | 990e7c9 | 2015-04-03 10:47:15 +0200 | [diff] [blame] | 171 | @printf " CP $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
Patrick Georgi | 828e0e8 | 2015-04-04 15:50:20 +0200 | [diff] [blame] | 172 | $$(CC_$(1)) $$(CPPFLAGS_$(1)) $($(1)-ld-ccopts) $(PREPROCESS_ONLY) -include $(obj)/config.h $$$$< > $$$$@.tmp |
| 173 | mv $$$$@.tmp $$$$@ |
Patrick Georgi | 990e7c9 | 2015-04-03 10:47:15 +0200 | [diff] [blame] | 174 | en$(EMPTY)def |
| 175 | endef |
| 176 | |
Patrick Georgi | ef345c2 | 2015-04-27 18:01:12 +0200 | [diff] [blame] | 177 | # Add handler to deal with archives |
| 178 | define generic-objs_a_template_gen |
| 179 | de$(EMPTY)fine $(1)-objs_a_template |
| 180 | $$(call src-to-obj,$1,$$(1).a): $$(1).a |
| 181 | @printf " CP $$$$(subst $$$$(obj)/,,$$$$(@))\n" |
| 182 | cp $$$$< $$$$@.tmp |
| 183 | mv $$$$@.tmp $$$$@ |
| 184 | en$(EMPTY)def |
| 185 | endef |
| 186 | |
Patrick Georgi | f430546 | 2015-04-03 10:39:05 +0200 | [diff] [blame] | 187 | # Add handler to add no rules for manual files |
| 188 | define generic-objs_manual_template_gen |
| 189 | # do nothing |
| 190 | endef |
| 191 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 192 | ####################################################################### |
| 193 | # Add handler to compile ACPI's ASL |
Aaron Durbin | ab454c6 | 2015-07-30 12:44:58 -0500 | [diff] [blame] | 194 | # arg1: base file name |
| 195 | # arg2: y or n for including in cbfs. defaults to y |
Vladimir Serbinenko | 36f8d27 | 2015-05-31 12:31:59 +0200 | [diff] [blame] | 196 | define asl_template |
| 197 | $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml-file = $(obj)/$(1).aml |
| 198 | $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml-type = raw |
| 199 | $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml-compression = none |
Aaron Durbin | ab454c6 | 2015-07-30 12:44:58 -0500 | [diff] [blame] | 200 | cbfs-files-$(if $(2),$(2),y) += $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/$(1).aml |
Vladimir Serbinenko | 36f8d27 | 2015-05-31 12:31:59 +0200 | [diff] [blame] | 201 | $(obj)/$(1).aml: $(src)/mainboard/$(MAINBOARDDIR)/$(1).asl $(obj)/config.h |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 202 | @printf " IASL $$(subst $(top)/,,$$(@))\n" |
Patrick Georgi | 26de112 | 2015-04-07 17:40:42 +0200 | [diff] [blame] | 203 | $(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 $$@ |
Vladimir Serbinenko | 36f8d27 | 2015-05-31 12:31:59 +0200 | [diff] [blame] | 204 | cd $$(dir $$@); $(IASL) -p $$(notdir $$@) $$(notdir $$@) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 205 | endef |
| 206 | |
| 207 | ####################################################################### |
Patrick Georgi | 3bbd2bf | 2012-03-09 12:30:07 +0100 | [diff] [blame] | 208 | # Parse plaintext cmos defaults into binary format |
| 209 | # arg1: source file |
| 210 | # arg2: binary file name |
| 211 | cbfs-files-processor-nvramtool= \ |
| 212 | $(eval $(2): $(1) $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout | $(objutil)/nvramtool/nvramtool ; \ |
| 213 | printf " CREATE $(2) (from $(1))\n"; $(objutil)/nvramtool/nvramtool -y $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout -D $(2).tmp -p $(1) && mv $(2).tmp $(2)) |
| 214 | |
| 215 | ####################################################################### |
Patrick Georgi | 843005c | 2012-04-30 23:15:17 +0200 | [diff] [blame] | 216 | # Link VSA binary to ELF-ish stage |
| 217 | # arg1: source file |
| 218 | # arg2: binary file name |
| 219 | cbfs-files-processor-vsa= \ |
| 220 | $(eval $(2): $(1) ; \ |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 221 | printf " CREATE $(2) (from $(1))\n"; $(OBJCOPY_ramstage) --set-start 0x20 --adjust-vma 0x60000 -I binary -O elf32-i386 -B i386 $(1) $(2).tmp && $(LD_ramstage) -m elf_i386 -e 0x60020 --section-start .data=0x60000 $(2).tmp -o $(2)) |
Patrick Georgi | 843005c | 2012-04-30 23:15:17 +0200 | [diff] [blame] | 222 | |
| 223 | ####################################################################### |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 224 | # Add handler for arbitrary files in CBFS |
| 225 | $(call add-special-class,cbfs-files) |
| 226 | cbfs-files-handler= \ |
Patrick Georgi | 3bbd2bf | 2012-03-09 12:30:07 +0100 | [diff] [blame] | 227 | $(eval tmp-cbfs-method:=$(word 2, $(subst :, ,$($(2)-file)))) \ |
Patrick Georgi | 1fc2bda | 2012-11-15 14:51:54 +0100 | [diff] [blame] | 228 | $(eval $(2)-file:=$(call strip_quotes,$(word 1, $(subst :, ,$($(2)-file))))) \ |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 229 | $(if $(wildcard $(1)$($(2)-file)), \ |
| 230 | $(eval tmp-cbfs-file:= $(wildcard $(1)$($(2)-file))), \ |
| 231 | $(eval tmp-cbfs-file:= $($(2)-file))) \ |
Patrick Georgi | 70c85ea | 2013-02-16 01:06:57 +0100 | [diff] [blame] | 232 | $(if $(strip $($(2)-required)), \ |
| 233 | $(if $(wildcard $(tmp-cbfs-file)),, \ |
| 234 | $(info This build configuration requires $($(2)-required)) \ |
| 235 | $(eval FAILBUILD:=1) \ |
| 236 | )) \ |
Patrick Georgi | 5839635 | 2014-12-09 12:49:21 +0100 | [diff] [blame] | 237 | $(if $(strip $($(2)-align)), \ |
| 238 | $(if $(strip $($(2)-position)), \ |
| 239 | $(info ERROR: It is not allowed to specify both alignment and position for $($(2)-file)) \ |
| 240 | $(eval FAILBUILD:=1) \ |
| 241 | )) \ |
Patrick Georgi | 3bbd2bf | 2012-03-09 12:30:07 +0100 | [diff] [blame] | 242 | $(if $(tmp-cbfs-method), \ |
| 243 | $(eval tmp-old-cbfs-file:=$(tmp-cbfs-file)) \ |
Patrick Georgi | 16c7ad7 | 2012-09-21 18:11:59 +0200 | [diff] [blame] | 244 | $(eval tmp-cbfs-file:=$(shell mkdir -p $(obj)/mainboard/$(MAINBOARDDIR); mktemp $(obj)/mainboard/$(MAINBOARDDIR)/cbfs-file.XXXXXX).out) \ |
Patrick Georgi | 3bbd2bf | 2012-03-09 12:30:07 +0100 | [diff] [blame] | 245 | $(call cbfs-files-processor-$(tmp-cbfs-method),$(tmp-old-cbfs-file),$(tmp-cbfs-file))) \ |
Kyösti Mälkki | d4665ae | 2014-12-23 15:10:08 +0100 | [diff] [blame] | 246 | $(eval cbfs-files += $(tmp-cbfs-file)|$(2)|$($(2)-type)|$($(2)-compression)|$(strip $($(2)-position))|$($(2)-align))\ |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 247 | $(eval $(2)-name:=) \ |
| 248 | $(eval $(2)-type:=) \ |
Dave Frodin | 0013bbf | 2012-08-14 11:01:53 -0600 | [diff] [blame] | 249 | $(eval $(2)-compression:=) \ |
Patrick Georgi | 70c85ea | 2013-02-16 01:06:57 +0100 | [diff] [blame] | 250 | $(eval $(2)-position:=) \ |
Patrick Georgi | 5839635 | 2014-12-09 12:49:21 +0100 | [diff] [blame] | 251 | $(eval $(2)-required:=) \ |
| 252 | $(eval $(2)-align:=) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 253 | |
| 254 | ####################################################################### |
| 255 | # a variety of flags for our build |
Stefan Reinauer | 6321758 | 2012-10-29 16:52:36 -0700 | [diff] [blame] | 256 | CBFS_COMPRESS_FLAG:=none |
Sven Schnelle | 8eee19d | 2011-05-02 19:53:04 +0000 | [diff] [blame] | 257 | ifeq ($(CONFIG_COMPRESS_RAMSTAGE),y) |
Stefan Reinauer | 6321758 | 2012-10-29 16:52:36 -0700 | [diff] [blame] | 258 | CBFS_COMPRESS_FLAG:=LZMA |
Sven Schnelle | 8eee19d | 2011-05-02 19:53:04 +0000 | [diff] [blame] | 259 | endif |
| 260 | |
Stefan Reinauer | 6321758 | 2012-10-29 16:52:36 -0700 | [diff] [blame] | 261 | CBFS_PAYLOAD_COMPRESS_FLAG:=none |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 262 | ifeq ($(CONFIG_COMPRESSED_PAYLOAD_LZMA),y) |
Stefan Reinauer | 6321758 | 2012-10-29 16:52:36 -0700 | [diff] [blame] | 263 | CBFS_PAYLOAD_COMPRESS_FLAG:=LZMA |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 264 | endif |
| 265 | |
| 266 | ifneq ($(CONFIG_LOCALVERSION),"") |
Martin Roth | e236204 | 2015-02-12 19:32:41 -0700 | [diff] [blame] | 267 | export COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION)) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 268 | endif |
| 269 | |
Aaron Durbin | dc9f5cd | 2015-09-08 13:34:43 -0500 | [diff] [blame] | 270 | CPPFLAGS_common := -Isrc -Isrc/include -Isrc/commonlib/include -I$(obj) |
Patrick Georgi | 58f73a6 | 2014-05-17 14:00:12 +0200 | [diff] [blame] | 271 | CPPFLAGS_common += -Isrc/device/oprom/include |
| 272 | CPPFLAGS_common += -include $(src)/include/kconfig.h |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 273 | |
Vadim Bendebury | 55cdc16 | 2014-04-22 17:06:43 -0700 | [diff] [blame] | 274 | CFLAGS_common += -pipe -g -nostdinc |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 275 | CFLAGS_common += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes |
| 276 | CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs |
Paul Menzel | 23b4e4c | 2015-04-08 10:53:39 +0200 | [diff] [blame] | 277 | CFLAGS_common += -Wstrict-aliasing -Wshadow |
Stefan Reinauer | d146ac6 | 2015-07-31 13:50:03 -0700 | [diff] [blame] | 278 | CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer |
| 279 | CFLAGS_common += -ffunction-sections -fdata-sections |
Paul Menzel | 23b4e4c | 2015-04-08 10:53:39 +0200 | [diff] [blame] | 280 | |
Aaron Durbin | d4dd44c | 2015-09-06 10:15:17 -0500 | [diff] [blame] | 281 | LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static --emit-relocs |
| 282 | |
Paul Menzel | 23b4e4c | 2015-04-08 10:53:39 +0200 | [diff] [blame] | 283 | ifeq ($(CONFIG_COMPILER_GCC),y) |
| 284 | # cf. commit f69a99db (coreboot: x86: enable gc-sections) |
| 285 | CFLAGS_common += -Wno-unused-but-set-variable |
| 286 | endif |
| 287 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 288 | ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 289 | CFLAGS_common += -Werror |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 290 | endif |
Vadim Bendebury | 55cdc16 | 2014-04-22 17:06:43 -0700 | [diff] [blame] | 291 | ifneq ($(GDB_DEBUG),) |
Stefan Reinauer | 87200e2 | 2015-03-15 00:21:17 +0100 | [diff] [blame] | 292 | CFLAGS_common += -Og |
Vadim Bendebury | 55cdc16 | 2014-04-22 17:06:43 -0700 | [diff] [blame] | 293 | else |
| 294 | CFLAGS_common += -Os |
| 295 | endif |
| 296 | |
Nico Huber | a15cd66 | 2013-06-19 16:16:05 +0200 | [diff] [blame] | 297 | additional-dirs := $(objutil)/cbfstool $(objutil)/romcc $(objutil)/ifdtool \ |
Isaac Christensen | 3a92be7 | 2014-09-08 15:28:17 -0600 | [diff] [blame] | 298 | $(objutil)/ifdfake $(objutil)/options $(objutil)/fletcher \ |
Paul Burton | b1688ca | 2014-06-14 00:09:49 +0100 | [diff] [blame] | 299 | $(objutil)/cbootimage $(objutil)/bimgtool |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 300 | |
| 301 | ####################################################################### |
| 302 | # generate build support files |
| 303 | $(obj)/build.h: .xcompile |
| 304 | @printf " GEN build.h\n" |
| 305 | rm -f $(obj)/build.h |
Martin Roth | e236204 | 2015-02-12 19:32:41 -0700 | [diff] [blame] | 306 | util/genbuild_h/genbuild_h.sh > $(obj)/build.ht |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 307 | mv $(obj)/build.ht $(obj)/build.h |
| 308 | |
Kyösti Mälkki | 0db2ae3a | 2012-04-19 12:00:06 +0300 | [diff] [blame] | 309 | build-dirs: |
| 310 | mkdir -p $(objcbfs) $(objgenerated) |
| 311 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 312 | ####################################################################### |
| 313 | # Build the tools |
Patrick Georgi | 533c119 | 2014-07-10 09:42:03 +0200 | [diff] [blame] | 314 | CBFSTOOL:=$(objutil)/cbfstool/cbfstool |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 315 | FMAPTOOL:=$(objutil)/cbfstool/fmaptool |
Patrick Georgi | 533c119 | 2014-07-10 09:42:03 +0200 | [diff] [blame] | 316 | RMODTOOL:=$(objutil)/cbfstool/rmodtool |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 317 | |
Patrick Georgi | 533c119 | 2014-07-10 09:42:03 +0200 | [diff] [blame] | 318 | $(obj)/cbfstool: $(CBFSTOOL) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 319 | cp $< $@ |
| 320 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 321 | $(obj)/fmaptool: $(FMAPTOOL) |
| 322 | cp $< $@ |
| 323 | |
Patrick Georgi | 533c119 | 2014-07-10 09:42:03 +0200 | [diff] [blame] | 324 | $(obj)/rmodtool: $(RMODTOOL) |
Aaron Durbin | 3eb8eb7 | 2014-03-10 16:13:58 -0500 | [diff] [blame] | 325 | cp $< $@ |
| 326 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 327 | _WINCHECK=$(shell uname -o 2> /dev/null) |
| 328 | STACK= |
| 329 | ifeq ($(_WINCHECK),Msys) |
| 330 | STACK=-Wl,--stack,16384000 |
| 331 | endif |
| 332 | ifeq ($(_WINCHECK),Cygwin) |
| 333 | STACK=-Wl,--stack,16384000 |
| 334 | endif |
| 335 | |
Patrick Georgi | e24a119 | 2014-05-17 19:05:56 +0200 | [diff] [blame] | 336 | # this allows ccache to prepend itself |
| 337 | # (ccache handling happens first) |
| 338 | ROMCC_BIN= $(objutil)/romcc/romcc |
| 339 | ROMCC?=$(ROMCC_BIN) |
| 340 | $(ROMCC_BIN): $(top)/util/romcc/romcc.c |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 341 | @printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n" |
| 342 | @# Note: Adding -O2 here might cause problems. For details see: |
| 343 | @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html |
| 344 | $(HOSTCC) -g $(STACK) -Wall -o $@ $< |
| 345 | |
Stefan Reinauer | 5b63579 | 2012-08-16 14:05:42 -0700 | [diff] [blame] | 346 | IFDTOOL:=$(objutil)/ifdtool/ifdtool |
| 347 | $(IFDTOOL): $(top)/util/ifdtool/ifdtool.c |
| 348 | @printf " HOSTCC $(subst $(obj)/,,$(@))\n" |
| 349 | $(HOSTCC) $(HOSTCFLAGS) -o $@ $< |
| 350 | |
Nico Huber | a15cd66 | 2013-06-19 16:16:05 +0200 | [diff] [blame] | 351 | IFDFAKE:=$(objutil)/ifdfake/ifdfake |
| 352 | $(IFDFAKE): $(top)/util/ifdfake/ifdfake.c |
| 353 | @printf " HOSTCC $(subst $(obj)/,,$(@))\n" |
| 354 | $(HOSTCC) $(HOSTCFLAGS) -o $@ $< |
| 355 | |
Bruce Griffith | 1a59039 | 2014-08-10 17:09:15 -0600 | [diff] [blame] | 356 | FLETCHER:=$(objutil)/fletcher/fletcher |
| 357 | $(FLETCHER): $(top)/util/fletcher/fletcher.c |
| 358 | @printf " HOSTCC $(subst $(obj)/,,$(@))\n" |
| 359 | $(HOSTCC) $(HOSTCFLAGS) -o $@ $< |
| 360 | |
Isaac Christensen | 3a92be7 | 2014-09-08 15:28:17 -0600 | [diff] [blame] | 361 | CBOOTIMAGE:=$(objutil)/cbootimage/cbootimage |
| 362 | |
Patrick Georgi | 758f26a | 2014-09-27 11:37:46 +0200 | [diff] [blame] | 363 | subdirs-y += util/nvidia |
Isaac Christensen | 3a92be7 | 2014-09-08 15:28:17 -0600 | [diff] [blame] | 364 | |
Paul Burton | b1688ca | 2014-06-14 00:09:49 +0100 | [diff] [blame] | 365 | BIMGTOOL:=$(objutil)/bimgtool/bimgtool |
| 366 | $(BIMGTOOL): $(top)/util/bimgtool/bimgtool.c |
| 367 | @printf " HOSTCC $(subst $(obj)/,,$(@))\n" |
| 368 | $(HOSTCC) $(HOSTCFLAGS) -o $@ $< |
| 369 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 370 | ####################################################################### |
| 371 | # needed objects that every mainboard uses |
| 372 | # Creation of these is architecture and mainboard independent |
| 373 | $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(objutil)/sconfig/sconfig |
| 374 | @printf " SCONFIG $(subst $(src)/,,$(<))\n" |
| 375 | mkdir -p $(obj)/mainboard/$(MAINBOARDDIR) |
| 376 | $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR) |
| 377 | |
| 378 | ramstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c |
Stefan Reinauer | 57879c9 | 2012-07-31 16:47:25 -0700 | [diff] [blame] | 379 | romstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 380 | verstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 381 | |
Patrick Georgi | 64ccc3b8 | 2011-05-20 23:08:12 +0000 | [diff] [blame] | 382 | $(obj)/%.ramstage.o $(abspath $(obj))/%.ramstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H) |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 383 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Marc Jones | a38ccfd | 2014-11-06 15:50:22 -0700 | [diff] [blame] | 384 | $(CC_ramstage) -MMD $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) $(ramstage-c-ccopts) -c -o $@ $< |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 385 | |
Stefan Reinauer | 57879c9 | 2012-07-31 16:47:25 -0700 | [diff] [blame] | 386 | $(obj)/%.romstage.o $(abspath $(obj))/%.romstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H) |
| 387 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Marc Jones | a38ccfd | 2014-11-06 15:50:22 -0700 | [diff] [blame] | 388 | $(CC_romstage) -MMD $(CFLAGS_romstage) $(CPPFLAGS_romstage) $(romstage-c-ccopts) -c -o $@ $< |
Stefan Reinauer | 57879c9 | 2012-07-31 16:47:25 -0700 | [diff] [blame] | 389 | |
Hung-Te Lin | fe18792 | 2013-02-01 01:09:24 +0800 | [diff] [blame] | 390 | $(obj)/%.bootblock.o $(abspath $(obj))/%.bootblock.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H) |
| 391 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Marc Jones | a38ccfd | 2014-11-06 15:50:22 -0700 | [diff] [blame] | 392 | $(CC_bootblock) -MMD $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) $(bootblock-c-ccopts) -c -o $@ $< |
Hung-Te Lin | fe18792 | 2013-02-01 01:09:24 +0800 | [diff] [blame] | 393 | |
Patrick Georgi | 27ef602 | 2015-04-30 14:25:14 +0200 | [diff] [blame] | 394 | $(objgenerated)/libverstage.a: $$(libverstage-objs) |
Patrick Georgi | ba80887 | 2015-04-27 18:09:22 +0200 | [diff] [blame] | 395 | rm -f $@ |
Patrick Georgi | b11be32 | 2015-05-07 22:27:01 +0200 | [diff] [blame] | 396 | $(AR_libverstage) rcsT $@ $^ |
Patrick Georgi | ba80887 | 2015-04-27 18:09:22 +0200 | [diff] [blame] | 397 | |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 398 | ####################################################################### |
| 399 | # Clean up rules |
| 400 | clean-abuild: |
| 401 | rm -rf coreboot-builds |
| 402 | |
| 403 | clean-for-update-target: |
Furquan Shaikh | 20f25dd | 2014-04-22 10:41:05 -0700 | [diff] [blame] | 404 | rm -f $(obj)/ramstage* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 405 | rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.* |
| 406 | rm -f $(obj)/option_table.* $(obj)/crt0.S $(obj)/ldscript |
| 407 | rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot |
| 408 | rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm |
| 409 | rm -f $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc |
| 410 | rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.* |
| 411 | rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm |
Martin Roth | 501005f | 2015-06-24 20:03:08 -0600 | [diff] [blame] | 412 | $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc clean |
Patrick Georgi | 71b8480 | 2011-02-22 14:35:05 +0000 | [diff] [blame] | 413 | |
| 414 | clean-target: |
| 415 | rm -f $(obj)/coreboot* |
| 416 | |
| 417 | ####################################################################### |
| 418 | # Development utilities |
| 419 | printcrt0s: |
| 420 | @echo crt0s=$(crt0s) |
| 421 | @echo ldscripts=$(ldscripts) |
| 422 | |
| 423 | update: |
| 424 | dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF |
| 425 | |
Patrick Georgi | cb02cb7 | 2012-02-25 19:42:59 +0100 | [diff] [blame] | 426 | lint lint-stable: |
Martin Roth | e4fc407 | 2015-10-13 13:40:59 -0600 | [diff] [blame] | 427 | util/lint/lint $@ |
Patrick Georgi | 6c44550 | 2011-05-16 15:32:28 +0000 | [diff] [blame] | 428 | |
Patrick Georgi | bb60528 | 2011-06-05 15:15:49 +0200 | [diff] [blame] | 429 | gitconfig: |
Patrick Georgi | 1b770fb | 2015-03-04 15:03:05 +0100 | [diff] [blame] | 430 | [ -d .git ] |
Zheng Bao | 50ad095 | 2012-10-22 16:29:37 +0800 | [diff] [blame] | 431 | mkdir -p .git/hooks |
zbao | f2c3254 | 2012-08-10 15:44:02 +0800 | [diff] [blame] | 432 | for hook in commit-msg pre-commit ; do \ |
| 433 | if [ util/gitconfig/$$hook -nt .git/hooks/$$hook -o \ |
| 434 | ! -x .git/hooks/$$hook ]; then \ |
Patrick Georgi | f394715 | 2015-04-28 21:36:11 +0200 | [diff] [blame] | 435 | sed -e "s,%MAKE%,$(MAKE),g" util/gitconfig/$$hook > .git/hooks/$$hook; \ |
zbao | f2c3254 | 2012-08-10 15:44:02 +0800 | [diff] [blame] | 436 | chmod +x .git/hooks/$$hook; \ |
| 437 | fi; \ |
| 438 | done |
Stefan Reinauer | 11186dd | 2015-06-13 10:45:40 +0200 | [diff] [blame] | 439 | # Now set up thehooks for 3rdparty/blobs |
Patrick Georgi | 11ac97b | 2015-07-06 09:31:42 +0000 | [diff] [blame] | 440 | if [ -d .git/modules/3rdparty -a \ |
| 441 | \( util/gitconfig/commit-msg -nt .git/modules/3rdparty/hooks/commit-msg -o \ |
| 442 | ! -x .git/modules/3rdparty/hooks/commit-msg \) ]; then \ |
| 443 | sed -e "s,%MAKE%,$(MAKE),g" util/gitconfig/commit-msg > .git/modules/3rdparty/hooks/commit-msg; \ |
| 444 | chmod +x .git/modules/3rdparty/hooks/commit-msg; \ |
Stefan Reinauer | 11186dd | 2015-06-13 10:45:40 +0200 | [diff] [blame] | 445 | fi |
| 446 | [ -d 3rdparty/blobs ] && cd 3rdparty/blobs && git config remote.origin.push HEAD:refs/for/master |
Ronald G. Minnich | 64b364d | 2013-01-03 08:26:09 -0800 | [diff] [blame] | 447 | git config remote.origin.push HEAD:refs/for/master |
Patrick Georgi | bb60528 | 2011-06-05 15:15:49 +0200 | [diff] [blame] | 448 | (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) |
| 449 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 450 | crossgcc: crossgcc-i386 crossgcc-x64 crossgcc-arm crossgcc-aarch64 crossgcc-mips crossgcc-riscv |
Peter Stuge | 0b6b4d6 | 2011-06-09 05:06:25 +0200 | [diff] [blame] | 451 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 452 | .PHONY: crossgcc-i386 crossgcc-x64 crossgcc-arm crossgcc-aarch64 crossgcc-mips crossgcc-riscv |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 453 | crossgcc-i386: clean-for-update |
| 454 | $(MAKE) -C util/crossgcc build-i386-without-gdb |
| 455 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 456 | crossgcc-x64: clean-for-update |
| 457 | $(MAKE) -C util/crossgcc build-x64-without-gdb |
| 458 | |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 459 | crossgcc-arm: clean-for-update |
| 460 | $(MAKE) -C util/crossgcc build-armv7a-without-gdb |
| 461 | |
Patrick Georgi | 3bff5d9 | 2014-11-19 18:36:37 +0100 | [diff] [blame] | 462 | crossgcc-aarch64: clean-for-update |
| 463 | $(MAKE) -C util/crossgcc build-aarch64-without-gdb |
| 464 | |
Patrick Georgi | a9330e0 | 2015-02-27 23:41:15 +0100 | [diff] [blame] | 465 | crossgcc-mips: clean-for-update |
| 466 | $(MAKE) -C util/crossgcc build-mips-without-gdb |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 467 | |
Patrick Georgi | f0bbc95 | 2015-03-07 10:57:25 +0100 | [diff] [blame] | 468 | crossgcc-riscv: clean-for-update |
| 469 | $(MAKE) -C util/crossgcc build-riscv-without-gdb |
Patrick Georgi | a9330e0 | 2015-02-27 23:41:15 +0100 | [diff] [blame] | 470 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 471 | crosstools: crosstools-i386 crosstools-x64 crosstools-arm crosstools-aarch64 crosstools-mips crosstools-riscv |
Patrick Georgi | f0bbc95 | 2015-03-07 10:57:25 +0100 | [diff] [blame] | 472 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 473 | .PHONY: crosstools-i386 crosstools-x64 crosstools-arm crosstools-aarch64 crosstools-mips crosstools-riscv |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 474 | crosstools-i386: clean-for-update |
| 475 | $(MAKE) -C util/crossgcc build-i386 |
| 476 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 477 | crosstools-x64: clean-for-update |
| 478 | $(MAKE) -C util/crossgcc build-x64 |
| 479 | |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 480 | crosstools-arm: clean-for-update |
| 481 | $(MAKE) -C util/crossgcc build-armv7a |
Patrick Georgi | 6c44550 | 2011-05-16 15:32:28 +0000 | [diff] [blame] | 482 | |
Patrick Georgi | 3bff5d9 | 2014-11-19 18:36:37 +0100 | [diff] [blame] | 483 | crosstools-aarch64: clean-for-update |
| 484 | $(MAKE) -C util/crossgcc build-aarch64 |
| 485 | |
Patrick Georgi | a9330e0 | 2015-02-27 23:41:15 +0100 | [diff] [blame] | 486 | crosstools-mips: clean-for-update |
| 487 | $(MAKE) -C util/crossgcc build-mips |
| 488 | |
Patrick Georgi | f0bbc95 | 2015-03-07 10:57:25 +0100 | [diff] [blame] | 489 | crosstools-riscv: clean-for-update |
| 490 | $(MAKE) -C util/crossgcc build-riscv |
| 491 | |
Patrick Georgi | 6c44550 | 2011-05-16 15:32:28 +0000 | [diff] [blame] | 492 | crossgcc-clean: clean-for-update |
| 493 | $(MAKE) -C util/crossgcc clean |
| 494 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 495 | tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(FMAPTOOL) $(RMODTOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(IFDFAKE) $(CBOOTIMAGE) |
Patrick Georgi | 43105d6 | 2011-11-05 14:44:41 +0100 | [diff] [blame] | 496 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 497 | ########################################################################### |
| 498 | # Common recipes for all stages |
| 499 | ########################################################################### |
| 500 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 501 | # loadaddr can determine the load address of a stage, which may be needed for |
| 502 | # platform-specific image headers (only works *after* the stage has been built) |
| 503 | loadaddr = $(shell $(OBJDUMP_$(1)) -p $(objcbfs)/$(1).debug | \ |
| 504 | sed -ne '/LOAD/s/^.*vaddr 0x\([0-9a-fA-F]\{8\}\).*$$/0x\1/p') |
| 505 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 506 | # find-substr is required for stages like romstage_null and romstage_xip to |
| 507 | # eliminate the _* part of the string |
| 508 | find-substr = $(word 1,$(subst _, ,$(1))) |
| 509 | |
| 510 | # find-class is used to identify the class from the name of the stage |
| 511 | # The input to this macro can be something like romstage.x or romstage.x.y |
| 512 | # find-class recursively strips off the suffixes to extract the exact class name |
| 513 | # e.g.: if romstage.x is provided to find-class, it will remove .x and return romstage |
| 514 | # if romstage.x.y is provided, it will first remove .y, call find-class with romstage.x |
| 515 | # and remove .x the next time and finally return romstage |
| 516 | find-class = $(if $(filter $(1),$(basename $(1))),$(if $(CC_$(1)), $(1), $(call find-substr,$(1))),$(call find-class,$(basename $(1)))) |
| 517 | |
Aaron Durbin | d972f78 | 2015-09-17 17:02:53 -0500 | [diff] [blame] | 518 | # Bootblocks are not CBFS stages. coreboot is currently expecting the bss to |
| 519 | # be cleared by the loader of the stage. For ARM SoCs that means one needs to |
| 520 | # include the bss section in the binary so the BootROM clears the bss on |
| 521 | # loading of the bootblock stage. Achieve this by marking the bss section |
| 522 | # loadable,allocatable, and data. Do the same for the .data section in case |
| 523 | # it's marked as NOBITS. |
| 524 | $(objcbfs)/bootblock.raw.bin: $(objcbfs)/bootblock.elf |
| 525 | @printf " OBJCOPY $(notdir $(@))\n" |
| 526 | $(OBJCOPY_bootblock) --set-section-flags .bss=load,alloc,data --set-section-flags .data=load,alloc,data $< $<.tmp |
| 527 | $(OBJCOPY_bootblock) -O binary $<.tmp $@ |
| 528 | |
| 529 | $(objcbfs)/%.bin: $(objcbfs)/%.raw.bin |
| 530 | cp $< $@ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 531 | |
| 532 | $(objcbfs)/%.elf: $(objcbfs)/%.debug |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 533 | $(eval class := $(call find-class,$(@F))) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 534 | @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" |
| 535 | cp $< $@.tmp |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 536 | $(NM_$(class)) -n $@.tmp | sort > $(basename $@).map |
| 537 | $(OBJCOPY_$(class)) --strip-debug $@.tmp |
| 538 | $(OBJCOPY_$(class)) --add-gnu-debuglink=$< $@.tmp |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 539 | mv $@.tmp $@ |
| 540 | |
| 541 | ########################################################################### |
| 542 | # Build the final rom image |
| 543 | ########################################################################### |
| 544 | |
| 545 | COREBOOT_ROM_DEPENDENCIES:= |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 546 | |
Patrick Georgi | 5839635 | 2014-12-09 12:49:21 +0100 | [diff] [blame] | 547 | extract_nth=$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-))) |
| 548 | |
| 549 | cbfs-add-cmd = \ |
| 550 | $(CBFSTOOL) $@.tmp \ |
| 551 | add$(if $(filter stage,$(call extract_nth,3,$(file))),-stage)$(if $(filter payload,$(call extract_nth,3,$(file))),-payload) \ |
| 552 | -f $(call extract_nth,1,$(file)) \ |
Daisuke Nojiri | bf84cf9 | 2015-09-22 15:21:36 -0700 | [diff] [blame] | 553 | -n $(call extract_nth,2,$(file)) \ |
| 554 | $(if $(filter-out stage,$(call extract_nth,3,$(file))),-t $(call extract_nth,3,$(file))) \ |
| 555 | $(if $(call extract_nth,4,$(file)),-c $(call extract_nth,4,$(file))) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 556 | |
| 557 | ifneq ($(CONFIG_UPDATE_IMAGE),y) |
| 558 | prebuild-files = \ |
| 559 | $(foreach file,$(cbfs-files), \ |
Aaron Durbin | 9b9d4b3 | 2015-09-15 21:30:58 -0500 | [diff] [blame] | 560 | $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&, \ |
Patrick Georgi | 5839635 | 2014-12-09 12:49:21 +0100 | [diff] [blame] | 561 | $(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&)) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 562 | prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file))) |
| 563 | |
Sol Boucher | 69b88bf | 2015-02-26 11:47:19 -0800 | [diff] [blame] | 564 | $(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(FMAPTOOL) $(CBFSTOOL) $$(cpu_ucode_cbfs_file) |
Julius Werner | f780c40 | 2014-11-10 13:11:50 -0800 | [diff] [blame] | 565 | $(CBFSTOOL) $@.tmp create \ |
Patrick Georgi | 45acb34 | 2015-07-14 22:18:23 +0200 | [diff] [blame] | 566 | -B $(objcbfs)/bootblock.bin \ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 567 | $(CBFSTOOL_PRE1_OPTS) |
| 568 | $(prebuild-files) true |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 569 | mv $@.tmp $@ |
| 570 | else |
Aaron Durbin | 999ed64 | 2015-06-03 11:54:59 -0500 | [diff] [blame] | 571 | prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file))) |
| 572 | # Add all cbfs files to image of the form: CONFIG_CBFS_PREFIX/<filename> |
| 573 | prebuild-files = \ |
| 574 | $(foreach file,$(cbfs-files), \ |
| 575 | $(if $(filter $(call strip_quotes, $(CONFIG_CBFS_PREFIX))/%,\ |
| 576 | $(call extract_nth,2,$(file))), \ |
Aaron Durbin | 9b9d4b3 | 2015-09-15 21:30:58 -0500 | [diff] [blame] | 577 | $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&,\ |
Aaron Durbin | 999ed64 | 2015-06-03 11:54:59 -0500 | [diff] [blame] | 578 | $(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&))) |
| 579 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 580 | .PHONY: $(obj)/coreboot.pre1 |
Aaron Durbin | 999ed64 | 2015-06-03 11:54:59 -0500 | [diff] [blame] | 581 | $(obj)/coreboot.pre1: $$(prebuilt-files) $(CBFSTOOL) |
| 582 | mv $(obj)/coreboot.rom $@.tmp |
| 583 | $(prebuild-files) true |
| 584 | mv $@.tmp $@ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 585 | endif |
| 586 | |
| 587 | ifeq ($(CONFIG_PAYLOAD_LINUX),y) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 588 | ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_COMMAND_LINE))),) |
Patrick Georgi | c2a0b7d | 2014-05-17 14:11:57 +0200 | [diff] [blame] | 589 | ADDITIONAL_PAYLOAD_CONFIG+=-C $(CONFIG_LINUX_COMMAND_LINE) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 590 | endif |
| 591 | ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD))),) |
Patrick Georgi | c2a0b7d | 2014-05-17 14:11:57 +0200 | [diff] [blame] | 592 | ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 593 | endif |
| 594 | endif |
| 595 | |
| 596 | ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y) |
| 597 | REFCODE_BLOB=$(obj)/refcode.rmod |
| 598 | $(REFCODE_BLOB): $(RMODTOOL) |
| 599 | $(RMODTOOL) -i $(CONFIG_REFCODE_BLOB_FILE) -o $@ |
| 600 | endif |
| 601 | |
Aaron Durbin | e3d2d6f | 2015-10-07 15:31:35 -0500 | [diff] [blame] | 602 | $(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/ramstage.elf $(CBFSTOOL) $$(call strip_quotes,$$(COREBOOT_ROM_DEPENDENCIES)) $$(INTERMEDIATE) $(REFCODE_BLOB) $$(VERSTAGE_FILE) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 603 | @printf " CBFS $(subst $(obj)/,,$(@))\n" |
Julius Werner | f780c40 | 2014-11-10 13:11:50 -0800 | [diff] [blame] | 604 | # The full ROM may be larger than the CBFS part, so create an empty |
| 605 | # file (filled with \377 = 0xff) and copy the CBFS image over it. |
WANG Siyuan | de8c780 | 2015-04-22 15:22:00 +0800 | [diff] [blame] | 606 | dd if=/dev/zero bs=$(call _toint,$(CONFIG_ROM_SIZE)) count=1 2> /dev/null | tr '\000' '\377' > $@.tmp |
Julius Werner | f780c40 | 2014-11-10 13:11:50 -0800 | [diff] [blame] | 607 | dd if=$(obj)/coreboot.pre of=$@.tmp bs=8192 conv=notrunc 2> /dev/null |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 608 | $(CBFSTOOL) $@.tmp add-stage -f $(objcbfs)/ramstage.elf -n $(CONFIG_CBFS_PREFIX)/ramstage -c $(CBFS_COMPRESS_FLAG) |
| 609 | ifeq ($(CONFIG_PAYLOAD_NONE),y) |
| 610 | @printf " PAYLOAD none (as specified by user)\n" |
| 611 | endif |
Patrick Georgi | c2a0b7d | 2014-05-17 14:11:57 +0200 | [diff] [blame] | 612 | ifneq ($(CONFIG_PAYLOAD_FILE),) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 613 | @printf " PAYLOAD $(CONFIG_PAYLOAD_FILE) (compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n" |
Patrick Georgi | c2a0b7d | 2014-05-17 14:11:57 +0200 | [diff] [blame] | 614 | $(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG) $(ADDITIONAL_PAYLOAD_CONFIG) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 615 | endif |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 616 | ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),) |
| 617 | ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),0) |
| 618 | @printf " SeaBIOS Wait up to $(CONFIG_SEABIOS_PS2_TIMEOUT) ms for PS/2 keyboard controller initialization\n" |
| 619 | $(CBFSTOOL) $@.tmp add-int -i $(CONFIG_SEABIOS_PS2_TIMEOUT) -n etc/ps2-keyboard-spinup |
| 620 | endif |
| 621 | endif |
Edward O'Callaghan | a296f9e | 2014-09-13 03:43:49 +1000 | [diff] [blame] | 622 | ifeq ($(CONFIG_SEABIOS_VGA_COREBOOT),y) |
| 623 | @printf " SeaBIOS Adding generated legacy VGA option rom.\n" |
| 624 | $(CBFSTOOL) $@.tmp add -f $(CONFIG_PAYLOAD_VGABIOS_FILE) -n vgaroms/seavgabios.bin -t raw |
| 625 | endif |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 626 | ifeq ($(CONFIG_INCLUDE_CONFIG_FILE),y) |
| 627 | @printf " CONFIG $(DOTCONFIG)\n" |
| 628 | if [ -f $(DOTCONFIG) ]; then \ |
Patrick Georgi | 701f67d | 2015-06-11 09:55:56 +0200 | [diff] [blame] | 629 | echo "# This image was built using git revision" `git rev-parse HEAD` > $(obj)/config.tmp && \ |
Jonathan A. Kollasch | d09b32b | 2015-08-10 12:15:40 -0500 | [diff] [blame] | 630 | $(MAKE) DOTCONFIG=$(DOTCONFIG) DEFCONFIG=$(obj)/config.tmp savedefconfig && \ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 631 | $(CBFSTOOL) $@.tmp add -f $(obj)/config.tmp -n config -t raw; rm -f $(obj)/config.tmp ; fi |
Vladimir Serbinenko | 6ead253 | 2014-08-23 01:08:09 +0200 | [diff] [blame] | 632 | @printf " REVISION build.h\n" |
| 633 | if [ -f $(obj)/build.h ]; then $(CBFSTOOL) $@.tmp add -f $(obj)/build.h -n revision -t raw; fi |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 634 | endif |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 635 | ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y) |
| 636 | $(CBFSTOOL) $@.tmp add-stage -f $(REFCODE_BLOB) -n $(CONFIG_CBFS_PREFIX)/refcode -c $(CBFS_COMPRESS_FLAG) |
| 637 | endif |
| 638 | ifeq ($(CONFIG_PXE_ROM),y) |
| 639 | $(CBFSTOOL) $@.tmp add -f $(CONFIG_PXE_ROM_FILE) -n pci$(CONFIG_PXE_ROM_ID).rom -t raw |
| 640 | endif |
| 641 | ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y) |
Kyösti Mälkki | d05a84c | 2014-12-27 11:55:47 +0200 | [diff] [blame] | 642 | ifeq ($(CONFIG_CPU_MICROCODE_ADDED_DURING_BUILD),y) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 643 | @printf " UPDATE-FIT \n" |
| 644 | $(CBFSTOOL) $@.tmp update-fit -n cpu_microcode_blob.bin -x $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) |
| 645 | endif |
| 646 | endif |
Martin Roth | 7b928cd | 2015-06-19 20:50:59 -0600 | [diff] [blame] | 647 | ifeq ($(CONFIG_INCLUDE_CONFIG_FILE),y) |
Paul Menzel | 16fa882 | 2015-09-25 09:18:43 +0200 | [diff] [blame] | 648 | @printf " CONFIG $(PAYLOAD_CONFIG)\n" |
Martin Roth | 7b928cd | 2015-06-19 20:50:59 -0600 | [diff] [blame] | 649 | if [ -f "$(PAYLOAD_CONFIG)" ]; then \ |
| 650 | $(CBFSTOOL) $@.tmp add -f "$(PAYLOAD_CONFIG)" -n payload_config -t raw; \ |
| 651 | fi |
| 652 | @printf " REVISION $(PAYLOAD_VERSION)\n" |
| 653 | if [ -f "$(PAYLOAD_VERSION)" ]; then \ |
| 654 | $(CBFSTOOL) $@.tmp add -f "$(PAYLOAD_VERSION)" -n payload_revision -t raw; \ |
| 655 | fi |
| 656 | endif |
Aaron Durbin | e3d2d6f | 2015-10-07 15:31:35 -0500 | [diff] [blame] | 657 | ifeq ($(CONFIG_SEPARATE_VERSTAGE),y) |
| 658 | $(CBFSTOOL) $@.tmp add-stage -f $(VERSTAGE_FILE) -n $(CONFIG_CBFS_PREFIX)/verstage $(CBFSTOOL_VERSTAGE_OPTS) |
| 659 | endif |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 660 | mv $@.tmp $@ |
| 661 | @printf " CBFSPRINT $(subst $(obj)/,,$(@))\n\n" |
| 662 | $(CBFSTOOL) $@ print |
| 663 | |
| 664 | cbfs-files-$(CONFIG_BOOTSPLASH) += bootsplash.jpg |
| 665 | bootsplash.jpg-file := $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE)) |
| 666 | bootsplash.jpg-type := bootsplash |
| 667 | |
Patrick Georgi | 24cca75 | 2014-11-29 11:51:25 +0100 | [diff] [blame] | 668 | $(obj)/coreboot.pre: $(objcbfs)/romstage.elf $(obj)/coreboot.pre1 $(CBFSTOOL) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 669 | @printf " CBFS $(subst $(obj)/,,$(@))\n" |
| 670 | cp $(obj)/coreboot.pre1 $@.tmp |
| 671 | $(CBFSTOOL) $@.tmp add-stage \ |
Patrick Georgi | 24cca75 | 2014-11-29 11:51:25 +0100 | [diff] [blame] | 672 | -f $(objcbfs)/romstage.elf \ |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 673 | -n $(CONFIG_CBFS_PREFIX)/romstage -c none \ |
| 674 | $(CBFSTOOL_PRE_OPTS) |
| 675 | mv $@.tmp $@ |
Patrick Georgi | 062e408 | 2014-08-29 20:10:38 +0200 | [diff] [blame] | 676 | |
Stefan Reinauer | d06258c | 2015-03-26 16:29:00 -0700 | [diff] [blame] | 677 | cbfs-files-$(CONFIG_BOARD_ID_MANUAL) += board_id |
| 678 | board_id-file := $(obj)/board_id |
| 679 | board_id-type := raw |
| 680 | |
| 681 | $(obj)/board_id: |
Vladimir Serbinenko | 93af2f2 | 2015-05-30 23:13:48 +0200 | [diff] [blame] | 682 | printf $(CONFIG_BOARD_ID_STRING) > $@ |
Stefan Reinauer | d06258c | 2015-03-26 16:29:00 -0700 | [diff] [blame] | 683 | |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 684 | junit.xml: |
Martin Roth | 917acb5 | 2015-10-21 15:28:21 -0600 | [diff] [blame] | 685 | echo "Building $(UTIL)" |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 686 | echo '<?xml version="1.0" encoding="utf-8"?><testsuite>' > $@.tmp |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 687 | echo "<testcase classname='$(UTIL)' name='$(UTIL)'>" >> $@.tmp |
Martin Roth | 917acb5 | 2015-10-21 15:28:21 -0600 | [diff] [blame] | 688 | -$(MAKE) -j $(CPUS) -C "util/$(UTIL)" clean distclean > $@.tmp.2 2>&1 |
| 689 | $(MAKE) -j $(CPUS) -C "util/$(UTIL)" >> $@.tmp.2 2>&1 && type="system-out" || type="failure"; \ |
| 690 | cat $@.tmp.2; \ |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 691 | if [ "$$type" = "failure" ]; then \ |
| 692 | echo "<failure type='buildFailed'>" >> $@.tmp; \ |
Martin Roth | 917acb5 | 2015-10-21 15:28:21 -0600 | [diff] [blame] | 693 | echo "Building $(UTIL) Failed"; \ |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 694 | else \ |
| 695 | echo "<$$type>" >> $@.tmp; \ |
Martin Roth | 917acb5 | 2015-10-21 15:28:21 -0600 | [diff] [blame] | 696 | echo "Building $(UTIL) Succeeded"; \ |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 697 | fi; \ |
| 698 | echo '<![CDATA[' >> $@.tmp; \ |
| 699 | cat $@.tmp.2 >> $@.tmp; \ |
| 700 | echo "]]></$$type>" >>$@.tmp |
| 701 | rm -f $@.tmp.2 |
| 702 | echo "</testcase>" >> $@.tmp |
| 703 | echo "</testsuite>" >> $@.tmp |
| 704 | mv $@.tmp "util/$(UTIL)/$@" |
Martin Roth | 917acb5 | 2015-10-21 15:28:21 -0600 | [diff] [blame] | 705 | echo |
Martin Roth | de9adeb | 2015-10-15 14:33:31 -0600 | [diff] [blame] | 706 | |
Paul Menzel | d98471c | 2015-10-18 11:45:52 +0200 | [diff] [blame] | 707 | TOOLLIST= \ |
| 708 | cbmem \ |
Martin Roth | 1fec04b | 2015-10-21 15:29:13 -0600 | [diff] [blame^] | 709 | ectool \ |
Paul Menzel | d98471c | 2015-10-18 11:45:52 +0200 | [diff] [blame] | 710 | inteltool \ |
Martin Roth | 1fec04b | 2015-10-21 15:29:13 -0600 | [diff] [blame^] | 711 | nvramtool \ |
| 712 | superiotool \ |
| 713 | viatool |
Patrick Georgi | e151407 | 2015-07-31 16:54:12 +0200 | [diff] [blame] | 714 | JENKINS_PAYLOAD?=none |
Patrick Georgi | c6a4aae | 2015-07-31 16:54:44 +0200 | [diff] [blame] | 715 | CPUS?=4 |
Patrick Georgi | 062e408 | 2014-08-29 20:10:38 +0200 | [diff] [blame] | 716 | what-jenkins-does: |
Martin Roth | 8d226f2 | 2015-10-13 15:08:01 -0600 | [diff] [blame] | 717 | util/lint/lint lint-stable --junit |
Martin Roth | 615f69e | 2015-10-13 12:29:19 -0600 | [diff] [blame] | 718 | util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD) -x -X $(top)/abuild-chromeos.xml |
Patrick Georgi | c6a4aae | 2015-07-31 16:54:44 +0200 | [diff] [blame] | 719 | util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c $(CPUS) -z -p $(JENKINS_PAYLOAD) |
Patrick Georgi | b551d8b | 2015-07-31 16:39:06 +0200 | [diff] [blame] | 720 | (cd payloads/libpayload; unset COREBOOT_BUILD_DIR; $(MAKE) $(if $(JENKINS_NOCCACHE),,CONFIG_LP_CCACHE=y) V=$(V) Q=$(Q) junit.xml) |
Martin Roth | 917acb5 | 2015-10-21 15:28:21 -0600 | [diff] [blame] | 721 | $(foreach tool, $(TOOLLIST), $(MAKE) CPUS=$(CPUS) V=$(V) Q=$(Q) UTIL="$(tool)" MFLAGS= MAKEFLAGS= junit.xml; ) |