Skip to content

Generate board factory-configs from the defaults - #1830

Open
saba8814 wants to merge 3 commits into
mainfrom
factory-cfg-split
Open

saba8814 wants to merge 3 commits into
mainfrom
factory-cfg-split

Conversation

@saba8814

@saba8814 saba8814 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The Banana Pi, NanoPi R2S, Raspberry Pi and Acer Connect Vero W boards
each shipped a complete static factory-config.cfg. A static file
skips gen-config, so any change to the defaults had to be made in 14
files, and the copies had already drifted apart. Only the interfaces,
hardware, DHCP server and firewall differ between boards.

This moves those parts out of the static files, as asked for in the
review of #1740. A change to
the defaults, the NACM for example would then be one file.

  • Each product ships gen-ifs-custom and gen-cfg-custom in
    etc/product/bin/. Both print a static JSON document. gen-config
    already runs them and is left as it is
  • /etc/product/bin is added to the PATH in /etc/confdrc
  • The static files are removed, and config-version.sh with them
  • A new unit test validates the factory-config of every product
    against the YANG models with yanglint

The generated configs differ from the old files in two places, both
where the old files had drifted: the keystore gets the self-signed
certificate, and the motd and meta version are generated.

Two things to be aware of:

  • A spin with its own /etc/confdrc has to add /etc/product/bin to
    its PATH, see doc/branding.md
  • The new test needs a built tree for the NETCONF server models and
    skips without one, so it skips in CI

I ran make test-unit, which covers the defaults and all 14 products.
On hardware I tested a Raspberry Pi 4, where the config was generated
and applied and DHCP and SSH work, and a Banana Pi BPI-R64, where the
config was generated and merged correctly.

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):

@saba8814
saba8814 marked this pull request as draft November 27, 2026 10:04
@saba8814 saba8814 added the ci:main Build default defconfig, not minimal label Nov 27, 2026
@saba8814
saba8814 force-pushed the factory-cfg-split branch 2 times, most recently from ac626d1 to f336fe1 Compare November 27, 2026 12:42
gen-config already takes a gen-ifs-custom interface generator and a
gen-cfg-custom overlay from PATH, which a br2-external builds into
/usr/libexec/confd.  An image that serves several products cannot do
that, the product directory is copied to / at boot and only reaches
/etc.  Add /etc/product/bin to the PATH in confdrc, so a product can
ship the two generators and lose its complete static factory-config.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
The per-product factory-config.cfg files were complete static copies,
so NACM, services and LLDP were duplicated in every one of them and any
change to the defaults had to be repeated per board.  Most had already
drifted: no NETCONF server, an older keystore and motd.

Each product now ships a gen-ifs-custom with its interfaces and a
gen-cfg-custom with the rest that differs from the defaults, i.e.,
hardware, DHCP server, firewall, hostname, NTP and update schedule.
Both print a static document.  With no static configs left in board/,
config-version.sh has nothing to check and goes.

Prepares for the NACM default changes in #1658, which become a change
to one file.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
The product generators carry no version for make migrate-configs to act
on, so a model change that breaks one would only show on the board
itself, as a boot into the failure-config.

The new repo check collates the factory.d defaults with the output of
each product's generators the way gen-config does and validates the
result with yanglint, against all modules in the srload .inc files with
their features.  The NETCONF server and keystore models come from the
libnetconf2 and netopeer2 sources, so the check needs a built tree and
is skipped without one.

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
@saba8814 saba8814 changed the title [DRAFT] Factory cfg split Generate board factory-configs from the defaults Nov 30, 2026
@saba8814
saba8814 marked this pull request as ready for review November 30, 2026 12:16
@saba8814
saba8814 requested a review from troglobit November 30, 2026 13:06

This branch has not been deployed

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

Labels

ci:main Build default defconfig, not minimal

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant