mirror of
https://github.com/Dasharo/heads.git
synced 2026-06-13 10:16:29 -07:00
d3396e85bd
Squashed from: https://github.com/tlaurion/heads/commit/2df1c8b5bdfd7999ebaa65140a92e0df061a930f https://github.com/tlaurion/heads/commit/447d464043cb69126420c06eb280c1746dccae31 then, updated EC revision as per: https://github.com/Dasharo/ec/pull/82#issuecomment-4048416056 Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
51 lines
1.9 KiB
Makefile
51 lines
1.9 KiB
Makefile
ifeq "$(CONFIG_DASHARO_EC)" "y"
|
|
|
|
modules-y += dasharo-ec
|
|
|
|
dasharo-ec_repo := https://github.com/Dasharo/ec
|
|
dasharo-ec_commit_hash := d198b641195e60e13afc17be9464e4f402d1c2fa
|
|
|
|
# Map BOARD to the EC board model
|
|
ifeq "$(BOARD)" "novacustom-v540tu"
|
|
DASHARO_EC_BOARD_MODEL := v540tu
|
|
else ifeq "$(BOARD)" "novacustom-v560tu"
|
|
DASHARO_EC_BOARD_MODEL := v560tu
|
|
else
|
|
$(error "$(BOARD): no Dasharo EC board model mapping defined")
|
|
endif
|
|
|
|
dasharo-ec_version := $(dasharo-ec_commit_hash)
|
|
dasharo-ec_base_dir := dasharo-ec-$(dasharo-ec_version)
|
|
dasharo-ec_dir := dasharo-ec-$(dasharo-ec_version)
|
|
|
|
# Use .built sentinel since the real output is in a dynamic path
|
|
dasharo-ec_output := .built
|
|
|
|
# No-op configure: submodules are handled by the EC Makefile's canary rule
|
|
# for git repos
|
|
dasharo-ec_configure :=
|
|
|
|
# Build the EC firmware following the upstream build.sh process:
|
|
# 1. make BOARD=novacustom/<model> (compile with SDCC)
|
|
# 2. Copy ec.rom from the dynamic output path to a known location
|
|
# 3. Extend ec.rom to 128KB (zero-padded) as required by coreboot
|
|
# Note: the && chain after make -C runs in the parent cwd, so use
|
|
# absolute paths. Use sh -c so the shell expands the glob.
|
|
dasharo-ec_target := \
|
|
BOARD=novacustom/$(DASHARO_EC_BOARD_MODEL) \
|
|
&& sh -c 'cp $(build)/$(dasharo-ec_dir)/build/novacustom/$(DASHARO_EC_BOARD_MODEL)/*/ec.rom $(build)/$(dasharo-ec_dir)/ec.rom' \
|
|
&& dd if=/dev/zero of=$(build)/$(dasharo-ec_dir)/ec.rom bs=1 seek=128k count=0 \
|
|
&& touch $(build)/$(dasharo-ec_dir)/.built
|
|
|
|
# Copy ec.rom into the coreboot source tree before coreboot configures.
|
|
# coreboot expects ec.rom in its root directory.
|
|
$(build)/$(coreboot_base_dir)/ec.rom: $(build)/$(dasharo-ec_dir)/.build
|
|
$(call do,COPY,ec.rom -> coreboot, \
|
|
cp "$(build)/$(dasharo-ec_dir)/ec.rom" "$@" \
|
|
)
|
|
|
|
# Ensure coreboot's configure step depends on ec.rom being present
|
|
$(build)/$(coreboot_dir)/.configured: $(build)/$(coreboot_base_dir)/ec.rom
|
|
|
|
endif
|