Commit Graph
3322 Commits
Author SHA1 Message Date
Filip Lewiński 5673c1ec32 ADL: add updated nv4x_adl config
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:55:25 -04:00
Filip Lewiński c8eb0e7421 .circleci/: account for the dasharo refactor
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:55:19 -04:00
Filip Lewiński 70b1f6380d patches: rename coreboot-dasharo-unreleased -> coreboot-dasharo_v56-unreleased
The coreboot module for NovaCustom MTL boards was renamed from
'dasharo' to 'dasharo_v56'. The Heads patch system resolves patch
directories as <module_name>[-<patch_version>], so with module
coreboot-dasharo_v56 and patch_version=unreleased the expected path
is patches/coreboot-dasharo_v56-unreleased/.

Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:55:13 -04:00
Thierry Laurion 7f2f495fbc coreboot-dasahro: add https://github.com/Dasharo/coreboot/pull/847 on top of 1.0.1 for testing (Improve performance by lowering the EPP value from the power-on default of 0xb3 (70%) to 0x73 (45%). Lower value = higher performance.)
Test fix for https://github.com/Dasharo/dasharo-issues/issues/1711

related:

- https://github.com/linuxboot/heads/pull/2039
- https://github.com/Dasharo/dasharo-issues/issues/1711
- https://github.com/linuxboot/heads/issues/1894

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-16 23:55:08 -04:00
Filip Lewiński 06a38e35d1 MTL: switch from Notebook to Clevo
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:55:02 -04:00
Filip Lewiński 16e8d38a2b modules/coreboot: split dasharo base revisions
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:54:56 -04:00
Filip Lewiński 88684f76d7 MTL release: coreboot revision and updated configs
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:54:50 -04:00
Thierry Laurion 93ad3bfd61 Makefile: Auto-clean board build directories when coreboot canary changes
When the coreboot git commit changes (canary mismatch), remove and recreate
the board-specific build directories to prevent stale artifacts from causing
compilation failures.

This eliminates the need for manual `rm -rf build/x86/BOARD` before rebuilding
after coreboot canary updates in development cycles (when creating patches).

One currently still has to, eg:
echo "bogues repo url + commit hash" | sudo tee /home/user/heads/build/x86/coreboot-25.09/.canary

Current logic then:
1. Detects canary changes and triggers repository cleanup
2. Removes both Heads board directory (build/x86/BOARD) and coreboot board
   directory (build/x86/coreboot-*/BOARD) that contain stale build artifacts
3. Recreates empty board directories for the subsequent build
4. Allows patches to apply cleanly without Ada compilation errors

This ensures Ada builds work correctly after coreboot updates without manual
intervention (resync repo, apply patches, clean artifact dirs and rebuilds only what changed).

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-16 23:54:44 -04:00
Filip Lewiński 85a7077bd9 modules/dasharo-ec: address review feedback and add nv4x_adl/ns50 support
- config/coreboot-novacustom-v560tu.config: switch EC from SYSTEM76_EC
  to DASHARO_EC (CONFIG_EC_DASHARO_EC=y, _UPDATE=y, _UPDATE_FILE="ec.rom"),
  matching the v540tu change already in this branch

- modules/dasharo-ec: strip UNTESTED_/EOL_ board name prefixes before
  the board model mapping so that boards not yet promoted (e.g.
  UNTESTED_nitropad-ns50) resolve correctly without a separate entry

- modules/dasharo-ec: add board model mappings for novacustom-nv4x_adl
  (ns5x_adl - nv4x_adl) and nitropad-ns50 (ns5x_adl)

- modules/dasharo-ec: drop redundant sh -c wrapper from cp recipe;
  Make already invokes recipe lines via the shell

- modules/dasharo-ec: replace dd seek-based padding with
  truncate --size=128KiB, as suggested in review (ec.rom is always
  smaller than 128 KiB)

- modules/dasharo-ec: indent ifeq variable assignments with a tab for
  readability

Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:54:38 -04:00
Filip Lewiński 1da1766cdd modules/dasharo-ec: fix build system and address review feedback
- Remove leading tabs from ifeq variable assignments (Make parse error)
- Move post-build steps (cp, dd, touch) out of dasharo-ec_target into
  a proper Make rule; _target is now only make arguments
- Set dasharo-ec_output to ec.rom (the actual artifact, not .built)
- Add -$(BOARD) suffix to dasharo-ec_base_dir and dasharo-ec_dir so
  v540tu and v560tu maintain independent build trees and ec.rom files
- Add explicit rule to copy and zero-pad ec.rom to 128 KB
- Fix coreboot copy rule: use FORCE + cmp so the recipe always runs
  but only updates the destination (and its mtime) when content differs,
  preventing the mtime race between boards sharing coreboot_base_dir

Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2026-04-16 23:54:32 -04:00
Thierry Laurion 60d8fa679f Prepare nix based docker image to be bumped to v0.2.9 to include minimal changes to build Dasharo-EC
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-16 23:54:26 -04:00
Maciej Pijanowski b63f9e5775 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 <maciej.pijanowski@3mdeb.com>
2026-04-16 23:54:21 -04:00
Maciej Pijanowski bb89edf1b4 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 <maciej.pijanowski@3mdeb.com>
2026-04-16 23:54:14 -04:00
Thierry Laurion a1bf81d7de Merge pull request #2088 from tlaurion/fix_nk3_secrets_app-not-GPG_admin_pin
NK3: use device-specific branding and PIN labels consistently across codebase
2026-04-16 23:54:06 -04:00
Thierry Laurion bd0f786c4d NK3: use device-specific branding and PIN labels consistently across codebase
The NK3 uses 'Secrets app' terminology and has 8 PIN retry attempts (vs 3 for
older devices), but the codebase had inconsistent UX messaging that referred to
'GPG Admin PIN', 'USB security dongle', 'TOKEN', etc. instead of the actual
brand and PIN type.

Fix 1: PIN label - $prompt_message is used in all user-facing strings (status,
prompts, error messages, reminder note) with correct value: 'Secrets app' for NK3,
'GPG Admin' for older devices.

Fix 2: Dynamic attempt counting - after the default PIN trial consumes an attempt,
re-read the counter and limit user attempts to min(retries-1, 3). If the counter
read is unreliable (0 or 1), fall back to 3 attempts so the user is never
blocked from sealing. Documented with example outcomes for NK3 (8 retries) and
pre-NK3 (3 retries).

Fix 3: NK3-specific error message now references 'Secrets app PIN' instead of
'GPG Admin PIN' in the PIN reset instructions.

Fix 4: Use $DONGLE_BRAND consistently in all USB security dongle messaging
(STATUS, prompts, dialog titles, guidance strings, integrity report, DEBUG
logs, error messages, NOTES) instead of hardcoded 'USB security dongle',
'OpenPGP signing card', 'GPG security dongle', 'dongle', 'signing card',
'Dongle key'. Also replaces 'TOKEN' in hotp_state/hotp_display with
$DONGLE_BRAND so integrity report shows actual brand (e.g. 'Nitrokey 3
PRESENT' instead of 'TOKEN PRESENT').

Fix 5: Centralize branding detection in standalone script entry points:
  - gui-init.sh: already detects at boot flow entry (line ~965)
  - oem-factory-reset.sh: added detection at script start (was missing)
  - confirm_gpg_card: detects for gpg-gui.sh and kexec-sign-config.sh
  - report_integrity_measurements: detects for hotp/gpg flow
  - seal-hotpkey.sh: has its own detection at script start

Fix 6: detect_usb_security_dongle_branding now guards against redundant
re-detection while preserving USB init safety: it skips USB re-init and lsusb
re-scan only when a specific DONGLE_BRAND is already set and _USB_ENABLED=y in
the current process. In child scripts that inherit DONGLE_BRAND but reset
_USB_ENABLED, it still runs enable_usb, then returns without re-scan if
branding is already specific.

Fix 7: Comment casing fix in oem-factory-reset.sh (Secrets App -> Secrets app)
to match user-facing strings and hotp_verification output.

Fix 8: Remove duplicate show_pin_retries call before PIN entry loop in
seal-hotpkey.sh. The function was being called twice before the first prompt
(once before the loop, once at loop start), showing 'Nitrokey 3 Secrets app
PIN retries remaining: 8' twice.

Fix 9: Clarify and enforce fast-path behavior for
detect_usb_security_dongle_branding in mixed parent/child script contexts:
avoid redundant module loads and scans in the same process, but do not skip USB
initialization when only branding is inherited.

Fix 10: detect_usb_security_dongle_branding now reuses wait_for_usb_devices
after enable_usb only when USB was not already initialized in the current
process. This avoids early lsusb enumeration races without regressing the
no-redundant-load/no-re-scan fast path.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-16 23:15:42 -04:00
Thierry Laurion 522e331388 Merge pull request #2089 from tlaurion/readme-docs-update
README: improve documentation table and add hardware-free testing note
2026-04-16 20:35:57 -04:00
Thierry Laurion adbcb6e335 README: improve documentation table and add hardware-free testing note
- Add 5 missing docs to the documentation table (prerequisites, faq,
  keys, development, build-freshness)
- Add note that Docker provides swtpm and canokey for full software
  testing without specialized hardware
- Add troubleshooting links to faq and build-freshness
- Fix component list: add musl-cross-make (was missing), correct
  'musl-libc' misconception, clarify not exhaustive
- Improve clarity throughout

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-16 15:16:26 -04:00
Thierry Laurion 98249ebcc2 Merge pull request #2081 from tlaurion/docker_scripts_improvements-local_dev_reconstruct_from_nix
docker: Add HEADS_FORCE_DOCKER_REBUILD and improve reproducibility checks
2026-04-16 14:41:26 -04:00
Thierry Laurion 4df98748ba docker: Add HEADS_FORCE_DOCKER_REBUILD and improve reproducibility checks
- Add HEADS_FORCE_DOCKER_REBUILD=1 to force rebuild from flake.nix/flake.lock
- Delete cached nix store result when forcing rebuild
- Add --print-build-logs to nix build for visibility
- Use docker load -i instead of docker load < for consistency
- Improve reproducibility check: explain config vs manifest digests
- Show method used (registry+jq, registry+sed, or pulled)
- Add tip to install jq and curl for faster registry checks
- Add get_remote_manifest_digest() with correct Docker Hub URL format
- Update doc/docker.md explaining config vs manifest digests
- Normalize indentation to tabs across docker scripts
- Use script-relative paths for deterministic nix build (--out-link)
- Add shared _parse_docker_image helper for consistent registry parsing
- Handle localhost as registry hostname (not Docker Hub)

Fixes:
- local result_target declaration in force rebuild
- handle regular file case for result (not just symlink)
- use printf instead of echo in hash computation
- fall back to shasum when sha256sum unavailable
- ensure temp directory cleanup on all paths
- handle @digest references in get_remote_manifest_digest
- restrict sha256 regex to exactly 64 hex chars
- use remote_method instead of hardcoded message
- Docker Hub URL uses sha256-{digest} not sha256:{digest}
- fix regex in get_remote_config_digest: use \. not \. for dot matching
- remove unused get_local_manifest_digest function
- move End marker to actual end points
- distinguish fetch_failed from mismatch in fallback message
- update documentation mismatch example to match current output
- check curl availability in get_remote_config_digest
- only show Docker Hub URL for Docker Hub images
- add curl availability check to get_remote_manifest_digest
- fix readlink -f fallback to use quoted variable
- fix pin-and-run.sh: strip :tag before appending @digest for valid Docker ref

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-09 13:49:38 -04:00
Thierry Laurion 8f78967f52 Merge pull request #2080 from JohnAZoidberg/usr-env-bin-bash
docker scripts: Use portable shebang
2026-04-08 14:36:42 -04:00
Daniel Schaefer e49e1516f6 docker scripts: Use portable shebang
Not all distros have /bin/bash, use env to get bash from the PATH

Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
2026-04-08 22:56:56 +08:00
Thierry Laurion d3d8053018 Merge pull request #2068 from tlaurion/tpm_reseal_ux-integrity_report-detect_disk_and_tpm_swap
UX improvements: TPM reseal (HOTP/TOTP/DUK) adds integrity report; detects disk/tpm swap and guide user into action, add terminal colors and guidance! Reduced quiet noise
2026-04-06 22:21:34 -04:00
Thierry Laurion 0152068517 fix tpmr.sh: use tpm_owner_passphrase from prompt function
The prompt_tpm_owner_password() function sets tpm_owner_passphrase variable,
but tpm2_seal was using an unset tpm_owner_password variable instead.
This caused evictcontrol to fail with auth error (0x9A2) since no passphrase
was being passed to the TPM command.

Also standardizes all user-facing strings and variables to use 'passphrase'
instead of 'password' for TPM owner auth, including the cache file path.

Fixes regression introduced in commit 16648ca4b9.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-06 21:13:23 -04:00
Thierry Laurion e567b1282b mount-usb: auto-select LUKS partition when passphrase is provided
When a passphrase is supplied (--pass) and multiple USB partitions are
present, scan for the one LUKS partition and mount it automatically.
This removes the need for the user to manually pick the correct partition
when using the GPG key-material backup thumb drive, which always has two
partitions: a LUKS-encrypted private partition and an exFAT public one.

If exactly one LUKS partition is found it is selected silently; if zero
or more than one LUKS partition is found the existing interactive menu
is shown as before, so the behavior is unchanged for all other cases.

Remove the now-redundant WARN in cache_gpg_signing_pin that instructed
the user to select the encrypted LUKS partition manually.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-06 20:43:18 -04:00
Thierry Laurion c8ed01270d recovery: clear secrets inside while loop to force PIN re-prompt on shell respawn
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-06 20:43:12 -04:00