Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/novacustom-v540tu/novacustom-v540tu.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

export CONFIG_COREBOOT=y
export CONFIG_COREBOOT_VERSION=dasharo
export CONFIG_DASHARO_EC=y
export CONFIG_LINUX_VERSION=6.1.8

CONFIG_COREBOOT_CONFIG=config/coreboot-novacustom-v540tu.config
Expand Down
1 change: 1 addition & 0 deletions boards/novacustom-v560tu/novacustom-v560tu.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

export CONFIG_COREBOOT=y
export CONFIG_COREBOOT_VERSION=dasharo
export CONFIG_DASHARO_EC=y
export CONFIG_LINUX_VERSION=6.1.8

CONFIG_COREBOOT_CONFIG=config/coreboot-novacustom-v560tu.config
Expand Down
5 changes: 3 additions & 2 deletions config/coreboot-novacustom-v540tu.config
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ CONFIG_RCBA_LENGTH=0x4000
# Embedded Controllers
#
CONFIG_EC_ACPI=y
CONFIG_EC_SYSTEM76_EC=y
# CONFIG_EC_SYSTEM76_EC_UPDATE is not set
CONFIG_EC_DASHARO_EC=y
CONFIG_EC_DASHARO_EC_UPDATE=y
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this coreboot config switched to support EC SYNC feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkopec this is the only new config we need to switch here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that is enough. If the path option is not specified, the code will look for ec.rom in the root of the coreboot directory.

CONFIG_EC_DASHARO_EC_UPDATE_FILE="ec.rom"

#
# Intel Firmware
Expand Down
5 changes: 3 additions & 2 deletions config/coreboot-novacustom-v560tu.config
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ CONFIG_RCBA_LENGTH=0x4000
# Embedded Controllers
#
CONFIG_EC_ACPI=y
CONFIG_EC_SYSTEM76_EC=y
# CONFIG_EC_SYSTEM76_EC_UPDATE is not set
CONFIG_EC_DASHARO_EC=y
CONFIG_EC_DASHARO_EC_UPDATE=y
CONFIG_EC_DASHARO_EC_UPDATE_FILE="ec.rom"

#
# Intel Firmware
Expand Down
19 changes: 18 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
# Inputs define external dependencies and their sources.
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # Using the unstable channel for the latest packages, while flake.lock fixates the commit reused until changed.
# No flake for 3.8.0
# Pinned nixpkgs for sdcc 4.2.0 - matches: https://github.com/Dasharo/ec-sdk/pull/2
# sdcc 4.5.0 has optimizer bug: https://github.com/Dasharo/dasharo-issues/issues/1785
nixpkgs-sdcc.url = "github:nixos/nixpkgs/7a339d87931bba829f68e94621536cad9132971a";
flake-utils.url = "github:numtide/flake-utils"; # Utilities for flake functionality.
};
# Outputs are the result of the flake, including the development environment and Docker image.
outputs = {
self,
flake-utils,
nixpkgs,
nixpkgs-sdcc,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}; # Accessing the legacy package set.
pkgs-sdcc = nixpkgs-sdcc.legacyPackages.${system}; # Pinned for sdcc 4.2.0
lib = pkgs.lib; # The standard Nix packages library.

# Dependencies are the packages required for the Heads project.
Expand Down Expand Up @@ -63,11 +69,13 @@
psmisc #process tools like killall, pstree, etc
python3 # me_cleaner, coreboot
rsync # coreboot
pkgs-sdcc.sdcc # Dasharo EC build — pinned to 4.2.0 (matches Debian oldstable, 4.5 has optimizer bug)
sharutils
texinfo
unzip
wget
which
xxd # Dasharo EC build
xz
zip
zlib
Expand Down
50 changes: 50 additions & 0 deletions modules/dasharo-ec
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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")
Comment on lines +10 to +14
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines in this conditional use a leading tab before the variable assignment (e.g., DASHARO_EC_BOARD_MODEL := ...). In GNU make, a line starting with a tab outside of a rule body is treated as a recipe line and can trigger "recipe commences before first target" parse errors. Remove the leading tab/indentation on these assignments (use no leading whitespace or spaces).

Suggested change
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")
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")

Copilot uses AI. Check for mistakes.
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

Comment on lines +21 to +23
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dasharo-ec_output is set to .built, but the generic module framework only guarantees creation of $(build)/$(dasharo-ec_dir)/.build (it touches that file after running make). Unless .built is created as part of the module's make invocation, the build will be forced every time and any downstream rules expecting ec.rom may fail. Define the module output as an actual produced artifact (e.g., ec.rom) and add an explicit rule to create it, or ensure .built is created by the invoked make target.

Copilot uses AI. Check for mistakes.
# 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
Comment on lines +32 to +42
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dasharo-ec_target is passed as arguments to $(MAKE) -C ... $($1_target) by the main build system. Including shell operators like &&, sh -c ..., dd ..., and touch ... here will make make interpret them as additional targets/arguments, which will fail. Move the post-build copy/pad steps into a separate Make rule (e.g., a rule that generates a stable output like ec.rom from $(build)/$(dasharo-ec_dir)/.build), and keep dasharo-ec_target limited to make arguments/targets (e.g., BOARD=...).

Suggested change
# 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
# Note: keep dasharo-ec_target limited to make arguments; post-build
# steps are handled by a dedicated Make rule that produces ec.rom.
dasharo-ec_target := \
BOARD=novacustom/$(DASHARO_EC_BOARD_MODEL)
# Generate a stable ec.rom in the Dasharo EC build directory, pad it to
# 128KB, and update the .built sentinel.
$(build)/$(dasharo-ec_dir)/ec.rom:
sh -c 'cp $(build)/$(dasharo-ec_dir)/build/novacustom/$(DASHARO_EC_BOARD_MODEL)/*/ec.rom $@'
dd if=/dev/zero of=$@ 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)/ec.rom

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule copies $(build)/$(dasharo-ec_dir)/ec.rom but only depends on $(build)/$(dasharo-ec_dir)/.build. With the current module definition, .build does not guarantee that ec.rom exists at that stable path. Make the prerequisite the actual artifact you intend to copy (e.g., depend on $(build)/$(dasharo-ec_dir)/ec.rom once it is generated as the module output) so the dependency graph reflects the real inputs/outputs.

Suggested change
$(build)/$(coreboot_base_dir)/ec.rom: $(build)/$(dasharo-ec_dir)/.build
$(build)/$(coreboot_base_dir)/ec.rom: $(build)/$(dasharo-ec_dir)/ec.rom

Copilot uses AI. Check for mistakes.
$(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
Loading