summaryrefslogtreecommitdiffstats
path: root/src/mainboard/google/poppy/spd/Makefile.inc
blob: 444ac00b928c4f24e2a2122127bafca250778e6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

SPD_BIN = $(obj)/spd.bin
SEC_SPD_BIN = $(obj)/sec-spd.bin

define gen_spd_bin
	for f in $2; \
	  do for c in $$(cat $$f | grep -v ^#); \
	    do printf $$(printf '\%o' 0x$$c); \
	  done; \
	done > $1
endef

add_spd_to_cbfs= \
	$(eval cbfs-files-y += $1) \
	$(eval $1-file := $2) \
	$(eval $1-type := spd)

ifeq ($(SPD_SOURCES),)
	SPD_DEPS := $(error SPD_SOURCES is not set. Variant must provide this)
else
	SPD_DEPS := $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)
endif

# Include SPD ROM data
$(SPD_BIN): $(SPD_DEPS)
	$(call gen_spd_bin, $@, $+)

$(call add_spd_to_cbfs, spd.bin, $(SPD_BIN))

# Add optional secondary SPD ROM data if present
ifneq ($(SEC_SPD_SOURCES),)

SEC_SPD_DEPS := $(foreach f, $(SEC_SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)

$(SEC_SPD_BIN): $(SEC_SPD_DEPS)
		$(call gen_spd_bin, $@, $+)

$(call add_spd_to_cbfs, sec-spd.bin, $(SEC_SPD_BIN))

endif