From fe3d278f6406f446e3099b96a6dc504a539a8a9e Mon Sep 17 00:00:00 2001 From: Maciej Pijanowski Date: Fri, 27 Feb 2026 15:12:05 +0100 Subject: [PATCH 1/2] modules/dasharo-ec: new module 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 --- .../novacustom-v540tu.config | 1 + .../novacustom-v560tu.config | 1 + config/coreboot-novacustom-v540tu.config | 5 +- config/coreboot-novacustom-v560tu.config | 5 +- modules/dasharo-ec | 50 +++++++++++++++++++ 5 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 modules/dasharo-ec diff --git a/boards/novacustom-v540tu/novacustom-v540tu.config b/boards/novacustom-v540tu/novacustom-v540tu.config index 7076b2c66..bc61ed94f 100644 --- a/boards/novacustom-v540tu/novacustom-v540tu.config +++ b/boards/novacustom-v540tu/novacustom-v540tu.config @@ -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 diff --git a/boards/novacustom-v560tu/novacustom-v560tu.config b/boards/novacustom-v560tu/novacustom-v560tu.config index 2451b1bda..dc73ec889 100644 --- a/boards/novacustom-v560tu/novacustom-v560tu.config +++ b/boards/novacustom-v560tu/novacustom-v560tu.config @@ -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 diff --git a/config/coreboot-novacustom-v540tu.config b/config/coreboot-novacustom-v540tu.config index 4f947d78c..44da03805 100644 --- a/config/coreboot-novacustom-v540tu.config +++ b/config/coreboot-novacustom-v540tu.config @@ -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 diff --git a/config/coreboot-novacustom-v560tu.config b/config/coreboot-novacustom-v560tu.config index 66a6a530d..403ecc76c 100644 --- a/config/coreboot-novacustom-v560tu.config +++ b/config/coreboot-novacustom-v560tu.config @@ -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 diff --git a/modules/dasharo-ec b/modules/dasharo-ec new file mode 100644 index 000000000..041283c0b --- /dev/null +++ b/modules/dasharo-ec @@ -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") +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/ (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 From f263fa2bb34ffa8bb67bf74b8b55c1e1789c97c0 Mon Sep 17 00:00:00 2001 From: Maciej Pijanowski Date: Fri, 27 Feb 2026 15:12:26 +0100 Subject: [PATCH 2/2] toolchain: add sdcc and xxd Required to to build dasharo-ec module. Need to pin SDCC version to 4.2.0 to avoid https://github.com/Dasharo/dasharo-issues/issues/1785 and be in sync with ec-sdk: https://github.com/Dasharo/ec-sdk/pull/2 Using 3.8.0 in nix toolchain (as originally used in ec-sdk) was not feasible: https://github.com/linuxboot/heads/pull/2062#issue-4001232463 Signed-off-by: Maciej Pijanowski --- flake.lock | 19 ++++++++++++++++++- flake.nix | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index f1f0771ca..3f671b431 100644 --- a/flake.lock +++ b/flake.lock @@ -34,10 +34,27 @@ "type": "github" } }, + "nixpkgs-sdcc": { + "locked": { + "lastModified": 1706220439, + "narHash": "sha256-JMPlh3WoVVOSFSGdetBDKKkKkLNwnTqewFn+g1v2n/A=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7a339d87931bba829f68e94621536cad9132971a", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7a339d87931bba829f68e94621536cad9132971a", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-sdcc": "nixpkgs-sdcc" } }, "systems": { diff --git a/flake.nix b/flake.nix index 0b985424a..bd0c226bf 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,10 @@ # 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. @@ -11,10 +15,12 @@ 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. @@ -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