Skip to content

Commit fe3d278

Browse files
committed
modules/dasharo-ec: new module
Squashed from: tlaurion@2df1c8b tlaurion@447d464 then, updated EC revision as per: Dasharo/ec#82 (comment) Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
1 parent 2ab9ff3 commit fe3d278

5 files changed

Lines changed: 58 additions & 4 deletions

File tree

boards/novacustom-v540tu/novacustom-v540tu.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
export CONFIG_COREBOOT=y
1717
export CONFIG_COREBOOT_VERSION=dasharo
18+
export CONFIG_DASHARO_EC=y
1819
export CONFIG_LINUX_VERSION=6.1.8
1920

2021
CONFIG_COREBOOT_CONFIG=config/coreboot-novacustom-v540tu.config

boards/novacustom-v560tu/novacustom-v560tu.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
export CONFIG_COREBOOT=y
1717
export CONFIG_COREBOOT_VERSION=dasharo
18+
export CONFIG_DASHARO_EC=y
1819
export CONFIG_LINUX_VERSION=6.1.8
1920

2021
CONFIG_COREBOOT_CONFIG=config/coreboot-novacustom-v560tu.config

config/coreboot-novacustom-v540tu.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,9 @@ CONFIG_RCBA_LENGTH=0x4000
543543
# Embedded Controllers
544544
#
545545
CONFIG_EC_ACPI=y
546-
CONFIG_EC_SYSTEM76_EC=y
547-
# CONFIG_EC_SYSTEM76_EC_UPDATE is not set
546+
CONFIG_EC_DASHARO_EC=y
547+
CONFIG_EC_DASHARO_EC_UPDATE=y
548+
CONFIG_EC_DASHARO_EC_UPDATE_FILE="ec.rom"
548549

549550
#
550551
# Intel Firmware

config/coreboot-novacustom-v560tu.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,9 @@ CONFIG_RCBA_LENGTH=0x4000
543543
# Embedded Controllers
544544
#
545545
CONFIG_EC_ACPI=y
546-
CONFIG_EC_SYSTEM76_EC=y
547-
# CONFIG_EC_SYSTEM76_EC_UPDATE is not set
546+
CONFIG_EC_DASHARO_EC=y
547+
CONFIG_EC_DASHARO_EC_UPDATE=y
548+
CONFIG_EC_DASHARO_EC_UPDATE_FILE="ec.rom"
548549

549550
#
550551
# Intel Firmware

modules/dasharo-ec

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
ifeq "$(CONFIG_DASHARO_EC)" "y"
2+
3+
modules-y += dasharo-ec
4+
5+
dasharo-ec_repo := https://github.com/Dasharo/ec
6+
dasharo-ec_commit_hash := d198b641195e60e13afc17be9464e4f402d1c2fa
7+
8+
# Map BOARD to the EC board model
9+
ifeq "$(BOARD)" "novacustom-v540tu"
10+
DASHARO_EC_BOARD_MODEL := v540tu
11+
else ifeq "$(BOARD)" "novacustom-v560tu"
12+
DASHARO_EC_BOARD_MODEL := v560tu
13+
else
14+
$(error "$(BOARD): no Dasharo EC board model mapping defined")
15+
endif
16+
17+
dasharo-ec_version := $(dasharo-ec_commit_hash)
18+
dasharo-ec_base_dir := dasharo-ec-$(dasharo-ec_version)
19+
dasharo-ec_dir := dasharo-ec-$(dasharo-ec_version)
20+
21+
# Use .built sentinel since the real output is in a dynamic path
22+
dasharo-ec_output := .built
23+
24+
# No-op configure: submodules are handled by the EC Makefile's canary rule
25+
# for git repos
26+
dasharo-ec_configure :=
27+
28+
# Build the EC firmware following the upstream build.sh process:
29+
# 1. make BOARD=novacustom/<model> (compile with SDCC)
30+
# 2. Copy ec.rom from the dynamic output path to a known location
31+
# 3. Extend ec.rom to 128KB (zero-padded) as required by coreboot
32+
# Note: the && chain after make -C runs in the parent cwd, so use
33+
# absolute paths. Use sh -c so the shell expands the glob.
34+
dasharo-ec_target := \
35+
BOARD=novacustom/$(DASHARO_EC_BOARD_MODEL) \
36+
&& sh -c 'cp $(build)/$(dasharo-ec_dir)/build/novacustom/$(DASHARO_EC_BOARD_MODEL)/*/ec.rom $(build)/$(dasharo-ec_dir)/ec.rom' \
37+
&& dd if=/dev/zero of=$(build)/$(dasharo-ec_dir)/ec.rom bs=1 seek=128k count=0 \
38+
&& touch $(build)/$(dasharo-ec_dir)/.built
39+
40+
# Copy ec.rom into the coreboot source tree before coreboot configures.
41+
# coreboot expects ec.rom in its root directory.
42+
$(build)/$(coreboot_base_dir)/ec.rom: $(build)/$(dasharo-ec_dir)/.build
43+
$(call do,COPY,ec.rom -> coreboot, \
44+
cp "$(build)/$(dasharo-ec_dir)/ec.rom" "$@" \
45+
)
46+
47+
# Ensure coreboot's configure step depends on ec.rom being present
48+
$(build)/$(coreboot_dir)/.configured: $(build)/$(coreboot_base_dir)/ec.rom
49+
50+
endif

0 commit comments

Comments
 (0)