1 ## SPDX-License-Identifier: GPL-2.0-only
2 ifeq ($(CONFIG_SOC_AMD_COMMON
),y
)
8 CPPFLAGS_common
+= -I
$(src
)/soc
/amd
/common
/vboot
/include
11 OPT_DEBUG_AMDFWTOOL
= --debug
14 ifneq ($(CONFIG_AMDFW_CONFIG_FILE
), )
15 FIRMWARE_LOCATION
=$(shell grep
-e FIRMWARE_LOCATION
$(CONFIG_AMDFW_CONFIG_FILE
) | awk
'{print $$2}')
17 # Add all the files listed in the config file to the dependency list
18 POUND_SIGN
=$(call strip_quotes
, "\#")
20 # If the MP2 file is not being loaded, remove it as a dependency
21 ifneq ($(CONFIG_PSP_LOAD_MP2_FW
),y
)
25 # Steps below to generate the dependency list
26 # 1a: Delete any line that starts with #, FIRMWARE_LOCATION, SOC_NAME, or AMD_FUSE_CHAIN
27 # 1b: Filter out lines containing MP2 or not, decided above.
28 # 1c: Use awk to return only field 2, the filename
29 # 2: Gather filenames with no path to add the firmware location later
30 # 3: Gather filenames with a path
31 # 4a: Add the firmware location to any files without a path to the dependencies
32 # 4b: add the lines containing a path to the dependencies
33 AMDFW_CFG_FILES
= $(shell sed
"/^$(POUND_SIGN)\|^FIRMWARE_LOCATION\|^AMD_FUSE_CHAIN\|^SOC_NAME/d; \
34 $(REMOVE_MP2)" $(CONFIG_AMDFW_CONFIG_FILE
) | \
36 AMDFW_CFG_IN_FW_LOC
= $(shell echo
"$(AMDFW_CFG_FILES)" | tr
' ' '\n' | grep
-v
"/")
37 AMDFW_CFG_WITH_PATH
= $(shell echo
"$(AMDFW_CFG_FILES)" | tr
' ' '\n' | grep
"/")
38 DEP_FILES
= $(patsubst %,$(FIRMWARE_LOCATION
)/%, $(AMDFW_CFG_IN_FW_LOC
)) \
39 $(AMDFW_CFG_WITH_PATH
)
41 amd_microcode_bins
+= $(wildcard ${FIRMWARE_LOCATION}/*U?odePatch
*.bin
)
43 ifeq ($(CONFIG_RESET_VECTOR_IN_RAM
),y
)
44 $(objcbfs
)/bootblock.bin
: $(obj
)/amdfw.rom
$(obj
)/fmap_config.h
47 amdfw_region_start
=$(subst $(spc
),,FMAP_SECTION_
$(call regions-for-file
,apu
/amdfw
)_START
)
48 amdfw_offset
=$(call int-subtract
, \
49 $(CONFIG_AMD_FWM_POSITION
) \
50 $(call int-subtract
, \
51 $(call get_fmap_value
,$(amdfw_region_start
)) \
52 $(call get_fmap_value
,FMAP_SECTION_FLASH_START
)))
55 $(CBFSTOOL
) $(1) add
-f
$(2) -n apu
/amdfw
-t amdfw \
56 -b
$(amdfw_offset
) -r
$(call regions-for-file
,apu
/amdfw
) \
57 $(CBFSTOOL_ADD_CMD_OPTIONS
)
59 endif # ifeq ($(CONFIG_RESET_VECTOR_IN_RAM),y)
61 ifeq ($(CONFIG_VBOOT_GSCVD
),y
)
62 build_complete
:: $(obj
)/ro-amdfw-list
64 $(obj
)/ro-amdfw-list
: $(AMDFWREAD
)
65 $(AMDFWREAD
) --ro-list
$(obj
)/coreboot.rom
> $@
67 amdfwread-offset-size-cmd
= grep
'$(1)' $(obj
)/ro-amdfw-list | \
68 sed
's/^.* 0x0*\(.*\) 0x0*\(.*\)$$/\1:\2/'
70 amdfwread-range-cmd
= $(shell ( \
71 range
=$$($(call amdfwread-offset-size-cmd
,$(1))) ;\
72 if
[ -n
"$$range" ]; then \
78 endif # ifeq ($(CONFIG_VBOOT_GSCVD),y)
80 endif # ifneq ($(CONFIG_AMDFW_CONFIG_FILE), )
82 MAINBOARD_BLOBS_DIR
:= $(call strip_quotes
, $(CONFIG_APCB_BLOBS_DIR
))
86 printf
"\n\t** WARNING **\n"
87 printf
"coreboot has been built without an APCB.\n"
88 printf
"This image will not boot.\n\n"
91 die_no_apcb
: warn_no_apcb
92 $(error This board requires the APCB to build correctly
)
94 endif # ifeq ($(CONFIG_SOC_AMD_COMMON),y)