Skip to content

Ec build#2062

Open
macpijan wants to merge 3 commits intolinuxboot:masterfrom
Dasharo:ec_build
Open

Ec build#2062
macpijan wants to merge 3 commits intolinuxboot:masterfrom
Dasharo:ec_build

Conversation

@macpijan
Copy link
Collaborator

@macpijan macpijan commented Feb 27, 2026

Snapshot from some experiments. Current issue is building EC firmware in heads build system.

  1. The SDCC version we used for release was: 3.8.0. I could not pin such such version in nix as it was not supported in flakes. Maybe better nix exp this can be done. That would be optimal as it should result with the same hash as the release version.
  2. Bumping SDCC version needs source code changes. Patch included here and pushed to upstream also: 330ebbe
  3. There are more compilation issues with SDCC 4.5 (currently in Debian stable I was trying to build ec-sdk to: update to debian:oldstable-20260223-slim Dasharo/ec-sdk#2

Maybe 4.2.0 would work for both Debian (oldstable) and nix (pin to 4.2.0 should be possible).

Alternative: fetch release EC binary in heads and include it in binary form? Use another build container to build EC?

macpijan added a commit to Dasharo/heads that referenced this pull request Feb 27, 2026
Required to to build dasharo-ec module.

Need to pin SDCC version to 4.2.0 to avoid
Dasharo/dasharo-issues#1785
and be in sync with ec-sdk:
Dasharo/ec-sdk#2

Using 3.8.0 in nix toolchain (as originally used in ec-sdk)
was not feasible:
linuxboot#2062 (comment)

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
@macpijan
Copy link
Collaborator Author

Maybe 4.2.0 would work for both Debian (oldstable) and nix (pin to 4.2.0 should be possible).

Using SDCC 4.2.0 results in the same binary hash across heads and ec-sdk builds: 5fbc3b616f50ee84d3b3383b6359e9a759e6b727198866c2fde8f2ffc7da49b6

This differs from the release binary. This has NOT been tested on hardware.

macpijan added a commit to Dasharo/heads that referenced this pull request Feb 27, 2026
Required to to build dasharo-ec module.

Need to pin SDCC version to 4.2.0 to avoid
Dasharo/dasharo-issues#1785
and be in sync with ec-sdk:
Dasharo/ec-sdk#2

Using 3.8.0 in nix toolchain (as originally used in ec-sdk)
was not feasible:
linuxboot#2062 (comment)

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
macpijan added a commit to Dasharo/heads that referenced this pull request Feb 27, 2026
Required to to build dasharo-ec module.

Need to pin SDCC version to 4.2.0 to avoid
Dasharo/dasharo-issues#1785
and be in sync with ec-sdk:
Dasharo/ec-sdk#2

Using 3.8.0 in nix toolchain (as originally used in ec-sdk)
was not feasible:
linuxboot#2062 (comment)

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
tlaurion added a commit that referenced this pull request Feb 27, 2026
initrd/*functions : add logic to show ec version under System Information and recovery shell, populated in init

Input for #2062
@tlaurion
Copy link
Collaborator

tlaurion commented Feb 27, 2026

@macpijan merged #2063 in master (replaces current f31f198)

@tlaurion
Copy link
Collaborator

tlaurion commented Feb 27, 2026

@macpijan docker image v0.2.8 + pinned hash usable from Dasharo#15 (comment), please rebase + cherry-pick + co-sign

@tlaurion
Copy link
Collaborator

Building locally https://github.com/tlaurion/heads/tree/Dasharo_ec_build_master_merged%2Bcherry_pick to test on v560tu v540tu (master merged+fixed conflicts)

@tlaurion
Copy link
Collaborator

Building locally https://github.com/tlaurion/heads/tree/Dasharo_ec_build_master_merged%2Bcherry_pick to test on v560tu v540tu (master merged+fixed conflicts)

v540tu EC firmware upgraded to 2026-02-27_ad7e15c

Note that upgrading EC firmware results in fan speeding up to 100%, and a poweroff not a reboot as typically by Heads firmware upgrade

CC @macpijan

@tlaurion
Copy link
Collaborator

Building locally https://github.com/tlaurion/heads/tree/Dasharo_ec_build_master_merged%2Bcherry_pick to test on v560tu v540tu (master merged+fixed conflicts)

v540tu EC firmware upgraded to 2026-02-27_ad7e15c

Note that upgrading EC firmware results in fan speeding up to 100%, and a poweroff not a reboot as typically by Heads firmware upgrade

CC @macpijan

See comments #2039 (comment)

@tlaurion
Copy link
Collaborator

@macpijan blocked here because v560tu ec doesn't build. Seperating v540tu/v56tu ec builds should point to different paths in config (not default) and that ec build be local for each coreboot configs.

Good news though, my v540tu gained masive performance gains, battery and proper perf throttle. So it was the EC afterall.

Note that nv4x_adl will need the ec build as well.

Let me know next steps.

@tlaurion
Copy link
Collaborator

Added proper labels

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>
Required to to build dasharo-ec module.

Need to pin SDCC version to 4.2.0 to avoid
Dasharo/dasharo-issues#1785
and be in sync with ec-sdk:
Dasharo/ec-sdk#2

Using 3.8.0 in nix toolchain (as originally used in ec-sdk)
was not feasible:
linuxboot#2062 (comment)

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
@macpijan
Copy link
Collaborator Author

I think I rebased and cleaned up my commits. Updated the EC revision so the V56 build can pass here as well.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds initial support for building and integrating Dasharo EC firmware into the Heads build system for NovaCustom V540TU/V560TU boards, and pins an SDCC toolchain version in Nix to improve build compatibility.

Changes:

  • Introduces a new dasharo-ec module intended to fetch/build EC firmware and provide ec.rom to coreboot.
  • Pins a separate nixpkgs revision to provide SDCC 4.2.0 (and adds xxd) in the flake development environment.
  • Switches NovaCustom V540TU/V560TU coreboot configs from System76 EC to Dasharo EC update integration and enables the module in board configs.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
modules/dasharo-ec New module wiring to fetch/build Dasharo EC and stage ec.rom for coreboot.
flake.nix Adds a pinned nixpkgs input to supply SDCC 4.2.0 and includes it in dev dependencies.
flake.lock Locks the additional nixpkgs input for SDCC pinning.
config/coreboot-novacustom-v560tu.config Enables Dasharo EC update and sets update file to ec.rom.
config/coreboot-novacustom-v540tu.config Enables Dasharo EC update and sets update file to ec.rom.
boards/novacustom-v560tu/novacustom-v560tu.config Enables CONFIG_DASHARO_EC for the board build.
boards/novacustom-v540tu/novacustom-v540tu.config Enables CONFIG_DASHARO_EC for the board build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +10 to +14
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")
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.
Comment on lines +32 to +42
# 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
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.
Comment on lines +21 to +23
# Use .built sentinel since the real output is in a dynamic path
dasharo-ec_output := .built

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.

# 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
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.
@tlaurion
Copy link
Collaborator

@macpijan docker image v0.2.8 + pinned hash usable from Dasharo#15 (comment), please rebase + cherry-pick + co-sign

Regression to prior 2.7 docker image.

ec.rom still shared between builds, won't fly :(

Coreboot configs need to point in distinguished paths for ec for all boards, and dasharo-ec do the right thing placing it where expected.

CC @macpijan

@tlaurion
Copy link
Collaborator

I think I rebased and cleaned up my commits. Updated the EC revision so the V56 build can pass here as well.

@macpijan do you need me to change anything that was added to docker image 2.8 pinned by hash? Not sure I follow.

tlaurion added a commit to tlaurion/heads that referenced this pull request Mar 12, 2026
…er image independently for v540tu and v560tu (toehr boards missing)

Steal/adapt/reuse as needed to speed things as needed for next feature freeze @macpijan
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
@tlaurion
Copy link
Collaborator

tlaurion commented Mar 12, 2026

I think I rebased and cleaned up my commits. Updated the EC revision so the V56 build can pass here as well.

@macpijan do you need me to change anything that was added to docker image 2.8 pinned by hash? Not sure I follow.

@macpijan See fixed #2039

Steal/reuse/fix this branch with changes rebased on upstream and adapting modules/coreboot, modules/coreboot and coreboot configs for all boards, where LOCALVERSION needs to be fixed, since all boards depend on same fork right now independently of Dasharo/coreboot having independent branched now for ns50,nv4x_adl/v560tu+v540tu intentionally for review

config/coreboot* were updated because defconfig provided made no sense since bugs found.

docker image updated to v0.2.9 per your changes in flakes* files.

Let me know how much more I can help.


work log

3h work here so ec for v540tu/v560tu can be built, and integrated in fw image correctly where f263fa2 didn't create a custom docker image to fit the need which of course douldnt' build, and where v540tu/v560tu shared same ec.rom even though reported 2 weeks ago #2062 (comment). Please be my dead angle and other brain for that, please.

tlaurion added a commit to tlaurion/heads that referenced this pull request Mar 12, 2026
…er image independently for v540tu and v560tu (toehr boards missing)

Steal/adapt/reuse as needed to speed things as needed for next feature freeze @macpijan
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
tlaurion added a commit to tlaurion/heads that referenced this pull request Mar 13, 2026
…er image independently for v540tu and v560tu (toehr boards missing)

Steal/adapt/reuse as needed to speed things as needed for next feature freeze @macpijan
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…mal changes to build Dasharo-EC

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
docker:
# Docker image: tlaurion/heads-dev-env:v0.2.7
- image: tlaurion/heads-dev-env@sha256:5f890f3d1b6b57f9e567191695df003a2ee880f084f5dfe7a5633e3e8f937479
# Docker image: tlaurion/heads-dev-env:v0.2.9
Copy link
Collaborator

@tlaurion tlaurion Mar 13, 2026

Choose a reason for hiding this comment

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

it's v0.2.9 (commit msg says v0.2.8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants