Skip to content

Conversation

@threexc
Copy link
Contributor

@threexc threexc commented Feb 3, 2026

Some U-Boot configurations may prepend timestamps to the beginning of every line during early boot, and at the prompt, e.g.:

|[ 2.397] Failed to get fastboot key config: -19
|[ 2.402] sdh@d4280000: 74 clk wait timeout(100)
|[ 2.405] MMC: no card present
|[ 2.408] mmc_init: -123, time 7
|[ 2.412] Net: RGMII interface
|[ 2.414] eth0: ethernet@cac80000
|[ 2.420] Autoboot in 5 seconds
|=>
|=> [ 4.878]
|=> [ 5.920]
|=> [ 503.743] d
|=> [ 505.712]

Unfortunately, this means that strategies may not behave as expected when trying to run commands, as labgrid's console.expect() function will always find the timestamp in addition to the check strings it sends. Handle this by adding the strip_timestamps boolean option for UBootDriver, which (if enabled) strips any timestamps found prepended to output lines.

Test results with tox:

================================================================================================== 363 passed, 41 skipped, 231 warnings in 195.01s (0:03:15) ==================================================================================================
py39: SKIP (0.17 seconds)
py310: SKIP (0.01 seconds)
py311: SKIP (0.01 seconds)
py312: SKIP (0.01 seconds)
py313: SKIP (0.36 seconds)
py314: OK (211.12=setup[15.06]+cmd[196.06] seconds)
congratulations :) (211.71 seconds)

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested - tested by proving it works with a known broken setup on my OrangePi RV2

Add a regex pattern for matching against timestamps prepended to console
lines, which is an option in some U-Boot configurations.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Some U-Boot configurations may prepend timestamps to the beginning of
every line during early boot, and at the prompt, e.g.:

|[   2.397] Failed to get fastboot key config: -19
|[   2.402] sdh@d4280000: 74 clk wait timeout(100)
|[   2.405] MMC: no card present
|[   2.408] mmc_init: -123, time 7
|[   2.412] Net:   RGMII interface
|[   2.414] eth0: ethernet@cac80000
|[   2.420] Autoboot in 5 seconds
|=>
|=> [   4.878] <INTERRUPT>
|=> [   5.920] <INTERRUPT>
|=> [ 503.743] d<INTERRUPT>
|=> [ 505.712]  <INTERRUPT>

Unfortunately, this means that strategies may not behave as expected
when trying to run commands, as labgrid's console.expect() function will
always find the timestamp in addition to the check strings it sends.
Handle this by adding a strip_timestamps boolean option to the
UBootDriver, which if enabled strips timestamps from received lines when
found.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
@threexc threexc force-pushed the tgamblin/strip-uboot-timestamps branch from 7aa5d98 to 4ae5d55 Compare February 3, 2026 20:27
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.2%. Comparing base (38d41d5) to head (4ae5d55).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/ubootdriver.py 50.0% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1816   +/-   ##
======================================
  Coverage    45.2%   45.2%           
======================================
  Files         174     174           
  Lines       13747   13751    +4     
======================================
+ Hits         6221    6223    +2     
- Misses       7526    7528    +2     
Flag Coverage Δ
3.10 45.2% <66.6%> (+<0.1%) ⬆️
3.11 45.2% <66.6%> (+<0.1%) ⬆️
3.12 45.2% <66.6%> (+<0.1%) ⬆️
3.13 45.2% <66.6%> (+<0.1%) ⬆️
3.14 45.2% <66.6%> (+<0.1%) ⬆️
3.9 45.2% <66.6%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@khilman
Copy link
Contributor

khilman commented Feb 3, 2026

Tested this on a MusePi-Pro board, with SpacemiT K1 SoC that has vendor u-boot that spits out u-boot timestamps in unpredictable ways. This series fixes the problem for me. Thanks!

Tested-by: Kevin Hilman khilman@baylibre.com

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants