Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early bootstrap refactor #811

Merged
merged 14 commits into from
Nov 8, 2024
Merged

Early bootstrap refactor #811

merged 14 commits into from
Nov 8, 2024

Conversation

troglobit
Copy link
Contributor

Description

Some products need workarounds to default Infix behavior. This change set is a refactor of the early system bootstrap to provide product-specific hooks. For the Styx platform we install a LED script that disables iitod in favor of a static setup.

Sumamry of general changes in this pull request:

  • The Infix prope script had some PEP8 fixes, as well as a few bug fixes
  • The device tree compatible string is now split up and listed, in reverse order, as an array in /run/system.json
  • The product specific setup now use the compatible array from /run/system.json` to apply overrides, from least significant to most significant
  • The product specific setup in Infix init now calls runparts -s /etc/product/init.d, meaning all product specific override scripts in that directory are called with a start argument
  • New bootstrap conditions:
    • rename ixinit-done -> ixinit, to match other conditions
    • add led and product conditions, triggering iitod
  • The missing file /etc/machine-id, required by RAUC, now points to /var/lib/dbus/machine-id, created by the Finit D-BUS plugin after factory reset
  • RAUC is now started with the flag -s to enable syslog support, previously added in 0f410eb, this fixes rauc: ansi control characters in log messages #809

Styx requires a few more generic, and specific, changes:

  • The Linux mv88e6xxx LED driver reported EINVAL instead of EOPNOTSUPP, causing lots of (bogus) worrying log messages
  • The LED override script clears the led condition, effectively disabling iitod. This script can be called from the prompt to perform other actions as well (list, flash, setup, etc.), call /usr/libexec/styx/led.sh (without any arguments) for more information
  • The device tree has restored copper LED LED1, the second green port. Instead of being called <device>:yellow:tp it is now called <device>:green:aux
  • The device tree has been updated to disable the second LED for all SFP ports, it is not connected on the boards (Rev. A and Rev. B)

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit troglobit requested a review from wkz November 7, 2024 13:23
@troglobit troglobit self-assigned this Nov 7, 2024
@troglobit troglobit added this to the Infix v24.10.2 milestone Nov 7, 2024
Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

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

Simply lovely! 😄

Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

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

🔥!

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch use the new compatible array in /run/system.json, installing
in order, least to most significant product overrides.

We also introduce a new way to run product specific scripts at init, to
override default behavior in Infix, e.g., LED control.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Some services launched at bootstrap must be possible to override per
product.  One such service is iitod, which manages the LEDs in Infix.

This change makes allows a product specific init script to clear the
led condtion, preventing Finit from lauching iitod.  Also, rename the
ixinit-done condition to match the nomenclature used already.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This reverts commit 7d1a708.  Turns out
the second LED is actually connected.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
On Rev. B, the second LED on the copper ports is green instead of yellow.
This patch renames them from yellow -> aux => <device>:aux:tp

Also on Rev. B, the second LED for SFP ports do not work at all.  This
patch drops them from the device tree to avoid confusion.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
After the initial probe, set up all port leds:

 - Disable all LEDs
 - Enable netdev trigger for all green LEDs (tp + sfp)
 - Enable link statux and rx/tx activity
 - Skip all aux LEDs

Also in script, a neat little flash function that can be used both for a
production test, to verify all LEDs work, and at runtime to locate the
device in a rack of devicess.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Bootstrapping a system with D-Bus using Finit will create the machine-id
file /var/lib/dbus/machine-id, this can be used as the unique machine-id
for services like RAUC, so let's set that as /etc/machine-id to reduce
the log spam we get otherwise:

Nov  7 06:18:08 test-05-25-f8 rauc[5512]: Failed to get machine-id: Failed to open file <E2>M-^@M-^\/etc/machine-id<E2>M-^@M-^]: No such file or directory

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
In 0f410eb a patch was added to RAUC to allow native logging to syslog,
it was however never enabled.  This patch enables logging to syslog.

Fix #809

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Check if the "usb-ports" key exists in /run/system.json before calling jq,
otherise we get the following error message:

Nov  8 05:11:45 ix bootstrap[3349]: jq: error (at <stdin>:0): Cannot iterate over null (null)

Also, minor whitespace cleanup and bashisms fixes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When we opportunistically set up mqprio on all interfaces, we pass over
interfaces without offloading support.  Catch that error message and log
an informational message about which interfaces are skipped.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

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

Once more with feeling! 😄

@troglobit troglobit merged commit 2910d8b into main Nov 8, 2024
5 of 6 checks passed
@troglobit troglobit deleted the bootstrap-refactor branch November 8, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

rauc: ansi control characters in log messages
2 participants