Compare commits

...
731 Commits
Author SHA1 Message Date
Joachim Wiberg 2057f3dae5 Update ChangeLog for v23.06.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-23 14:22:13 +02:00
Joachim Wiberg a8271d878d .github: Introducing the Infix Release General
Similar to the standard build workflow, with the following exceptions:

 - Sets internal variable 'ver' to ${GITHUB_REF#refs/tags/v}, for filenames
   and directories, ensuring the leading 'v' in the tag is dropped
 - Sets INFIX_RELEASE variable, for post-image.sh, to '$ver' so it creates
   the .img files with the same name as the tarball and directory. (RELEASE
   clashes with OpenSSL's release handling, breaking builds completely.)
 - Sets release directory + tarball to infix-$variant-$ver, where variant
   is one of "classic" or "" (for NETCONF).
 - *Skips the tests*, for now.  We release from main, which should already
   be tested.  Future releases may run a release test suite here
 - Each build step (matrix) uploads its artifacts, when all build steps
   have completed we start the release job (depends on build), which then
   downloads all the various artifacts before creating the GitHub release
 - The release notes are derived from the file ChangeLog.md.  Please note,
   extraction of the first release notes will fail since there is no prior
   release marker in the file

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 23:16:33 +02:00
Joachim Wiberg 89ea840e74 board/common: append $INFIX_RELEASE to artifact names
This patch affects the various artiact file names in release tarballs.
The files /etc/os-release and /etc/version in the image use the actual
GIT commit (git describe), as per post-build.sh

Guiding principle: artifacts without release suffix are development or
"nightly" builds.  Artifacts *with* release suffix are released ones.

This drops the $GITVER from .img files for consistency with the other
artifacts, e.g. .gns3a and .pkg.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 23:12:10 +02:00
Joachim WibergandTobias Waldekranz f48fdcd211 buildroot: bump to 2023.02.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 19:16:41 +02:00
Joachim WibergandTobias Waldekranz aea74842e0 test/case: new test, basic bridge vlan filtering
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 13:55:16 +02:00
Joachim WibergandTobias Waldekranz a295086a35 confd: add support for bridge VLAN proto and pvid
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 13:55:16 +02:00
Joachim WibergandTobias Waldekranz c8a3e94501 confd: initial support for bridge native vlan filtering
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 13:55:16 +02:00
Tobias Waldekranz 3784d769ca netopeer: Increase timeout to 60s
Empirical data shows response times of over 10s for even simple config
changes on heavily loaded systems (non-accelerated VMs with lots of
stress on the host). So we choose a really large number, hoping that
we won't be back here for a while.
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz da1bc57b92 confd: prevent sprious errors of symlinks already existing
When/If dagger generations are abandoned we should not bail out if a
recovery generation finds an existing 'order' in the previous gen.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 76b7dce7fc confd: ignore other end of veth pairs also when deleting interfaces
Same as with creating veth pairs, we must not try to delete both ends
since the kernel does that for us.  Ensure we check skip in the current
generation and not in the next.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 5e5cc8070f confd: skip shebang in dagger action if action already exists
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 9ca26a6ef7 confd: clean up error messages and drop developer debug messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 2994b68e89 confd: follow-up to bridge support, support removing bridge ports
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 791a153ebf confd: minor refactor
Relocate and reorder code a bit, preparing for VLAN support.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 1c6b06d3ac test/case: minor, fix copy-paste in step description
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 2014c470cd test/infamy: reset between test cases using 'copy startup running'
This should copy factory running, instead of using the factory-reset RPC
but for now we use startup since 'factory' is not yet supported as a
copy-from target.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 52c2fe1e68 test/infamy: spellcheck
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-22 00:12:43 +02:00
Joachim WibergandTobias Waldekranz 35b4e3296b test/infamy: fix runtime exception handling
File "/home/runner/work/infix/infix/test/infamy/netconf.py", line 116, in put_config
    except self.ncc.RpcError:
           ^^^^^^^^^^^^^^^^^
AttributeError: 'Manager' object has no attribute 'RpcError'

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz d4014816d9 test: fix copy-paste from other test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz e8c3eff52b confd: add support for setting bridge group_fwd_mask
This one was a little bit tricky with the special yang union.  To figure
out the integer value of enums one has to check the schema and deref the
correct subvalue within.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 587f92cbaa test/infamy: attempt to handle RpcError "processing timed out"
While running tests in GitHub action, the following[1] often happens.
From the timestamp it seems unlikely to be casused by timeout, which
from what I can tell is 120 sec in the library and 30 sec on our socket.
This never happens when running locally, so I've added a simple
try-catch to retry the operation, because some[2] jobs actually pass.

2023-06-18 09:18:17 # Traceback (most recent call last):
2023-06-18 09:18:17 #   File "/home/runner/work/infix/infix/test/case/infix_interfaces/dual_bridge.py", line 18, in <module>
2023-06-18 09:18:17 #     target.put_config_dict("ietf-interfaces", {
2023-06-18 09:18:17 #   File "/home/runner/work/infix/infix/test/infamy/netconf.py", line 117, in put_config_dict
2023-06-18 09:18:17 #     return self.put_config(lyd.print_mem("xml", with_siblings=True, pretty=False))
2023-06-18 09:18:17 #            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-06-18 09:18:17 #   File "/home/runner/work/infix/infix/test/infamy/netconf.py", line 112, in put_config
2023-06-18 09:18:17 #     self.ncc.edit_config(xml, default_operation='merge')
2023-06-18 09:18:17 #   File "/root/.infix-test-venv/lib/python3.11/site-packages/netconf_client/ncclient.py", line 277, in edit_config
2023-06-18 09:18:17 #     self._send_rpc(rpc_xml)
2023-06-18 09:18:17 #   File "/root/.infix-test-venv/lib/python3.11/site-packages/netconf_client/ncclient.py", line 223, in _send_rpc
2023-06-18 09:18:17 #     r = f.result(timeout=timeout)
2023-06-18 09:18:17 #         ^^^^^^^^^^^^^^^^^^^^^^^^^
2023-06-18 09:18:17 #   File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result
2023-06-18 09:18:17 #     return self.__get_result()
2023-06-18 09:18:17 #            ^^^^^^^^^^^^^^^^^^^
2023-06-18 09:18:17 #   File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
2023-06-18 09:18:17 #     raise self._exception
2023-06-18 09:18:17 # netconf_client.error.RpcError: EV ORIGIN: "rpc" ID 5 processing timed out.
2023-06-18 09:18:17 #

[1]: https://github.com/kernelkit/infix/actions/runs/5302735753/jobs/9597878647
[2]. https://github.com/kernelkit/infix/actions/runs/5302735946/jobs/9597878838

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz c832a906fd test/case: split bridge-basic test in three
A basic test should be just that, very basic test of a feature.  So we
split out the more advanced ones, building up to the dual-bridge.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 16be0e9db5 test/infamy: use merge operation with edit-config
Unsure if this is right, but existing nework test does not send loopback
or other interfaces in the networking configuration, so maybe merge?

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 4d122eb49b .github: prevent multiple reggies from running from the same branch
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 09055f64ea .github: start bob on push to main
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz c4f16e788d .github: upload resulting Infix image(s) even if tests fail
Add support for uploading resulting image(s) from a job even though the
tests may have failed.   This way we can inspect the image and see what
went wrong, or if it was a glitch in the matrix^W^Wazure.

Retain a symlink to images/ for test step.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 1d3b9e9e0f patches/sysrepo: add support for sysrepoctl -Cfactory -d running
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 812ee32029 test: add basic pc --> bridge-veth-bridge test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 7555e18996 confd: allow wheel group (admin) to access datastore locally
The admin account is the superuser in Infix.  The root account will soon
only be for running system daemons.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz c00ff6daf5 confd: bootstrap sysrepo+netopeer yang models with factory defaults
To set up proper factory defaults in Infix we need to drop the default
/etc/sysrepo datastores, initialized at compile-time by Buildroot when
installing netopeer2.  The pre-initialized datastores cannot be set up
with new {factory} data in any other way.

The system factory-config is constructed from two parts: static data and
generated data.  The latter is:

 - hostname (product name + the three last octets of the base MAC)
 - interface defaults (depends on number of ports on the device) that
   enable IPv6 link-local on all interfaces, and
 - per-device unique SSH hostkey for remote NETCONF access, requires
   openssl binary on target.  Can maybe use openssh for this (TODO).
   The hostkeys are saved in /cfg/factory.d/ to prevent them from being
   regenerated on every boot.

The script gen-hostkeys and the update of 10-netconf-server.json are
inspired by the netopeer2 scripts merge_hostkey.sh and merge_config.sh,
which do just about the same thing for regular systems.

We bootstrap sysrepo early with all the required models, netopeer2 as
well as our own, by calling sysrepoctl with initial data for {factory}
and {startup} datastores.  A local patch to sysrepo is used to allow it
to look for an /etc/factory-default.json instead of compile-time default
data, the patch allows us to have variable amount of objects in the init
data, e.g. number of interface objects.

A system startup-config is generated, if one is mising, from {running}.

We then drop the initial {running} datastore before starting the daemons
sysrepo-plugind and netopeer2-server so that they, and our plugins, are
ready when we load the system startup-config.

Some sanity checks and debug possibilities:

 - Ensure /etc/sysrepo exists before copying factory-config
 - Keep factory-default.json for debug

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz f19939e405 buildroot: backport sysrepo factory-default init support
Backport upstream sysrepo support for initializing internal modules,
like ietf-netconf-acm, with factory-default data.

A local KernelKit patch on top is required for run-time loading from
/etc/sysrepo/factory-default.json instead of the upsream compile-time
support.

Renamed existing patches to maintain the proper patch order.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 003eedeab8 confd: IP addresses must not be set, or be deleted, when not enabled
The ietf-ip yang model has a global IPv4 and IPv6 'enabled' setting that
must be honored.  E.g., when setting eth0 as a bridge port and disabling
IPv4 address on eth0, we must flush all addresses, including autoconf.
When detaching interface from the bridge and toggling the 'enabled' node
back on, we only get a "replaced" flag for that node, so we must restore
all addresses from the configure data.  The same goes for 'autoconf'.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz d71a3b3db6 confd: add support for "replace" operation
When toggling settings like 'interfaces/interface/ipv6/enabled', which
guards both link-local and all static addresses, the operation is not
"create" or "delete", but "replace".  Callback must take any "replace"
on an 'enabled' node into account since none of the other nodes will
be available in the diff.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 5be4a629f3 confd: add errno codes for out-of-range prio and missing current gen
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 352a1f1f64 confd: refactor, make lydx_is_enabled() available to all modules
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 86304e2656 confd: rudimentary support for Linux bridges
Very limited, only TPMR-style bridge, no VLAN filtering support yet.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 1b7d72a07c confd: add support for veth pairs, incl. new native YANG models
This change adds support for Linux veth pairs and is also a bit of a
cleanup of our native yang models, more on that below.  The interesting
things are the use of submodule(s) for veth, and the addition of the
deviation for the deprecated /if:interfaces-state.

Unfortunately the `fprintf(ip, "link add dev %s down", ifname);` had to
be delagated from netdag_gen_afspec_add() because of this change.  This
because we only know very late that the peer-end of the pair should be
skipped.  Having a lingering `ip link add dev foo down` causes iproute2
to fail hard.

A note about Yang models.  According to RFC they must follow the naming
standard; 'org-name' and use prefixes 'org-shortname'.  So we've decided
to standardize on 'infix-modulename' and 'infix-mn', where 'modulename'
is the standard model we extend, and 'mn' is the prefix used by that
standard model.  For example

 - infix-interfaces extend ietf-interfaces and use infix-if
 - infix-if-veth is a submodule extending infix with veth pairs

Upcoming bridge and lag models follow the same pattern.  The use of
submodules require a patch to sysrepo, included earlier, and allows
us to have the same 'infix-if:', or 'infix-interfaecs:' prefix to
all ietf-interfaces extensions.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 7c17793e5a confd: add support for bookkeeping "skip" interfaces
When setting up veth pairs we only need to set up one end of the pair,
so the confd callback code need a way to remember to skip setting up
the peer interface.

The code added here is generic enough to handle other such transactions.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 491239f99c confd: backport fexistf() from latest libite master
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 50a02e1690 confd: add support for changes in more deeply nested nodes
With the coming support for veth pairs, bridge, and link aggregates, we
need to infer peer interfaces (veth), and similar more deeply nested
data nodes to aid the user.  Thereforce we can no longer rely on the
xpath in the callbacks to always be "interfaces/interface[name='ifnm']".

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz f6e64a52ac confd: minor fixes
- initialize stack variables to prevent undefined behavior
 - memory leak

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 28d07c6255 confd: new function, srx_set_str(), complements srx_set_item()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 6f27e51700 confd: refactor srx_require_module(), patched upstream now works
This changeset includes a patch to the upstream sysrepo that is a slight
refactor of the internal function sr_install_modules_prepare_mod() that
is used by sr_install_module2().  Meaning, the srx_require_module() can
now be simplified greatly and we now also support the include statement
with submodules in yang models.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Joachim WibergandTobias Waldekranz 8462fe4ab6 confd: refactor ietf-system augments and deviations
Initial yang model cleanup:

 - Use infix-foo@rev.yang for augments and deviations of each std-foo model
 - Drop kernelkit-infix-deviations, moved to infix-system model

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-20 11:11:52 +02:00
Jon-Olov VatnandJoachim Wiberg aa372c247e Fixing typos is Infix discovery doc.
Ready for review.

Note for future: Add picture on Infix as Network Infrastructure
equipment in Windows Explorer (SSDP section)
2023-06-16 16:21:14 +02:00
Jon-Olov VatnandJoachim Wiberg ede1f59479 Minor changes to Infix discovery doc 2023-06-16 16:21:14 +02:00
Jon-Olov VatnandJoachim Wiberg 14712fdc91 Add info on Infix discovery services and possibilities 2023-06-16 16:21:14 +02:00
Tobias WaldekranzandJoachim Wiberg 77f9ca8e2a doc/testing: Add an overview of the test system 2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg 4e69f800de test/case: Add meta/wait to wait for nodes to boot up
When running in the cloud, without KVM emulation, together with many
other tenants, it can take a very long time to boot the instances.

Therefore, add a meta test that will wait for all devices in the
physical topology to come up before exiting. This means that the
actual test cases that follow can assume that devices will answer
NETCONF requests.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg aa8e11a58b test/infamy: Create an infamy specific topology object
Create topology objects that are tailored to represent topologies on
the expected format. This let's us make convenient accessors for
things like the controller node, infix devices, getting the ports used
to reach a certain device from another one, etc.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg 175f7e1c58 x86_64: Make the test environment more customizable
- Collect all test related targets under the test- prefix.

- Add target to run test suite against a `make run` instance. The
  intended use-case is that you are testing out a new build with `make
  run`, and then realize that you want to run some tests.  With this
  change, it is now possible to run `make infix-run-check` from a
  separate terminal - which attaches to the running instance and runs
  the tests.

- Provide -sh targets to spawn interactive environments, which is
  useful during debugging.

- Allow the user to supply a custom suite or list of tests to be run
  by 9PM.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg d75ecf3a1e test/env: Improve usage message 2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg c35553b20a test/env: Allow KVM to be explicitly disabled in the container
This let's us check for timing issues in tests that arise when falling
back to TCG acceleration in QEMU.

While we're here, add a proper option to see the usage message.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg d5b5cffa3b test/env: Provide a wrapper for qeneth to the running topology
With this change, when running an interactive test session, a plain
`qeneth status` will show the status for the network started by
test/env.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg bc3933ad92 test/env: Accept an explicit topology in place of a qeneth network
For now, this is only expected to be used with `-C`, i.e. not in a
containerized environment.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg c76233f5ba test/docker: Add debug tools to container
busybox-extras contains an implementation of telnet, which is needed
for `qeneth console` to work. While we're updating, add tcpdump since
we'll need it sooner or later.
2023-06-14 17:40:16 +02:00
Tobias WaldekranzandJoachim Wiberg 7eb2269972 test/infamy: Fix incorrect call when bailing out of MACVLAN creation
We're calling the bound instance of __exit__, so `self` is
superfluous.
2023-06-14 17:40:16 +02:00
Richard AlpeandJoachim Wiberg 723c325b0d statd: add limited operational data for all ifaces
Add oper-status and if-index data to sysrepo for every existing
interface. The origin of the data is the "standard" ip tool with
JSON output.

Current implementation is limited to interfaces existing at startup.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-13 16:39:53 +02:00
Richard AlpeandJoachim Wiberg 75155b72b3 confd: move helper.c to lib
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-13 16:39:53 +02:00
Joachim Wiberg 9e5cf13522 test: debug gh action
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg 6c9735a783 .github: shorten job title
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg 3afd84fb1a board: minimal builds provide qeneth compatible .img
Minimal builds should probably trigger use of another template in
Infamy, but for now we use this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg 0da9606644 test: infamy: raise exception if dut mgmt ip cannot be found
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg 4582b3446c .github: drop this job from regular branches and run after merge
We want Reggie to take most of the hits, then we sail in and build after
the PR has been merged so we can upload new "Nightly" images.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg 72c5e18f5c .github: add dedicated regression job for all actions and branches
- Keep build times low, use minimal defconfig and a single arch
 - Focus on the regression testing
 - Allow running on all branches for all users

Goal: when tests pass, reviews can start, if review is good, then merge

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg a4c3d7367b configs: add x86_64_minimal_defconfig
The idea for this is to maintain a smallest-possible type build that can
be used to run regression tests in GitHub Actions.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Joachim Wiberg c34981cc9f board/common: allow image signing to be optional
Primarily intended for minimal/testing images, but likely also useful
for other use-cases as well.

Defaults remain to sign all images.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-09 11:54:23 +02:00
Tobias WaldekranzandJoachim Wiberg d28b17bdef .github: Run the test suite as part of the CI on x86_64-netconf 2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg 225395f749 x86_64: Add convenience target to run the test suite
Once infix has been built, the test suite can now be run by issuing:

    make infix-check
2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg f26bd54336 test: Add a 9PM compatible test suite to run all tests 2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg 0f76b07625 test: Introduce a standardized test environment 2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg d81ca8fcd1 test: Add qeneth topology for running tests in VMs 2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg 3c0afcdc08 test: Add ietf_interfaces/vlan_ping
Verify that we can communicate with an infix device over a stacked
VLAN interface.
2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg d82da157b6 test: Add ietf_system/hostname 2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg 0fc720d48a test/infamy: Initial add of python based test library 2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg 9bead2fca4 qemu: Generate graphviz description of instance
This will be used to run tests against a `make run` instance.
2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg b3e6325c76 9pm: Generic test anything protocol (TAP) runner and expect wizard
The plan is to leverage this for Infix's internal test suite.
2023-06-08 11:10:31 +02:00
Tobias WaldekranzandJoachim Wiberg 60d2b1f105 test: Remove 9pm console lab
Hopefully we won't have to go down the dark path of console parsing,
but if we do, it's good to have this example in the log.
2023-06-08 11:10:31 +02:00
Richard AlpeandJoachim Wiberg 382f428edf confd: add new statd skeleton for operational status
Add a new "statd" module to sysrepo. This module is intended to handle
operational status, i.e. R/O attributes.

In this state, the statd module only retrieves and answers to the
"oper-state" of "eth0". This will be replaced by proper interface
handling and json data processing in upcoming patches. The indent here
is to get the base logistics in place as soon as possible to make life
easier for developers.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-07 13:24:23 +02:00
Richard AlpeandJoachim Wiberg 26391d5381 confd: move srx_module to src/lib
Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-07 13:24:23 +02:00
Richard AlpeandJoachim Wiberg 84822390ff confd: move lyx source to new src lib directory
Preparation for statd.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-07 13:24:23 +02:00
Tobias Waldekranz f6a7fe5353 qemu: Allow qemu.sh to be run from any directory
Since qemu.sh is now tied to the directory it's ran from, it makes
sense to change into that directory before starting to resolve any
file paths. This let's us start the script from any directory without
the need for any (cd && qemu) subshell.
2023-06-05 14:07:02 +02:00
Joachim WibergandTobias Waldekranz fd9d3a2723 board: minor shellsheck fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-05 14:07:02 +02:00
Joachim WibergandTobias Waldekranz f8d5c3a9b8 Drop Infix Qemu support from "make menuconfig"
This change drops Qemu menuconfig from the regular 'make menuconfig' in
favor of full release tarball support.  Meaning "make update-defconfig"
will not longer cause unwanted diffs for Qemu defaults checked in when
the defconfigs are updated.

Details:

 - For "make run, run-menuconfig" and bootstrapping qemu.cfg we want to
   use the Buildroot menuconfig system. However, we must set the proper
   environment variables for it to not overwrite our product's .config,
   so the calls to conf and mconf are not pretty.

 - The qemu.sh script can probably be cleaned up further, I've just set
   a CONFIG_ prefix to all variables and dropped any images/ prefix vs.
   the original.  The CONFIG_ prefix is to make the qemu.cfg compatible
   with kconfig-mconf from the kconfig-frontends package.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-05 14:07:02 +02:00
Joachim WibergandTobias Waldekranz 816cf5c370 qemu: add stand-alone menuconfig support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-05 14:07:02 +02:00
Joachim WibergandTobias Waldekranz 93701ae2ef qemu: export Qemu start script in release tarball
First basic step, we also want a menuconfig-like way of changing the
settings, e.g., networking options.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-05 14:07:02 +02:00
Richard AlpeandTobias Waldekranz 4fa89651a7 confd: move src into confd subdirectory
This patch is a preparation for the upcoming "statd" addition.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-06-05 13:21:01 +02:00
Joachim WibergandTobias Waldekranz 19df588fe4 package/querierd: bump to version 0.10
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-02 18:19:50 +02:00
Joachim Wiberg 646364a6e0 doc: update README and add doc/cli.md
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-02 15:38:40 +02:00
Joachim Wiberg e6ef11a023 configs: fix string syntax, i.e., s/""/"/g
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-02 14:32:49 +02:00
Joachim WibergandTobias Waldekranz c81bc445ca confd: simplify, yang model ensures iftype (+ ifname) is always set
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-01 15:16:39 +02:00
Tobias Waldekranz d82e586687 confd: Infer VLAN parameters for the common <BASE>.<VID> pattern
When adding a new interface to the candidate, if the name matches
<BASE>.<VID>, infer that:

- The parent-interface is <BASE>
- The tag-type is c-vlan
- The vlan-id is <VID>

With this in place, from klish, the following sequence:

configure
set interfaces interface e0.10
leave

Will create a stacked VLAN interface, using VID 10, on top of e0.
2023-06-01 15:16:39 +02:00
Tobias Waldekranz a09a1b922f confd: Generalize VLAN support to arbitrary virtual interfaces
- Make sure that when we need to delete an interface, this is done in
  the exit phase of the generation we're exiting, i.e. it is treated
  as a regular delete.

- When we need to delete and rebuild an interface, make sure that all
  settings and addresses are applied again.  This is done by swapping
  out the diff for the configured data, which we just annotate with
  enough metadata to make it look like a diff.

- Create a dagger dependency from the VLAN to it's parent interface.
  This ensures that the parent interface is properly configured before
  the VLAN is created, which is important when virtual interfaces are
  stacked on top of each other. E.g. a VLAN on top of another VLAN.

- Recreate the VLAN when the parent is changed.

- Fix VLAN tag-type parsing
2023-06-01 15:16:39 +02:00
Tobias Waldekranz 361c0d7827 confd: Move interface deletion logic to its own function
Let's try to keep netdag_gen_iface from becoming do_everything().
2023-06-01 15:16:39 +02:00
Tobias Waldekranz 82aa842cd2 confd: srx: Add helper to query the number of items matching a path
This is useful in candidate inference scenarios where you only want
to infer settings that don't have explicit values set.
2023-06-01 15:16:39 +02:00
Tobias Waldekranz 258ba272c7 confd: lyx: Allow diffs of NULL nodes
This makes the pattern

    if (lydx_get_diff(lydx_get_child(diffnode, "attribute"), &nd)) {
        /* Handle changes to "attribute" */
    }

safe to use in the common case where "attribute" has not been
modified, and is therefore not present in `diffnode`.
2023-06-01 15:16:39 +02:00
Tobias Waldekranz 092db20a80 confd: Avoid duplicate nodes in fetched config data
It is not clear why, but the former XPATH will return a tree with many
duplicate nodes in it, while the latter will not.
2023-06-01 15:16:39 +02:00
Tobias Waldekranz a9c5fccd47 dagger: Keep abandoned generations around for debugging
When evolving to a new generation fails, users will typically abandon
it (so that a new attempt can be made).  However, the generated
scripts and the logged output is very valuable from a debugging
perspective.

Therefore, keep the data around by just renaming the generation
directory.

Later, we can include these directories in the garbage collecting
process, if we want to.
2023-06-01 15:16:39 +02:00
Tobias Waldekranz af298a0a05 qemu: Create a gdbserver to UNIX socket bridge
Infix ships with a gdbserver configuration that listens on
/dev/hvc1. Connect this to gdbserver.sock on the host, so that we can
attach to or run Infix processes using GDB.
2023-06-01 15:16:39 +02:00
Joachim WibergandTobias Waldekranz ba382e1af5 src/confd: fix copy-paste check of alloca() return value
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-01 15:16:39 +02:00
Joachim WibergandTobias Waldekranz 37397543fa src/confd: drop developer debug messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-01 15:16:39 +02:00
Joachim WibergandTobias Waldekranz ee73ed3410 src/confd: add support for VLAN sub-interfaces
This adds support for VLAN sub-interfaces on physical interfaces, e.g.,
eth0.10 on eth0.  There are no restrictions or sanity checks other than
what is defined in the YANG models.

Neither the ietf-if-extensions or the ietf-if-vlan-encapsulation model
have been ratified as standards and are thus experimental.  As such, the
ietf-if-vlan-encapsulation model originally references a non-existing
revision of ieee802-dot1q-types, which has been modified to use the
latest release from IEEE.

How to set up, notice we do not use the l2vlan type:

  interface eth0.10 {
    type ethSubInterface;
    encapsulation {
      dot1q-vlan {
        outer-tag {
          tag-type s-vlan;
          vlan-id 10;
        }
      }
    }
    parent-interface eth0;
    ipv6 {
      autoconf {
        create-global-addresses true;
      }
    }
  }

Unfortunately, we have to create the VLAN interface on a separate line
since adding VLAN interfaces does not allow setting addrgenmode at the
same time, hence the introduction of the new line `link set %s down`.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-01 15:16:39 +02:00
Joachim WibergandTobias Waldekranz c2fc658734 board/common: relocate and drop unused files from NETCONF build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-01 08:23:36 +02:00
Joachim WibergandTobias Waldekranz d449279661 configs: trim default build, drop unused packages
These packages are not (yet) used in the NETCONF build, only make sense
in the Classic Infix builds.  SMCRoute will be needed later on, but not
right now, so also remove.

The dhcpcd package is only used by ifupdown-ng in Classic, in NETCONF we
use avahi-autoipd and udhcpc.

iproute2 is selected by the net tool, so collapsed by menuconfig.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-06-01 08:23:36 +02:00
Joachim WibergandGitHub 4ad676bb4e .github: also run when PR is merged
https://stackoverflow.com/a/61565445/1708249
2023-05-30 09:00:59 +02:00
Joachim WibergandTobias Waldekranz 8ffe839a99 src/confd: add support for ietf-system user authorized-key(s)
- Keys stored in system specific directory /var/run/sshd/$USER.keys
 - Keys are regenerated on each corresponding reconfiguration event
 - Deletion of key(s) or user remove all keys

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-28 23:31:18 +02:00
Joachim WibergandTobias Waldekranz e7bc7d76e8 src/confd: always run initctl in batch mode
Also, quiet output from cond get.  We're only using the exit code.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-28 23:31:18 +02:00
Joachim WibergandTobias Waldekranz 838a83e5b3 src/confd: fix review issue 'cannot disable dhcp client'
- Flip 'enabled' logic, if attribute is missing => 'enabled: false'
 - Release lease on udhcpc exit
 - Call initctl with -f (force) when deleting dhcp-$iface.conf otherwise
   in interactive mode, waiting for (y/N)? question
 - Also, always use -batch and -quiet modes with initctl

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz 6c8d5472d5 src/confd: finalize initial DHCPv4 with optional client-id support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz f2cb63df72 src/confd: initial support for DHCPv4 yang model
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz 0e48a847b9 buildroot: bump libyang, sysrepo, and netopeer2 to latest versions
Changes to netopeer2-server required refactoring our foreground patch.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz b319a2df9d src/confd: refactor commit done hook into a pre and post hook
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Joachim WibergandTobias Waldekranz ebc87eb0a0 src/confd: refactor handling of callbacks for SR_DS_CANDIDATE
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-26 15:10:26 +02:00
Tobias WaldekranzandJoachim Wiberg 3424985b2b netconf: Allow IPv6 connections by default in factory-config
By default, netopeer2 will accept connections from
INADDR_ANY (0.0.0.0), which limits it to IPv4. Open it up to include
IPv6 as well.
2023-05-25 16:34:50 +02:00
Tobias WaldekranzandJoachim Wiberg cd52a42388 netconf: Inject NACM config for admin user in factory-config
On May 10, 2023, @troglobit wrote:
> Initial proposal for factory-config, based on example from RFC8341.

This gives the admin user the ability to configure the device over
NETCONF.
2023-05-25 16:34:50 +02:00
Tobias Waldekranz 3dbc59120f confd: srx: Duplicate entire tree in srx_get_diff
Use the _siblings variant to ensure that the full diff tree is
duplicated. Otherwise, the caller would only see the first branch of
changes.
2023-05-25 11:45:10 +02:00
Richard AlpeandJoachim Wiberg 6adb508f37 confd: add new factory user admin:admin
This patch adds a new user "admin" with the password "admin". The
password is hashed with sha512 ($6) as a hint to new users attempting
to change the password (avoid the weakest algorithms).

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-25 08:24:31 +02:00
Richard AlpeandJoachim Wiberg f56ca0d0ca confd: fix json merging when generating factory config
jq -s 'add' didn't merge data, i.e.:

hostname.json:
"ietf-system:system": {
  "hostname": { }
}

auth.json:
"ietf-system:system": {
  "authentication": { }
}

Didn't become:
"ietf-system:system": {
  "authentication": { }
  "hostname": { }
}

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-25 08:24:31 +02:00
Joachim Wiberg d4333e1a8d src/confd: fix ietf-interfaces copy-paste bug in netdat_init()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 11:20:09 +02:00
Joachim WibergandTobias Waldekranz 96fb836635 Add disclaimer about Frr and podman in Hybrid Mode section
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:52:16 +02:00
Joachim WibergandTobias Waldekranz 4c15897c6a Fix #29: drop FRR from default builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:52:16 +02:00
Joachim WibergandTobias Waldekranz 9844f0e148 configs: enable CA certificates package for all defconfigs
Provided a little time, all an embedded system really needs is trust.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:52:16 +02:00
Joachim WibergandTobias Waldekranz 0a99f1a5f6 board/common: drop factory/reset user
Initial analysis of system default users gives that there is no real
need for a default 'factory' user to trigger a factory reset.  On an
actual physical device we will have a reset button or a menu option in
the bootloader to trigger factory reset, and in both physical and
virtual (GNS3) devices a logged in admin user can call the factory
command.

A virtual device that cannot be logged in to will have to be removed and
have its persistent backing store deleted, but that is the only real
downside to removing this user.  The idea is to set a kernel command
line flag from the bootloader, and that could also be done from, e.g.,
GNS3.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:51:37 +02:00
Joachim WibergandTobias Waldekranz 08ad4e9bc6 Fix #24: disable bridge firewalling by default in Infix
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-23 08:48:47 +02:00
Joachim WibergandTobias Waldekranz d8b24e16de doc: new document, Containers in Infix (with podman & CNI)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 8addf469bf package/podman: add tool to create CNI profiles
Currently only supports creating host-device profiles, e.g. from veth
pairs or physical interfaces.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 679d64d496 Update Hybrid Mode with podman example to start Docker containers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 56677fb1d6 package/podman: helper script to create supervised Finit service
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz b3761d84dc board: update kernel defconfigs for running containers (podman)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 852f1ed4c4 board/common: bind mount /var and /var/lib
The /var, and particularly /var/lib, directories are used for persistent
storage for various system daemons.  While adding support for containers
it became clear we had to change how we make these directories writable.
Both LXC and Podman use OverlayFS for the writable layer, and you cannot
set up an overlay on top of another overlay.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz bd696cba9a qemu: add support for optional /var disk (256M)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 468b49e916 buildroot: bump to v2023.02.1 w/ kkit patches
- package/libyang: Bump version to 2.1.55
 - package/netopeer2: Bump version to 2.1.59
 - package/sysrepo: Bump version to 2.2.60
 - package/cni-plugins: partial backport to enable missing plugins

The libite v2.5.3 backport has been dropped from the kkit patches
since it's been merged in upstream Buildroot LTS branch.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 65d170985c package/podman: new package
Podman (POD manager) is an open source tool for developing, managing,
and running containers on your Linux systems.

Based on work by Christian Stewart and Nathaniel Husted.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Joachim WibergandTobias Waldekranz 1624c88708 package/conmon: new package
Conmon is an OCI container runtime monitor.  It sits between container
runtimes, e.g., crun and runc, and userland managers, e.g., podman.

Based on work by Christian Stewart and Nathaniel Husted.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-21 20:39:12 +02:00
Richard AlpeandJoachim Wiberg 08a3f51e8f test: add functional example of how to test CLI auth
This test is based on the 9pm framework, which supports execution
of test-cases written in any language. This test is written in
tcl/expect with help from the 9pm expect library. It's what I used to
test during development of the Infix basic authentication support.

The aim of this patch is to serve as an example of how the
interactiveness of the 9pm-expect library can be used.

9pm framework code is here:
https://github.com/rical/9pm

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-16 13:34:28 +02:00
Joachim Wiberg 8aed30552f package/finit: bump for Finit v4.4 (GA)
Full release notes: https://github.com/troglobit/finit/releases/tag/4.4

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 19:17:23 +02:00
Joachim Wiberg 8ab2f5f9da src/confd: system users, like admin, have no shell by default
Rudimentary support for setting login shell for new users.  Currently
hard-coded from what's selected in the Buildroot config, if Bash is
available or not.

Follow-up to f5866ee

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 18:45:37 +02:00
Joachim Wiberg 50963a7883 src/confd: fix regression in ietf-system:motd and ietf-system:clock
The writesf() API was hard coded to always open files in "r+" mode,
which fails if the file doesn't exist.

Add a mode option to writesf() and writedf().

Also, drop the default motd, we don't have one in NETCONF mode.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 16:05:08 +02:00
Joachim Wiberg 23dc3fcb4f qemu: change console to hvc0, ensure TTY is saved and restored
This change drops -nographic in favor of the more flexible virtconsole,
fixing the problem with loss of terminal history and reset.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 16:05:08 +02:00
Joachim Wiberg 480d870587 src/confd: harmonize ietf-system, rename infix-system.yang augment
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 16:05:08 +02:00
Joachim Wiberg f5866ee3d4 Add support for admin/admin to manage Infix as group 'wheel'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-15 12:53:32 +02:00
Tobias WaldekranzandJoachim Wiberg 304e65e298 confd: ietf-interfaces: Handle attribute deletions properly
When deleting a value, the old value is in nd.val, so use the absence
of a new value to catch deletions.
2023-05-15 12:17:10 +02:00
Tobias WaldekranzandJoachim Wiberg 9d5a1d893c confd: lyx: Return the modified-from-default value from the diff
I.e. return the answer to the question "has this attributes changed
from the last config generation?" Which is always what we want to know
anyway.
2023-05-15 12:17:10 +02:00
Tobias WaldekranzandJoachim Wiberg 7491c280ac confd: Reload finit after the exit phase, if services are disabled
Bringing down the current generation is a step of its own, so it makes
sense to let finit clear out all old services before setting up the
new ones.

For example, with avahi-autoipd, without this step, we would run the
following sequence when disabling it on an interface:

initctl disable zeroconf@iface
ip link set dev iface down
ip link set dev iface up
initctl reload

But we really want to stop the zeroconf service before the down/up
cycle on the interface, since that is likely to disrupt the
daemon. With this additional step, the sequence becomes:

initctl disable zeroconf@iface
initctl reload
ip link set dev iface down
ip link set dev iface up
initctl reload

Which means that finit won't try to restart zeroconf if it dies during
the down/up cycle, since the service is already gone at that point.
2023-05-15 12:17:10 +02:00
Tobias WaldekranzandJoachim Wiberg 5b261cff2d dagger: Add pre and post hooks for actions
The special directories @pre and @post will always have their scripts
ran before and after, respectively, the rest of the DAG.
2023-05-15 12:17:10 +02:00
Joachim Wiberg b2191d0c20 package/finit: bump for 4.4-rc2 + kill process group fix
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-14 09:37:49 +02:00
Joachim WibergandTobias Waldekranz 3b3cadd72d src/confd: simplify after review comments from wkz
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Joachim WibergandTobias Waldekranz c98a99df58 src/confd: use global hook also for core_startup_save()
Saving running to startup follows the same pattern as config update of
candidate to running, so we must employ the same hook mechanism here.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Joachim WibergandTobias Waldekranz 688e196347 src/confd: consistent whitespace
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Joachim WibergandTobias Waldekranz 36f38d6198 src/confd: global event hook support
Refactor register_change() wrapper, for sr_module_change_subscribe(),
with an additional twist of setting up a commit DONE event catcher.

This creates a global event hook that ensures we call 'initctl reload'
after all module callbacks have completed, regardless of the xpath and
without having to have "shadow" subscriptions to all new modules being
added to confd.

Based on on ideas from https://github.com/sysrepo/sysrepo/issues/2188

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-12 15:58:20 +02:00
Tobias WaldekranzandJoachim Wiberg 580bcf5115 confd: Support controlling IP forwarding on interfaces 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg a1183780d1 sysctl: Disable forwarding by default on netconf builds
This matches the defaults in ietf-ip.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 0d09c4e16a confd: Use regular errnos internally when generation iface config
This:
1. Makes the code more familiar and easy to read
2. Let's us output more precise error messages
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg a07910f51f confd: Simplify code with the lyx diff helpers 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg fa311c699b sysctl: Keep static IPv6 addresses on downed interfaces 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 32f6f22b47 common: Use IPv4/6 default configuration on all interfaces
The comment in the script has the story.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg c2042bb036 confd: ietf-interfaces: Add IPv4/6 autoconf support 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 82d11112a6 avahi-autoipd: Default to always assigning a LL address
Without --force-bind, the address is removed if another routable
address is added to the interface.

While this is likely something that should be configurable in the
future, we choose this mode as the default so that IPs used for
NETCONF connections are not dropped because other addresses are added.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 5e23b2ac79 confd: dagger: Explicitly choose order for init/exit actions
Dagger's builtin fallback to bottom-up works for init, but exit should
run top-down.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 580c5b06b9 confd: lyx: Add helpers to classify the modification of a node 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg cc15adb774 confd: Move from net-do to dagger for managing config generations 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 3342270e18 dagger: Directed Acyclic Graph Generational Execution Runner
A generic replacement for src/net with some advantages:

- Shell script is well-suited to these kinds of tasks, making this
  implementation much simpler.

- Allow arbitrary number of actions (not just init/exit), this can be
  used to implement things like `dagger exec up/down`.

- Allow arbitrary number of scripts for each action/node tuple. This
  will let us handle more complex scenarios in confd without having to
  fiddle about with src/net.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 8df758dac0 confd: Add support for static IPv4/6 address configuration 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 88c845bc16 confd: Disable support for non-contiguous netmasks
Not something we need, and keeping it disabled has some nice symmetry
effects on the handling of ipv4/6 addresses.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 3192a69970 confd: ietf-interfaces: Initial work on net-do implementation 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg a5b4c04d08 confd: Add helper to get the diff being applied as a libyang tree 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 6e39b3dbf6 confd: Add helpers to find attributes belonging to a lyd_node
This avoids awkward XPath lookups when the structure of the lyd is
known.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 35ec76b0ef confd: Add helpers to read files containing a single number 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 751b22f4db confd: Avoid futile attempts to reload finit's config during boot
finit is not ready to accept the messages anyway, so we end up waiting
for the 2s timeout (2 times). Since finit won't setup a utmp entry
until it leaves runlevel S, we use that as the sync point for when
finit is ready to receive reloads.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 3ae4e1d9ca confd: Use printf attribute on relevant helpers
This let's the compiler catch format-specifier-to-argument mismatches.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 31d5dbda8c confd: Split out libyang extensions to separate file 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg a79c6ec06c confd: Remove temporary interface configuration
This will be replaced by the "net do" implementation
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 03e44dd5b1 confd: Dynamically generate factory-config
This allows you to define a single "logical" config that can be
tailored to the specific system based on the available interfaces,
base MAC address etc.
2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg 80d9312e36 confd: Infer type when configuring physical interfaces 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg ed41b621d9 confd: Fix -Wformat-security warning 2023-05-12 14:24:41 +02:00
Tobias WaldekranzandJoachim Wiberg f40841e5e7 confd: Consistently use srx_require_modules
This allows confd to start without errors when modules are already
loaded.
2023-05-12 14:24:41 +02:00
Richard AlpeandJoachim Wiberg def761b067 src/confd: add basic user authentication support
This patch introduces basic user authentication support via sysrepo.

Namely it adds:
* The ability to create or delete a UNIX user.
* The ability to set or delete a UNIX user password.

The password needs to be hashed and in a UNIX shadow format, such as
"$ALG$SALT$HASH". We want to avoid the handling of clear text
passwords as much as possible. In the meanwhile, passwords
can be generated in the infix shell using mkpasswd.

CLI Examples:

Add a user:
configure> set system authentication user foo

Delete a user:
configure> delete system authentication user foo

Set a user password:
configure> set system authentication user foo password ...

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-10 09:50:53 +02:00
Richard AlpeandJoachim Wiberg 53ad138854 sys/confd: expose systemv functions in new header
Expose systemv() and systemv_silent() to confd code that includes
core.h or systemv.h explicitly.

Signed-off-by: Richard Alpe <richard@bit42.se>
2023-05-10 09:50:53 +02:00
Joachim Wiberg e7e22c4a13 package/finit: bump for fixes to 'initctl enable' regression
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-05 06:04:45 +02:00
Joachim Wiberg 28f8f36cca Enable runparts support at bootstrap for hybrid systems
This commit enables support for running custom startup scripts at boot,
allowing a mix of a NETCONF-based system and Classic /etc.  For example,
use NETCONF to set up network interfaces, users, etc. and runparts for
enabling and configuring the device as an OSPF router.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-05 06:04:45 +02:00
Henrik NordstromandJoachim Wiberg 7db1581b21 linux aarch64: Enable CPU_THERMAL 2023-05-02 10:52:43 +02:00
Joachim Wiberg f19d1fc06f package/skeleton-init-finit: take "new" runlevel 0 into account
Some critical services must never be stopped, and with the unfortunate
separation of runlevel S and 0 in Finit recently, all affected service
definitions must be updated.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-05-02 00:00:04 +02:00
Joachim Wiberg 941a2d85aa src/confd: system() replacement without /bin/sh intermediary
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-30 19:49:27 +02:00
Joachim Wiberg 60fa170bee board/common: for consistency, preserve x86_64 even in filenames
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-29 12:47:30 +02:00
Joachim Wiberg d69109305c .github: store symlinks as files
For each build there is an infix-$ARCH-$VARIANT.img -> rootfs.squash
that we want to be a real file when extracting it.  This to ease the
integration with testing frameworks like Qeneth.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-29 12:18:38 +02:00
Joachim Wiberg da014804a6 patches/lldpd: allow group wheel to use lldpctl
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-28 20:40:20 +02:00
Joachim Wiberg 6d96b218ca board/classic: generate interfaces.d, set hostname from qemu_fw_cfg
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-28 19:43:06 +02:00
Joachim Wiberg 806a0293a5 board/common: allow /bin/bash as login shell (BusyBox symlink)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-28 19:00:51 +02:00
Joachim Wiberg 5e15d85ff9 board/common: artifact naming overhaul
With the introduction of the -classic defconfigs we need to also make
sure to name the resulting artifacts accordingly:

 - infix-$ARCH.{gns3a,img,pkg}
 - infix-$ARCH-classic.{gns3a,img,pkg}

For release builds the version (-23.02-$REV) will be appended before
the file suffix, e.g., infix-x86-64-classic-23.02-3.img

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-28 18:18:16 +02:00
Joachim Wiberg 42dbc1feee configs: follow-up to 5d7e6bd, path to grub-embed.cfg has changed
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-28 11:47:56 +02:00
Joachim WibergandTobias Waldekranz daa67f94c1 board/netconf: add missing (empty) rootfs overlay
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz ff7faada00 .github: fix .ccache caching
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz f515d8e737 .github: update to bild all platform::variant defconfigs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 5b02ab80e9 configs: add aarch64_classic_defconfig, same as x86_64_classic
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 2272b56618 board/common: let Bash update its PS1 hostname for each new line
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 05d49f6cfc src/confd: set NETCONF specific motd as default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 8158d3bffb Simplify and refine NETCONF and Classic build variants
- board/common: drop everything not needed by NETCONF mode
 - board/classic: most board/common helpers relocated here
 - Simplify Finit scripts for critical services
 - Source variant from /etc/os-release to select ramdisk /etc

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 5d7e6bd693 Rename amd64 -> x86_64 and native -> classic
A long standing internal debate comes to its logical conclusion.  Arch
naming should follow GCC.  The "native /etc" has also found a better
name: classic!

README and GitHub action has been updated accordingly.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz de85e4e4e0 configs: netconf build requires 512 MiB RAM and we want 10 ifaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 3caaada051 board/common: add menuconfig support for GNS3 RAM and num. of ifaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz ce10e4b734 board/common: add missing $DISK_IMAGE_SIZE to mkdisk.sh
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 291bfaeff0 board/common: fix system timezone in "show system-information" command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 9462499d51 configs: split defconfigs in default (NETCONF) and simplificed (native)
- Drop unused packages in NETCONF (default) mode
   In the default build we will use the net tool instead of iupdown-ng,
   p-net & Profeth will move to customer-specifc builds with another
   licensing model.
 - Split out NETCONF specific parts from board/common to board/netconf

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 3cea71a11f configs/amd64_minimal_defconfig: simplified basic Linux build
This build is intended as a base reference and for use as a very simple
end device.  The default starts DHCP and IPv4LL (ZeroConf) on eth0, but
can be configured by editing /etc/network/interfaces.d/*

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 65afece50a package/confd: update factory-config, zeroconf for IPv4/IPv6 on eth0
Still ways to go here, eth0 should be in a bridge with a vlan1 interface
on top, which in turn should have this config.  But let's start here, it
works! :-)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 0fffb1296f package/confd: allow avahi (mDNS/SD) and sshd to be enabled by default
The idea is to, as a plain Infix default, start up devices with DHCP and
IPv4LL/ZeroConf and IPv6 link-local address.  Using mDNS the user can
then and push a NETCONF configuration over SSH.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 7dde00c6b0 package/confd: rename factory.cfg -> factory-config.cfg
Consistent naming to match startup-config.cfg and running-config.cfg

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 461599e502 src/confd: hackish w/a to get 'initctl reload' for ietf-interfaces
This is very ugly, what we really want is that the commit_done_hook()
runs when *all* DONE events have been processed in all models.  The
side-effect of this hack is that the callback is run twice, both for
ietf-systm and ietf-interfaces if both are modified.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 8b9504ffa5 src/confd: augment ietf-ip with an 'autoconf' setting also for IPv4
This patch adds a first Infix model to augment ietf-ip with a node,
similar to the IPv6 'autoconf' node, also for IPv4.  For IPv6 the
autoconf feature comes built-in, for IPv4 it is defined in RFC3927.

The setting behaves the same as for IPv6, but in the case of IPv4 we
enable avahi-autoipd per interface to acquire the 169.254/16 address.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz ae62c20d40 src/confd: minor, spellcheck
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 85f67f6a0f configs: enable avahi-autoipd for use as ZeroConf agent
With the new templating support in Finit, and this patch, we can now
very easily enable a ZeroConf service on, e.g., eth0:

    $ initctl enable zeroconf@eth0

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 78c12d66fe patches/klish: allow all users of group 'wheel' to connect to klishd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 33d1b9cfc5 board/common: drop clicon + www-data users, add default admin user
The root user is by default not allowed to log in over SSH, so we add an
admin user with limited root privileges for this purpose.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz cb9d981dfc board/common: replace sshd subsystem cli with klish
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz e789738a64 package/finit: bump for S vs 0 runlevel fixes and templating support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Joachim WibergandTobias Waldekranz 3cd3d04bae package/skeleton-init-finit: fix make skeleton-init-finit-rebuild
When calling 'make skeleton-init-finit-rebuild' to (re)install any new
or modified services, we cannot remove everything installed already.
That breaks what other packages may have installed already and is not
the Buildroot way.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-27 09:59:35 +02:00
Tobias WaldekranzandJoachim Wiberg dcf3c5fe97 confd: Infer the interface type for common patterns
When a new interface is create, but the type is not specified, try to
infer the type from the interface name.
2023-04-21 19:03:15 +02:00
Tobias WaldekranzandJoachim Wiberg 54200eaba9 confd: Add wrapper for sr_set_item
This allows the xpath to be built using format string.
2023-04-21 19:03:15 +02:00
Tobias WaldekranzandJoachim Wiberg 2259e108e4 confd: Rename srx_set_item -> lydx_new_path
Since this function wraps lyd_new_path.

This allows us to write a wrapper for sr_set_item, using the expected
name.
2023-04-21 19:03:15 +02:00
Tobias WaldekranzandJoachim Wiberg 69d6bc6942 confd: Fix some build warnings 2023-04-21 19:03:15 +02:00
Tobias WaldekranzandJoachim Wiberg 62e4a733d0 confd: Honor CFLAGS coming in from configure
This makes it easy to create unoptimized debug builds, for example.
2023-04-21 19:03:15 +02:00
Tobias WaldekranzandJoachim Wiberg 7afc650bcf confd: Fix use of uninitialized value 2023-04-21 19:03:15 +02:00
Tobias WaldekranzandJoachim Wiberg 9969987347 confd: Skip extraneous calls to sr_unsubscribe
core.c will always take care of this if any initialization fails.
2023-04-21 19:03:15 +02:00
Joachim WibergandTobias Waldekranz 81c7939a0d src/net: update docs with new admin-state control file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz dd96583ce2 package/net: depends also on iproute2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz cd00a3d2be package/net: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 8a73c31f91 package/confd: update package dependencies
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 64804bee5d src/net: add missing deps when moving between generations
The init_next_gen() function moves us to the next generation, as well as
intialize all data files for expected interfaces in that generation.

However, bridge and lag interfaces have dependendcies that need to be
moved as well.  It is only the test author that knows the expected new
state, so this function only sets up the desired state, without ever
looking at what any previous generation looked like.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 1c99e92312 src/net: finalize bridge-lag.sh test, add step remove; vlan1 and br0
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 3edd4c7dff src/net: let init_next_gen init new generation with ifaces
The (optional) interface list represent the expected state in the new
generation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz c99b5c659a src/net: add test to verify moving port from lag to bridge
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 61c5724da7 src/net: update basic bridge test with new create_bridge() API
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz afb82a52e4 src/net: test; factor out state file creation from create_iface()
With more advanced interface types we cannot use create_iface() to set
up the file structure in new generations.  This commit adds a _data()
function that should be used instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 19ed88ac9e src/net: silence noisy "skipping" debug logs for missing scripts
Not really needed unless you're doing changes to the net tool itself.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 9aeb35c73b src/net: rename helper fn create_ng -> init_next_gen
This function is responsible for initializing the necessary files for
the next net generation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 4c7813f996 src/net: new test, advanced bridge with lag and a top VLAN interface
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 7945207989 src/net: fix interface creation/attach order in generation generator
The net tool traverses the graph and executes the scripts et al in
postorder, i.e., all leaves are evaluated first before the parent's
script is run.  Hence, attaching ports to a bridge or link aggregate
is the responsibility of the parent, not the leaves.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 45c6b704f9 src/net: must close each pipe before exectuing the next pipe action
For instance, when adding ip command to the ip pipe we need the kernel
to execute those commands before the bridge command pipe is executed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 2de8ff052d src/net: factor out pipe identification and debug each piped command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz e6834c5db6 src/net: new test, basic bridge
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz a26dd9c19f src/net: install tests to target /usr/share/net
Host tools and target are often out of sync, sometimes because we need
to run a newer version of iproute2 with more features.  By installing
tests to target we can still verify basic functionality, provided the
tests verify their dependencies and exit 77 (SKIP).

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz f84b4803d9 src/net: fix bugs in 'net up|down' uncovered by first test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 48fba80baf src/net: finalize first test, three indep ifaces in two generations
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 6b3eaa05e5 src/net: refactor test into lib.sh and <test>.sh
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz f180bcae24 src/net: convert to GNU Configure & Build system
- Simplify build process, including cross compilation
 - Add basic test framework, available as `make check`

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz da56f8d653 src/net: first automated test case, run with unshare
Run with unshare, as so:

    make clean; make; cd test/
    unshare -mrun ./three-independent.sh

This sets up a test directory in /tmp/net, creates three independtent
interface configs for dummy interfaces.  Activates the config with a
call to `net -vd apply`, and then verifies the result using a mix of
ip link/addr and jq magic.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 0f337a4b13 src/net: increased debugging of basics
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz ad1c3fb777 src/net: 'do' is a reserved keyword in shell scripts add 'apply' too
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 0ec3448858 src/net: refactor, reuse existing linked list also for 'do' command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 997e536081 src/net: add support for acting as a multicall binary (ifup/ifdown)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 75a1b231da src/net: add commands; do, up/down with optional ifname(s)
Calling net prevsiouly meant `net do`, the new separation is to be able
to add `net up` and `net down` commands, with optional interface args.

The idea is to support the same semantics as `ifup -a` of `ifup foo`.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 32db1fe3d0 src/net: refactor filtering of forbidden names
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz f2472d6474 src/net: minor cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz a80a8eeee5 src/net: fix bug in savedep(), trashed interface path argument
This caused the critical run() function to run action scripts properly.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 9a895dcd47 src/net: fix bug in test, lag0 remains a dep for br0 even in gen 1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 6eb6324477 src/net: rename action scripts as per review
Naming the actions after their executing entity, e.g., foo.sh when it is
executed by /bin/sh, is a tried and true paradigm.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 47c3448774 src/net: calculate and run teardown in reverse dependency order
When taking down a network setup, it needs to be deconstructed using the
foo.exit rules of the previous generation, and in reverse dependency
order.

This patch adds support for generating the deps when bringing up the
network setup, and saving an rdeps file in that generation, which can
be used later when moving leafs between nodes.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz 0f7d931541 src/net: new test, also drop lo and use same interfaces as in figure
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Joachim WibergandTobias Waldekranz a2fbc9e2f8 src/net: ovarhaul script naming ip-link.up/ip-addr.up -> ip.init etc
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-20 21:14:54 +02:00
Tobias WaldekranzandJoachim Wiberg 09751fdd96 x86_64: Harmonize GRUB's behavior with that of U-Boot
This means that:

- The full boot order is now respected, using the magic "fallback"
  varible in GRUB. This means that if an entry fails to load, we move
  on to the next one in the defined order.

- Netbooting is supported. In this mode, GRUB will acquire an IP
  address using DHCP, after which it downloads an image using TFTP.

- If we run out of valid entries, we always make sure to reboot. This
  ensures that, e.g., a temporary TFTP server outage does not cause an
  Infix device to get stuck in GRUB.

At the moment, the image handling is excruciatingly inefficient when
netbooting, as the image is downloaded multiple times behind the
scenes. Ideally, downloads would be cached, but a quick investigation
indicates that an implementation of this would take more time than we
can spare at the moment. Therefore, we settle for the working, though
wasteful, implementation.
2023-04-19 10:47:54 +02:00
Joachim Wiberg b7058b2d6c board/common: enable ipv4 and ipv6 global forwarding flag by default
The per-interface and per-af setting in the ietf-ip yang module allow
the user to enable a more granular forwarding between interfaces, which
is disabled by default.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 23cf9df856 Follow-up to 7e089ee: convert to kernel modules, use /etc/modprobe.d
Instead of having to rely on the kernel command line, we convert all the
kernel functionality in question into modules and rely on the auto-load
feature in the kernel and modprobe to add options at load time.

The fb_tunnels setting is a net core setting, for that we use sysctl.

This commit also syncs the kernel config between our two main archs,
disabling DRM and SOUND for the Amd64 build as a spin-off.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg dfda11f9ce Follow-up to 025a877, import new iana-if-type version
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 15010acc3a src/confd: set default loopback addresses
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 4f09f2b51e src/confd: refactor, simplify ietf-system:system-state
We now have our own srx_set_item() that hides a lot of the complexity.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 5bc7dd443f qemu: disable bond0, dummy0, sit0, erspan0, etc. fallback interfaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg a8227a3ab9 src/confd: standardize on 'fail:' as cleanup label on failure
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 4fe6a2aba7 src/confd: initial operational data support for ietf-interfaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 5fe77fdbee src/confd: add missing free() of data from lyd_print_mem()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 34d8cf2fdb src/confd: add missing calls to release context in ieft-system
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg a061242119 src/confd: minor refactor, add convenience macro REGISTER_OPER()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg f080ebd341 src/confd: add support for ipv6 in ietf-interfaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 36d4e1b92b src/confd: refactor srx_val.c to use sr_get_items() to silence log
Calling sr_get_time() for an xpath that has no data causes sysrepo to
always log the access as an error.  With sr_get_items() it is left to
the callee to determine if the missing data should cause an error.

This patch is a refactor that silences the syslog message and also
fixes one or tow memory leaks.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg fdb8e56461 src/confd: fix invalid xpath, 'enabled' not available per address
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg abe8ecb3d3 src/confd: fix invalid use of fopenf() in write*f() wrappers
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg dabfe7bc20 src/confd: drop developer debug messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 2e73d643ed src/confd: add support for ietf-ip:ipv4/forwarding
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg a7306d0c06 src/confd: refactor, add first file function helper: writesf()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 8296f75893 src/confd: optionally use netmask instead of prefix-length
Some users still prefer the old netmask style to set up an interface.
This patch enables the corresponding model feature and checks for a
netmask only if prefix-length is unset.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg ac0b0d520f src/confd: refactor srx_get_bool() to create srx_enabled()
All value functions, except the new srx_enabled(), now return clear
error indication, with the value as a separate argument.

The srx_enabled() predicate function is for cases where the default
value is disabled and code checks enable a subsystem or flag.  I.e.,
when an error can safely be returned as 'false'.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 63bc767593 src/confd: refactor sr_get_int() into a generic srx_get_int()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 9882309adf src/confd: rename sr_ext.[ch] -> srx_module.[ch]
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg eaedae4ccb src/confd: draft ietf-interfaces prototype to set static IP address
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg ce5ff75c9c src/confd: refactor sr_get_bool() into srx_get_bool()
Note: new API, srx_get_bool() returns -1 on error, leaving 0 and 1 as
false and true, respectively.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 4654e169a5 src/confd: replace local run() function with systemf() from libite
It started its life as a copy of systemf() anyway, time to clean up.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg c838977f91 src/confd: unlock -lite API, e.g. fopenf(), systemf(), etc.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg f28a19c9ea src/confd: minor, rename local var for consistency
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 12f72c5e5f src/confd: refactor helper fns to new namespace
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg ede544257f src/confd: add missing header
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg cfba783f1c src/confd: minor, drop trailing / from YANG_PATH_
Prevent // in new srx_require_module() when composing module PATH.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 6ff3d15b0b src/confd: add SPDX license identifier to new files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg c74f76cdee src/confd: minor, use more common fmt rather than frmt
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Joachim Wiberg 6a73a3fcc2 src/confd: minor, fix iana-if-type revision
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-17 14:09:24 +02:00
Tobias WaldekranzandJoachim Wiberg 1bd66003ae confd: if: Ensure that the required modules are loaded 2023-04-17 14:09:24 +02:00
Tobias WaldekranzandJoachim Wiberg a7fcdc8f4a confd: Add helper to ensure that required modules are loaded
Unfortunately, sysrepo considers it an error to load a module that is
already loaded, ruling out using `sr_install_modules`.

Therefore, provide `require_modules` instead, which ensures that a
given set of modules are loaded, or loads them otherwise.
2023-04-17 14:09:24 +02:00
Tobias WaldekranzandJoachim Wiberg db804eb9d0 confd: Allow usage of asprintf 2023-04-17 14:09:24 +02:00
Joachim WibergandTobias Waldekranz 95a4b43091 configs: drop currently unused packages to save build time + size
Things we really want later, but don't use right now:

 - MRP
 - MSTP

Neat to have in a networking product, but not used at all by us atm:

 - ttyd
 - tmux

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 12:22:29 +02:00
Joachim WibergandTobias Waldekranz 3217722c36 Update, Clixon has been replaced by sysrepo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 12:22:29 +02:00
Joachim WibergandTobias Waldekranz 4e4b6f2a7b package/{ifupdown2,python-templating}: drop unused packages, replaced by ifupdown-ng
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 12:22:29 +02:00
Joachim WibergandTobias Waldekranz 4d835ff808 package/{sysrepo*,umgmt}: drop unused packages, replaced by confd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 12:22:29 +02:00
Joachim WibergandTobias Waldekranz 73892ea6f0 package/cli*: drop cligen and clixon after migration to sysrepo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 12:22:29 +02:00
Joachim WibergandTobias Waldekranz 41b17fc64d package/mech: drop, unused after migration to sysrepo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 12:22:29 +02:00
Joachim WibergandTobias Waldekranz e9757ac3ef .github: run action on approved PR or if started manually
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 11:12:09 +02:00
Joachim WibergandTobias Waldekranz 1ebdf05371 .github: only allow upload of latest build from main repo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-13 11:12:09 +02:00
Tobias Waldekranz f2aaf4a558 Merge branch 'sysrepo' 2023-04-13 10:21:23 +02:00
Tobias Waldekranz e9c4bafb4c confd: Treat all build warnings as errors
We exclude unused parameters, since many callbacks have parameters
that we're not interested in.
2023-04-13 09:30:43 +02:00
Tobias Waldekranz f5259b32d8 confd: Kill all -Wall -Wextra warnings 2023-04-13 09:30:43 +02:00
Tobias Waldekranz 3320175abd confd: Fix symbol redefinition error 2023-04-13 09:27:36 +02:00
Richard AlpeandJoachim Wiberg 02ac6a7ea7 src/confd: add the ability to change MotD in cli
Add the ability to set and delete system MotD (Message Of The Day)
using the cli.

This patch augments the standard ietf-system yang schema with
a new infix-system schema which contains a new motd leaf.

The default value is hard coded in two places, confd and the rootfs
file /etc/motd. The intention is to fix this in upcoming patches.

Introduces:
exec> configure> set system motd STRING
exec> configure> delete system motd
2023-04-12 16:51:08 +02:00
Joachim Wiberg 22a18f3e61 src/confd: skeleton for ietf-interfaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-12 09:22:50 +02:00
Joachim Wiberg 015f1b7a87 package/finit: add support for setting RTC plugin fallback datetime
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-10 16:36:32 +02:00
Joachim Wiberg 82c8423cea src/net: fixes after spec. audit by wkz
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 10:53:44 +02:00
Joachim Wiberg caa07e8b20 Drop local libite patches in favor of libite v2.5.3
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 07:18:46 +02:00
Joachim WibergandGitHub e9a49ac546 Merge pull request #6 from hno-addiva/fix/crb_defconfig
cn9130_crb_boot: Add required host tools for build

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-06 15:45:28 +02:00
Joachim WibergandGitHub 530adeaf53 Merge pull request #5 from hno-addiva/fix/binutils-2.9
Patch for building ARM TF-A with binutils-2.39+

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-06 15:44:46 +02:00
Henrik Nordstrom dc8f1c344e cn9130_crb_boot: Add required host tools for build 2023-04-06 15:44:17 +02:00
Henrik Nordstrom a410c38c0f Patch for ARM TF-A with binutils-2.39+
Adopted from https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/19401/4/Makefile
2023-04-06 15:35:50 +02:00
Joachim WibergandGitHub 2bdb910db8 Merge pull request #3 from hno-addiva/main
Set buildroot branch name

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-06 14:53:46 +02:00
Henrik Nordstrom 64c3fdc5b1 Set buildroot branch name
allows "submodule update --remote" to refresh to current version
2023-04-06 14:31:04 +02:00
Joachim Wiberg 8f1f74263d src/net: first prototype
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-05 16:08:07 +02:00
Joachim Wiberg 2943922b4c configs: add dosfstools and mtools for disk image generation + gns3
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-04 15:11:55 +02:00
Joachim Wiberg 2ba8612f7f src/confd: add commit_done_hook() to call initctl reload
This is needed to confirm the new system configuration generation and
reload all affected services.  E.g., when configuring an NTP server
and committing the candidate to running, the ietf-system plugin has
only enabled the service, as a last step we need to tell Finit to
actually start it.

This hook needs to run last since the enabled service(s) may depend on
other service(s), or networking, to be enabled in the proper order.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 20:35:55 +02:00
Joachim Wiberg 59d5340eae src/confd: mark missing yang support with XXX
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 19:33:37 +02:00
Joachim Wiberg 69920cb230 src/confd: add support for /ietf-system:system/dns-resolver
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 19:31:34 +02:00
Joachim Wiberg 42281378f8 src/confd: new function, sr_get_int()
Really ugly handling here, needs to be reworked into sr_uint8() etc.,
adding as-is for big upcoming demo.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 19:29:55 +02:00
Joachim Wiberg 443cb2ddf1 src/confd: add support for /ietf-system:system/clock, with deviation
Declare deviation for /ietf-system:system/clock/timezone-utc-offset,
which we currently do not support.

Please note, when setting out to add support for timezone-utc-offset,
you need to ensure the user does not input both, that should be a
validation error.  It's an either-or thing.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 18:17:59 +02:00
Joachim Wiberg 68a5a50040 src/confd: add timezone support to set-current-datetime rpc
How to verify, use the following command and paste the XML below:

    $ sysrepocfg -R
    <sys:set-current-datetime xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system">
        <sys:current-datetime>2022-01-12T14:29:00-02:00</sys:current-datetime>
    </sys:set-current-datetime>

Reuse code from mech, verified and working.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 16:37:23 +02:00
Joachim Wiberg 4e0d7ad494 src/confd: use /etc/os-release for platform operational data
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 14:14:05 +02:00
Joachim Wiberg a2d2d0948f src/confd: minor refactor
Reuse code from mech, verified and working.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 14:08:30 +02:00
Joachim Wiberg 32e55d3562 configs: update defconfigs post e729c82
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 06:32:17 +02:00
Joachim Wiberg 4e3f3a01b3 board/common: change cli alias to start klish
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 06:31:47 +02:00
Joachim Wiberg 36ff60f99c package/confd: support for customer factory startup-config.cfg
When researching the systemd tmpfiles.d implementation I discovered the
effort to standarize on /usr/share/factory as a generic factory defaults
for Linux systems.  This patch adds a small example factory.cfg file
that is installed as /usr/share/factory/cfg/startup-config.cfg.  The
tmpfiles.d backend will then install it as /cfg/startup-config.cfg if
that file is missing at boot.  Confd does the rest to bootstrap our
(by default) empty sysrepo db with this startup-config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 06:00:54 +02:00
Joachim Wiberg f9a7c256ca package/libite: backport rsync + copyfile fixes from upcoming v2.5.3
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-03 06:00:16 +02:00
Joachim Wiberg 79eb5fd5f4 confd: startup-config hook with support for merging in at bootstrap
This change adds a hook to the startup datastore, we use the ietf-system
module because the module argument is mandatory.  The hook runs when all
changes have been saved to the internal store.  Since sysrepo has many
startup files in /etc/sysrepo, we saving a JSON copy of all these files
in /cfg/startup-config.cfg, which is persistent.  On system bootstrap
this file is merged into the (empty) running datastore, which is what
the sysrepo maintainers recommend to be independent of any yang model
updates that might occur on image upgrades.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg d8eb88e6da src/confd: improve error handling in ietf-system
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg af5c5bc3d2 src/confd: refactor, expose flags arg to change subscrie
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg 405e1f1b70 src/confd: minor refactor, split in multiple files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg b3b25ed4d6 src/confd: improved coverage of ietf-system
- Call external programs safely with run()
 - Use augeas to update /etc/hostname and /etc/hosts
 - Add support for generating /etc/chrony.conf
 - Update license copyright due to significant contrib.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg 7079a35088 configs: disable nginx temporarily while evaluating sysrepo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg 3bef1eec16 Disable rauc streaming and kernel nbd, not used atm.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Joachim Wiberg b639812ba4 patches/netopeer2: add support for running in foreground with syslog
The default is to use -d (debug), which changes logging to stdout, which
we do not want with Finit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 16:24:08 +02:00
Tobias Waldekranz e729c82c32 klinfix: Initial add
Infix integration of klish and klish-plugin-sysrepo.

Initially we add:

More flexible management of running vs. startup: Instead of always
committing changes both to running and startup, commit only modifies
running. To persist changes to startup, the copy command is
introduced. This lets the user copy from factory/startup/running to
startup/running at any time.

Well-known verbs like abort, leave, end, etc.
2023-03-31 17:31:34 +02:00
Joachim Wiberg abd001f57d package/confd: start netopeer2-server along with sysrepo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-31 11:03:44 +02:00
Joachim Wiberg cfef79bbf9 configs: enable netopeer2-cli and add klish to defconfigs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-31 11:02:45 +02:00
Joachim Wiberg 3cce1e6427 src/confd: drop shortname yang module aliases and load with version
Drop the shortname yang aliases, installed they become copies of
their versioned counterpart, which is not the intention, but also,
no other yang consumer does this.

We'd like to use ly_ctx_load_module() directly, or a slim sysrepo
wrapper of the same, but no such API (load by yang module *name*
with optional revision) exists currently.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-29 13:00:10 +02:00
Tobias Waldekranz d66dc16600 package/klish-plugin-sysrepo: Bump to latest master
This adds completion support for nodes nested under choice and case
nodes.
2023-03-29 11:32:09 +02:00
Joachim Wiberg 24a1eb542d src/confd: add support for enabling yang features
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-29 08:03:37 +02:00
Joachim Wiberg 708b756eba src/confd: minor, coding style
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-29 07:43:48 +02:00
Joachim Wiberg 3bbc5c49cd src/confd: derive YANG module search path from configure
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-29 07:12:13 +02:00
Joachim Wiberg 41db19ffaa src/confd: import updated yang models from mech
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-29 06:22:27 +02:00
Joachim Wiberg 1907bd6a75 src/confd: adjust Denis' copyright year, last changed 2020
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-29 06:22:27 +02:00
Joachim Wiberg d1444b900a package/confd: allow klishd to run in NETCONF mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:53:55 +02:00
Joachim Wiberg 737f99e35e package/klish: make sure to enable libxml2 in configure
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:53:41 +02:00
Tobias WaldekranzandJoachim Wiberg b549ddd88a package/klish-plugin-sysrepo: Add version 1.0.0
Adds a klish interface to local datastores managed by sysrepo.
2023-03-28 20:29:31 +02:00
Tobias WaldekranzandJoachim Wiberg 5d8e0ec123 package/klish: Add version 3.0.0
Extensible CLI application
2023-03-28 20:29:31 +02:00
Tobias WaldekranzandJoachim Wiberg fdfcac70eb package/faux: Add version 2.1.0
Used by the upcoming klish package
2023-03-28 20:29:31 +02:00
Joachim Wiberg 7a69c21e9d configs: change default NETCONF to use sysrepo instead of clixon
Extended evaluation of sysrepo due to problems parsing yang v1.1 models
with the built-in yang parser in Clixon.  Problems not seen with libyang

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg b1be357a41 package/confd: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg 767296e830 src/confd: port to sysrepo 2.x
Changes compared to original project:

 - installs into the sysrepo-plugind plugin directory, so no need
   for calling sysrepoctl to load the plugin
 - the plugin loads its yang module, so no need for calling sysrepoctl
   to load the module before starting sysrepo-plugind
 - bug fix ERROR() macro

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg 91d67e6b00 src/confd: import sysrepo ietf-system plugin by Denis Kalashnikov
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg 8e03114518 patches: add support for running sysrepo-plugind in the foreground
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg 546a2f3afb package/mech: relocate clixon system setup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 20:27:18 +02:00
Joachim Wiberg aa3d8945b9 buildroot: switch to (updated) sysrepo branch from kkit
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-28 13:37:45 +02:00
Joachim Wiberg d7b032cee7 .github: dispatch workflows manually from now on
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 15:53:35 +02:00
Joachim Wiberg f5a863df04 package/finit: bump for initctl -n additions (enable/disable)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 15:48:38 +02:00
Joachim Wiberg 0cfd0fcd89 package/skeleton-init-finit: add Frr pathd and vrrpd start scripts
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:38:17 +02:00
Joachim Wiberg 81c9398a19 doc: project goals and founding ideas
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:13:25 +02:00
Joachim Wiberg eed61988d1 doc: RESTCONF adventures, lab notes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:11:10 +02:00
Joachim Wiberg fe20f4a470 mech: new autocli commands, cut-and-paste from various examples
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:10:26 +02:00
Joachim Wiberg ac7b9073a5 mech: disable debug dumps of transactions by default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:08:27 +02:00
Joachim Wiberg aec2514eae mech: add support for ietf-syste:system/dns-resolver
This commit adds multi-nameserver support using openresolv (resolvconf)
and dnsmasq.  This means that a DHCP client (dhcpcd) or VPN client can
be providers of nameservers to the system.  Dnsmasq takes over as the
system resolver, except when the user has set up static configuration.

Static nameserver(s), as well as search and options, are always added
first by openresolv to /etc/resolv.conf.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:05:03 +02:00
Joachim Wiberg a5258d7102 mech: wrap system() as run(), returning WEXITSTATUS() or -1 on error
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-27 14:03:03 +02:00
Joachim Wiberg 4acaa170e4 mech: add support for ietf-system:set-current-datetime rpc
Also adds:
 - namespace validation
 - proper rpc operation lookup

Fixes:
 - ietf-system:system-shutdown (broken due do invalid op)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-24 01:50:36 +01:00
Joachim Wiberg 688c0ce2f7 mech: add support for ietf-system state data
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-24 01:50:36 +01:00
Joachim Wiberg 2ff4f869fa board/common: add ID_LIKE, BUILD_ID and ARCHITECTURE to /etc/os-release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-24 01:50:36 +01:00
Joachim Wiberg cdb68cb611 package/skeleton-init-finit: add remaining Frr daemons
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-24 01:50:36 +01:00
Joachim Wiberg 8cff15e215 package/skeleton-init-finit: drop stdout log redirection
lldpd already use syslog

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-24 01:50:31 +01:00
Joachim Wiberg b25a374409 mech: drop unused code
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-23 18:40:18 +01:00
Joachim Wiberg 35b0880e7b package/clixon: add clish alias and append to /etc/shells
Allow clixon_cli to be a login shell.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-23 15:00:15 +01:00
Joachim Wiberg 80f57d0809 Add Building section and ToC
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-23 14:51:49 +01:00
Joachim Wiberg 89d08338ce mech: initial support for ietf-interfaces state data
First example of how to implement supoort for ro/state-data.
Only oper-status and phys-address per interface currently.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-23 13:25:23 +01:00
Joachim Wiberg 2abb0a5eb9 mech: add support for setting interface description as ifalias
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-23 13:24:26 +01:00
Joachim Wiberg 4730f3fe09 mech: clean up developer logs in ietf-interfaces
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-23 13:23:54 +01:00
Joachim Wiberg ec7d72c4c5 package/finit: bump to latest snapshot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-22 09:43:41 +01:00
Joachim Wiberg cbc0374251 mech: add support for ietf-system:system-restart and system-shutdown
Shutdown depends on how the kernel is configured, on most embedded
systems this just means reboot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 19:32:24 +01:00
Joachim Wiberg 2124f27d2c mech: initial support for ietf-interfaces and ietf-ip
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 17:40:39 +01:00
Joachim Wiberg 6df91143ba board/common: no need to clean up rc.local or /etc/network/*
In managed NETCONF mode /etc is always based on the image's read-only
/etc with a read-writable overlay as a RAM disk.  We control the image
and know the default rc.local is empty and the interfaces file only
list the loopback interface.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 17:38:38 +01:00
Tobias Waldekranz c74203720a mech: Compress empty yang containers in CLI
E.g. instead of: `set interfaces interface eth0`

We can now say: `set interface eth0`
2023-03-16 16:13:09 +01:00
Joachim Wiberg 74cf105512 mech: fix disabling chronyd when system ntp client is disabled
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 15:55:13 +01:00
Joachim Wiberg 0da4578362 board/common: allow lldpd to run by default in NETCONF mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 15:55:13 +01:00
Joachim Wiberg 24d2f28fb6 board/common: allow default auth:none restconf via nginx to clixon
- Only disable default services we don't need, prevents touching
   services mid-air in runlevel S.  Allow nginx now as well
 - Enable fcgi based RESTCONF interface via nginx by default
 - Enable auth:none for customer demo

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 15:55:13 +01:00
Tobias Waldekranz 3c6c2ec66d mech: Import ietf-{interface,ip} models 2023-03-16 15:48:38 +01:00
Tobias Waldekranz f7f6333b6f mech: Generate a tree representation of the YANG model
If pyang is available, generate texual and HTML representations of the
system's YANG model.
2023-03-16 15:48:38 +01:00
Joachim Wiberg 4e46b60b6f mech: deviation /sys:system/clock/timezone-utc-offset not-supported
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 08:26:21 +01:00
Joachim Wiberg 0185efeb3f mech: add support for setting timezone, e.g. Europe/Stockholm
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 08:00:40 +01:00
Joachim Wiberg f0e659c185 chrony: does not support SIGHUP, requires /var/lib/chrony
Chrony drops privs after startup to user chrony, when restarting it
writes its state in /var/lib/chrony, so the directory needs to have
the correct permissions for that user.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 07:26:40 +01:00
Joachim Wiberg 4ca2e2d8c4 mech: initial support for ietf-system ntp using chrony
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 07:26:40 +01:00
Joachim Wiberg 79f4baf519 board/common: enable syslog LOG_DEBUG messages to /var/log/debug
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 06:37:56 +01:00
Joachim Wiberg fa45015140 mech: debug transactions
For observability. All transactions that reach ietf-system are logged
with LOG_DEBUG log level.  See /var/log/debug for details.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 06:37:56 +01:00
Joachim Wiberg 17424a140f mech: ensure clixon_backend always use syslog backend
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 06:37:56 +01:00
Joachim Wiberg d130011f96 mech: common convenience library, currently only XML debug fns
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 06:37:56 +01:00
Joachim Wiberg d01617a79e board/amd64: enable RTC subsystem
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-16 06:37:56 +01:00
Joachim Wiberg 00daab72fc package/mech: start clixon_backend as 'clixon', redirect stdout/err
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 20:32:38 +01:00
Joachim Wiberg 90b4a739b5 mech: always run initctl in batch mode when in non-interactive mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 20:31:50 +01:00
Joachim Wiberg 28b6cecb73 package/clixon: bump to 6.1.0+kkit
Tracking kkit branch (clixon 6.1+) w/a for issue #334.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 17:05:21 +01:00
Joachim Wiberg 48f819b315 package/cligen: bump to v6.1.0
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 17:05:00 +01:00
Joachim Wiberg e9b252b514 buildroot: bump to 2023.02 LTS
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 16:07:15 +01:00
Joachim Wiberg 060af92a29 package/clixon: /var/clixon is a directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:38:08 +01:00
Joachim Wiberg 7a4fe98a3e mech: remember hard-coded strings
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg f43b31b1f5 mech: system headers before clixon, skip sys/ prefix
The canonical location for syslog.h is in the root.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 1aac798041 mech: must specify model revision
Found when debugging output from "show state", which displayed NULL for
the infix model.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 77f6d5e82e mech: use same pager as Clixon by default
Add configurable pager support to Clixon later.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg cc5453bfbd mech: use new 'show -n' to skip shell user's help notice
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 3c4ff8cabb board/common: add 'show -n' for no footer output
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 6fec738628 board/common: make sure to enable clixon_backend in NETCONF mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 6a591ddd5a mech: use NOTICE file and spdx format for Apache 2.0 license
Recommendations on how to apply the Apache 2.0 license to a project from
https://www.linkedin.com/pulse/how-apply-apache-20-license-your-open-source-software-vladimír-gorej/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg d8d761bfa4 mech: change license to Apache v2.0, same as Clixon package
To facilitate linking and circumvent any possible legal problems.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 2f7dbe110a src/mech: add some basic 'show' commands
- Example of optional args (show log [FILE])
 - Example of dynamic expansion
 - Example of how to re-enable signals for external commands
 - Example of hidden commands
 - Add basic 'help' command for the current level

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 9041c54dbd README: mention Clixon and add Qeneth as alternative to GNS3
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 9f74bac06c README: fix footnote link
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Joachim Wiberg 70a393ec99 package/mech: minor, for Buildroot conformance
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-14 09:06:22 +01:00
Tobias Waldekranz 77d94e0ffd doc: Expand boot procedure documentation
Provide more details on the boot procedure, different image types
used, how to configure the bootloader, and how to perform system
upgrades.
2023-03-13 23:20:01 +01:00
Tobias Waldekranz 19672fcc58 rauc: Initial support
Add support for firmware updates via RAUC on aarch64. The created RAUC
bundle (images/infix-$BR2_ARCH.pkg) is signed with the same key used
to sign the raw FIT image.
2023-03-13 14:46:37 +01:00
Tobias Waldekranz e7112ca0c9 qemu: Support mounting host filesystem inside guest
This is mounted at /mnt/host in the guest. By default the images
directory is mounted.
2023-03-13 13:53:12 +01:00
Tobias Waldekranz 162f019574 aarch64: Remove U-Boot envimage generation from defconfig
This created a circular dependency that caused the build to fail. This
is now handled by the mkdisk.sh script instead.
2023-03-13 10:21:08 +01:00
Tobias Waldekranz bf240e0d89 amd64: Update GNS3 appliance generation to use the disk image
The appliance now uses the same QEMU setup as when using `make run`
with OVMF loader.
2023-03-13 09:57:04 +01:00
Tobias Waldekranz 6cc26307b7 common: Mark output from Infix shell scripts similarly to Make
Similarly to how $(call IXMSG,"hello world") outputs a blue
information line from a makefile, provide `ixmsg` to accomplish the
same thing in shell scripts.

Use a different prefix (`#!:` vs `>>>`) to differentiate it from
makefile output.
2023-03-13 09:57:04 +01:00
Tobias Waldekranz d777d59ee2 common: Prettify output from Infix extensions to the build system
This makes it easier to spot where we've added things (that might not
work :))
2023-03-13 09:57:04 +01:00
Tobias Waldekranz 3c720892dc aarch64: Cleanup unused stuff from defconfig
Config options are now loaded internally by the post-image script.

We never use the EXT image for anything.
2023-03-13 09:57:04 +01:00
Tobias Waldekranz f3304a6539 common: Unify disk image generation across aarch64 and amd64
On amd64, we use grub instead of U-Boot, because yours truly can't
figure out how to handle ACPI handover to the kernel.

The resulting image is now called disk.img instead of the old mmc.img,
since we can use it over any interface (e.g. virtio or SCSI).
2023-03-13 09:57:03 +01:00
Tobias Waldekranz 515d9f6e84 config: Replace $() with ${}
This lets us source .config from shell scripts
2023-03-13 09:56:37 +01:00
Tobias Waldekranz 96af542d40 qemu: Consolidate DTB extension handling in qemu.sh 2023-03-13 09:55:16 +01:00
Tobias Waldekranz e9adde4100 qemu: Add option to start with UEFI instead of BIOS 2023-03-13 09:55:16 +01:00
Tobias Waldekranz 81f0276a31 qemu: Remove redundant enabling of KVM 2023-03-13 09:55:16 +01:00
Tobias Waldekranz 7ba2e0a0b1 qemu: Always use disk images when using U-Boot
The U-Boot scripts won't accept a raw squash.
2023-03-13 09:55:16 +01:00
Tobias Waldekranz d1607cc2f3 doc: Document boot process and image formats 2023-03-13 09:55:16 +01:00
Tobias Waldekranz 9869c1a290 common: uboot: Update environment to new disk layout
- Adapt boot scripts to exepect the split FIT header/SquashFS image
  layout.

- Make sure that we can boot from any kind of block device (most
  importantly virtio for GNS3).

- Rename net -> dhcp as we might have more kinds of netboots in the
  future (http).
2023-03-13 09:55:16 +01:00
Tobias Waldekranz 8296a98e61 common: Use plain SquashFS images on disk
Store FIT headers separately on aux, and place the raw SquashFS images
on primary/secondary. This removes the need to muck about with the
device mapper to setup the rootfs, and it allows us to boot using
syslinux files.
2023-03-13 09:55:16 +01:00
Joachim Wiberg c328c41eff package/profeth: document QEMU_NET_TAP_N=10 requirement
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 07:21:50 +01:00
Joachim Wiberg 6c1a53ffdb package/skeleton-init-finit: add missing /etc/sysctl.d directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 07:17:21 +01:00
Joachim Wiberg 597207b7dd profeth: drop copy of p-net headers, use library headers instead
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 06:58:46 +01:00
Joachim Wiberg 67727e3050 configs: enable PROFINET support in default builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 05:58:09 +01:00
Joachim Wiberg 8eb879c8b2 board/amd64: enable E1000 ethernet nic support for Qemu
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 05:58:09 +01:00
Joachim Wiberg f8738de608 package/skeletin-init/finit: per-package tmpfiles.d directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 05:58:09 +01:00
Joachim Wiberg 2f0b2e113e package/skeleton-init-finit: update lldpd configuration
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 05:58:09 +01:00
Joachim Wiberg 0f38ac54f8 src/profeth: add submodules for all ports, matching the GSD file
These changes allow profeth to pass the Automatic RT Tester's first
behavior tests: Scenario 1-9.

 - Explorative changes to the GSD file to appease the conformance tool
 - Fix mismatch in installed submodules vs advertised ports in GSD file

Note: changes in GSD file only match the amd64 virtual build.  Must be
      updated for the final product.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-09 05:58:09 +01:00
Joachim Wiberg 25db613398 Refactor boot mode handling
With the recent `if:<cond>` addition to Finit we can simplify a lot of
the logic for disabling and enabling features in Infix.  Standardizing
on conditions that Finit provides.

We create boot/netconf, boot/etc, and boot/profinet conditions early,
after all filesystems have been mounted (and cleaned), so they are all
set before Finit loads its configuration files in runlevel S.

The default is still to boot into a managed NETCONF mode, since the end
goal remains to integrate PROFINET as yet another service.  The other
mode, native /etc, should then be the only exception.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 20:02:03 +01:00
Joachim Wiberg 81212e12f1 package/profeth: persistent data in /var/lib, syslog.conf
Split tmpfiles config in two, one for snmpd and one for profeth.
Add logging and redirect profeth logs to /log/profinet.log with
default log rotation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 20:02:03 +01:00
Joachim Wiberg f8670f7150 package/p-net: increase log level slightly Fatal -> Info
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 20:01:55 +01:00
Joachim Wiberg 917633f439 mech: create the /run/clixon directory at boot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 18:40:25 +01:00
Joachim Wiberg e94b4de865 rootfs: add handy /log shortcut to /var/log
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 18:39:23 +01:00
Joachim Wiberg 5045c6e6ba utils: use same IP subnet as PROFINET Automated RT Tester
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 17:05:37 +01:00
Joachim Wiberg f41846fab4 src/profeth: use RT-Labs VendorID and DeviceID for now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 15:08:20 +01:00
Joachim Wiberg 4942a53483 package/profeth: add set_network_parameters script
Allow profeth to set IP address, netmask and gateway on PROFINET set.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 15:08:09 +01:00
Joachim Wiberg 06599d2097 package/finit: bump for next snapshot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:54:00 +01:00
Joachim Wiberg 5ddbb2cf55 utils: helper script for briding a Qemu instance with the real world
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 7cf945af5b board/common: add PROFINET boot mode, compliments native /etc
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 6c7d945e8b profeth: use /var/run/agentx/master socket instead of default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg bb62d58b17 profeth: branding
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg c0c087e719 src/profeth: fix system IP address/netmask and gateway query
Replace the old p-net API for querying the interface address, netmask
and gateway with the new ones that use getifaddrs() and inspect the
kernel routing table.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg e33f191d07 package/profeth: add support for starting and monitoring PROFINET
An Infix build with PROFINET gears Net-SNMP heavily towards acting as a
servant to profeth (p-net stack).  This will be hard-coded for now until
we've integrated it all better in Clixon.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg d572bc78f3 package/skeleton-init-finit: add support for monitoring net-snmp
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 5a003c40c3 package/skeleton-init-finit: add env file to mini-snmpd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg e3adc8a6e4 src/profeth: add GPLv3 license and basic README
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 221cc0b1f6 mech: move Finit service .conf to package and add conditions
The new if: conditions require latest Finit master, unreleased v4.4

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 90a1fd99ec board/common: ensure cache directory for nginx is created at boot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 80b23566b5 board/common: use same method to determine operating mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Joachim Wiberg 281183755b qemu: replace -nic with -netdev to get >8 NICs, fix MAC calculation
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:58 +01:00
Tobias WaldekranzandJoachim Wiberg 5a441252f8 profeth: Initial add 2023-03-06 10:50:58 +01:00
Tobias WaldekranzandJoachim Wiberg 23a25147cc package/p-net: new package
Use ael fork with not-yet upstreamed fixes for now.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-06 10:50:51 +01:00
Joachim Wiberg 04e646ab40 qemu: default to 256M RAM for both targets
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-28 14:47:56 +01:00
Joachim Wiberg 7537e7e263 package/clixon: prevent host install from stripping .so files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-28 11:34:59 +01:00
Joachim Wiberg bc7b366c85 package/cligen: prevent host install from stripping .so files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-28 11:34:55 +01:00
Joachim Wiberg 046b15fbc0 common: separate handling of aarch64 and amd64 images, for now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-28 11:33:35 +01:00
Joachim Wiberg 759f8aa589 aarch64: add missing $BR2_ARCH arg to post-image.sh
Needed by sign.sh when creating the image.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-28 11:33:08 +01:00
Tobias WaldekranzandJoachim Wiberg d8c529a2a7 common: Make U-Boot's auxiliary environment accessable from Infix
This is not the full environment used by U-Boot, just the bits needed
for U-Boot to know which slot to boot and for Infix to know how the
boot process went.

U-Boot will selectively import/export only these keys during boot,
which avoids a malicious user from altering the boot in a way that
might bypass signature validation.
2023-02-28 11:01:04 +01:00
Tobias WaldekranzandJoachim Wiberg dd8bcca180 common: Generate a new dev cert with a distant expiry date
100 years ought to be enough for everyone.
2023-02-28 11:00:15 +01:00
Tobias WaldekranzandJoachim Wiberg d4432b72dd common: uboot: Add missing blkmap patches
The blkmap patches were not included in the original U-Boot Secure
Boot changeset.

Fixes: d243c80 ("aarch64: Convenience target to configure a QEMU compatible U-Boot")
2023-02-28 11:00:15 +01:00
Tobias WaldekranzandJoachim Wiberg 07dd863fb9 common: Remove remnants of old separate FIT-header-PoC
Now that the uncut FIT is stored in primary/secondary, we don't create
any FIT header files.

Fixes: 499a8f7 ("common: Create (e)MMC image with redundant root filesystems")
2023-02-28 11:00:15 +01:00
Joachim Wiberg c94c360d4a configs: sync aarch64 with amd64 to get Clixon, Frr, nginx, etc.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-28 10:49:27 +01:00
Joachim Wiberg 513316f19e configs: drop qemu tap settings, default should bet user
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-27 15:56:38 +01:00
Joachim Wiberg 47c39c311f Basic User Guide for the Open Source base
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-24 20:08:34 +01:00
Joachim Wiberg 48a64a39f2 amd64,aarch64: disable udev hwdb, not needed currently
Saves 18 MiB from /etc

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-23 09:41:38 +01:00
Joachim Wiberg 0c07f10062 board/amd64: minor fixups to isolinux.cfg
- Drop unused com32 modules
 - Fix duplicate prompt output (serial not needed)
 - Reduce timeout before booting default to 0.5 sec
 - UI or DEFAULT must be set, otherwise isolinux complains
   so replace ONTIMEOUT with DEFAULT
 - Increase user-walked-away timeout to 5 minutes
 - Always show the prompt

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-23 09:37:40 +01:00
Joachim Wiberg f2dd7430a7 package/finit: bump for next snapshot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-22 20:00:04 +01:00
Joachim Wiberg fc6a793269 configs/amd64_defconfig: simplify syslinux, drop graphical menu
Not required and often just looks garbled, better to drop it for now.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-22 18:56:28 +01:00
Joachim Wiberg c098629ce9 mkgns3a.sh: increase node ram even more, we need 512 MiB (!) to run
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-22 18:53:30 +01:00
Joachim Wiberg 384ef8c189 package/skeleton-init-finit: fix regression introduced in aee7fb9
On rebuild (without distclean) the getty.conf contained two tty lines
for the same TTY, causing Finit to believe the command line args had
been changed between each reload -- and thus kicking out the logged
in console user who just typed `initctl reload`.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-22 18:51:45 +01:00
Joachim Wiberg 8e7b173de3 mkgns3a.sh: increase node ram, we now provide Frr
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-22 07:32:43 +01:00
Joachim Wiberg 0a5729cbea package/skeleton-init-finit: fix ftbfs regression from aee7fb9
Need to rsync the whole skeleton since we provide more than just the
finit.d files, e.g. /etc/fstab, which we also modify in this .mk.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-22 07:31:31 +01:00
Joachim Wiberg c3d7405b8f Add support for using /usr/bin/pdmenu (setup) as a login shell
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 378633fa5c setup: make this the default /etc/pdmenurc in Infix
Set COLORTERM instead of using -c flag.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 6cf4a986f5 setup: add support for performing factory reset
Now that we have dialog on target we can add a user-friendly factory
reset dialog.  The new `yorn` script handles any form of yes-or-no
question, with or without dialog, to call a command.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 9af4155a83 board/common: always clear the tty after the setup command
Exiting pdmenu leaves artifacts on screen.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 0bd3acd361 setup: add support for easily switching system boot mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 22:28:42 +01:00
Joachim Wiberg 7733f18179 configs/amd64: enable squashfs images as well as kernel support
Now that we only support mmc and squash in `make run` we should make
sure the reference platform works as well as aarch64.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 20:12:12 +01:00
Joachim Wiberg 12b5731655 board/common: add support for overriding managed mode
This change adds support for setting the system boot mode to native /etc
style for systems where it's difficult, or close to impossible, to set
the Finit boot condition to 'etc'.

Note: this also moves the check for factory reset before we check if we
should use_etc, rather than NETCONF.  This to allow clearing out any of
the state files (.use_etc) before proceeding to boot in the default mode

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 20:05:31 +01:00
Joachim Wiberg 605bd7262b src/factory: use new /mnt/cfg/infix/.reset path
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-21 20:02:34 +01:00
Joachim Wiberg 357799bf47 package/skeleton-init-finit: add support for Frr
1. Use same naming standard for quagga and frr
 2. Only one of quagga and frr can be used at the same time
 3. Subdirectories in available/ only in the skeleton, not on target

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-20 14:49:37 +01:00
Joachim Wiberg aee7fb91d0 package/skeleton-init-finit: refactor, install svc files on demand
Only install the corresponding Finit svc if the package is selected in
the Buildroot menuconfig.  Some packages cannot be enabled by default
though, since they require a daemon configuration file, e.g. in the
case of ulogd it requires a valid /etc/ulogd.conf

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-20 14:49:37 +01:00
Tobias Waldekranz 499a8f718c common: Create (e)MMC image with redundant root filesystems
This image contains:

- A partition to hold bootloader config ("aux").

- Two redundant copies of the FIT framed rootfs (which will be
  upgradable by RAUC from within Infix).

- A partition to store critical configuration data ("cfg")

- A partition to store data created dynamically by Infix ("var")
2023-02-20 10:48:24 +01:00
Tobias Waldekranz ca3966db62 common: Create signature of root filesystem
mkimage will generate an FIT image containing a signature of the
rootfs, where the data is kept out of the DTB data structure, i.e.:

.---------.
|   DTB   |
:---------:
| Padding |
:---------:
|         |
|         |
| rootfs  |
|         |
|         |
'---------'

This is the on-disk format of Infix. At boot, we extract kernel and
device trees from the rootfs, and then use Linux's device mapper to
create a virtual block device that exposes the rootfs (squash).
2023-02-20 10:45:51 +01:00
Tobias Waldekranz 40f55058c6 common: Enable required U-Boot options in fragment file
This ensures that U-Boot images that we build can always:

- Rely on the environment extensions in env.dtsi being available
- Access the configured signing keys
- Use SD/eMMC cards
- Extract files from SquashFS filesystems

All of which are foundations that we intend to design our image
loading around.
2023-02-20 09:57:31 +01:00
Tobias Waldekranz b655ac778a common: Install signing key and environment in U-Boot's build tree
Ensure that whenever U-Boot is built:
- The chosen signing key and is converted to the expected format and
  installed in the build tree.
- Infix's environment extensions are installed in the build tree
2023-02-20 09:57:31 +01:00
Tobias Waldekranz 8716bea698 common: Add a development signing key
Keep a shared in-tree key that can be used to sign Infix images during
development. The idea is that this will also be included in developer
builds of U-Boot.
2023-02-20 09:57:31 +01:00
Tobias Waldekranz 98b59ac20b qemu: Optionally start from U-Boot using MMC disk
This is very useful for testing things like image signature
verification, system upgrades, etc.
2023-02-20 09:57:31 +01:00
Tobias Waldekranz d243c802b0 aarch64: Convenience target to configure a QEMU compatible U-Boot 2023-02-20 09:57:31 +01:00
Tobias Waldekranz 205d6e0187 aarch64: Enable support for PCI SDHC controllers
This let's us easily emulate SD/MMC disks from QEMU.
2023-02-20 08:56:06 +01:00
Joachim Wiberg 1cb4c9ac63 package/finit: bump for next snapshot
This is likely the last before v4.4-rc1.  Last remaining thing is a very
basic tmpfiles.so plugin that replaces a lot of what bootmisc.so hs been
(ab)used for.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:30:43 +01:00
Joachim Wiberg df6a19bac4 configs; enable nginx and clixon restconf over fcgi
Also add libcurl so all Clixon utility functions and apps are build with
full support for RESTCONF.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:15:57 +01:00
Joachim Wiberg 14dea1c6e1 src/mech: allow backend to start restconf in fcgi mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:15:22 +01:00
Joachim Wiberg 2875a787d4 package/clixon: add missing libfcgi dependency
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:14:49 +01:00
Joachim Wiberg 0162c2382a src/mech: sock and pid files should go in /run
This introduces a dependency on /run/clixon to exist when starting up.
Requires a patch to Finit panding the upcoming tempfiles.so plugin.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:13:08 +01:00
Joachim Wiberg c0c2ca622b board/common: add nginx.conf with /restconf fcgi reverse proxy
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:11:49 +01:00
Joachim Wiberg b0dfad05fb package/skeleton-init-finit: add support for monitoring nginx
Also needs /var/cache/nginx when starting up.  Requires separate patch
for now, but will be added a tmpflies.so plugn to Finit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:10:20 +01:00
Joachim Wiberg efb4efc0a0 Add support for Frr and SMCRoute
Primarily for evaluating OSPF in customer's use-case.  Preparing for
some (static) multicast routing tests as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 19:03:05 +01:00
Joachim Wiberg 6822c92fb2 package/skeleton-init-finit: fix copy-paste error in chrony env file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-15 11:17:41 +01:00
Tobias Waldekranz 581c0946b7 defconfig: Build mech by default
Clixon is the future :)
2023-02-10 16:11:34 +01:00
Tobias Waldekranz 00c93cd70c mech: Initial ietf-system support
Only hostname is supported for now.
2023-02-10 16:11:34 +01:00
Tobias Waldekranz 3d35194341 mech: Add infrastructure for backend plugins using Augeas 2023-02-10 16:11:34 +01:00
Tobias Waldekranz 3235f00cd1 mech: Import basic autocli support from clixon's main example
This allows use the autogenerated CLI to modify the database.
2023-02-10 16:11:34 +01:00
Tobias Waldekranz e56348a916 mech: Make startup_db persistent, prepare for factory configs
Keep the transient files in the system's /mnt/tmp, and only persist
startup_db in /cfg.

This design (with a symlink) means that /cfg/startup_db _must_ exist
in order for clixon to start properly. Therefore run
/lib/infix/prep-db to take care of this.

At the moment, this just creates an empty factory config, and copies
it to startup if it doesn't exist. In the future, prep-db could select
a factory config based on some hardware identifier, or even build one
dynamically, based on available ports etc.
2023-02-10 15:51:47 +01:00
Tobias Waldekranz 5a27b30c7c mech: Startup clixon at boot 2023-02-09 10:26:10 +01:00
Tobias Waldekranz 61213c7c3c sshd: Move hostkeys to /var/lib/ssh
This means keys are persistent even when /etc is not.
2023-02-09 10:26:10 +01:00
Tobias Waldekranz fbd68c4a65 qemu: Let user supply extra append options 2023-02-09 10:26:10 +01:00
Tobias Waldekranz 66688b4e5a board/common: mnt: Fix boot/etc detection
Previously, the absense of any finit boot conditions would be
interpreted as unmanaged mode, but managed should be the default.
2023-02-09 10:26:10 +01:00
Tobias Waldekranz d7c83cb9a7 board/common: Make it easier to access the CLI
- Create a shell alias, 'cli'
- Add an sshd subsystem, 'cli'
2023-02-09 10:26:10 +01:00
Tobias Waldekranz 3036b08945 board/common: Split out iface renaming from swup
The factory config part of swup will now only run when in unmanaged
mode.
2023-02-09 09:43:15 +01:00
Tobias Waldekranz 437961a644 board/common: Keep static /etc/iproute2/group
This way we don't have to patch it at every boot.
2023-02-09 09:43:15 +01:00
Tobias Waldekranz fa4a83e38d board/common: Keep our own dhcpcd.conf
This avoids the issue where the config file keeps growing as more
"background" lines are appended to it with each build.
2023-02-09 09:43:15 +01:00
Tobias Waldekranz 16af6f9622 board/common: Remove remnants of dropbear key generation 2023-02-09 09:43:15 +01:00
Tobias Waldekranz 7740baf796 Revert "board/common: enable NETCONF over SSH"
This reverts commit 2ddf9448fe.

Two reasons:

1. We will move to a debian-style /etc/ssh/ssh_config.d/ structure
   soon.

2. In a managed scenario, NETCONF could be disabled, so mech should be
   responsible for activating it at boot.
2023-02-09 09:43:15 +01:00
Joachim Wiberg 7bfb0a9478 Follow-up to 252feef: rename Orc to Mech everywhere
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 15:12:57 +01:00
Joachim Wiberg f75842ab8b src/mech: update socket group s/clixon/clicon/
Recommended group according to Clixon FAQ

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:55:03 +01:00
Joachim Wiberg 8f82d24724 board/common: add clicon user according to FAQ
https://github.com/clicon/clixon/blob/master/doc/FAQ.md#do-i-need-to-setup-anything

With the additional wheel group for the clicon user since our plugins
need to modify files in /etc at bootstrap and reconf.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:47 +01:00
Joachim Wiberg 2ddf9448fe board/common: enable NETCONF over SSH
The allows remote NETCONF access to the Clixon example (for now).  This
will be replaced later with the Clixon Infix system.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:03 +01:00
Joachim Wiberg 83b3a1b1cc board/common: follow-up to 91b40a1, fix bridge access ports
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:03 +01:00
Joachim Wiberg 6de17bb06a board/common: follow-up to 4ca58836b, let less be less
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:03 +01:00
Joachim Wiberg 8fe9e87550 patches/clixon: adjust paths to PID file and XML db store
- Use the more common .pid format for the PID file
 - Use an existing directory for the XML db, /var/lib/misc

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:03 +01:00
Joachim Wiberg 58c2ee159c package/clixon: fix misspelled BR2 variables in clixon.mk
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:53:01 +01:00
Joachim Wiberg e5545f1d27 Add licensing information, GPL like Buildroot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:52:19 +01:00
Joachim Wiberg e5032e1835 board/common: minor shellcheck fixes to mnt script
- Double quoting to prevent word splitting
 - local keyword is undefined in POSIX sh
 - `-m 0755` only applies to deepest directory (ignore)
 - Useless cat
 - Redirect to null, lilke the other mount_rw statements

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-08 14:52:19 +01:00
Tobias Waldekranz 252feef1c4 mech: Initial add
The mechanic, Infix's integration layer to Clixon
2023-02-08 14:05:47 +01:00
Tobias Waldekranz f8b32fb1be package/clixon: Fix default config file location
The comment in the makefile says it all.

With this in place, we can start clixon_{backend,cli,...} without any
arguments.
2023-02-08 14:05:47 +01:00
Joachim Wiberg 41737b2343 package/clixon: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-07 19:12:40 +01:00
Joachim Wiberg aa9a986d4b package/cligen: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-07 19:12:40 +01:00
Tobias Waldekranz ca1467736f common: Refactor persistent storage setup
In the new model, we have three sources of storage:

- /mnt/var: Mountpoint for a disk with the label "var"
- /mnt/cfg: Mountpoint for a disk with the label "cfg"
- /mnt/tmp: Mountpoint for a ramdisk

These sources are used for the following overlays:

- **/cfg, /home, /root**: /mnt/cfg if available, else /mnt/tmp

- **/etc**: /mnt/cfg if available and the boot/etc finit condition is
            set, else /mnt/tmp

- **/var**: /mnt/var if available, else /mnt/tmp

- **/var/lib**: /mnt/var if available, else /mnt/cfg if available,
                else /mnt/tmp

See board/common/rootfs/lib/infix/mnt for more information.
2023-02-07 15:42:35 +01:00
Joachim Wiberg 5ec019f97a Add link to GitHub Releases page
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-06 08:48:53 +01:00
Joachim Wiberg 17692eb250 package/sysrepo-plugin-system: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 13:50:25 +01:00
Joachim Wiberg f4c1f48d04 package/sysrepo-plugins-common: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 13:14:42 +01:00
Joachim Wiberg baa0d77598 package/umgmt: new package
Required by upcoming package sysrepo-plugin-system by Deutsche Telekom.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 12:38:50 +01:00
Joachim Wiberg ad22478866 board/common: allow full color output in setup tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:46:05 +01:00
Joachim Wiberg 326f2024d7 board/common: use plain view of log files in setup tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:46:02 +01:00
Joachim Wiberg 31d036c8c7 board/common: very basic 'setup' tool, also works as login shell
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 8525f26137 board/common: fix show formatting in '-p' (plain output) mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 0d9a218d95 board/common: add '-p' (plain output) to help command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 8b263f2766 board/common: add template /etc/mactab, syntax reminder only
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 92ce79bc7a board/common: add simple 'hostnm' script to change system hostname
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg b313096745 board/common: add '-p' option to help script for plain/noansi output
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg 81698b17a1 board/common: update and fix show script for plain/noansi output
Also, the "show port foo" didn't work.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:36 +01:00
Joachim Wiberg c4f40a49c7 board/common: ensure port+iface group is assigned in factory defaults
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-02-01 08:35:33 +01:00
Joachim Wiberg 4ca58836b4 board/common: replace edit and editor with symlink to nano
The nano editor has been shown, over and over again, to be more
user-friendly to complete UNIX/Linux beginners than even Mg.

Also, change the default pager/less to be less (again), it was
very confusing to have less be most and more just be more.  We
recommend scripts to use pager and edit/editor to call system
safe defaults.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 21:45:32 +01:00
Joachim Wiberg 70b725baec board/common: some helpful hints on port classification and NAT
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 20:03:59 +01:00
Joachim Wiberg 5ab09ccad0 Demo issues fixed
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 12:35:39 +01:00
Joachim Wiberg 11e96318ef board/common: make rc.local executable, not called otherwise
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 12:35:39 +01:00
Joachim Wiberg d100f27585 board/common: import default sysctl.conf from Debian
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 12:35:39 +01:00
Joachim Wiberg a1c5e8b33f board/common: drop ifupdown2 defaults, not used anymore
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 12:25:58 +01:00
Joachim Wiberg 2e62e0d655 package/ifupdown-ng: fix overlayfs issue (DT_REG)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-31 11:35:24 +01:00
Joachim Wiberg 69e3e4672b Minor issues observed when preparing the first demo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-27 19:24:02 +01:00
Joachim Wiberg c84af105ec board/common: 192 MiB RAM is not longer enough, increase to 256 MiB
Regrettably, the latest additions of functionality to Infix have also
incresed the size of the ramdisk.  We expect it to go down slightly
before v1.0, but considering we'll add Frr before then it's better to
be realistic of our needs when run in GNS3.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-26 17:59:59 +01:00
Joachim Wiberg 4cc1a14a87 configs: fix .gns3a file generation, missing rw.ext4
Sync amd64 build with genimage support from aarch64.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-26 15:58:04 +01:00
Joachim Wiberg 193a51af86 .github: always update latest tag on builds
The previous fix, setting 'rm: false' to prevent the parallel builds
from replacing each other, caused the latest tag to not be updated.
Very confusing, not just to end-users, but also for devs.

This patch changes the workflow to use a separate release step that
runs in sequence, waiting for the build to finish, before it moves
the latest tag.

The trick to solving this is to use upload/download artifact.  It is the
recommended way of sharing files between independent jobs in a workflow.
Notice the lack of 'name:' in both and 'path:' in the latter, it means
"don't care" just upload and then download everything to the artifact/
directory.  Making the job of the releaser action quite simple.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-26 08:22:05 +01:00
Joachim Wiberg cba6926918 TODO: wizard idea, use pdmenu for initial setup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 21:22:49 +01:00
Joachim Wiberg 2d7ca5ac88 board/common: drop bridge.template, same text now in 'help net'
Will also be part of the upcoming setup-bridge wizard built on pdmenu.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 21:20:45 +01:00
Joachim Wiberg 91b40a1385 Fix factory default, untagged access ports
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 21:16:38 +01:00
Joachim Wiberg 37ab226c9e Adjust ingress, we've moved to ifupdown-ng
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 21:00:00 +01:00
Joachim Wiberg ee926b52a2 Update 'help' with info on most, pwgen, fping, socat, etc.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:57:54 +01:00
Joachim Wiberg 2872227ec1 configs: add ttyd to all builds for sharing terminal over web
Experimental, may be reverted later after evaluation.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:50:27 +01:00
Joachim Wiberg b3c08d3503 configs: add irqbalance and the full kmod tools, for evaluation
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:49:19 +01:00
Joachim Wiberg 4aec9bf8cb configs: add pdmenu, neofetch, and pwgen to all builds
- pdmenu for the made-easy management tool for Infix
 - neofetch is just for demo purposes, we can add KernelKit logo
 - pwgen is for basic help, like netcalc

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:47:11 +01:00
Joachim Wiberg 05d86832f0 configs: enable fping and netcat for all builds
- fping is better for checking multiple hosts
 - OpenBSD netcat has more features and is generally better for multiple
   network testing scenarios

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:44:45 +01:00
Joachim Wiberg 45a03f17f8 configs: enable stress-ng, for stressing SoC, kernel, etc.
For board bringup, burn in testing, compliance testing, and general
troubleshooting.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:42:58 +01:00
Joachim Wiberg e7fad6fc7f We have terminfo for more terminals, let's default to TERM=linux
This gives us much better rendering of help system and other
console mode tools.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:41:40 +01:00
Joachim Wiberg 683e16cba2 configs: enable text-mode browser lynx
For debugging and external viewing of, e.g., man pages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:40:18 +01:00
Joachim Wiberg df1cf36437 Change help viewer to 'most', more helpful to newbies
- Default to start pager (most), fall back to less/more/cat
 - Drop : from sub-headings
 - Repeat 'See Also' section
 - Relocate network section's Interesting Files to end
 - Add dhcpcd.conf to list of interesting files

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 20:36:55 +01:00
Joachim Wiberg 08cd175cfc package/tetris: new package
Small easter egg for presentations, demos, etc.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 19:57:32 +01:00
Joachim Wiberg 028298714a configs: add conntrack tools to default build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 19:02:40 +01:00
Joachim Wiberg 579d0b5789 configs: add universal nework logging daemon (netfilter logging)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 19:01:52 +01:00
Joachim Wiberg fdd94a5943 configs: add nftables, with iptables compat, to default build
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 19:00:05 +01:00
Joachim Wiberg 36ccea2ab0 configs: enable a few more network debugging tools
- traceroute + mtr
 - nmap et al

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:52:06 +01:00
Joachim Wiberg 04ad1b90e3 Minor update, mention GNS3 support, initial password, and 'help'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg 3e4891bcaf board/common: update gns3a template, better description and usage
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg e421e938ff board/common: ensure dhcpcd backgrounds immediately for quicker boot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg 96c8f838e3 Update online help slightly
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg 2730c87772 configs: udev + dbus + avahi
This patch drops our use of mdnsd and mdev in regular Infix builds, yet
keeping them in the config and repo for smaller builds, e.g. endpoints.

Also, enable dbus to increase level of integration between compoents.
The dbus-test-tool is included for debugging connections.

Since it's about the tenth time I've been missing strace on target, it
too is added in this commit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg f5a95b3a91 package/finit: bump to latest snapshot (pre -rc1)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg 1fd929a68e buildroot: bump to latest master for upcoming 2023 LTS
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg 1ee3ab604d package/skeleton-init-finit: enable Avahi if selected in Buildroot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 17:41:13 +01:00
Joachim Wiberg d6e578e060 package/ifupdown-ng: change to KernelKit integration branch
- Disable IPv6 on bridge links when adding to a bridge

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-25 12:41:14 +01:00
Joachim Wiberg 7a9af5d244 package/skeleton-init-finit: let /var/lock be a symlink to /run/lock
The whole of /var may be read-only, while /run is a newstyle ramdisk.
The /run/lock directory is created by the Finit bootmisc.so plugin at
boot.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-24 14:45:52 +01:00
Joachim Wiberg 51f24b7765 board/common: initial /etc/mdev.conf from mdev-like-a-boss
- Support modprobe for hotplugged devices
 - Allow writable /dev/{null,zero,...} by all users
 - Correct TTY and console permissions
 - Adapt groups to Buildroot standard (Debian)

https://github.com/slashbeast/mdev-like-a-boss

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-24 08:06:07 +01:00
Joachim Wiberg fef42eb45b configs: switch from ifupdown2 to ifupdown-ng
- Replace ISC dhclient with dhcpcd => IPv4 link-local address
 - Enable openresolv to handle /etc/resolv.conf for us
 - iproute2 was a dependency of ifupdown2, but now we need to
   enable it explicitly
 - Ensure we have the same default system interface in infix
 - Reenable BusyBox applets disabled when enabling ifupdown2, for
   infix derivatives that may prefer a smaller base image.

Note: ifupdown-ng prefers dhcpcd over udhcpc, so no risk for conflict by
      reenabling udhcpc.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-19 18:09:26 +01:00
Joachim Wiberg 9fd0015873 package/ifupdown-ng: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-19 16:13:15 +01:00
Joachim Wiberg 9018024ca9 Add support for generating GNS3 appliance file for amd64 builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-16 19:15:40 +01:00
Joachim Wiberg 2a89445570 board/common: default to show group 'iface' in show iface command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-16 19:15:40 +01:00
Joachim Wiberg 59a2abb203 board/common: include a default (empty) rc.local as example
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-16 19:15:40 +01:00
Joachim Wiberg 9cda32b4f5 board/common: bridge template for ifupdown2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-16 19:15:40 +01:00
Joachim Wiberg e514cf419d board/common: use swup to ensure port and iface groups exist
Used by the 'show' script for grouping and filtering Linux interfaces.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-16 19:15:40 +01:00
Joachim Wiberg 3283090401 .github: always replace artifacts in the latest release
With two parallel builds (amd64, aarch64) we have contention of who last
uploads their artifact, meaning aarch currently removes the amd64 build.
This change should fix that.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-12 15:21:56 +01:00
Joachim Wiberg 3160162f9c .github: debug workflow, try *.tar.gz instead of *.tgz
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-11 22:43:59 +01:00
Joachim Wiberg ebc776bbfc .github: add workflow to build and upload tarballs to latest tag
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-11 18:35:32 +01:00
Joachim Wiberg b05f51f673 Guidelines for how to contribute to the project
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-11 18:07:12 +01:00
Joachim Wiberg d625a4915d Import a general CoC for project
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-11 17:58:35 +01:00
Joachim Wiberg bc21f93ec2 Add support for returning a device to factory defaults
This change adds a `factory` tool, and login shell, that schedules a
reset of all writable (overlay) filesystems.  The tool is set up with
the suid gid flag to allow all members of the wheel group to perform
the reset.

The login method only allows reset from /dev/console, to prevent any
malicious reset over SSH.  This should be further constrained later
when PAM is introduced.

To initiate factory reset from the login prompt, use login/pass:

    factory/reset

To initiate factory reset from the shell, call

    factory

Both methods are interactive by default, but two command line options
can be used to modify the behavior:

  -r  Skip reboot, and "reboot now?" question
  -y  Assume yes to all questions, for non-interactive use

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-04 15:24:36 +01:00
Joachim Wiberg ec177085d9 Reminders for later
@wkz look here, something for your ~/.emacs:

(use-package magit-org-todos
  :after magit
  :config
  (magit-org-todos-autoinsert)
  (setq magit-org-todos-filename "TODO.org"))

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-03 20:41:15 +01:00
Joachim Wiberg c748128137 configs: enable jq regexp support with Oniguruma
Needed by, e.g., new swup script, but also everything else we might want
to do with jq in any sane way.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-03 20:37:22 +01:00
Joachim Wiberg ccba72b083 Add factory default, all switch ports in group VLAN 1 on br0
This change checks¹ if the system does not have a br0 interface, creates
a default one consisting of all switch ports in VLAN 1 of br0.

On top of br0 a vlan1 management interface is created with DHCP address.

For emulation and test purposes, a way to supply tap interfaces from
Qemu, and pass off as if they were regular switch ports, is added.
____
¹ obviously a better way to detect a factory-reset device is needed,
  not all systems running infix will need or want a br0 interface.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-03 18:25:18 +01:00
Joachim Wiberg ec3c6e245a show: drop auto-port classification
This should now be handled by the swup script at bootstrap instead.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-03 18:14:43 +01:00
Joachim Wiberg 7e56dec874 board/common: new ifduown2 dhcp policy
Do not wait for dhclient to acquire first release, this will cause
unnecessary delays when booting, and not provide any real value in our
system.  Because we will never have any service that depends on a
network address being set when starting up, this is a feature that
Finit can provide for us as a condition when starting such services.

Also, never set global "README" in multiple policy files, this will
cause ifupdown2 to crash in horrific ways.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-01-03 17:11:02 +01:00
Joachim Wiberg ef86cd23f4 configs: enable rngd to improve entropy with /dev/hwrng
Also, enable virtio-rng-pci in Qemu for testing.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-21 10:35:37 +01:00
Joachim Wiberg 1c5730d193 configs: enable jq for all targets
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-21 10:35:00 +01:00
Joachim Wiberg 50493740e4 board/common: new script swup
Probe for switch ports, classify, rename interfaces according to mactab

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-20 16:32:21 +01:00
Joachim Wiberg c3cf4a4d60 board/common: set local mgmt interface prefix policy for ifupdown2
The default policy for management interface prefix in ifupdown2 is
"eth", which currently clashes with Infix default switch port names.
Changing our naming policy of switch ports to "swpN", mimicing the
naming using in Cumulus Linux, would also help.  To be discussed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-16 11:29:32 +01:00
Joachim Wiberg d9841fbf3e board/common: override ifupdown2 addons.conf
We will not use features like batman, vxrd, or openvswitch.  Also, the
clagd and vxrd addons are not in ifupdown2, so likely proprietary ext.
by Cumulus.  Dropping them makes "unknown addon" warnings go away.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-16 11:27:22 +01:00
Joachim Wiberg 26e127d495 configs: enable mdnsd for all platforms
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 23:06:16 +01:00
Joachim Wiberg e3c772e25a package/ifupdown2: bump to latest git hash
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 23:05:07 +01:00
Joachim Wiberg ab6c156c89 board/common: add compat symlinks to ip command
Various scripts and tools search for the ip command in different
places.  Most distros install it to /bin/ip and symlink to /sbin
and /usr dito, but Buildroot only installs to /sbin/ip

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg 6a5ce15fc0 package/ifupdown2: use older version of python-mako for now
This is a workaround for the following code in ifupdown/template.py:37
that throw the exception with python-mako >= 1.2.0:

    try:
        self.logger.debug('setting template lookuppath to %s'
                template_lookuppath)
        lc = utils.importName('mako.lookup', 'TemplateLookup')
        self.tclassargs['lookup'] = lc(
                    directories=template_lookuppath.split(':'))
    except Exception as e:
        self.logger.warning('unable to set template lookup path'
                            ' %s (%s): are you sure \'python3-mako\''
                            'is installed?'
                            % (template_lookuppath, str(e)))

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg af6907a380 package/python-templating: port of old python-mako
The ifupdown2 package is incompatible with python-mako >= v1.2.0.  So as
a workaround we add the old one as a local override.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg 245c298f0d configs: drop old ifupdown-scripts, not needed anymore
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg 6829e0b72d Follow-up to e7d3a42: add noauto to cfgfs, optional feature atm
Unlike debugfs, cfgfs is currently an optional feature in Infix, so
let's set it to noauto for now.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg bf37f8bbf8 package/mdnsd: new package
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg dc42c70f4e configs: enable IGMP querier daemon in default builds
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg cfb8a8aa88 package/querierd: new package
The Westermo querierd is an IGMP querier daemon for use on top of a
standard Linux VLAN-aware bridge.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg 1653980b19 configs/aarch64_defconfig: enable mdio-tools
Latest Buildroot now has mdio-tools in mainline.  This is useful when
debugging devices attaced over MDIO interfaces, eg. switches.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg 08fba1ea05 buildroot: bump to latest master, preparing for 2023.02 LTS
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim Wiberg 3c02e4b675 board/common: silence runtime warnings from ifupdown2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-14 22:21:16 +01:00
Joachim WibergandGitHub 698420b90d Mention ifupdown2, another load bearing component 2022-12-13 17:36:15 +01:00
Joachim Wiberg 63b0849ca7 qemu: prefer squashfs as initrd if enabled in .config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-13 17:34:19 +01:00
Joachim Wiberg 66f605681d configs: enable socat, for testing and scripting
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-13 17:34:19 +01:00
Joachim Wiberg 989a81fdc9 Enable ifupdown2 for all platforms, replacing BusyBox ifup/ifdown
This change replaces the BusyBox ifup/ifdown applets with the full-blown
ifupdown2 package.  To get it fully working we also need to enable a few
missing kernel features: ipv4 + ipv6, multiple routing tables, and some
netfilter features.  We take the opportunity to sync kernel features in
between the two archs as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-13 17:34:19 +01:00
Joachim Wiberg cd5282c636 package/ifupdown2: new package
This is the next generation ifupdown from Cumulus Networks (now NVIDIA).
The idea is to use this to set up everything port/lag/vlan/interface
related in the system.

This first import uses the kkit branch from the KernelKit fork, becuase
of, amongst other things, integration problems with upstream packages.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-13 17:34:19 +01:00
Tobias Waldekranz e7d3a42eec common: Mount configfs, if available 2022-12-12 16:07:25 +01:00
Tobias Waldekranz d56937f9dc qemu: Support passing custom options to setup user mode networking
This can be used to specify things like port forwards, TFTP server,
etc.
2022-12-12 16:07:25 +01:00
Joachim Wiberg c2c45026d0 show: add support for port classification and "show port NAME"
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-08 11:29:58 +01:00
Joachim Wiberg e2f3e43461 Update .PHONY rule, missing argument
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-08 11:29:58 +01:00
Joachim WibergandGitHub e14eccbbc0 Revert, project front page is not as wide
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-05 21:18:28 +01:00
Joachim WibergandGitHub ed341df849 Force line break in project description for effect
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-05 21:16:42 +01:00
Joachim WibergandGitHub d9fc2c68d2 Update README.md
Drop Introduction heading, redundant.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-05 21:15:18 +01:00
Joachim Wiberg 073f2fb043 qemu: move quick-help text to right before starting qemu
The qemu.sh script can fail, due to misconfiguration or other problems,
before it actually starts qemu.  Therefore, move the help text to right
before starting the emulator.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-05 21:12:04 +01:00
Joachim Wiberg 8d9bd8ec09 Roll out final product branding
Change all inf/IX or Inf/IX to plain Infix after steering group meeting.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-05 21:09:05 +01:00
Joachim Wiberg 333f972d12 board/marvell: drop linux-extras, merged in aarch6/linux_defconfig
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-12-05 20:39:03 +01:00
Joachim Wiberg 5446978a5a Minor, spellcheck and mention new EspressoBIN support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:59:41 +01:00
Joachim Wiberg 179024b091 doc: add raw svg logos made using Inkscape
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:09:43 +01:00
Joachim Wiberg a83542df8d Change to logo variant more suitable for dark mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:09:15 +01:00
Joachim Wiberg 1b426edc2a New logo
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:08:59 +01:00
Joachim Wiberg 6530bcaacb Drop ASCII logo and convert to an introduction
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:08:46 +01:00
Joachim Wiberg 5adb612dda board/aarch64: initial support for EspressoBIN
- Drop Cortex A72 in favor of more general A53 images
 - Enable device trees for all supported EspressoBIN models
 - Bump kernel to latest 6.0
 - Currently only starts from SD card, so add genimage to post-build
 - Create Ext2/4 disk image for SD card
 - Add infix-rw partition to sd-card image
 - The genimage tool needs genext2fs to create rw.ext4

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:05:26 +01:00
Joachim Wiberg 0bbb908114 patches/mstdp: drop, already in Buildroot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-26 17:05:14 +01:00
Tobias Waldekranz 9358a0f277 aarch64: Enable SMP support for SparX-5i
Upstream device trees specify regular PSCI support for SparX-5i, but
the U-Boot that Microchip ships does not actually support it.
Therefore, wrap the upstream version to disable PSCI and revert to
spin tables for SMP bringup.
2022-11-24 22:55:11 +01:00
Tobias Waldekranz a3ed770e1e aarch64: Add make target to flash U-Boot to the SparX-5i eval board 2022-11-24 22:55:11 +01:00
Joachim Wiberg 0a5870aa64 package/skeleton-init-finit: sync OpenSSH support from myLinux
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 18:03:28 +01:00
Joachim Wiberg 766e07e9c3 amd64,aarch64: change from Dropbear SSH -> OpenSSH
OpenSSH also enable OpenSSL and ZLIB, both of which we'll need later.
This in turn means Net-SNMP no longer needs its built-in OpenSSL stub.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 18:02:22 +01:00
Joachim Wiberg 6e2438da6e patches/tcpdump: backport DSA fix for extracting VID
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 14:41:23 +01:00
Joachim Wiberg 23ce9485ea packages/skeleton-init-finit: sync Finit start scripts with myLinux
This adds Finit support for starting chronydy and mstpd, as well as
an update to inadyn supporting env file for custom args.

Also included is a patch to the start script of mstpd for BusyBox pidof,
which don't have the '-c' option.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 14:41:23 +01:00
Joachim Wiberg 9f9581ae83 amd64,aarch64: drop Finit watchdog in favor of watchdogd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 14:41:23 +01:00
Joachim Wiberg c5ffeb2d06 qemu: add default options to enable i6300 WDT and host RTC
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 14:41:23 +01:00
Joachim Wiberg 2a06a50687 amd64,aarch64: enable kernel watchdog driver support
- At least softdog should always be there
 - Add i6300esb driver for Qemu

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 14:41:23 +01:00
Joachim Wiberg 49b0e81571 aarch64,amd64: add chrony, dnsmasq, mstpd, net-snmp, ssdpd, watchdogd
- chrony will be used as NTP v3/v4 server
 - dnsmasq will serve as a DNS forwarder and DHCP server when the
   very basic BusyBox DHCP server is insufficient
 - mstpd provides RSTP support
 - ssdp-responder provides device discovery in Windows
 - watchdogd provides basic system supervision and reset cause logging

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-23 14:41:23 +01:00
Tobias Waldekranz feb73e84ef doc: Unbricking instruction for SparX-5i eval board
For...you know...other people.
2022-11-22 15:33:25 +01:00
Tobias Waldekranz 4d41f16a7e common: Add ethtool to defconfigs 2022-11-21 20:46:23 +01:00
Joachim Wiberg 41eaae2369 Follow-up to a399bc1, re-add Finit to project identity
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-20 11:36:36 +01:00
Joachim Wiberg 25205f0957 common: follow-up to 3cb7606, prevent host key regen on boot
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-20 11:33:44 +01:00
Joachim Wiberg 0bdacbf59b common: add default /etc/issue
Preparing for the upcoming Finit v4.4 which takes system information
from /etc/os-release -- reduces branding efforts.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-20 11:33:44 +01:00
Joachim Wiberg a399bc1f88 motd logo too big, move to README for now
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-20 11:33:44 +01:00
Joachim Wiberg 03023c23af aarch64,amd64: enable tcpdump support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-19 15:50:00 +01:00
Joachim Wiberg ceacc5a3dc common: add support for 'factory' to reset /rw/infix to defaults
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-19 12:36:43 +01:00
Joachim Wiberg 1d89526fac common: resize serial terminal on login
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-19 12:18:38 +01:00
Joachim Wiberg 8d0653b5e9 common: default Inf/IX message of the day
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-19 12:18:08 +01:00
Joachim Wiberg f5f4af380e common: colorize fdb/mdb and route show commands
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:54:37 +01:00
Joachim Wiberg 9ef2078758 common: standardize on 8 char (tab) indent for shell scripts
Like Buildroot

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:49:15 +01:00
Joachim Wiberg 138a4261a3 common: add 'show fdb' and 'show mdb' commands
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:48:20 +01:00
Joachim Wiberg 5355876821 common: source /etc/bash.bashrc to disable built-in help command
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:44:22 +01:00
Joachim Wiberg 4e8e5bc228 aarch64,amd64: enable netcalc command line tool
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:44:22 +01:00
Joachim Wiberg 82bd7ea032 mkfit.sh: silent by default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:44:22 +01:00
Joachim Wiberg 8388c647bf common: add 'help' and 'show' commands
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:44:22 +01:00
Joachim Wiberg e8c2f11821 aarch64,amd64: enable LLDP support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:08:59 +01:00
Joachim Wiberg 3cb760626e aarch64,amd64: enable SSH servver support using Dropbear daemon
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:08:59 +01:00
Joachim Wiberg 71948c6c9b aarch64,amd64: enable IEC 62439-2 MRP bridge and userspace support
Set up bridge first:

    root@infix:~# ip link set dev eth0 up
    root@infix:~# ip link set dev eth1 up
    root@infix:~# ip link set dev eth2 up
    root@infix:~# ip link set dev eth3 up
    root@infix:~# ip link add name br0 type bridge
    root@infix:~# ip link set dev eth0 master br0
    root@infix:~# ip link set dev eth1 master br0
    root@infix:~# ip link set dev eth2 master br0
    root@infix:~# ip link set dev eth3 master br0

Start MRP server and add a configuration:

    root@infix:~# mrp_server &
    root@infix:~# mrp addmrp bridge br0 ring_nr 1 pport eth0 sport eth1 ring_role mrm
    root@infix:~# mrp addmrp bridge br0 ring_nr 2 pport eth2 sport eth3 ring_role mrm
    root@infix:~# mrp getmrp
    bridge: br0 ring_nr: 1 pport: eth0 sport: eth1 ring_role: MRM ring_state: CHK_RO
    bridge: br0 ring_nr: 2 pport: eth2 sport: eth3 ring_role: MRM ring_state: CHK_RC

Once all rings are set up:

    root@infix:~# ip link set dev br0 up

For more information, see:

 - https://github.com/microchip-ung/mrp
 - https://lwn.net/Articles/809089/

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:08:59 +01:00
Joachim Wiberg 8fe0ac2901 Follow-up to 0332cfe: fix aarch64 toolchain regression
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 17:08:59 +01:00
Tobias Waldekranz dc9de06317 README: Add some basic documentation 2022-11-18 16:24:32 +01:00
Tobias Waldekranz 4948cfebff aarch64/sparx5: Add support for PCB135 (eMMC) board 2022-11-18 16:24:32 +01:00
Tobias Waldekranz cef9cd9e44 aarch64/kernel: Support SparX-5i 2022-11-18 16:24:32 +01:00
Joachim WibergandTobias Waldekranz 15572e9ec6 aarch64: enable bash, en_CA locale, tzdata, and tmux
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz e641ca947e aarch64: replace package override with local.mk rule in external.mk
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz 0332cfe483 configs: bump kernel to last 5.19
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz 0d31903736 amd64: enable common rootfs overlay import Buildroot linux_defconfig
The Buildroot linux_defconfig doesn't have CONFIG_OVERLAY_FS, which we
need for our shared rootfs overlay.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz 92dde2ea20 amd64: enable bash, en_CA locale, tzdata, and tmux
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz d322a7153c configs: sync aarch64 and amd64 defconfigs, same kernel + packages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz 9e3a9e12d1 amd64: update defconfig and change from uclibc to glibc
Also, like the other defconfigs, ensure we have gdb-server on target.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz d8d05b5278 qemu: silence dd and mkfs outputs, otherwise used by qemu
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim WibergandTobias Waldekranz 7badb97d06 qemu: add support for x86_64 with ext2 rootfs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 12:05:51 +01:00
Joachim Wiberg e3c4bffb99 qemu: drop debug message from stdout
Fixes first-start error: "Qemu: cannot find 'Creating'"

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-11-18 07:59:54 +01:00
Tobias Waldekranz b2befc4566 build: Optionally build an FIT image with all enabled DTBs 2022-11-17 20:26:53 +01:00
Tobias Waldekranz aba3d1c5ce aarch64: Add post-build script to defconfig 2022-11-17 20:24:53 +01:00
Tobias Waldekranz 7477f81d71 post-image: Remove old QEMU remnants
TODO: Restore x86_64 support
2022-11-17 20:16:38 +01:00
Tobias Waldekranz 5ec3817bf3 aarch64/sparx5: Add defconfig to build U-Boot for devboard 2022-11-17 16:05:20 +01:00
Tobias Waldekranz 4232b22b76 qemu: Add virtualization support
The virtualized system is configured through kconfig under "External
Options"->"QEMU Virtualization".

To launch the system, simply run "make run". This works both from
output directories, and from the infix root with O= set.
2022-11-17 00:19:23 +01:00
Tobias Waldekranz e2fbd55970 aarch64: Add kernel defconfig
Default to build CN9130 for now.
2022-11-16 20:29:48 +01:00
Tobias Waldekranz e8943b77cf rootfs: Disable mg backups by default 2022-11-16 20:28:41 +01:00
Tobias Waldekranz 1e326a1ce2 rootfs: Add ipaddr/iplink aliases to the default profile 2022-11-16 20:27:42 +01:00
Tobias Waldekranz 45d07372d8 rootfs: Pluggable ifup scripts
Allow networking config to be supplied from multiple fragmens in
/etc/network/interfaces.d. This way, a user can customize their setup
without having to override /etc/network/interfaces.
2022-10-06 10:50:32 +02:00
Tobias Waldekranz d3e32f3286 rootfs: Add support for persistent system configuration 2022-10-06 10:46:13 +02:00
Tobias Waldekranz c4e6a24a47 rootfs: Add common overlay
Start out with some convenience macros and a proper PS1.
2022-10-06 10:46:02 +02:00
Tobias Waldekranz ef8f975b58 aarch64: Add mg and iproute2 to defconfig 2022-10-06 10:41:51 +02:00
Tobias Waldekranz 8b4c2615b2 aarch64: Initial support
Start with a basic config for the CN9130-CRB board.
2022-09-27 16:02:20 +02:00
Tobias Waldekranz 2bffa52be3 common/post-build: Use infix's version, not buildroot's, in os-release
This way we can more easily know exactly from which commit an image
was built.
2022-09-27 16:02:20 +02:00
Tobias Waldekranz 878e46c3f9 common/post-build: Make architecture independent
Until there's a real need to specify a variant, let's just not.
2022-09-27 16:02:20 +02:00
Tobias Waldekranz 9f31622e77 Add defconfig to build U-Boot for CN9130 CRB
NOTE: We globally disable stack protection, as the ATF specific
setting for disabling it does not seem to be respected by all rules in
the repo.
2022-09-27 13:26:23 +02:00
Tobias Waldekranz 3d9ad3b65b boot/arm-trusted-firmware: Workaround for non-GIT source builds
For some reason, the ATF build system does not deem an mv-ddr-marvell
archive to be valid unless it versioned using GIT. This is obviously
not the case when building from a tarball downloaded from GitHub.

Therefore, remove the check.

Despite the ominous warning above the removed line, the lack of a .git
directory does not seem to have any detrimental effect on the
generated artifact - at least not on a Marvell CN9130 build.
2022-09-27 13:20:06 +02:00
Tobias Waldekranz f6348db852 buildroot: Bump to 2022.08 2022-09-13 13:28:46 +02:00
Joachim Wiberg 2181bda965 package/finit: wrap custom fstab setting in an advanced sub-menu
Turns out its real easy to get this wrong, ending up with a "" as your
default fstab.  Since this is an advanced option let's mark it as such.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-13 05:43:05 +02:00
Joachim Wiberg 22de57e0dc configs: enable Buildroot host env. setup for SDK relocation
Note: update-defconfig moved sysklogd config and dropped custom headers.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-13 05:42:08 +02:00
Joachim Wiberg 38b5c16dc1 board/common: generate /etc/os-release in new post-build.sh
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-18 08:33:23 +02:00
Joachim Wiberg 06c1306dc5 board/common: enable kernel quiet mode by default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-17 08:49:31 +02:00
Joachim Wiberg 976c45b2b1 configs/amd64: add e2fsprogs for fsck.auto
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-17 08:49:13 +02:00
Joachim Wiberg 123937ea5f configs/amd64: enable sysklogd as system logger
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-17 08:45:50 +02:00
Joachim Wiberg 48195a1894 configs/amd64: enable finit by default
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-17 08:44:44 +02:00
Joachim Wiberg 2dd603113b package/finit: new init package, with skeleton
This patch imports Finit v4.3 from myLinux to infIX along with a
rudimentary rootfs skeleton.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-17 08:43:08 +02:00
Joachim Wiberg 1b492c905a configs: add custom BusyBox defconfig for amd64_defconfig
- Disable default init
 - Disable syslogd/klogd

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-17 08:41:11 +02:00
Joachim Wiberg fb018ece43 Minor fixups, make buildroot/Makefile and order-only dep
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-16 08:23:10 +02:00
475 changed files with 42082 additions and 63 deletions
+45
View File
@@ -0,0 +1,45 @@
Contributor Code of Conduct
===========================
As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all
people who contribute through reporting issues, posting feature
requests, updating documentation, submitting pull requests or patches,
and other activities.
We are committed to making participation in this project a
harassment-free experience for everyone, regardless of level of
experience, gender, gender identity and expression, sexual orientation,
disability, personal appearance, body size, race, ethnicity, age,
religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct. By adopting
this Code of Conduct, project maintainers commit themselves to fairly
and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code
of Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public
spaces when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by opening an issue or contacting one or more of the project
maintainers.
This Code of Conduct is adapted from the [Contributor Covenant][1],
[version 1.2.0][2].
[1]: http://contributor-covenant.org
[2]: http://contributor-covenant.org/version/1/2/0/
+78
View File
@@ -0,0 +1,78 @@
Contributing to Infix
=====================
We welcome any and all help in the form of bug reports, fixes, patches
to add new features -- *preferably as GitHub pull requests*. Other
methods are of course also possible: emailing the [maintainers][] a
patch or even a raw file, a feature request or an alert of a problem.
If you are unsure of what to do, or how to implement an idea or bugfix,
open an issue with `"[RFC: Unsure if this is a bug ... ?"`, or use the
GitHub discussions forum, so we can discuss it. Talking about the code
first is the best way to get started before submitting a pull request.
Either way, when sending an email, patch, or pull request, start by
stating the version the change is made against, what it does, and why.
Please take care to ensure you follow the project coding style and the
commit message format. If you follow these recommendations you help
the maintainer(s) and make it easier for them to include your code.
Coding Style
------------
> **Tip:** Always submit code that follows the style of surrounding code!
First of all, lines are allowed to be longer than 72 characters these
days. In fact, there exist no enforced maximum, but keeping it around
100 chars is OK.
The coding style itself is otherwise strictly Linux [KNF][].
Commit Messages
---------------
Commit messages exist to track *why* a change was made. Try to be as
clear and concise as possible in your commit messages, and always, be
proud of your work and set up a proper GIT identity for your commits:
git config --global user.name "Jane Doe"
git config --global user.email jane.doe@example.com
Example commit message from the [Pro Git][gitbook] online book, notice
how `git commit -s` is used to automatically add a `Signed-off-by`:
Brief, but clear and concise summary of changes
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as
the subject of an email and the rest of the text as the body. The
blank line separating the ummary from the body is critical (unless
you omit the body entirely); tools like rebase can get confused if
you run the two together.
Further paragraphs come after blank lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, preceded
by a single space, with blank lines in between, but conventions
vary here
Signed-off-by: Jane Doe <jane.doe@example.com>
Code of Conduct
---------------
It is expected of everyone to respect the [Code of Conduct][conduct].
The *"maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct."*
[1]: ../doc/MAINTAINERS
[KNF]: https://en.wikipedia.org/wiki/Kernel_Normal_Form
[gitbook]: https://git-scm.com/book/ch5-2.html
[conduct]: CODE-OF-CONDUCT.md
+94
View File
@@ -0,0 +1,94 @@
name: Bob the Builder
on:
pull_request:
branches:
- main
types:
- closed
workflow_dispatch:
jobs:
build:
if: ${{github.ref == 'refs/heads/main' && github.event_name == 'push'}} || github.event_name == 'workflow_dispatch'
name: Build ${{ matrix.platform }} ${{ matrix.variant }}
runs-on: ubuntu-latest
strategy:
matrix:
platform: [aarch64, x86_64]
variant: [netconf, classic]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set Build Variables
id: vars
run: |
if [ "${{ matrix.variant }}" = "netconf" ]; then
target=${{ matrix.platform }}
else
target=${{ matrix.platform }}-${{ matrix.variant }}
fi
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v3
with:
path: dl/
key: dl-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-${{ matrix.platform }}-${{ matrix.variant }}-
dl-${{ matrix.platform }}-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v3
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-${{ matrix.platform }}-${{ matrix.variant }}-
ccache-${{ matrix.platform }}-
ccache-
- name: Configure & Build
run: |
if [ "${{ matrix.variant }}" = "netconf" ]; then
target=${{ matrix.platform }}_defconfig
else
target=${{ matrix.platform }}_${{ matrix.variant }}_defconfig
fi
echo "Buildring $target ..."
make $target
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- name: Test
if: matrix.platform == 'x86_64' && matrix.variant == 'netconf'
run: |
make test-qeneth
- uses: actions/upload-artifact@v3
with:
path: output/${{ steps.vars.outputs.tgz }}
release:
if: github.repository == 'kernelkit/infix' && github.ref == 'refs/heads/main'
name: Upload Latest Build
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: pyTooling/Actions/releaser@main
with:
tag: latest
rm: true
token: ${{ secrets.GITHUB_TOKEN }}
files: artifact/*
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
# Latest Build Complete! :rocket:
For the public download links of these build artifacts, please see:
<https://github.com/kernelkit/infix/releases/tag/latest>
EOF
+64
View File
@@ -0,0 +1,64 @@
name: Reggie Regression
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Regression Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Build Variables
id: vars
run: |
target=x86_64-minimal
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v3
with:
path: dl/
key: dl-x86_64-netconf-${{ hashFiles('.git/modules/buildroot/refs/heads/master', 'package/*/*.hash') }}
restore-keys: |
dl-x86_64-netconf-
dl-x86_64-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v3
with:
path: .ccache/
key: ccache-x86_64-netconf-${{ hashFiles('.git/modules/buildroot/refs/head/master', 'package/*/*.hash') }}
restore-keys: |
ccache-x86_64-netconf-
ccache-x86_64-
ccache-
- name: Configure Minimal NETCONF
run: |
make x86_64_minimal_defconfig
- name: Build
run: |
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: output/${{ steps.vars.outputs.tgz }}
- name: Regression Test
run: |
make test-qeneth
+100
View File
@@ -0,0 +1,100 @@
name: Release General
on:
push:
tags:
- 'v[0-9]*.*'
jobs:
build:
if: github.repository == 'kernelkit/infix' && startsWith(github.ref, 'refs/tags/')
name: Build Infix ${{ github.ref_name }} [${{ matrix.platform }}-${{ matrix.variant }}]
runs-on: ubuntu-latest
strategy:
matrix:
platform: [aarch64, x86_64]
variant: [netconf, classic]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set Release Variables
id: build
run: |
ver=${GITHUB_REF#refs/tags/v}
echo "ver=${ver}" >> $GITHUB_OUTPUT
if echo $ver | grep -qE '[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then
echo "pre=true" >> $GITHUB_OUTPUT
else
echo "pre=false" >> $GITHUB_OUTPUT
fi
if [ "${{ matrix.variant }}" = "netconf" ]; then
target=${{ matrix.platform }}-${ver}
else
target=${{ matrix.platform }}-${{ matrix.variant }}-${ver}
fi
echo "dir=infix-$target" >> $GITHUB_OUTPUT
echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT
- name: Restore Cache of dl/
uses: actions/cache@v3
with:
path: dl/
key: dl-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }}
restore-keys: |
dl-${{ matrix.platform }}-${{ matrix.variant }}-
dl-${{ matrix.platform }}-
dl-
- name: Restore Cache of .ccache/
uses: actions/cache@v3
with:
path: .ccache/
key: ccache-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
restore-keys: |
ccache-${{ matrix.platform }}-${{ matrix.variant }}-
ccache-${{ matrix.platform }}-
ccache-
- name: Configure & Build
env:
INFIX_RELEASE: ${{ steps.build.outputs.ver }}
run: |
if [ "${{ matrix.variant }}" = "netconf" ]; then
target=${{ matrix.platform }}_defconfig
else
target=${{ matrix.platform }}_${{ matrix.variant }}_defconfig
fi
echo "Buildring $target ..."
make $target
make
- name: Prepare Artifact
run: |
cd output
mv images ${{ steps.build.outputs.dir }}
ln -s ${{ steps.build.outputs.dir }} images
tar chfz ${{ steps.build.outputs.tgz }} ${{ steps.build.outputs.dir }}
- uses: actions/upload-artifact@v3
with:
path: output/${{ steps.build.outputs.tgz }}
release:
name: Release Infix ${{ github.ref_name }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Extract ChangeLog entry ...
run: |
awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \
|head -n -1 > release.md
cat release.md
- uses: ncipollo/release-action@v1
with:
name: Infix ${{ github.ref_name }}
prerelease: ${{ needs.build.outputs.pre }}
bodyFile: release.md
artifacts: artifact/*
- name: Summary
run: |
cat <<EOF >> $GITHUB_STEP_SUMMARY
# Infix ${{ github.ref_name }} Released! :rocket:
For the public download links of this release, please see:
<https://github.com/kernelkit/infix/releases/tag/${{ github.ref_name }}>
EOF
+1
View File
@@ -3,4 +3,5 @@
/.ccache
/dl
/output*
/test/.venv
/local.mk
+7 -1
View File
@@ -1,3 +1,9 @@
[submodule "buildroot"]
path = buildroot
url = https://github.com/buildroot/buildroot.git
url = ../buildroot.git
[submodule "9pm"]
path = 9pm
url = ../9pm
[submodule "qeneth"]
path = qeneth
url = ../qeneth.git
Submodule
+1
Submodule 9pm added at d8a9f678f2
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+58
View File
@@ -0,0 +1,58 @@
Change Log
==========
All notable changes to the project are documented in this file.
[v23.06.0][] - 2023-06-23
-------------------------
Midsummer release. The first official Infix release, based on [Buildroot
2023.02.2][br2023.02.2], with NETCONF support using the [sysrepo][] and
[netopeer2][].
Supported YANG models in addition to those used by sysrepo and netopeer:
- [ietf-system][]
- Everything except radius authentication and timezone-utc-offset
- Augmented with MotD (Message of the Day), Infix YANG model
- [ietf-interfaces][]
- [ietf-ip][] augmented with IPv4LL similar to standardized IPv6LL
- [ietf-if-vlan-encapsulation][], Linux VLAN interfaces, e.g. `eth0.10`
- Linux bridge interfaces with native VLAN support, Infix YANG model
- Linux VETH pairs, Infix YANG model
> **DISCLAIMER:** the [Infix YANG models for Linux][yang23.06], are
> still under heavy development. New revisions are expected which may
> not be backwards compatible. When upgrading to a new release, test on
> a GNS3 staging environment first, or start over from a factory reset.
[br2023.02.2]: https://git.busybox.net/buildroot/tag/?h=2023.02.2
[ietf-system]: https://www.rfc-editor.org/rfc/rfc7317.html
[ietf-interfaces]: https://www.rfc-editor.org/rfc/rfc7223.html
[ietf-ip]: https://www.rfc-editor.org/rfc/rfc8344.html
[ietf-if-vlan-encapsulation]: https://www.ietf.org/id/draft-ietf-netmod-sub-intf-vlan-model-08.html
[yang23.06]: https://github.com/kernelkit/infix/blob/aea74842e0475441d8df834f2dcd8cbc21fa253d/src/confd/yang/infix-interfaces%402023-06-05.yang
### Changes
- Bump sysrepo to v2.2.73
- Backport support for initializing factory-default data store with
default config data also for sysrepo internal modules.
- Add support for `sysrepocfg -Cfactory -d running`, for testing
- Bump netopeer2 to v2.1.62
- Bump libyang to v2.1.80
- Add klish, a CLI for sysrepo
- Add podman for container support, backported from upstream Buildroot
- Add conmon for container support, backported from upstream Buildroot
- Backport cni-plugins support for host-local and static plugins
### Fixes
- N/A
[buildroot]: https://buildroot.org/
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v23.06.0...HEAD
[v23.06.0]: https://github.com/kernelkit/infix/compare/BASE...v23.06.0
[sysrepo]: https://www.sysrepo.org/
[netopeer2]: https://github.com/CESNET/netopeer2
+35
View File
@@ -0,0 +1,35 @@
# For /etc/os-release, uses CondtionArchitechture= from systemd.unit(5)
config INFIX_ARCH
string
default "arm" if BR2_arm
default "arm64" if BR2_aarch64
default "mips64" if BR2_mips64
default "riscv64" if BR2_riscv
default "x86_64" if BR2_x86_64
# For /etc/os-release, VARIANT & VARIANT_ID used, e.g., in mnt script
choice
prompt "Select variant/flavor"
default INFIX_VARIANT_NETCONF
config INFIX_VARIANT_NETCONF
bool "NETCONF"
help
Managed NETCONF mode, /etc is a ramdisk, all configuration is
generated by sysrepo plugins using NETCONF (xml) or RESTCONF.
config INFIX_VARIANT_CLASSIC
bool "Classic /etc mode"
help
User managed mode, read-write configuration files in /etc that
is saved across reboots.
endchoice
menu "Packages"
source "$BR2_EXTERNAL_INFIX_PATH/package/Config.in"
endmenu
source "$BR2_EXTERNAL_INFIX_PATH/board/common/Config.in"
+4 -6
View File
@@ -13,18 +13,16 @@ all: $(config) buildroot/Makefile
$(config):
@+$(call bmake,list-defconfigs)
@echo "ERROR: No configuration selected."
@echo "\e[7mERROR: No configuration selected.\e[0m"
@echo "Please choose a configuration from the list above by running"
@echo "'make <board>_defconfig' before building an image."
@exit 1
%: buildroot/Makefile
%: | buildroot/Makefile
@+$(call bmake,$@)
buildroot/Makefile:
@git submodule update --init
run:
@echo "Starting Qemu :: Ctrl-a x -- exit | Ctrl-a c -- toggle console/monitor"
@(cd $(O)/images && ./qemu.sh)
.PHONY: all
+217
View File
@@ -0,0 +1,217 @@
<img align="right" src="doc/text3134.png" alt="Infix Linux Networking Made Easy">
* [Introduction](#introduction)
* [NETCONF Mode](#netconf-mode)
* [NETCONF Mode](#netconf-mode)
* [Classic Mode](#classic-mode)
* [Hybrid Mode](#hybrid-mode)
* [Hardware](#hardware)
* [Qemu](#qemu)
* [GNS3](#gns3)
* [Building](#building)
* [Origin & Licensing](origin--licensing)
Introduction
------------
Infix is an embedded Linux Network Operating System (NOS) based on
[Buildroot][1], [Finit][2], [ifupdown-ng][3], and [sysrepo][6].
Providing an easy-to-maintain and easy-to-port Open Source base for
networked equipment.
> See the [GitHub Releases](https://github.com/kernelkit/infix/releases)
> page for out pre-built images. The *Latest Build* has the bleeding edge
> images, if possible we recommend using a versioned release.
>
> For customer specific builds of Infix, see your respective repository.
Infix has two main *flavors*, or defconfigs:
- **NETCONF:** the default, managed using, e.g., the `cli` tool
- **Classic:** built from `$ARCH_classic_defconfig`, more below
Both flavors have an `admin` user, which is allowed to log in from
remote, password `admin` on standard builds. It is the recommended
account to use for managing Infix. (The `root` account is currently
also available, but will soon become a non-login account used only for
running system services.)
### NETCONF Mode
NETCONF is the primary reason Infix exists. Configuration of an Infix
device can be done either remotely, using tools like [netconf-client][]
or [netopeer2-cli][], or locally using the [`cli` tool](doc/cli.md).
Infix use [sysrepo][6] as the data store for NETCONF. A set of plugins
configure the network, using iproute2, generate configuration files in
`/etc`, and control the system daemons, e.g., enable DHCP client on an
interface.
### Classic Mode
Here it is up to the administrator to modify configuration files in
`/etc` and control the system daemons using the `initctl` tool.
See the online `help` command for an introduction to the system.
### Hybrid Mode
Since Infix is under heavy development, it does not yet have all bells
and whistles in place, in particular in the default build. To that end
it is possible to manually manage certain services that are not yet
possible to configure using NETCONF.
At bootstrap Finit can start user scripts from a [run-parts(8)][] like
directory: `/cfg/start.d`. For example, the following starts OSPF:
```sh
root@infix:~$ mkdir /cfg/start.d
root@infix:~$ cd /cfg/start.d
root@infix:/cfg/start.d$ cat <<EOF >10-enable-ospf.sh
#!/bin/sh
# Use vtysh to modify the OSPF configuration
rm /etc/frr/frr.conf
ln -s /cfg/frr/frr.conf /etc/frr/
initctl enable zebra
initctl enable ospfd
initctl enable bfdd
exit 0
EOF
root@infix:/cfg/start.d$ chmod +x 10-enable-ospf.sh
```
> **Note:** Neither [Frr](https://frrouting.org) (Zebra/OSPF/BFD) or
> [podman](https://podman.io) are enabled in default Infix builds.
> Please use customer specific builds, or enable it yourself in Infix by
> using `make menuconfig` followed by rebuilding the image.
This is also the way to start containers (provided the images have been
downloaded with `podman pull` first):
```
root@infix:/cfg/start.d$ cat <<EOF >20-enable-container.sh
#!/bin/sh
podman-service -e -d "Nginx container" -p "-p 80:80" nginx:alpine
exit 0
EOF
root@infix:/cfg/start.d$ chmod +x 20-enable-container.sh
```
Reboot to activate the changes. To activate the changes without
rebooting, run the script and call `initctl reload`.
Hardware
--------
### aarch64
By default, Infix builds with support for the following boards (you
may enable additional boards in the config, of course):
- Marvell CN9130 CRB
- Marvell EspressoBIN
- Microchip SparX-5i PCB135 (eMMC)
See the aarch64 specific [documentation](board/aarch64/README.md) for more
information.
### x86_64
Primarily intended to be run under [QEMU][] for development & test as
well as evaluation, demo and [training][] purposes, e.g. using [GNS3][]
or [Qeneth][7].
QEMU
----
A virtualized instance can easily be launched from a Linux system, with
Qemu installed, by issuing `make run`.
Some settings, e.g. networking, can be configured via `make menuconfig`
under `External options -> QEMU virtualization`.
GNS3
----
Download the [latest build][0] of the `x86_64`, or `x86_64_classic`
flavor. Unpack in a dedicated directory and use ["Import Appliance"][9]
to install the `.gns3a` file into GNS3. Infix (`x86_64`) is in the
"Router" category, it has 10 interfaces available by default for use as
switch ports or routing. The *classic* build only has one interface by
default, geared more towards acting as an end device.
Building
--------
Buildroot is almost stand-alone, but need a few locally installed tools
to bootstrap itself. For details, see the [excellent manual][manual].
Briefly, to build an Infix image; select the target and then make:
make x86_64_defconfig
make
Online help is available:
make help
To see available defconfigs for supported targets, use:
make list-defconfigs
> **Note:** build dependencies (Debian/Ubuntu): <kbd>sudo apt install make libssl-dev</kbd>
Origin & Licensing
------------------
Infix is entirely built on Open Source components (packages). Most of
them, as well as the build system with its helper scripts and tools, is
from [Buiildroot][1], which is distributed under the terms of the GNU
General Public License (GPL). See the file COPYING for details.
Some files in Buildroot contain a different license statement. Those
files are licensed under the license contained in the file itself.
Buildroot and Infix also bundle patch files, which are applied to the
sources of the various packages. Those patches are not covered by the
license of Buildroot or Infix. Instead, they are covered by the license
of the software to which the patches are applied. When said software is
available under multiple licenses, the patches are only provided under
the publicly accessible licenses.
Infix releases include the license information covering all Open Source
packages. This is extracted automatically at build time using the tool
`make legal-info`. Any proprietary software built on top of Infix, or
Buildroot, would need separate auditing to ensure it does not link with
any GPL[^1] licensed library.
[^1]: Infix image builds use GNU libc (GLIBC) which is covered by the
[LGPL][4]. The LGPL *does allow* proprietary software, as long as
said software is linking dynamically, [not statically][5], to GLIBC.
[0]: https://github.com/kernelkit/infix/releases/tag/latest
[1]: https://buildroot.org/
[2]: https://github.com/troglobit/finit
[3]: https://github.com/ifupdown-ng/ifupdown-ng
[4]: https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
[5]: https://lwn.net/Articles/117972/
[6]: https://www.sysrepo.org/
[7]: https://github.com/wkz/qeneth
[8]: https://addiva-elektronik.github.io/2023/05/12/using-netconf-client-and-server-to-update-switch-configuration/
[9]: https://docs.gns3.com/docs/using-gns3/beginners/import-gns3-appliance/
[QEMU]: https://www.qemu.org/
[GNS3]: https://gns3.com/
[training]: https://addiva-elektronik.github.io/
[manual]: https://buildroot.org/downloads/manual/manual.html
[run-parts(8)]: https://manpages.ubuntu.com/manpages/trusty/man8/run-parts.8.html
[netconf-client]: https://pypi.org/project/netconf-client/
[netopeer2-cli]: https://github.com/CESNET/netopeer2
+22
View File
@@ -0,0 +1,22 @@
* TODO doc: User Guide
- Feature set and scope, e.g.
- Device discovery: SSDP, LLDP, mDNS-SD how do they work, interfacing with Windows/macOS/Linux
- Network redundancy protocols: STP/RSTP, MRP
- Configuring the system; using ifupdown2, enabling/disabling services
- Diagnosing the system; using rmon, port mirroring, debugging services, searching logs
- Limitations, e.g., PRP/HSR or IEEE 802.1CB will not be possible to support
- Tips & Trix
* TODO document how to set up passwordless SSH
* TODO add setup wizard, based on pdmenu
- setup-port script to tweak ethtool settings
- setup-iface script to configure a layer-3 interface
- setup-bridge script that creates a new bridge with config from cmdline
- setup-firewall script that can do basic firewall rules and masquerading
* TODO split out qemu Config.in to a "make run-menuconfing"
* TODO rename qemu/ to run/, perhaps?
* TODO ship qemu/* with output/images/ for stand-alone runs of older builds
+67
View File
@@ -0,0 +1,67 @@
aarch64
=======
Microchip SparX-5i PCB135 (eMMC)
--------------------------------
At present, only FIT images are supported via the SparX-5i eval
board's U-Boot, which must contain a valid load address. If you are
using this board, after selecting your base configuration, run the
following command to supplement the existing config with the required
FIT options:
make board-enable-sparx-fit
### Unbricking
1. Don't load a corrupt bootloader to begin with
2. Done
If, for some reason, you didn't manage to follow step 1, you can use
the `FLASH_PROG`(`J4`) connector on the board to access the SPI flash
directly.
Using a [Bus Blaster][BB3] in combination with [dangerspi][dangerspi],
you can load a new bootloader. The schematic below details how to
connect the Bus Blaster to the board, but the concept should be
portable to any debugger/device based around an FTDI2232 chip.
```
Bus Blaster: FLASH_PROG (J4):
.---. .---.
VTG >o o| VTG SCK >o o| GND
TRST |o o| GND MISO |o o| #RESET_FLASH
TDI |o o| GND o o| 3V3
TMS |o o| GND #CS |o o| #SYSRESET
TCK o o| GND MOSI |o o| GND
RTCK o o| GND '---'
TDO |o o| GND
TSRST |o o| GND
DBGRQ |o o| GND
DBGACK |o o| GND
'---'
```
| Bus Blaster | FLASH_PROG |
|-------------|----------------|
| `VTG` | `3V3` |
| `GND` | `GND` |
| | |
| `VTG` | `#RESET_FLASH` |
| `GND` | `#SYSRESET` |
| | |
| `TDI` | `MOSI` |
| `TMS` | `#CS` |
| `TCK` | `SCK` |
| `TDO` | `MISO` |
With the cable in place, build U-Boot with the correct configuration:
make fireant_boot_defconfig && make
To flash it to the board, connect the cable to `J4` and run:
make board-sparx-flash-uboot
[BB3]: http://dangerousprototypes.com/docs/Bus_Blaster#Bus_Blaster_v3
[dangerspi]: https://github.com/wkz/dangerspi
+37
View File
@@ -0,0 +1,37 @@
.PHONY: board-enable-qemu-uboot
board-enable-qemu-uboot:
@$(call IXMSG,"Enabling build of QEMU compatible U-Boot")
./utils/config --file $(BR2_CONFIG) \
--enable PACKAGE_HOST_UBOOT_TOOLS \
--enable PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT \
--enable PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT \
--enable TARGET_UBOOT \
--enable TARGET_UBOOT_BUILD_SYSTEM_KCONFIG \
--enable TARGET_UBOOT_CUSTOM_VERSION \
--set-str TARGET_UBOOT_CUSTOM_VERSION_VALUE \
"2023.04-rc2" \
--set-str TARGET_UBOOT_PATCH \
'$$(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/patches' \
--set-str TARGET_UBOOT_BOARD_DEFCONFIG \
"qemu_arm64" \
--set-str TARGET_UBOOT_CONFIG_FRAGMENT_FILES \
'$$(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/extras.config' \
--enable TARGET_UBOOT_FORMAT_DTB
.PHONY: board-enable-sparx-fit
board-enable-sparx-fit:
@$(call IXMSG,"Enabling SparX-5i compatible FIT options")
@BR2_PREFIX= ./utils/config --file $(BR2_CONFIG) \
--enable FIT_IMAGE \
--set-str FIT_KERNEL_LOAD_ADDR "0x7 0x00000000"
.PHONY: board-sparx-flash-uboot
board-sparx-flash-uboot: $(BINARIES_DIR)/u-boot.bin
@grep -q 'BR2_TARGET_UBOOT_BOARD_DEFCONFIG="mscc_fireant_pcb135_emmc"' $(BR2_CONFIG) || \
{ echo Build tree does not seem to be configured for SparX-5i eval board; exit 1; }
@echo Erasing...
@dangerspi.py erase 0 0x100000
@echo Programming...
@dangerspi.py write 0 0x100000 <$<
@echo Done...
+7
View File
@@ -0,0 +1,7 @@
blkmap get boot dev devnum
load blkmap ${devnum} ${kernel_addr_r} /boot/Image
#TODO: LOAD FDT
setenv bootargs "${bootargs_root} ${bootargs_rauc} ${bootargs_log}"
booti ${kernel_addr_r} ${ramdisk} ${fdt_addr}
@@ -0,0 +1,22 @@
/* Upstream device trees specify regular PSCI support for SparX-5i,
* but the U-Boot that Microchip ships does not actually support it.
* Therefore, wrap the upstream version to disable PSCI and revert to
* spin tables for SMP bringup.
*/
/dts-v1/;
#include "microchip/sparx5_pcb135_emmc.dts"
&cpu0 {
enable-method = "spin-table";
cpu-release-addr = <0x0 0x0000fff8>;
};
&cpu1 {
enable-method = "spin-table";
cpu-release-addr = <0x0 0x0000fff8>;
};
/ {
/delete-node/ psci;
};
+25
View File
@@ -0,0 +1,25 @@
image cfg.ext4 {
ext4 {
label = "cfg"
}
empty = true
size = 16M
}
image sdcard.img {
hdimage {
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}
partition cfg {
partition-type = 0x83
image = "cfg.ext4"
}
}
# Silence genimage warnings
config {}
+543
View File
@@ -0,0 +1,543 @@
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_AUDIT=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_PREEMPT=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=18
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
CONFIG_USER_NS=y
CONFIG_SCHED_AUTOGROUP=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PROFILING=y
CONFIG_SMP=y
CONFIG_ARCH_SPARX5=y
CONFIG_ARCH_MVEBU=y
CONFIG_ARCH_VEXPRESS=y
CONFIG_ARM64_VA_BITS_48=y
CONFIG_SCHED_MC=y
CONFIG_NR_CPUS=64
CONFIG_COMPAT=y
# CONFIG_SUSPEND is not set
CONFIG_ARM_PSCI_CPUIDLE=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
CONFIG_CPUFREQ_DT=y
CONFIG_ARM_ARMADA_37XX_CPUFREQ=y
CONFIG_ARM_ARMADA_8K_CPUFREQ=y
CONFIG_ACPI=y
CONFIG_ARM64_CRYPTO=y
CONFIG_CRYPTO_SHA1_ARM64_CE=y
CONFIG_CRYPTO_SHA2_ARM64_CE=y
CONFIG_CRYPTO_GHASH_ARM64_CE=y
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_KPROBES=y
CONFIG_JUMP_LABEL=y
# CONFIG_GCC_PLUGINS is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_KSM=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CMA=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_XDP_SOCKETS=y
CONFIG_XDP_SOCKETS_DIAG=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_NET_IPIP=m
CONFIG_NET_IPGRE_DEMUX=m
CONFIG_NET_IPGRE=m
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_SYN_COOKIES=y
CONFIG_NET_IPVTI=m
CONFIG_NET_FOU_IP_TUNNELS=y
CONFIG_IPV6_SIT=m
CONFIG_IPV6_GRE=m
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
CONFIG_IPV6_PIMSM_V2=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_NETFILTER=y
CONFIG_BRIDGE_NETFILTER=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_CT=m
CONFIG_NFT_CONNLIMIT=m
CONFIG_NFT_LOG=m
CONFIG_NFT_LIMIT=m
CONFIG_NFT_MASQ=m
CONFIG_NFT_REDIR=m
CONFIG_NFT_NAT=m
CONFIG_NFT_TUNNEL=m
CONFIG_NFT_OBJREF=m
CONFIG_NFT_QUEUE=m
CONFIG_NFT_REJECT=m
CONFIG_NFT_COMPAT=m
CONFIG_NFT_HASH=m
CONFIG_NFT_XFRM=m
CONFIG_NFT_SOCKET=m
CONFIG_NFT_OSF=m
CONFIG_NFT_DUP_NETDEV=m
CONFIG_NFT_FWD_NETDEV=m
CONFIG_NFT_REJECT_NETDEV=m
CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
CONFIG_NETFILTER_XT_TARGET_LOG=m
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NETFILTER_XT_MATCH_CGROUP=m
CONFIG_NETFILTER_XT_MATCH_COMMENT=m
CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m
CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
CONFIG_NETFILTER_XT_MATCH_DSCP=m
CONFIG_NETFILTER_XT_MATCH_HELPER=m
CONFIG_NETFILTER_XT_MATCH_LIMIT=m
CONFIG_NETFILTER_XT_MATCH_MAC=m
CONFIG_NETFILTER_XT_MATCH_MARK=m
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_MANGLE=m
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP6_NF_MATCH_AH=m
CONFIG_IP6_NF_MATCH_EUI64=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
CONFIG_IP6_NF_FILTER=m
CONFIG_IP6_NF_TARGET_REJECT=m
CONFIG_IP6_NF_RAW=m
CONFIG_IP6_NF_NAT=m
CONFIG_IP6_NF_TARGET_MASQUERADE=m
CONFIG_IP6_NF_TARGET_NPT=m
CONFIG_NF_TABLES_BRIDGE=m
CONFIG_NFT_BRIDGE_META=m
CONFIG_NF_CONNTRACK_BRIDGE=m
CONFIG_BRIDGE_NF_EBTABLES=m
CONFIG_BRIDGE_EBT_BROUTE=m
CONFIG_BRIDGE_EBT_T_FILTER=m
CONFIG_BRIDGE_EBT_T_NAT=m
CONFIG_BRIDGE_EBT_802_3=m
CONFIG_BRIDGE_EBT_ARP=m
CONFIG_BRIDGE_EBT_IP=m
CONFIG_BRIDGE_EBT_IP6=m
CONFIG_BRIDGE_EBT_LIMIT=m
CONFIG_BRIDGE_EBT_PKTTYPE=m
CONFIG_BRIDGE_EBT_STP=m
CONFIG_BRIDGE_EBT_VLAN=m
CONFIG_BRIDGE_EBT_ARPREPLY=m
CONFIG_BRIDGE_EBT_DNAT=m
CONFIG_BRIDGE_EBT_REDIRECT=m
CONFIG_BRIDGE_EBT_SNAT=m
CONFIG_BRIDGE_EBT_LOG=m
CONFIG_BRIDGE_EBT_NFLOG=m
CONFIG_BPFILTER=y
CONFIG_BRIDGE=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_BRIDGE_MRP=y
CONFIG_BRIDGE_CFM=y
CONFIG_NET_DSA=y
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_TCINDEX=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NETLINK_DIAG=y
CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
CONFIG_MPLS_ROUTING=m
CONFIG_MPLS_IPTUNNEL=m
CONFIG_NET_PKTGEN=y
# CONFIG_WIRELESS is not set
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_LWTUNNEL=y
CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
CONFIG_PCI_IOV=y
CONFIG_PCI_AARDVARK=y
CONFIG_PCI_HOST_GENERIC=y
CONFIG_PCIE_ARMADA_8K=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_FW_CFG_SYSFS=y
CONFIG_FW_CFG_SYSFS_CMDLINE=y
CONFIG_MTD=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_BLOCK2MTD=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_NAND_MARVELL=y
CONFIG_MTD_SPI_NOR=y
CONFIG_OF_OVERLAY=y
CONFIG_BLK_DEV_NULL_BLK=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_RAM=y
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_NVME=y
CONFIG_SRAM=y
CONFIG_EEPROM_AT24=y
# CONFIG_SCSI_PROC_FS is not set
CONFIG_BLK_DEV_SD=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_VIRTIO=y
CONFIG_ATA=y
CONFIG_SATA_AHCI=y
CONFIG_SATA_AHCI_PLATFORM=y
CONFIG_AHCI_MVEBU=y
CONFIG_PATA_PLATFORM=y
CONFIG_PATA_OF_PLATFORM=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_INIT=y
CONFIG_DM_VERITY=y
CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y
CONFIG_NETDEVICES=y
CONFIG_BONDING=m
CONFIG_DUMMY=m
CONFIG_NET_TEAM=m
CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=m
CONFIG_NET_TEAM_MODE_LOADBALANCE=m
CONFIG_MACVLAN=m
CONFIG_MACVTAP=m
CONFIG_IPVLAN=m
CONFIG_IPVTAP=m
CONFIG_VXLAN=m
CONFIG_GENEVE=m
CONFIG_BAREUDP=m
CONFIG_MACSEC=m
CONFIG_TUN=m
CONFIG_VETH=m
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
CONFIG_NET_VRF=y
CONFIG_NET_DSA_MV88E6XXX=y
CONFIG_NET_DSA_MV88E6XXX_PTP=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
# CONFIG_NET_VENDOR_AGERE is not set
# CONFIG_NET_VENDOR_ALACRITECH is not set
# CONFIG_NET_VENDOR_ALTEON is not set
# CONFIG_NET_VENDOR_AMAZON is not set
# CONFIG_NET_VENDOR_AMD is not set
# CONFIG_NET_VENDOR_AQUANTIA is not set
# CONFIG_NET_VENDOR_ARC is not set
# CONFIG_NET_VENDOR_ATHEROS is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_CADENCE is not set
# CONFIG_NET_VENDOR_CAVIUM is not set
# CONFIG_NET_VENDOR_CHELSIO is not set
# CONFIG_NET_VENDOR_CISCO is not set
# CONFIG_NET_VENDOR_CORTINA is not set
# CONFIG_NET_VENDOR_DEC is not set
# CONFIG_NET_VENDOR_DLINK is not set
# CONFIG_NET_VENDOR_EMULEX is not set
# CONFIG_NET_VENDOR_EZCHIP is not set
# CONFIG_NET_VENDOR_GOOGLE is not set
# CONFIG_NET_VENDOR_HISILICON is not set
# CONFIG_NET_VENDOR_HUAWEI is not set
CONFIG_MVNETA=y
CONFIG_MVPP2=y
# CONFIG_NET_VENDOR_MELLANOX is not set
# CONFIG_NET_VENDOR_MICREL is not set
CONFIG_SPARX5_SWITCH=y
# CONFIG_NET_VENDOR_MICROSEMI is not set
# CONFIG_NET_VENDOR_MYRI is not set
# CONFIG_NET_VENDOR_NI is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_NETERION is not set
# CONFIG_NET_VENDOR_NETRONOME is not set
# CONFIG_NET_VENDOR_NVIDIA is not set
# CONFIG_NET_VENDOR_OKI is not set
# CONFIG_NET_VENDOR_PACKET_ENGINES is not set
# CONFIG_NET_VENDOR_PENSANDO is not set
# CONFIG_NET_VENDOR_QLOGIC is not set
# CONFIG_NET_VENDOR_BROCADE is not set
# CONFIG_NET_VENDOR_QUALCOMM is not set
# CONFIG_NET_VENDOR_RDC is not set
CONFIG_8139CP=y
# CONFIG_NET_VENDOR_RENESAS is not set
# CONFIG_NET_VENDOR_ROCKER is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SILAN is not set
# CONFIG_NET_VENDOR_SIS is not set
# CONFIG_NET_VENDOR_SOLARFLARE is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_SOCIONEXT is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_SUN is not set
# CONFIG_NET_VENDOR_SYNOPSYS is not set
# CONFIG_NET_VENDOR_TEHUTI is not set
# CONFIG_NET_VENDOR_TI is not set
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
CONFIG_SFP=y
CONFIG_MARVELL_PHY=y
CONFIG_MARVELL_10G_PHY=y
CONFIG_MICREL_PHY=y
CONFIG_MICROCHIP_PHY=y
CONFIG_MICROCHIP_T1_PHY=y
CONFIG_MICROSEMI_PHY=y
CONFIG_MDIO_BITBANG=y
CONFIG_MDIO_MVUSB=y
CONFIG_MDIO_MSCC_MIIM=y
CONFIG_MDIO_BUS_MUX_MMIOREG=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_CDC_EEM=y
# CONFIG_USB_NET_CDC_NCM is not set
# CONFIG_USB_NET_NET1080 is not set
# CONFIG_USB_NET_CDC_SUBSET is not set
# CONFIG_USB_NET_ZAURUS is not set
# CONFIG_WLAN is not set
CONFIG_INPUT_EVDEV=y
CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIO_AMBAKMI=y
CONFIG_VT_HW_CONSOLE_BINDING=y
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_XILINX_PS_UART=y
CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
CONFIG_SERIAL_MVEBU_UART=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MUX_GPIO=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_MUX_PINCTRL=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_I2C_MV64XXX=y
CONFIG_I2C_SLAVE=y
CONFIG_SPI=y
CONFIG_SPI_ARMADA_3700=y
CONFIG_SPI_NXP_FLEXSPI=y
CONFIG_SPI_PL022=y
CONFIG_SPI_MUX=y
CONFIG_SPI_SPIDEV=m
CONFIG_SPMI=y
CONFIG_PINCTRL_MICROCHIP_SGPIO=y
CONFIG_PINCTRL_OCELOT=y
CONFIG_GPIO_DWAPB=y
CONFIG_GPIO_PL061=y
CONFIG_GPIO_XGENE=y
CONFIG_GPIO_PCA953X=y
CONFIG_GPIO_PCA953X_IRQ=y
CONFIG_GPIO_MAX77620=y
CONFIG_POWER_RESET_GPIO_RESTART=y
CONFIG_POWER_RESET_XGENE=y
CONFIG_POWER_RESET_SYSCON=y
CONFIG_BATTERY_BQ27XXX=y
CONFIG_CHARGER_GPIO=y
CONFIG_SENSORS_SPARX5=y
CONFIG_SENSORS_JC42=y
CONFIG_SENSORS_LM90=m
CONFIG_SENSORS_INA2XX=m
CONFIG_CPU_THERMAL=y
CONFIG_THERMAL_EMULATION=y
CONFIG_ARMADA_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_SYSFS=y
CONFIG_SOFT_WATCHDOG=y
CONFIG_ARMADA_37XX_WATCHDOG=y
CONFIG_I6300ESB_WDT=y
CONFIG_MFD_MAX77620=y
CONFIG_MFD_SEC_CORE=y
CONFIG_MFD_ROHM_BD718XX=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_BD718XX=y
CONFIG_REGULATOR_GPIO=y
CONFIG_REGULATOR_MAX77620=y
CONFIG_REGULATOR_PCA9450=y
CONFIG_REGULATOR_QCOM_SPMI=y
CONFIG_REGULATOR_S2MPS11=y
# CONFIG_HID_GENERIC is not set
# CONFIG_HID_A4TECH is not set
# CONFIG_HID_APPLE is not set
# CONFIG_HID_BELKIN is not set
# CONFIG_HID_CHERRY is not set
# CONFIG_HID_CHICONY is not set
# CONFIG_HID_CYPRESS is not set
# CONFIG_HID_EZKEY is not set
# CONFIG_HID_KENSINGTON is not set
# CONFIG_HID_LOGITECH is not set
# CONFIG_HID_MICROSOFT is not set
# CONFIG_HID_MONTEREY is not set
CONFIG_USB=y
CONFIG_USB_OTG=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_MVEBU=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC2=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_ISP1760=y
CONFIG_USB_HSIC_USB3503=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_ULPI=y
CONFIG_USB_GADGET=y
CONFIG_USB_SNP_UDC_PLAT=y
CONFIG_TYPEC=y
CONFIG_TYPEC_TCPM=y
CONFIG_TYPEC_TCPCI=y
CONFIG_TYPEC_RT1711H=y
CONFIG_MMC=y
CONFIG_MMC_BLOCK_MINORS=32
CONFIG_MMC_ARMMMCI=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_OF_SPARX5=y
CONFIG_MMC_SPI=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_SDHCI_XENON=y
CONFIG_SCSI_UFSHCD=y
CONFIG_SCSI_UFSHCD_PLATFORM=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_SYSCON=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_CPU=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_MAX77686=y
CONFIG_RTC_DRV_PCF8523=y
CONFIG_RTC_DRV_S5M=y
CONFIG_RTC_DRV_DS3232=y
CONFIG_RTC_DRV_EFI=y
CONFIG_RTC_DRV_PL031=y
CONFIG_RTC_DRV_ARMADA38X=y
CONFIG_DMADEVICES=y
CONFIG_MV_XOR=y
CONFIG_MV_XOR_V2=y
CONFIG_PL330_DMA=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
# CONFIG_SURFACE_PLATFORMS is not set
CONFIG_COMMON_CLK_CS2000_CP=y
CONFIG_COMMON_CLK_S2MPS11=y
CONFIG_COMMON_CLK_XGENE=y
CONFIG_COMMON_CLK_BD718XX=y
CONFIG_MAILBOX=y
CONFIG_ARM_SMMU=y
CONFIG_ARM_SMMU_V3=y
CONFIG_EXTCON_USB_GPIO=y
CONFIG_IIO=y
CONFIG_TI_ADC081C=y
CONFIG_PWM=y
CONFIG_PHY_XGENE=y
CONFIG_PHY_MVEBU_CP110_COMPHY=y
CONFIG_PHY_SAMSUNG_USB2=y
CONFIG_MUX_MMIO=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_QUOTA=y
CONFIG_AUTOFS4_FS=y
CONFIG_FUSE_FS=y
CONFIG_VIRTIO_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
CONFIG_9P_FS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_SECURITY=y
CONFIG_CRYPTO_CCM=m
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_ANSI_CPRNG=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=0
CONFIG_IRQ_POLL=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_DEBUG_PREEMPT is not set
# CONFIG_RCU_TRACE is not set
CONFIG_FUNCTION_TRACER=y
# CONFIG_STRICT_DEVMEM is not set
CONFIG_MEMTEST=y
@@ -0,0 +1,3 @@
label Infix (aarch64)
kernel /boot/Image
append ${bootargs_root} ${bootargs_rauc} ${bootargs_log}
+21
View File
@@ -0,0 +1,21 @@
[system]
compatible=infix-aarch64
bootloader=uboot
statusfile=/var/lib/rauc/status
mountprefix=/var/lib/rauc/mnt
bundle-formats=-plain
[keyring]
directory=/etc/rauc/keys
[slot.rootfs.0]
device=/dev/disk/by-partlabel/primary
bootname=primary
[slot.rootfs.1]
device=/dev/disk/by-partlabel/secondary
bootname=secondary
[slot.net.0]
device=/dev/ram
bootname=net
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
. "$BR2_CONFIG"
# Prevent regen of host key at every boot, /etc is saved across reboots
if [ -L "$TARGET_DIR/etc/dropbear" ]; then
rm "$TARGET_DIR/etc/dropbear"
mkdir "$TARGET_DIR/etc/dropbear"
fi
+690
View File
@@ -0,0 +1,690 @@
#!/bin/sh
# COLUMS and ROWS should be set on the console, if not, use fallback
if [ -z "$COLUMNS" ]; then
if command -v tput; then
COLUMNS=$(tput cols)
else
COLUMNS=80
fi
fi
h1()
{
STR="$*"
if [ -n "$plain" ]; then
echo "$STR" | tr '[:lower:]' '[:upper:]'
echo "$STR" | sed 's/./=/g'
else
printf "\033[7m%-${COLUMNS}s\033[0m" "$STR"
fi
}
h2()
{
STR="$*"
if [ -n "$plain" ]; then
echo "$STR"
echo "$STR" | sed 's/./-/g'
else
printf "\033[1m%-${COLUMNS}s\033[0m" "$STR"
fi
}
ul()
{
if [ -n "$plain" ]; then
echo "__${*}__"
else
printf "\033[54%s\033[0m" "$*"
fi
}
em()
{
if [ -n "$plain" ]; then
echo "**${*}**"
else
printf "\033[5m%s\033[0m" "$*"
fi
}
overview()
{
cat <<EOF
$(h1 "Help System Press 'Q' to quit | Arrow keys and PgUp/PgDn to scroll")
$(h2 "See Also")
help edit Tutorial on VI and Mg editors
help net Network set up introduction
setup User friendly setup and diagnostic tool
$(h2 "General Syntax")
cmd [optional arg] E.g., use 'date -h' to get help for date command
$(h2 "File system")
pwd | ls | cd Show directory, contents, or change directory
cat file Show file contents
vi | mg [file] Edit file with the VI or Micro Emacs editor
$(h2 "Services")
initctl list Lists all configurable services (svc's)
initctl enable svc Enable a service 'svc'
initctl reload Reload init process' state, start/stop svc's
initctl start svc Start a stopped service 'svc'
initctl stop svc Stop 'svc'
initctl restart svc Restart a running 'svc'
initctl status [svc] Display running status of all services, or one 'svc'
$(h2 "Tools")
setup User friendly setup and diagnostic tool
date [-h] Display current time, or sets the system date
factory Factory reset the device (on the next boot)
hwclock [-h] Query or set the hardware clock (RTC)
logout | Ctrl-D Log out from TTY
mdio | mvls Low-level MDIO access, also for Marvell switch status
tail -F file Continuously read from a file Useful for monitoring the
health of services, see 'ls /var/log/' for log files
less [file] Pagers provding easily scrollable content (q quits) >
more [file] > e.g., 'cat very-long-file | less'
most [file] > e.g., 'cat very-long-file | most'
passwd Change user password
pwgen Password generator
reboot Restart the device
reset Reset the shell prompt if it gets garbled
$(h2 "Network Tools")
ethtool [-h] Ethernet stats, and low-level MAC/PHY settings
traceroute [-h] Trace the route ip packets follow going to a host
tcpdump [-h] Display network packet headers in real-time
arping [-h] Ping hosts by ARP requests/replies
fping [-h] Send ICMP ECHO_REQUEST packets to multiple hosts
ping [-h] Send ICMP ECHO_REQUEST packets to a network host
lynx URL [-h] The text mode web browser
netcalc [-h] Calculate IP network settings from a IP address
netcat [-h] NetCat - TCP/IP swiss army knife (alias: nc)
socat [-h] Multipurpose socket relay program
ttyd [-h] Sharing a terminal over the web
ifconfig [--help] See/Reconfigure available network interfaces
route [--help] Edit the kernel's routing tables
ifup | ifdown IFACE Bring up/down interfaces in /etc/network/interfaces
ip [link|addr] Manage available network interfaces
ip [rule|route] Manage routing tables
bridge [link|vlan] Manage bridge ports and VLANs
scp Securely copy a file to a remote host file system
tftp Copy a file to/from a remote host
ftpput Store a local file on a remote machine via FTP
ftpget Retrieve a remote file via FTP
wget Get a file using HTTP or FTP from a remote host
$(h2 "Overview Commands")
df -h List disk usage (in human readable format)
free List memory usage
ps List running processes
show [arg] Show system status, see 'show help' for more info
top Displays CPU usage and top list of running tasks
$(h2 "Interesting Files")
/etc/default/svc Command line args for service 'svc' (see above)
/etc/rc.local Local setup, runs after all services have started
/etc/network/ Directory of networking setup, see 'help net'
$(h2 "Example Commands")
cd /tmp; wget ftp://192.168.55.43/file && cat file
cd /var/log; tftp -p -l messages 192.168.55.43
cat /proc/net/arp
edit /etc/network/interfaces
$(h2 "See Also")
help edit Tutorial on VI and Mg editors
help net Network set up introduction
setup User friendly setup and diagnostic tool
EOF
}
vi()
{
cat <<EOF
$(h1 "Visual Editor (vi)")
Vi is the de facto standard editor in UNIX systems. It comes with two modes:
- $(em "Command mode (default):") administrative tasks such as saving files,
executing commands, moving the cursor, cutting and pasting lines or words,
as well as finding and replacing. $(em "Return to command mode with Esc")
- $(em "Insert mode:") Everything that's typed in this mode is interpreted as
input and placed in the file.
$(h2 "Navigation commands")
h - move the cursor one character to the left
j - move the cursor down one character
k - mode the cursor up one character
l - move the cursor right one character
b - move to beginning of word, or previous word
w - move to next word
0 - move to beginning of line
$ - move to end of line
:0 - move to beginning of file
G - move to end of file
$(h2 "Editing commands")
u - undo last operation
x - delete the character the cursor is on
cw - change word, from position of cursor
dw - delete to end of word
dd - delete the line the character is on
p - paste (line, word, or char) after cursor
P - paste (line, word, or char) before cursor
$(h2 "Saving and quit commands")
:w - save the current file
:w filename - save a copy of the file named filename
:w! - try to save the file, even if it is read only
:wq - save and quit vi
ZZ - save and quit vi
:wq! - try to save the file if it is read only, quit if successful
:wq filename - save a copy of the file named filename and quit
:wq! filename - save a copy of the file named filename and quit,
override read only permissions if possible
:q - quit vi
:q! - quit vi even if the file has unsaved changes
$(h2 "Enter insert mode")
a - append new text after the cursor
i - insert text before the cursor
o - open a new line below the cursor
O - open a new line above the cursor
> Return to command mode with Esc
EOF
}
emacs()
{
cat <<EOF
$(h1 "Micro Emacs (mg)")
Mg is a bit more user-friendly than vi. It has the same familiar interface
as Notepad, but with slightly different keybindings.
$(h2 "Introduction")
Most commands involve using the Control ("Ctrl") or the Meta ("Alt") key.
The following conventions are used in the online help:
C-<chr> means hold down the Control key while typing the character <chr>
M-<chr> means hold down the Alt key while typing the character <chr>
If you don't have a Meta/Alt key, you can use Esc instead. Press and release
the Esc key and then type <chr>. This is equivalent to M-<chr>.
$(h2 "Navigation")
Though arrow keys, Home/End, and PgUp/PgDn usually work, using Mg over serial
console can sometimes cause these keys to be mismapped by terminal program.
C-f Move forward one character (can also use right arrow key)
C-b Move backward one character (can also use left arrow key)
C-p Move up one line (can also use up arrow key)
C-n Move down one line (can also use down arrow key)
M-f Move forward one word
M-b Move backward one word
C-a Move to beginning of line (can also use Home key)
C-e Move to end of line (can also use End key)
C-v Move forward one page (can also use PgDn/Page Down key)
M-v Move backward one page (can also use PgUp/Page Up key)
M-< Move to beginning of file
M-> Move to end of file
C-x g Move to line number
$(h2 "Editing")
All edit commands that kill (cut) text is placed in a kill ring (clipboard).
Note: when marking text, there is no visual mark.
C-_ Undo, also C-x u
M-% Replace word/string in file, from cursor position
M-q Reformat paragraph (set fill column with C-x f)
C-s Search forward (type C-s again to find next)
C-r Reversed search
C-Space Set beginning of mark (beginning of selected text)
C-x C-x Jump back and forth between mark and cursor position
C-x h Mark whole buffer
C-w Wipe (cut) region from mark to cursor position
M-w Copy region from mark to cursor position
C-y Yank (paste) text from kill ring
C-k Kill (cut) to end of line
M-Backspace Kill (delete) previous word
M-d Kill (delete) next word
C-d Delete character to the right
C-o Open new line at cursor
$(h2 "General Commands")
C-g Abort current command
C-l Recenter buffer on current line
C-h b List all keybindings
M-! Run shell command, output in new buffer
C-z Suspend Mg, return to shell, use 'fg' to get back
C-x C-f Open file
C-x C-i Insert file at cursor position
C-x C-s Save file
C-x s Save file (interactive)
C-x k Kill (close) file
C-x C-b List open buffers (files)
C-x b Switch to another buffer
C-x C-c Exit
$(h2 "Window Commands")
C-x 0 Unsplit, keep other window
C-x 1 Unsplit, keep this window
C-x 2 Split window in two
C-x o Go to other window
C-x p Go to previous window
C-x n Go to next window
C-x ^ Enlarge this split
EOF
}
editor()
{
case $1 in
vi)
vi
;;
ed* | em* | mg)
emacs
;;
*)
vi
emacs
cat <<EOF
$(h1 "Summary")
Use Mg or GNU Nano if you are a beginner. The system is set up to so you can
use the 'edit' command, which will start GNU Nano:
edit /etc/rc.local # Starts GNU Nano
EOF
;;
esac
}
networking()
{
cat <<EOF
$(h1 "Networking")
This section details how to set up everything from basic to advanced networking.
Topics covered include:
- Static vs Dynamic Addresses
- VLAN Interfaces
- Bridging Interfaces
- Link Aggregation (bonding)
- Persistent Configuration
Please note, the terms 'port' and 'interface' may be used interchangably in
the following text (and elsewher online as well). Usually the term 'port' is
reserved for Ethernet links attached to a switch or bridge, while the term
'interface' more generically refers to the physical interface in a system.
$(h2 "Static vs Dynamic Addresses")
An IPv4 address consists of four "octets" separated by periods. A static IPv4
address can look like this:
192.168.1.42
However, for networking to function properly, a device usually needs a netmask,
default route, NTP server, and at least one DNS address. Setting all these up
statically is a lot of work to maintain, in particular with many devices.
For both IPv4 and IPv6 there is an alternative called DHCP. It is a dynamic
protocol where a server on request from a client device hands out a "lease" of
an IP address, as well as lot of other network parameters, including but not
limited to the ones already mentioned. A client device can give hints to the
server, e.g., its hostname, MAC address (default), or other client identifier.
It is up to the server to honor these hints or not, but it is very common to
set up the server to honor the client's hostname and automatically update the
central name server (DNS) when the client is online.
| There are many other interesting aspects to DHCP not covered here.
| For instance, DHCP relay servers (proxies), that can be used to
| forward DHCP requests from very large networks to a central server.
| Some relay "agents" even support something called Option 82, which
| when running on a simple switch, can attach port and relay info to
| the client's DHCP request -- allowing the server to assign an IP
| address per port, even on remote switches (with a relay agent).
When your interface is setup with DHCP, use the 'ifconfig' or 'ip addr' tools
to see which address you got, if needed (see next section).
In cases when the DHCP client cannot find a DHCP server, and thus not obtain a
lesae, the system falls back to set a link-local address (169.254.*.*). This
can be disabled by editing the file /etc/dhcpcd.conf, adding:
noipv4ll
A link-local address is however very useful, in particular in combination with
mDNS to discover and access a device you do not know, or do not want to know,
the IP address to. See more in the next section.
$(h2 "DNS and mDNS")
Managing a central DNS is both painful and time consuming, most networks, and
in particular industrial, therefore only set up a DNS for static servers and
resources. Leaving end devices, switches, and in many cases even routers,
without a human-friendly name on the network. This have misled many to think
that they need to know the IP address, and often opt for static addresses on
equipment. Meaning many devices out-of-the-box have a static address set that
need to be manually changed before the device is deployed on the network.
A less time consuming, and human-friendly, way is to enable mDNS (multicast
DNS). With this protocol the device notifies all neighbors on the same LAN
of how to reach it:
"Hello everyone, my address is 169.254.47.11, you can call me device.local"
Any other device that also has mDNS enabled can then automaticall update a
local database of name-to-address mappings. Usually the name sent out is
the device's hostname. (It is up to the device manufacturer to set a useful
default hostname, i.e., model-01-02-03, where the suffix is the last octets
of the base MAC address, from the product label on the case.)
As you can see, in combination with a link-local address (previous section)
mDNS is a very attractive combination that greatly simplify device management.
Tools:
avahi-browse -a
ping foo.local
mDNS, or more correctly mDNS-SD, is also used for *Service Discovery*. E.g.,
a printer can publish IPP records with meta data on the printer type and model
or donwload URL for drivers. Switches and routers usually publish how they
can be reached: HTTP/HTTPS and SSH.
Note: there are other mechanisms for device discovery. Microsoft have been
slow to adopt mDNS, having relied on their own SSDP protocol. For the
full experince Apple's "Bonjour" can be installed in Windows.
mDNS is supported in this product and should be enabled by default. To
verify it works, open the Windows File Explorer (Win+E) and scroll to
Network in the left-hand menu. An icon with a matching hostname can be
found there which, when clicked, opens up the device's Web Interface.
macOS users have mDNS fully integrated by default. Linux users can use
'mdns-scan' or Avahi, as shown above. The latter two can also just set
their web browsers to https://hostname-01-02-03.local
$(h2 "VLAN Interfaces")
A VLAN interface in Linux is an "upper" interface, e.g., 'eth0.1'. It is
where you set an IP address and interact with th rest of the world. The
base/raw/lower interface, here 'eth0', is the physical interface on which
Ethernet packets ingress and egress with a VLAN tag. To create 'eth0.1':
ip link add eth0.1 link eth0 vlan id 1
In Linux a VLAN interface is a "stackable" entity. Many VLAN interfaces
can be built on top of each other. When injecting a packet on the top
most interface, the kernel adds the corresponding VLAN "tag" when the
packet goes down the order of stacked interfaces, and then finally hits
the physical interface and proceeds to egress onto the media.
ip link add eth0.1.2 link eth0.1 vlan id 2
Injecting a packet on 'eth0.1.2' creates a double-tagged VLAN frame when
the packet egresses 'eth0'. The outermost tag has VID 1 and the inner
VID is 2.
VLAN interfaces can be used for many things, here we will focus on their
use as upper interface on a bridge.
$(h2 "Bridging Interfaces")
A bridge is the correct name for a switch. In the context of this text,
however, we will use the term to refer to the Linux bridge module in the
kernel, which implements an advanced software switch. The Linux bridge
supports "offloading" many switching functions to an underlying switching
chipset, when available. This greatly simplifies managing that switch since
the same tools one use to manage the bridge will, by extension, also be used
to manage the switch.
To create a bridge in Linux:
ip link add br0 type bridge
To add three ports (interfaces) to the bridge we use:
ip link set eth0 master br0
ip link set eth1 master br0
ip link set eth2 master br0
Bring all ports and the bridge 'up' and you have a working switch! Any frame
injected on eth0 (from the outside) can be switched to either of eth1, eth2,
*or* br0. As soon as the bridge has learned where end devices are connected,
none of the other ports will see the traffic -- like a regular switch.
Note: these ports should not (cannot) have any IP address. Instead, any IP
address is set on 'br0'. To disable IPv6 link-local address, set the
/proc/sys/net/ipv6/conf/eth0/disable_ipv6 sysctl file to '1'.
$(h2 "Bridging and VLANs")
A VLAN-aware bridge works the same way, only with VLAN separation taken into
account. All communication, as well as MAC address learning, is limited to
ports in the same VLAN. The syntax is slightly different and requires a few
more steps:
ip link add br0 type bridge vlan_filtering 1
ip link set eth0 master br0
ip link set eth1 master br0
ip link set eth2 master br0
ip link set eth3 master br0
To assign ports to different VLANs, and make sure they are regular "access"
ports (untagged). We assign eth0 and eth1 to VLAN 1 and the others to VLAN 2:
bridge vlan add vid 1 dev eth0 pvid untagged
bridge vlan add vid 1 dev eth1 pvid untagged
bridge vlan add vid 2 dev eth2 pvid untagged
bridge vlan add vid 2 dev eth3 pvid untagged
Here's the twist, to be able to reach the bridge (switch) itself from each
VLAN, we need to ensure the bridge itself is a tagged member of each VLAN:
bridge vlan add vid 1 dev br0 self
bridge vlan add vid 2 dev br0 self
This way we can add VLAN interfaces on top of br0, which we in turn can set
a static or dynamic IP address on:
ip link add vlan1 link br0 type vlan id 1
ip link add vlan2 link br0 type vlan id 2
The resulting stack of interfaces look like this:
:
vlan1 : vlan2 Layer-3 :: IP Networking
\\ : / _________________________
.-------------.
| br0 | Layer-2 :: Switching
'-------------' _________________________
/ | : | \\
eth0 eth1 : eth2 eth3 Layer-1 :: Link layer
:
$(h2 "Persistent Configuration")
A simple end device can get by with the following in /etc/network/interfaces:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
This brings up both the loopback (required for UNIX networking to function),
and the (presumed only) Ethernet interface. The loopback gets its standard
address, 127.0.0.1, and eth0 will request its IP address using DHCP.
To set up the bridge example (above), is actually quite a lot easier than
using the command line ip and bridge tools. Create the file 'bridge':
edit /etc/network/interfaces.d/bridge
Paste in the following content:
iface e0
bridge-access 1
iface e1
bridge-access 1
iface e2
bridge-access 2
iface e3
bridge-access 2
auto br0
iface br0
bridge-ports e0 e1 e2 e3
bridge-vlan-aware yes
bridge-stp on
bridge-vids 1 2
auto vlan1
iface vlan1 inet dhcp
vlan-id 1
vlan-raw-device br0
auto vlan2
iface vlan2 inet static
vlan-id 2
vlan-raw-device br0
address 192.168.2.1/24
Notice how 'vlan1' only has a DHCP and 'vlan2' uses a static address. It is
possible to combine the two if needed. Use 'inet dhcp' and add an 'address'
statement to the iface stanza.
$(h2 "Port Classification")
The bundled 'show' script is a very handy tool. It use several tricks to make
information about the system more accessible. On switching capable hardware
products, switch ports are identified early at system bootstrap and placed in
the 'port' group. See 'ip link' output:
...
4: e0: <BROADCAST,MULTICAST> master br0 state UP $(em "group port")
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
...
When running in Qemu or other hardware it may be useful to manually classify
certain interfaces as ports. This can be achieved in many ways, here we show
two. First /etc/mactab, which is read at boot to rename interfaces according
their matching MAC address, one interface per line:
e0 52:54:00:12:34:56
e1 52:54:00:12:34:57
e2 52:54:00:12:34:58
e3 52:54:00:12:34:59
Another way is to add something like this to /etc/rc.local:
for port in eth0 eth1 eth3 eth4; do
ip link set \$port group port
done
$(h2 "Interesting Files")
- /etc/dhcpcd.conf General DHCP and ZeroConf (LL) settings
- /etc/network/interfaces The original, useful for small setups
- /etc/network/interfaces.d/* Snippets, useful for non-trivial setups
- /etc/mactab Rename interfaces: 'NAME16CHARS WHITESPACE MAC'
- /etc/sysctl.conf Interface and TCP/IP settings, e.g., routing
- /etc/sysctl.d/* Snippets, useful for per-subsystem settings
$(h1 "Summary")
All persistent networking is set up in /etc/network/interfaces using the
program ifupdown-ng. The tools to reconfigure networking at runtime are:
ifup [-a] [IFACES]
ifdown [-a] [IFACES]
When changing the configuration at runtime you usually have to bring the
affected interfaces down (ifdown e0 e1 e2 e3), if they were set up with
/etc/network/interfaces before. Then do the change, and bring it all up
again.
Both tools understand dependencies between interfaces, so when a 'ifup -a'
command is received it brings up all interfaces: adding links to br0 before
adding VLANs, the vlan1 and vlan2 interfaces on top so it of it all. Then
finally it can start the DHCP client on vlan1 and set the static IP address
on vlan2.
$(em ">>> Be careful with these tools when logged in remotely! <<<")
EOF
}
topic()
{
topic=$1
[ -n "$1" ] && shift
case $topic in
ed*)
# shellcheck disable=SC2068
editor $*
;;
net*)
networking
;;
*)
overview
;;
esac
}
if [ "$1" = "-p" ]; then
shift
pager="cat"
plain="yes"
else
if command -v most; then
pager=most
elif command -v less; then
pager="less -R"
elif command -v more; then
pager="more"
else
pager="cat"
fi
fi
if [ -t 1 ] ; then
fn=$(mktemp /tmp/system-help.XXXXXX)
# shellcheck disable=SC2086,SC2068
topic $@ >"$fn"
$pager "$fn"
rm "$fn"
else
topic "$*"
fi
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Changes hostname in /etc/hostname and /etc/hosts
current=$(cat /etc/hostname)
newname=$1
[ -n "$newname" ] || exit 1
sed -i "s/$current/$newname/" /etc/hosts
sed -i "s/$current/$newname/" /etc/hostname
hostname $newname
initctl touch sysklogd
initctl touch dnsmasq
initctl reload
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
pdmenu
clear
+327
View File
@@ -0,0 +1,327 @@
#!/bin/sh
# Displays basic information about the system
# shellcheck disable=SC2048,SC2086
. /etc/os-release
bopt="-c"
opt="-br"
all=""
plain=""
TTY=$(resize)
eval "$TTY"
# COLUMS and ROWS should be set on the console, if not, use fallback
if [ -z "$COLUMNS" ]; then
if command -v tput; then
COLUMNS=$(tput cols)
else
COLUMNS=80
fi
fi
h1()
{
STR="$*"
if [ -n "$plain" ]; then
echo "$STR" | tr '[:lower:]' '[:upper:]'
else
printf "\033[7m%-${COLUMNS}s\033[0m\n" "$STR"
fi
}
h2()
{
STR="$*"
if [ -n "$plain" ]; then
echo "$STR"
echo "$STR" | sed 's/./-/g'
else
printf "\033[1m%-${COLUMNS}s\033[0m\n" "$STR"
fi
}
dm()
{
if [ -n "$plain" ]; then
echo "${*}"
else
printf "\033[2m%s\033[0m\n" "$*"
fi
}
ul()
{
if [ -n "$plain" ]; then
printf "__%s__" "$*"
else
printf "\033[4%s\033[0m" "$*"
fi
}
em()
{
if [ -n "$plain" ]; then
printf "**%s**" "$*"
else
printf "\033[5m%s\033[0m" "$*"
fi
}
usage()
{
cat <<EOF
usage:
show [opt] cmd
options:
-a Show all, of something
-f Show full output, not brief port/iface listings
-h Show this help text
-n Show output without any footer
-p Show plain output, no bells or whistles
commands:
port PORT Show port configuration and link information
ports Show ports available for bridging
vlans Show port groups in bridge
ifaces Show interfaces and their addresses
fdb Show forwarding database (unicast)
mdb Show multicast forwarding database
ip route Show routing table
log [FILE] Show latest entries from syslog, or other FILE
rmon PORT Show RMON counters for PORT (when applicable)
system Show OS details
version Show OS verson
EOF
}
# Usage 1: show port eth0
# Usage 2: show port
# Usage 3: show ports
#
# The first show ethtool output for 'eth0' (in this case). The latter
# two are the same, showing a summary of all interfaces classified as
# access ports.
ports()
{
if [ $# -gt 0 ] && [ -e "/sys/class/net/$1" ]; then
for port in $*; do
ethtool "$port"
done
return
fi
h1 "PORT STATE MAC ADDRESS FLAGS"
if grep -q port /etc/iproute2/group && [ -z "$all" ]; then
ip $opt link show group port
else
ip $opt link show
fi
if [ -z "$plain" ] && [ -z "$nofoot" ]; then
dm "______________________________________________________________________________"
dm "Use: '[ip|bridge] --help' and '[ip|bridge] link help' for more details."
fi
}
vlans()
{
h1 "INTERFACE VLAN FLAGS"
bridge $bopt vlan show |tail +2 | awk 'NF { iface=$1; vid=$2; printf("%-16s %4d ", iface, vid); for (i=3; i <= NF; i++) printf("%s ", $i); printf("\n"); }'
if [ -z "$plain" ] && [ -z "$nofoot" ]; then
dm "______________________________________________________________________________"
dm "See: 'bridge --help' and 'bridge vlan help' for more details."
fi
}
ifaces()
{
h1 "INTERFACE STATE ADDRESS"
if [ -n "$all" ]; then
ip $opt addr show
elif grep -q iface /etc/iproute2/group; then
ip $opt addr show group iface
else
ip $opt addr show |awk '{ if ($1 !~ /eth[0-9]*/ && $1 !~ /.*@NONE/) { print }}'
fi
if [ -z "$plain" ] && [ -z "$nofoot" ]; then
dm "______________________________________________________________________________"
dm "See: 'ip --help' and 'ip address help' for more details."
fi
}
log()
{
if [ -n "$1" ] && [ -r "/var/log/$1" ]; then
fn="/var/log/$1"
else
fn="/var/log/syslog"
fi
if [ -n "$all" ]; then
cat $fn
else
tail -$LINES $fn
fi
if [ -z "$plain" ] && [ -z "$nofoot" ]; then
dm "______________________________________________________________________________"
dm "See: 'tail -25 /log/FILE', 'tail -F /log/FILE' to continuously monitor files."
fi
}
rmon()
{
if [ -z "$*" ]; then
echo "Missing argument, see 'show port' for available interfaces"
exit 1
fi
for port in $*; do
ethtool -S "$port"
done
if [ -z "$plain" ] && [ -z "$nofoot" ]; then
dm "______________________________________________________________________________"
dm "See: 'ethtool --help' for more details."
fi
}
rstp()
{
mstpctl showbridge
echo "br0 port info"
mstpctl showport br0
}
fdb()
{
bridge $bopt fdb show
}
mdb()
{
bridge $bopt mdb show
}
routes()
{
ip $opt route show
}
igmp()
{
querierctl $@
}
system()
{
h1 "SYSTEM INFORMATION"
echo "System Name : $(uname -n)"
echo "System Variant : $VARIANT"
echo "System Description : $PRETTY_NAME"
echo "System Contact : $HOME_URL"
echo "System Timezone : $(cat /etc/timezone)"
echo "System Type : $NAME"
echo "System Version : $(cat /etc/version)"
echo "System Arch : $(uname -m)"
echo "Kernel Version : $(uname -sr)"
}
version()
{
cat /etc/version
}
while [ "$1" != "" ]; do
case $1 in
-a)
all=1
;;
-f)
opt=""
if [ -n "$plain" ]; then
opt="-color=never"
bopt="-color=never"
fi
;;
-n)
nofoot="yes"
;;
-p)
plain="yes"
opt="$opt -color=never"
bopt="$bopt -color=never"
;;
-h)
usage
exit 0
;;
*)
break
esac
shift
done
cmd=$1
if [ -n "$cmd" ]; then
shift
fi
case $cmd in
help)
usage
;;
port*)
ports $*
;;
vlan*)
vlans
;;
fdb)
fdb
;;
mdb)
mdb
;;
if*)
ifaces
;;
ip)
cmd=$1
shift
case $cmd in
addr*)
ifaces
;;
route*)
routes
;;
igmp*)
igmp $*
;;
*)
usage
;;
esac
;;
log)
log $1
;;
rmon)
rmon $*
;;
route*)
routes
;;
span*)
rstp
;;
sys*)
system
;;
ver*)
version
;;
*)
usage
exit 1
;;
esac
+55
View File
@@ -0,0 +1,55 @@
#!/bin/sh
#set -x
usage()
{
cat <<EOF
usage:
yorn [-h] ["Do you want to run command?" command]
options:
-h Show this help text
-p Show plain output, no bells or whistles
Displays the yes-or-no question and runs command on yes.
EOF
}
if [ -z "$1" ]; then
usage
exit 1
fi
case $1 in
-h)
usage
exit 0
;;
-p)
plain=1
shift
;;
*)
;;
esac
question=$1
shift
command=$*
if [ -z "$command" ]; then
usage
exit 1
fi
if [ -z "$plain" ]; then
if dialog --erase-on-exit --colors --defaultno --yesno "\Zb$question\ZB" 0 0; then
yorn=y
fi
else
# shellcheck disable=SC2162,SC3045
read -n 1 -p "$question (y/N): " yorn
fi
if [ "$yorn" = "y" ] || [ "$yorn" = "Y" ]; then
$command
fi
+51
View File
@@ -0,0 +1,51 @@
# Infix's configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
#hostname
# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid
# Persist interface configuration when dhcpcd exits.
persistent
# vendorclassid is set to blank to avoid sending the default of
# dhcpcd-<version>:<os>:<machine>:<platform>
vendorclassid
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# Request a hostname from the network
option host_name
# Most distributions have NTP support.
#option ntp_servers
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
# Background immediately, do not wait for DHCP lease (speed up boot process)
background
+144
View File
@@ -0,0 +1,144 @@
#
# Run-time configuration file for dialog
#
# Automatically generated by "dialog --create-rc <file>"
#
#
# Types of values:
#
# Number - <number>
# String - "string"
# Boolean - <ON|OFF>
# Attribute - (foreground,background,highlight?,underline?,reverse?)
# Set aspect-ration.
aspect = 0
# Set separator (for multiple widgets output).
separate_widget = ""
# Set tab-length (for textbox tab-conversion).
tab_len = 0
# Make tab-traversal for checklist, etc., include the list.
visit_items = OFF
# Shadow dialog boxes? This also turns on color.
use_shadow = ON
# Turn color support ON or OFF
use_colors = ON
# Screen color
screen_color = (WHITE,BLUE,OFF)
# Shadow color
shadow_color = (BLACK,BLACK,OFF)
# Dialog box color
dialog_color = (BLACK,CYAN,OFF)
# Dialog box title color
title_color = (BLACK,CYAN,ON)
# Dialog box border color
border_color = dialog_color
# Active button color
button_active_color = (CYAN,BLACK,ON)
# Inactive button color
button_inactive_color = dialog_color
# Active button key color
button_key_active_color = (WHITE,BLACK,ON)
# Inactive button key color
button_key_inactive_color = (WHITE,CYAN,ON)
# Active button label color
button_label_active_color = button_active_color
# Inactive button label color
button_label_inactive_color = dialog_color
# Input box color
inputbox_color = (BLACK,CYAN,OFF)
# Input box border color
inputbox_border_color = inputbox_color
# Search box color
searchbox_color = inputbox_color
# Search box title color
searchbox_title_color = (BLUE,WHITE,ON)
# Search box border color
searchbox_border_color = (WHITE,WHITE,ON)
# File position indicator color
position_indicator_color = searchbox_title_color
# Menu box color
menubox_color = dialog_color
# Menu box border color
menubox_border_color = dialog_color
# Item color
item_color = inputbox_color
# Selected item color
item_selected_color = button_key_active_color
# Tag color
tag_color = button_inactive_color
# Selected tag color
tag_selected_color = (CYAN,BLACK,OFF)
# Tag key color
tag_key_color = button_key_inactive_color
# Selected tag key color
tag_key_selected_color = (WHITE,BLACK,ON)
# Check box color
check_color = inputbox_color
# Selected check box color
check_selected_color = button_key_active_color
# Up arrow color
uarrow_color = (GREEN,WHITE,ON)
# Down arrow color
darrow_color = uarrow_color
# Item help-text color
itemhelp_color = (WHITE,BLACK,OFF)
# Active form text color
form_active_text_color = button_key_active_color
# Form text color
form_text_color = (WHITE,CYAN,ON)
# Readonly form item color
form_item_readonly_color = (CYAN,WHITE,ON)
# Dialog box gauge color
gauge_color = searchbox_title_color
# Dialog box border2 color
border2_color = dialog_color
# Input box border2 color
inputbox_border2_color = inputbox_color
# Search box border2 color
searchbox_border2_color = inputbox_color
# Menu box border2 color
menubox_border2_color = dialog_color
@@ -0,0 +1 @@
run [S] /lib/infix/swup --
+112
View File
@@ -0,0 +1,112 @@
# NetBox mdev.conf based on https://github.com/slashbeast/mdev-like-a-boss/
# Syntax:
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
#
# [-]: do not stop on this match, continue reading mdev.conf
# =: move, >: move and create a symlink
# !: do not create device node
# @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
# support module loading on hotplug
$MODALIAS=.* root:root 660 @modprobe -b "$MODALIAS"
# null may already exist; therefore ownership has to be changed with command
null root:root 666 @chmod 666 $MDEV
zero root:root 666
full root:root 666
random root:root 444
urandom root:root 444
hwrandom root:root 444
grsec root:root 660
# Kernel-based Virtual Machine.
#kvm root:kvm 660
# vhost-net, to be used with kvm.
#vhost-net root:kvm 660
kmem root:root 640
mem root:root 640
port root:root 640
# console may already exist; therefore ownership has to be changed with command
console root:tty 600 @chmod 600 $MDEV
ptmx root:tty 666
pty.* root:tty 660
# Typical devices
tty root:tty 666
tty[0-9]* root:tty 660
vcsa*[0-9]* root:tty 660
ttyS[0-9]* root:dialout 660
# block devices
ram([0-9]*) root:disk 660 >rd/%1
loop([0-9]+) root:disk 660 >loop/%1
sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
fd[0-9]* root:floppy 660
#SUBSYSTEM=block;.* root:disk 660 */lib/infix/storage-device
# Run settle-nics every time new NIC appear.
# If you don't want to auto-populate /etc/mactab with NICs,
# run 'settle-nis' without '--write-mactab' param.
#-SUBSYSTEM=net;DEVPATH=.*/net/.*;.* root:root 600 @/lib/infix/settle-nics --write-mactab
net/tun[0-9]* root:netdev 660
net/tap[0-9]* root:root 600
# alsa sound devices and audio stuff
#SUBSYSTEM=sound;.* root:audio 660 @/lib/infix/sound-control
adsp root:audio 660 >sound/
audio root:audio 660 >sound/
dsp root:audio 660 >sound/
mixer root:audio 660 >sound/
sequencer.* root:audio 660 >sound/
# raid controllers
cciss!(.*) root:disk 660 =cciss/%1
ida!(.*) root:disk 660 =ida/%1
rd!(.*) root:disk 660 =rd/%1
fuse root:root 666
card[0-9] root:video 660 =dri/
agpgart root:root 660 >misc/
psaux root:root 660 >misc/
rtc root:root 664 >misc/
# input stuff
SUBSYSTEM=input;.* root:plugdev 660
# v4l stuff
vbi[0-9] root:video 660 >v4l/
video[0-9] root:video 660 >v4l/
# dvb stuff
dvb.* root:video 660
# drm etc
dri/.* root:video 660
# Don't create old usbdev* devices.
usbdev[0-9].[0-9]* root:root 660 !
# Stop creating x:x:x:x which looks like /dev/dm-*
[0-9]+\:[0-9]+\:[0-9]+\:[0-9]+ root:root 660 !
# /dev/cpu support.
microcode root:root 600 =cpu/
cpu([0-9]+) root:root 600 =cpu/%1/cpuid
msr([0-9]+) root:root 600 =cpu/%1/msr
# Populate /dev/bus/usb.
#SUBSYSTEM=usb;DEVTYPE=usb_device;.* root:root 660 */lib/infix/dev-bus-usb
# Catch-all other devices, Right now useful only for debuging.
#.* root:root 660 */lib/infix/catch-all
+1
View File
@@ -0,0 +1 @@
Note: use help, show, and setup commands to set up and diagnose the system.
@@ -0,0 +1,6 @@
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
source-directory /etc/network/interfaces.d
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/pdmenu
title:Setup & Diagnostics
color:desktop:blue:blue
color:title:blue:white
color:base:blue:white
menu:main:Main Menu:Use arrow keys, Enter, Escape, and Q to navigate
show:_System Settings..::system
show:_Network Settings..::network
show:_Tools..::tools
nop
exec:Show _fdb:truncate:show -p fdb
exec:Show _mdb:truncate:show -p mdb
exec:Show _ports:truncate:show -p ports
exec:Show _vlans:truncate:show -p vlans
exec:Show _interfaces:truncate:show -p iface
exec:Show _routes:truncate:show -p route
nop
exec:Show _online users:truncate:w
exec:Show _CPU Load::top
nop
show:_Help..::help
exit:_Quit
menu:help:Help:Help Menu
exec:Introduction:truncate:/bin/help -p
exec:Editors:truncate:/bin/help -p edit
exec:Networking:truncate:/bin/help -p net
nop
exit:_Main menu..
menu:network:Network:Network Settings
exec:Show all _links:truncated:ip -br link
exec:Show all _addresses:truncated:ip -br address
exec:Show managed _interfaces:truncated:ifparse --all
nop
exec:Take _interface down:edit:ifdown ~Enter name of interface to take down:~
exec:Take _interface up:edit:ifup ~Enter name of interface to take up:~
nop
exec:Edit _dhcpcd.conf::edit /etc/dhcpcd.conf
exec:Edit _dnsmasq.conf::edit /etc/dnsmasq.conf
exec:Edit _interfaces::edit /etc/network/interfaces
exec:Edit _mactab::edit /etc/mactab
exec:Edit _sysctl.conf::edit /etc/sysctl.conf
nop
exit:_Main menu..
menu:system:System:System Settings
exec:List _log files:truncate:ls -l /var/log
exec:Show _log file:edit,truncate:show -p -a log ~Show logfile, Enter for syslog:syslog~
exec:Change _hostname:edit:hostnm ~Enter new hostname \[-a-zA-Z0-9\]:~
exec:Change your _password::passwd
exec:Edit _rc.local::edit /etc/rc.local
nop
exec:_Show State of Services:truncate:initctl -p
exec:_Reload services:truncate:initctl reload;sleep 2;initctl -p
exec:Show _available services:truncate:initctl -p ls
exec:_Enable service:edit:initctl enable ~Enter name of service (filename) to enable:~
exec:_Disable service:edit:initctl disable ~Enter name of service (filename) to disable:~
nop
exec:_Factory Reset::yorn "Factory reset device (reboots), are you sure?" factory -y
nop
exit:_Main menu..
menu:tools:Tools:Tools
exec:_Ping:edit,pause:ping ~Enter address (IP or name) to ping:~
exec:_Shell Prompt::/bin/bash --login
exec:_SSH:edit,pause:ssh ~Enter [username@]address (IP or name) to SSH to:~
exec:_Telnet:edit,pause:telnet ~Enter address (IP or name) to telnet to:~
exec:_Traceroute:edit,pause:mtr ~Enter address (IP or name) to traceroute to:~
exec:Browse _WWW:edit,pause:lynx ~Enter URL to browse:~
nop
exit:_Main menu..
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# This file is run at the very end of runlevel S (bootstrap)
#
# Note: 1) not all initctl commands are allowed here
# 2) to enable IP forwarding, use /etc/sysctl.conf, or /etc/sysctl.d/
# 3) ensure the script calls `exit 0` at the end
#
# Uncomment to classify all interfaces starting with 'eth' as ports.
#for port in $(ip -br link |awk '/eth/{print $1}'); do
# ip link set $port group port
#done
# Uncomment to enable IP masquerading (NAT) of all traffic egressing
# the WAN interface, here eth0. E.g., if you are a router for your
# LAN on eth1.
#iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
exit 0
+62
View File
@@ -0,0 +1,62 @@
#!/bin/sh
# Factory default:
# 1) all switch ports in VLAN 1 of br0
# 2) no switch ports => DHCP on eth0
# 3) no eth0
create_bridge()
{
nm=$1
shift
ports=$@
touch "/etc/network/interfaces.d/$nm"
for port in $ports; do
cat <<-EOF >>"/etc/network/interfaces.d/$nm"
iface $port
bridge-access 1
post-up ip link set $port group port
EOF
done
cat <<-EOF >> "/etc/network/interfaces.d/$nm"
auto $nm
iface $nm
bridge-ports $ports
bridge-vlan-aware yes
bridge-stp on
bridge-vids 1
auto vlan1
iface vlan1 inet dhcp
vlan-id 1
vlan-raw-device $nm
post-up ip link set vlan1 group iface
EOF
ip link set vlan1 group iface
}
# Check if already set up
[ -z "$(ls -A /etc/network/interfaces.d/)" ] || exit 0
# Check for custom hostname from Qemu/Qeneth
nm=$(cat /sys/firmware/qemu_fw_cfg/by_name/opt/hostname/raw)
if [ -n "$nm" ]; then
hostnm "$nm"
fi
# need to check for 'length > 0' because ip command
# outputs empty json objects for non-port group ifs
ports=$(ip -json link show group port | jq -r '.[].ifname | select(length > 0)' | tr "\n" " ")
if [ -n "$ports" ]; then
create_bridge br0 $ports
else
ifaces=$(ip -json addr show |jq -r '.[] | select(.link_type=="ether").ifname')
for iface in $ifaces; do
cat <<-EOF > "/etc/network/interfaces.d/$iface"
auto $iface
iface $iface inet dhcp
pre-up ip link set $iface group iface
EOF
done
fi
+90
View File
@@ -0,0 +1,90 @@
menuconfig SIGN_ENABLED
bool "Image Signing"
default y
choice
prompt "Signing key source"
depends on SIGN_ENABLED
default SIGN_SRC_DIR
config SIGN_SRC_DIR
bool "Directory"
config SIGN_SRC_PKCS11
bool "PKCS#11 URL"
endchoice
config SIGN_KEY
string "Signing key"
depends on SIGN_ENABLED
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/dev-key" if SIGN_SRC_DIR
menuconfig DISK_IMAGE
bool "Disk image"
help
Compose a full disk image with redundant firmware partitions,
configuration partition, etc.
This is useful when:
- Bringing up a blank system during manufacturing
- Creating a GNS3 appliance
- Developing/debugging issues in the boot process in QEMU
config DISK_IMAGE_SIZE
string "Image size"
depends on DISK_IMAGE
default "512M"
help
Create a disk image of this size. A K/M/G suffix may be used
to multiply by powers of 1024. Suffixes like KB/MB/GB may be
used to multiply by powers of 1000. The image will be split
proportionally to fit the two rootfs, a kernel, a writable
/cfg and /var partiotions.
Minimum supported size is 512M.
menuconfig GNS3_APPLIANCE
bool "GNS3 Appliance"
select DISK_IMAGE
default y if BR2_x86_64
help
Create a GNS3 appliance description that, together with the
disk image, can be imported into GNS3.
config GNS3_APPLIANCE_RAM
int "Reserved RAM (MiB)"
depends on GNS3_APPLIANCE
default "192"
help
Amount of host RAM reserved for an appliance instance.
Minimum supported size is 192M.
config GNS3_APPLIANCE_IFNUM
int "Number of interfaces"
depends on GNS3_APPLIANCE
default "1"
help
Number of Ethernet interfaces to create for an appliance instance.
menuconfig FIT_IMAGE
bool "Traditional FIT image"
help
Create a "regular" FIT image where the kernel and DTBs are
stored in the FIT rather than inside the rootfs (like it
normally is in Infix).
This is useful when trying out Infix on targets whose
bootloader might not be capable of booting a raw Squash, but
is able to handle an FIT.
config FIT_ARCH
string
depends on FIT_IMAGE
default "arm64" if BR2_aarch64
config FIT_KERNEL_LOAD_ADDR
string "Kernel load address"
depends on FIT_IMAGE
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
include $(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/uboot.mk
define RAUC_POST_BUILD_INSTALL_CERT
@$(call IXMSG,"Installing signing cert for RAUC")
mkdir -p $(TARGET_DIR)/etc/rauc/keys
$(foreach crt,$(shell ls $(SIGN_KEY)/*.crt), \
cp $(crt) $(TARGET_DIR)/etc/rauc/keys/$(shell openssl x509 -hash -noout <$(crt)).0;)
endef
RAUC_POST_BUILD_HOOKS += RAUC_POST_BUILD_INSTALL_CERT
+32
View File
@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFbTCCA1WgAwIBAgIUAW8J6lminthZoomqqt4Hmv1UcJEwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAgFw0yMzAyMjAxNDEyMDZaGA8yMTIz
MDEyNzE0MTIwNlowRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCAiIwDQYJKoZIhvcN
AQEBBQADggIPADCCAgoCggIBAL2RAAmRNp688DoFAQZaeHGMHTjsYSG4vdk38xuZ
iY2GBdzKQB7JfvGSAqzrn1BVN0AsYmc5ZZG6W10CecKrHU8EbBgdEfB4iRHmYbnS
nBAB6MTv1m4TDG9Ic0E7TEHFLNWi7u+TPIQGFlqeXdoE0jh6d7tFZJlkSzJaEPGW
O4IjhWV1Ow2+Erwaz6Vgm8t6PTgrPtJMo7+UTIlLkjhIp99OR+vQdSsEBimxg0uc
E3qvDMOvyBqshYQsJn8EX+L6X5g7cigk/RmeoYZ8hu2/dwxhvoK1kfTfKSzBQzTq
d9/Y9ASVcmbRx3e9qdyK+yxfMMv0ujYoiv0sslw7ZvtJ0EvaLkzgls6BwMdZqmAC
S/JkZUtPK3J14lvDtpr5gD1yIABf36T0b3WUxVCAccmbfzDbY4EGEgHowGZW9wkF
mzVgZ1gta9mxzFsE1OipMMlVu+GOts91qESWSzj4hxn8tVNbfWraWKWXJHDAAnsF
jBZg6UHybxLIlb6igyiCeDjFzC0iVAhiPu45kfSjYqIhbngZdxVGKeTGTzrkFBT8
XT8jJazSwAJX3gCMbzVqcgwL/+JhJABAWlm8hDMI/13eYC4mDETQEeBWx0ywtNz6
hC4QItiJkHB2F51T9bJwXJiT3UUUUUy9aeFqRVI153jy9sOsXEx6Cl5u1X0JoZYB
PW5nAgMBAAGjUzBRMB0GA1UdDgQWBBTHl9X576dPVGUaJTisvr9bG91RuzAfBgNV
HSMEGDAWgBTHl9X576dPVGUaJTisvr9bG91RuzAPBgNVHRMBAf8EBTADAQH/MA0G
CSqGSIb3DQEBCwUAA4ICAQBKyqzQ1CAhGG/Thtpnu6BOkyt3Kp7XH55S2f4zShHE
AtW0L56NOF1ASBm0+bTwmd4S6AEIpcG9oO7opqcnFncJtTFcMnTPYH55ldUmp/FW
bR1ICwGgW3y5tFnC3BicTbhHBgoh73oGJFPbCCsvZgeu8duygG3ULERw60xkjJGN
ZvNTk8AEmdmwXnkKeHuEojm7WAuIJbc7wy6dIjJonffJekCgI2NjSTweA3bLb2m4
bpUSv19aRPDXH8kYjguLTpjYHF6TjV3gsWSX0gBwmYqZK/kHwObqV85oT9iCRbmy
ErP0XkYHtPyed+W/jTtW7tVPj7PctV9CYCUmLVyHS8C1JCpCkaLWlR/UUwGC2DKH
gYksFxrZbVk6ApzRAd5Oza6EExSQf5FmHf4YLj4qon7WArbY7tqBkV7k4FCjEQIk
B45oH0kg1b0zyK4LL+d0UVcPB6PN9sLQf8Dgjhu34ls14x5cjVW5rpTqpekuMAJn
E+PXXOYFhrwchCp/CC/SIWC1aglNiXr0+ZOKFyxYXNzQ0D2X7WKhRxgsCOVB9ZuX
tL1RSP4qLtEL+pMRus+uGT85pz2N7JHBc7yTX6yGecFBkZ9iXJIQTOJAb5z1+VBE
Ey/boWpVqK8sEZKAIdnOKF+GWUQEDGhdwZiTiSNzcALw1QBnBecOj1Up0RToDeQ/
wg==
-----END CERTIFICATE-----
+52
View File
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQC9kQAJkTaevPA6
BQEGWnhxjB047GEhuL3ZN/MbmYmNhgXcykAeyX7xkgKs659QVTdALGJnOWWRultd
AnnCqx1PBGwYHRHweIkR5mG50pwQAejE79ZuEwxvSHNBO0xBxSzVou7vkzyEBhZa
nl3aBNI4ene7RWSZZEsyWhDxljuCI4VldTsNvhK8Gs+lYJvLej04Kz7STKO/lEyJ
S5I4SKffTkfr0HUrBAYpsYNLnBN6rwzDr8garIWELCZ/BF/i+l+YO3IoJP0ZnqGG
fIbtv3cMYb6CtZH03ykswUM06nff2PQElXJm0cd3vancivssXzDL9Lo2KIr9LLJc
O2b7SdBL2i5M4JbOgcDHWapgAkvyZGVLTytydeJbw7aa+YA9ciAAX9+k9G91lMVQ
gHHJm38w22OBBhIB6MBmVvcJBZs1YGdYLWvZscxbBNToqTDJVbvhjrbPdahElks4
+IcZ/LVTW31q2lillyRwwAJ7BYwWYOlB8m8SyJW+ooMogng4xcwtIlQIYj7uOZH0
o2KiIW54GXcVRinkxk865BQU/F0/IyWs0sACV94AjG81anIMC//iYSQAQFpZvIQz
CP9d3mAuJgxE0BHgVsdMsLTc+oQuECLYiZBwdhedU/WycFyYk91FFFFMvWnhakVS
Ned48vbDrFxMegpebtV9CaGWAT1uZwIDAQABAoICACLGFJGst65Kzm52OIfn1KxP
nZSxl+fNsdXE862ebqMtcKnd2AFNySGbPS5nUqQz3ZzCB5MT7lPbMaNQLvHM3eV+
1C1gN8g69Dn6XvbtcX9mOkLWFCnBCMjpK2tN62EtQFo4N0hvY+x8CWG6J1E1DTMb
FBegVSHmSf0ElJMckfH/fhrsdFbDBUDIUkrt++ZJmC1TkYSWVntwQtH0sO/uNA08
mOjjJnsrk83WKFWYXeJldhv3hOePujZSuwUV0lkawKp2TSycDGnEtbCr6zx1oOr+
iyoDELEwtqblFOUCFddUPv8QQxolZUfL3Pr967FqDNN9IyOIMGbc6iMNKojyM2lF
oasOFqTcw/slGIAKOgISshT4EJulix1FNYXk8qFTjJTXkiFeNdqbgFvprE+ivoX+
qhVt+9bexWdZDf1USGX/POSb5AMoa2OAwMpv06UueF4Uin9ImxdHJhi8EGwPbqk+
czSBPz2lelgeX7Cq0tqTWnKY5SskDGKapKSMiF7L6bbmNSNg1PdE/EVSNriP5/n5
mE+b3oVpg136B3ExgGnQ1h4JmrcNp1VLa7FTaluMAbvzg6IFPx2fiKDzMwjlqDxq
sGUqTfaUB2mH5STeeidwBB9Y5NdKBc4zl5d0bjUyR8LAAgET1GHdmvFIlgUmBKZQ
u6quaFy7JtJBYGl43y2xAoIBAQDMT699Tkq/aws28UrbfMlMtIDyXjqZSdq13HDh
vFCjRBMYy4zjhbjQIxU+zXPRi2FYgMffjyuJ1MABCbGDlgwaGQ9DuKnrs+VVpw2o
UL+D25kVxQJQuwCYK+Iy1cwb2IQM+68hvnuemYqnT7zSMl3sqEwNeZ5YiZCgg90S
SIv1kYTVmjoTHsLR0jdLXfGTWr1AL3+X/vlkl0WxjcJrSNa8wlcqiMwnVdI2r9Zd
NF+HVNeh8IKrkoCvBfK7BzUhMRKtritcH0xycxxt80WO6PzcRoVDxu44HJN0cDnZ
OhsK0DoZdaBIiEWUFqzo04kDz0iSSvxKJ43+/03oVg8XBNL1AoIBAQDthltLpys6
4p6vGj7feOmJDuA1E1M+MUttnfaX3FKMYVk8idTaoRBXM/tqWhNJHldCJjliG6tt
sWLSruYWs+VwUmBntNNDH753FW1INZPN7Mrb/kiVx1JXBKNtoymCxNxQq1Jut2c9
lDEUZp1wY96RBZfUhkxAMCc23Z/S4xKNLw5X9+isC/AUlVCa1sM87zD/pVbQ1P2x
rvCcU75sa1h84FBBF7mGYd+oZBaK12Xw8ZHPsRgdznkhHwNHXlO9HgcX2DQ56vpn
Hl2syZT1UOB+W4IkGHbPWtDGUDaI9bzarEJ6T0dP7Qdqana4HioGMu4aqgxiapre
6s9CSXb1nvprAoIBAQCC31hOL+R5kRvx6cZFqj1XwRgIKIvovQI4FCjKsFIHAwgo
jdqFs5aa3J4zSG+z/lAw3O0rKw58j6ceAxOOcoL2BK9edd+CeA2jPArnkjHbSMNa
yoOdKuxKjXGrln/UJnEPz/hy6Q1OnpPOcKlHC7RWb8enqgvgMt5Ns6ncmFPuzXQF
T3F75extcvawdFDWTv2DK+nTdyRRZwThoyiyiEnlR6eGO3Jqj/LDzQbHVVEL4zDt
Lp7FQGblti2x2AAUbtbEIhjsPbA+b7X6SCZ6UIwInbOnorndf5CEuY6Usz+3QYK1
5D7ztza6kXvY+AeARTr7WsUYyxWODgPdm6K24AQxAoIBAEiRrxz7Exsnl+HZu/Hc
6EUGtXuhzuIGf4wbIfcdyl63c2MqnUy6vtpVuG+y24eQbIp6UTfnSkX2V0IVS5kO
F4BsuqWUuqMcdL2/Xycbr2/P896o3xZb0o1hjmj1273nVYSUA1huUm2e9CvOejWX
Xa2jLtMwwOUvkRuTNLxiwg0+njxEMuM1toEjaYAVM4tPbQH+Svr8yBHcaAjrERfg
6CUnB34LuJQVHRc+lSCQVMX7mFgDPGIG7j0vU3ofmKgEH5iqZrJ3V0/gGDCtWgRl
VGFmpelPTCVoErc0VKUdpziMPrdNt3T07zoVEvaHyMEiGFsvLx92gKCwzufquByt
GMcCggEATu40rFJOUA5at5WK9uI2TwR2ZVO2wgfu7kUiVmQJZmkMuQKhER0lkRxU
eWtME0JYLprWwvIBRmR0y4IBohJBGAxR7CWJsxnrBJxplc/Nf3ziFs3DY75EPKAP
pwbl41BFHqdLfee9OOJGHRXT7YlAsHxl0X2pBfrnV+HhG2hcWoFxuclVOsAGbdxt
0C4zbyjGqfpDkFLbFcGcN09NSRsBEKB2kgM4i4zAtW/kTXLl16l+UBApXx2vkkDz
XuB+ikwqAZE+LNMwy9Oxmfq6mzpt9D5wwtw3dasMzvK9Tr+DC6ctHjCNl3e2fKkP
hE4TY9HQcE7tdZysxkzni6CX77WRiQ==
-----END PRIVATE KEY-----
+65
View File
@@ -0,0 +1,65 @@
image aux.ext4 {
mountpoint = "/aux"
temporary = true
size = 2M
ext4 {
label = "aux"
}
}
image cfg.ext4 {
empty = true
temporary = true
size = 16M
ext4 {
label = "cfg"
}
}
image var.ext4 {
empty = true
temporary = true
# 44M - 24k (GPT backup)
size = 45032k
ext4 {
label = "var"
}
}
image mmc.img {
size = 512M
hdimage {
partition-table-type = "gpt"
}
partition aux {
offset = 2M
image = "aux.ext4"
}
partition primary {
image = "rootfs.squashfs"
size = 224M
}
partition secondary {
bootable = true
image = "rootfs.squashfs"
size = 224M
}
partition cfg {
image = "cfg.ext4"
}
partition var {
image = "var.ext4"
}
}
# Silence genimage warnings
config {}
+66
View File
@@ -0,0 +1,66 @@
@BOOTIMG@
image aux.ext4 {
mountpoint = "/aux"
temporary = true
size = @AUXSIZE@
ext4 {
label = "aux"
}
}
image cfg.ext4 {
empty = true
temporary = true
size = @CFGSIZE@
ext4 {
label = "cfg"
}
}
image var.ext4 {
empty = true
temporary = true
size = @VARSIZE@
ext4 {
label = "var"
}
}
image disk.img {
size = @TOTALSIZE@
hdimage {
partition-table-type = "gpt"
}
@BOOTPART@
partition aux {
offset = @AUXOFFS@
image = "aux.ext4"
}
partition primary {
image = "rootfs.squashfs"
size = @IMGSIZE@
}
partition secondary {
image = "rootfs.squashfs"
size = @IMGSIZE@
}
partition cfg {
image = "cfg.ext4"
}
partition var {
image = "var.ext4"
}
}
# Silence genimage warnings
config {}
+19
View File
@@ -0,0 +1,19 @@
ixmsg()
{
printf "\e[37;44m#!: $@\e[0m\n"
}
die()
{
echo "$@" >&2
exit 1
}
load_cfg()
{
local tmp=$(mktemp -p /tmp)
grep "$1" $BR2_CONFIG >$tmp
. $tmp
rm $tmp
}
+183
View File
@@ -0,0 +1,183 @@
#!/bin/sh
set -e
K=10
M=20
G=30
size2int()
{
# Use truncate's error message to convert input like "1K to "1024"
# for us.
#
# - What do you mean by "fragile"?!
truncate -s $1 /dev/null 2>&1 | awk '{ print($7); }'
}
dimension()
{
if [ $total -ge $((4 << G)) ]; then
bootsize=$(( 8 << M))
auxsize=$(( 8 << M))
imgsize=$(( 1 << G))
cfgsize=$((512 << M))
# var is at least ~1.5G
elif [ $total -ge $((2 << G)) ]; then
bootsize=$(( 8 << M))
auxsize=$(( 8 << M))
imgsize=$((512 << M))
cfgsize=$((256 << M))
# var is at least ~1.75G
elif [ $total -ge $((1 << G)) ]; then
bootsize=$(( 4 << M))
auxsize=$(( 4 << M))
imgsize=$((256 << M))
cfgsize=$(( 64 << M))
# var is at least ~0.5G
elif [ $total -ge $((512 << M)) ]; then
bootsize=$(( 4 << M))
auxsize=$(( 4 << M))
imgsize=$((192 << M))
cfgsize=$(( 16 << M))
# var is at least ~100M
else
echo "Can't create disk images smaller than 512M"
exit 1
fi
# Size var to fit whatever is left over. Also reserve another 32K
# at the end to make room for the backup GPT.
varsize=$(($total - $auxsize - 2 * $imgsize - $cfgsize))
if [ "$bootoffs" ]; then
varsize=$(($varsize - $bootsize))
fi
varsize=$(($varsize - (32 << K)))
if [ "$bootoffs" ]; then
# Align the end of the boot partition to an even MiB. E.g. if
# boot was dimensioned to 4M, and bootoffs is 32K, then the
# final bootsize becomes 4M - 32K, meaning aux will start on
# exactly 4M.
auxoffs=$bootsize
bootsize=$(($bootsize - $bootoffs))
else
# No bootloader, place aux after GPT, resize it to end on an
# even MiB (as is done for boot above).
auxoffs=$((32 << K))
auxsize=$(($auxsize - $auxoffs))
fi
}
probeboot()
{
# If we have built an EFI app, typically grub, make sure to
# include it.
if [ -d $BINARIES_DIR/efi-part/EFI ]; then
bootoffs=$((32 << K))
fi
}
genboot()
{
if [ -d $BINARIES_DIR/efi-part/EFI ]; then
bootimg=$(cat <<EOF
image efi-part.vfat {
size = $bootsize
vfat {
file EFI {
image = $BINARIES_DIR/efi-part/EFI
}
}
}
EOF
)
bootpart=$(cat <<EOF
partition efi {
offset = $bootoffs
partition-type-uuid = U
bootable = true
image = efi-part.vfat
}
EOF
)
fi
}
common=$(dirname $(readlink -f "$0"))
root=$BUILD_DIR/genimage.root
tmp=$BUILD_DIR/genimage.tmp
total=$((512 << M))
bootoffs=
bootimg=
bootpart=
while getopts "a:s:" opt; do
case ${opt} in
a)
arch=$OPTARG
;;
s)
total=$(size2int $OPTARG)
;;
esac
done
shift $((OPTIND - 1))
mkdir -p $root
probeboot
dimension
genboot
# Use awk over sed because replacement text may contain newlines,
# which sed does not approve of.
awk \
-vtotal=$total \
-vauxsize=$auxsize -vauxoffs=$auxoffs \
-vimgsize=$imgsize \
-vcfgsize=$cfgsize \
-vvarsize=$varsize \
-vbootimg="$bootimg" -vbootpart="$bootpart" \
'{
sub(/@TOTALSIZE@/, total);
sub(/@AUXSIZE@/, auxsize);
sub(/@AUXOFFS@/, auxoffs);
sub(/@IMGSIZE@/, imgsize);
sub(/@CFGSIZE@/, cfgsize);
sub(/@VARSIZE@/, varsize);
sub(/@BOOTIMG@/, bootimg);
sub(/@BOOTPART@/, bootpart);
}1' \
< $common/genimage.cfg.in >$root/genimage.cfg
mkdir -p $root/aux
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/primary.itbh
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh
case "$arch" in
aarch64)
mkenvimage -s 0x4000 -o "$root/aux/uboot.env" \
"$BR2_EXTERNAL_INFIX_PATH/board/common/uboot/aux-env.txt"
;;
x86_64)
mkdir -p "$root/aux/grub"
cp -f "$BR2_EXTERNAL_INFIX_PATH/board/$arch/grub.cfg" \
"$BR2_EXTERNAL_INFIX_PATH/board/$arch/grubenv" \
"$root/aux/grub/"
;;
*)
;;
esac
rm -rf "$tmp"
genimage \
--rootpath "$root" \
--tmppath "$tmp" \
--inputpath "$BINARIES_DIR" \
--outputpath "$BINARIES_DIR" \
--config "$root/genimage.cfg"
+108
View File
@@ -0,0 +1,108 @@
#!/bin/sh
die()
{
echo "$@" >&2
exit 1
}
load_cfg()
{
local tmp=$(mktemp -p /tmp)
grep ^FIT_ $BR2_CONFIG >$tmp
. $tmp
rm $tmp
}
load_cfg
[ "$FIT_IMAGE" = "y" ] || exit 0
work=$(pwd)/build/fit-image-local
dtbs=$(find $BINARIES_DIR -name '*.dtb')
kernel=$(find $BINARIES_DIR -name '*Image' | head -n1)
squash=$BINARIES_DIR/rootfs.squashfs
mkdir -p $work
# mkimage will only align images to 4 bytes, but U-Boot will leave
# both DTB and ramdisk in place when starting the kernel. So we pad
# all components up to a 4k boundary.
truncate -s %4k $kernel $dtbs
: >$work/dtbs.itsi
: >$work/cfgs.itsi
for dtb in $dtbs; do
name=$(basename $dtb .dtb)
cat <<EOF >>$work/dtbs.itsi
$name-dtb {
description = "$name";
type = "flat_dt";
arch = "$FIT_ARCH";
compression = "none";
data = /incbin/("$dtb");
};
EOF
cat <<EOF >>$work/cfgs.itsi
$name {
description = "$name";
kernel = "kernel";
ramdisk = "ramdisk";
fdt = "$name-dtb";
};
EOF
done
: >$work/kernel-load.itsi
if [ "$FIT_KERNEL_LOAD_ADDR" ]; then
cat <<EOF >$work/kernel-load.itsi
load = <$FIT_KERNEL_LOAD_ADDR>;
entry = <$FIT_KERNEL_LOAD_ADDR>;
EOF
fi
cat <<EOF >$work/infix.its
/dts-v1/;
/ {
timestamp = <$(date +%s)>;
description = "Infix ($FIT_ARCH)";
creator = "infix";
#address-cells = <0x1>;
images {
kernel {
description = "Linux";
type = "kernel";
arch = "$FIT_ARCH";
os = "linux";
$(cat $work/kernel-load.itsi)
compression = "none";
data = /incbin/("$kernel");
};
ramdisk {
description = "Infix";
type = "ramdisk";
os = "linux";
arch = "$FIT_ARCH";
compression = "none";
data = /incbin/("$squash");
};
$(cat $work/dtbs.itsi)
};
configurations {
$(cat $work/cfgs.itsi)
};
};
EOF
mkimage \
-E -p 0x1000 \
-f $work/infix.its $BINARIES_DIR/infix.itb \
|| die "Unable to create FIT image"
+60
View File
@@ -0,0 +1,60 @@
#!/bin/sh
if [ -n "$INFIX_RELEASE" ]; then
rel="-${INFIX_RELEASE}"
fi
NM="${1:-custom}${rel}"
RAM=${2:-512}
IFNUM=${3:-1}
cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
{
"name": "$NM",
"category": "router",
"description": "Infix is a Network Operating System based on Linux. It can be set up both as a switch, with offloading using switchdev, and a router with firewalling.",
"vendor_name": "KernelKit",
"vendor_url": "https://github.com/kernelkit/",
"product_name": "Infix",
"registry_version": 6,
"status": "stable",
"maintainer": "KernelKit",
"maintainer_email": "kernelkit@googlegroups.com",
"usage": "Default console login is 'root', no password. For remote login, default user/pass: admin/admin also works.\n\nType 'help' for an overview of commands and relevant configuration files.\n\nThe /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/",
"port_name_format": "eth{0}",
"linked_clone": true,
"qemu": {
"adapter_type": "virtio-net-pci",
"adapters": ${IFNUM},
"ram": ${RAM},
"cpus": 1,
"hda_disk_interface": "virtio",
"arch": "x86_64",
"console_type": "telnet",
"kvm": "allow"
},
"images": [
{
"filename": "OVMF.fd",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/OVMF.fd"),
"md5sum": "$(md5sum "$BINARIES_DIR/OVMF.fd" | awk '{print $1}')",
"version": "0.0"
},
{
"filename": "disk.img",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/disk.img"),
"md5sum": "$(md5sum "$BINARIES_DIR/disk.img" | awk '{print $1}')",
"version": "0.0"
}
],
"versions": [
{
"name": "0.0",
"images": {
"bios_image": "OVMF.fd",
"hda_disk_image": "disk.img"
}
}
]
}
EOF
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
set -e
common=$(dirname $(readlink -f "$0"))
root=$BUILD_DIR/genimage.root
tmp=$BUILD_DIR/genimage.tmp
mkdir -p $root/aux
cp -f $BINARIES_DIR/uboot-env.bin $root/aux/uboot.env
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/primary.itbh
cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh
rm -rf $tmp
genimage \
--rootpath $root \
--tmppath $tmp \
--inputpath $BINARIES_DIR \
--outputpath $BINARIES_DIR \
--config $common/genimage.cfg
+48
View File
@@ -0,0 +1,48 @@
#!/bin/sh
set -e
GIT_VERSION=$(git -C $BR2_EXTERNAL_INFIX_PATH describe --always --dirty --tags)
if [ -n "$INFIX_RELEASE" ]; then
rel="-${INFIX_RELEASE}"
fi
name=$1${rel}
arch=$2
sign=$3
crt=$(ls $sign/*.crt)
key=$(ls $sign/*.key)
common=$(dirname $(readlink -f "$0"))
work=$BUILD_DIR/mkrauc
mkdir -p $work
cp -f $common/rauc-hooks.sh $work/hooks.sh
# RAUC internally uses the file extension to find a suitable install
# handler, hence the name must be .img
cp -f $BINARIES_DIR/rootfs.squashfs $work/rootfs.img
cp -f $BINARIES_DIR/rootfs.itbh $work/rootfs.itbh
cat >$work/manifest.raucm <<EOF
[update]
compatible=infix-${arch}
version=${GIT_VERSION}
[bundle]
format=verity
[hooks]
filename=hooks.sh
[image.rootfs]
filename=rootfs.img
hooks=post-install
EOF
rm -f $BINARIES_DIR/$name.pkg
rauc --cert=$crt --key=$key \
bundle $work $BINARIES_DIR/$name.pkg
+53
View File
@@ -0,0 +1,53 @@
#!/bin/sh
# shellcheck disable=SC1090,SC1091
. "$BR2_CONFIG" 2>/dev/null
. "$TARGET_DIR/usr/lib/os-release"
if [ -n "${ID_LIKE}" ]; then
ID="${ID} ${ID_LIKE}"
fi
GIT_VERSION=$(git -C "$BR2_EXTERNAL_INFIX_PATH" describe --always --dirty --tags)
# This is a symlink to /usr/lib/os-release, so we remove this to keep
# original Buildroot information.
rm -f "$TARGET_DIR/etc/os-release"
{
echo "NAME=\"Infix\""
echo "VERSION=${GIT_VERSION}"
echo "ID=infix"
echo "ID_LIKE=\"${ID}\""
echo "VERSION_ID=${GIT_VERSION}"
echo "BUILD_ID=\"${NAME} ${VERSION}\""
echo "PRETTY_NAME=\"Infix by KernelKit\""
if [ "$INFIX_VARIANT_NETCONF" = "y" ]; then
echo "VARIANT=\"Managed NETCONF\""
echo "VARIANT_ID=netconf"
else
echo "VARIANT=\"Classic, writable /etc\""
echo "VARIANT_ID=classic"
fi
echo "ARCHITECTURE=\"${INFIX_ARCH}\""
echo "HOME_URL=https://github.com/KernelKit"
} > "$TARGET_DIR/etc/os-release"
echo "Infix by KernelKit $GIT_VERSION -- $(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version"
# Allow pdmenu (setup) and bash to be a login shells, bash
# is added automatically when selected in menuyconfig, but
# not when BusyBox provides a symlink (for ash).
grep -qsE '^/usr/bin/pdmenu$$' "$TARGET_DIR/etc/shells" \
|| echo "/usr/bin/pdmenu" >> "$TARGET_DIR/etc/shells"
grep -qsE '^/bin/bash$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/bash" >> "$TARGET_DIR/etc/shells"
# Menuconfig support for modifying Qemu args in release tarballs
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/qemu.sh" "$BINARIES_DIR/"
sed "s/default QEMU_aarch64/default QEMU_$BR2_ARCH/" \
< "$BR2_EXTERNAL_INFIX_PATH/board/common/qemu/Config.in" \
> "$BINARIES_DIR/Config.in"
rm -f "$BINARIES_DIR/qemu.cfg"
CONFIG_="CONFIG_" BR2_CONFIG="$BINARIES_DIR/qemu.cfg" \
"$O/build/buildroot-config/conf" --olddefconfig "$BINARIES_DIR/Config.in"
rm -f "$BINARIES_DIR/qemu.cfg.old" "$BINARIES_DIR/.config.old"
+55 -13
View File
@@ -1,16 +1,58 @@
#!/bin/sh
common=$(dirname "$(readlink -f "$0")")
. $common/lib.sh
# shellcheck disable=SC1090
. "$BR2_CONFIG" 2>/dev/null
load_cfg BR2_DEFCONFIG
load_cfg BR2_EXTERNAL_INFIX_PATH
NAME=infix-$(basename "$BR2_DEFCONFIG" _defconfig | tr _ - | sed 's/x86-64/x86_64/')
cat <<-EOF >"$BINARIES_DIR/qemu.sh"
#!/bin/sh
line=\$(stty -g)
stty raw
qemu-system-x86_64 -M pc -cpu kvm64 -enable-kvm -nographic \\
-kernel bzImage -append "rootwait root=/dev/vda console=ttyS0" \\
-drive file=rootfs.ext2,if=virtio,format=raw \\
-net nic,model=virtio -net user
stty "\$line"
EOF
chmod +x "$BINARIES_DIR/qemu.sh"
ver()
{
if [ -n "$INFIX_RELEASE" ]; then
printf -- "-%s" "$INFIX_RELEASE"
return
fi
}
load_cfg SIGN_ENABLED
if [ "$SIGN_ENABLED" = "y" ]; then
load_cfg BR2_ARCH
load_cfg SIGN_KEY
ixmsg "Signing SquashFS Image"
$common/sign.sh $BR2_ARCH $SIGN_KEY
ixmsg "Creating RAUC Update Bundle"
$common/mkrauc.sh $NAME $BR2_ARCH $SIGN_KEY
fi
load_cfg DISK_IMAGE
load_cfg DISK_IMAGE_SIZE
if [ "$DISK_IMAGE" = "y" ]; then
ixmsg "Creating Disk Image"
$common/mkdisk.sh -a $BR2_ARCH -s $DISK_IMAGE_SIZE
fi
load_cfg GNS3_APPLIANCE
if [ "$GNS3_APPLIANCE" = "y" ]; then
load_cfg GNS3_APPLIANCE_RAM
load_cfg GNS3_APPLIANCE_IFNUM
ixmsg "Creating GNS3 Appliance, $GNS3_APPLIANCE_RAM MiB with $GNS3_APPLIANCE_IFNUM ports"
$common/mkgns3a.sh $NAME $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM
fi
load_cfg FIT_IMAGE
if [ "$FIT_IMAGE" = "y" ]; then
ixmsg "Creating Traditional FIT Image"
$common/mkfit.sh
fi
if [ -z "${NAME##*minimal*}" ]; then
NAME=$(echo "$NAME" | sed 's/-minimal//')
fi
rel=$(ver)
ln -sf rootfs.squashfs "$BINARIES_DIR/${NAME}${rel}.img"
if [ -n "$rel" ]; then
ln -sf "$BINARIES_DIR/${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img"
fi
+146
View File
@@ -0,0 +1,146 @@
mainmenu "QEMU Virtualization"
choice
prompt "Target Architecture"
default QEMU_aarch64
config QEMU_x86_64
bool "x86_64"
select QEMU_ARCH_IS_64
config QEMU_aarch64
bool "AArch64 (little endian)"
select QEMU_ARCH_IS_64
endchoice
choice
prompt "Loader"
default QEMU_LOADER_KERNEL
config QEMU_LOADER_KERNEL
bool "Kernel"
config QEMU_LOADER_UBOOT
bool "U-Boot"
depends on QEMU_aarch64
config QEMU_LOADER_OVMF
bool "OVMF (UEFI)"
depends on QEMU_x86_64
endchoice
choice
prompt "Rootfs type"
default QEMU_ROOTFS_INITRD
config QEMU_ROOTFS_MMC
bool "MMC"
config QEMU_ROOTFS_INITRD
bool "Initrd"
config QEMU_ROOTFS_VSCSI
bool "Virtio SCSI"
endchoice
config QEMU_MACHINE
string
default "qemu-system-aarch64 -M virt -cpu cortex-a72 -m 256M" if QEMU_aarch64
default "qemu-system-x86_64 -M q35,accel=kvm -cpu host -m 512M" if QEMU_x86_64
config QEMU_KERNEL
string
depends on QEMU_LOADER_KERNEL
default "Image" if QEMU_aarch64
default "bzImage" if QEMU_x86_64
config QEMU_BIOS
string
depends on !QEMU_LOADER_KERNEL
default "u-boot.bin" if QEMU_LOADER_UBOOT
default "OVMF.fd" if QEMU_LOADER_OVMF
config QEMU_ROOTFS
string
default "disk.img" if !QEMU_ROOTFS_INITRD
default "rootfs.squashfs" if QEMU_ROOTFS_INITRD
config QEMU_CONSOLE
string
depends on !QEMU_ROOTFS_MMC
default "ttyAMA0" if QEMU_aarch64
default "ttyS0" if QEMU_x86_64
config QEMU_DTB_EXTEND
bool
depends on QEMU_LOADER_UBOOT
default y if QEMU_aarch64
config QEMU_RW
string "Writable /cfg layer"
depends on QEMU_ROOTFS_INITRD
default "cfg.ext4"
config QEMU_RW_VAR_OPT
bool "Separate writable /var (256MB)"
if QEMU_RW_VAR_OPT
config QEMU_RW_VAR
string "Writable /var layer"
default "var.ext4"
endif
config QEMU_HOST
string "Export host filesystem path"
default "/tmp"
config QEMU_APPEND
string "Extra kernel options"
depends on !QEMU_ROOTFS_MMC
config QEMU_EXTRA
string "Extra QEMU options"
comment "Networking"
choice
prompt "Mode"
default QEMU_NET_USER
config QEMU_NET_NONE
bool "None"
config QEMU_NET_BRIDGE
bool "Bridged"
config QEMU_NET_USER
bool "User"
config QEMU_NET_TAP
bool "TAP"
endchoice
config QEMU_NET_MODEL
string "Interface model"
default "virtio"
config QEMU_NET_BRIDGE_DEV
string "Bridge device"
depends on QEMU_NET_BRIDGE
default "virbr0"
config QEMU_NET_USER_OPTS
string "User mode options"
depends on QEMU_NET_USER
help
Extra -nic user,<OPTIONS>
config QEMU_NET_TAP_N
int "Number of TAPs"
depends on QEMU_NET_TAP
default 1
+294
View File
@@ -0,0 +1,294 @@
#!/bin/sh
# This script can be used to start an Infix OS image in Qemu. It reads
# either a .config, generated from Config.in, or qemu.cfg from a release
# tarball, for the required configuration data.
#
# Debian/Ubuntu users can change the configuration post-release, install
# the kconfig-frontends package:
#
# sudo apt install kconfig-frontends
#
# and then call this script with:
#
# ./qemu.sh -c
#
# To bring up a menuconfig dialog. Select `Exit` and save the changes.
# For more help, see:_
#
# ./qemu.sh -h
#
# Local variables
prognm=$(basename "$0")
usage()
{
echo "usage: $prognm [opts]"
echo
echo " -c Run menuconfig to change Qemu settings"
echo " -h This help text"
echo
echo "Note: 'kconfig-frontends' package (Debian/Ubuntu) must be installed"
echo " for -c to work: sudo apt install kconfig-frontents"
exit 1
}
die()
{
echo "$@" >&2
exit 1
}
load_qemucfg()
{
local tmp=$(mktemp -p /tmp)
grep ^CONFIG_QEMU_ $1 >$tmp
. $tmp
rm $tmp
[ "$CONFIG_QEMU_MACHINE" ] || die "Missing QEMU_MACHINE"
[ "$CONFIG_QEMU_ROOTFS" ] || die "Missing QEMU_ROOTFS"
[ "$CONFIG_QEMU_KERNEL" -a "$CONFIG_QEMU_BIOS" ] \
&& die "QEMU_KERNEL conflicts with QEMU_BIOS"
[ ! "$CONFIG_QEMU_KERNEL" -a ! "$CONFIG_QEMU_BIOS" ] \
&& die "QEMU_KERNEL or QEMU_BIOS must be set"
}
loader_args()
{
if [ "$CONFIG_QEMU_BIOS" ]; then
echo -n "-bios $CONFIG_QEMU_BIOS "
elif [ "$CONFIG_QEMU_KERNEL" ]; then
echo -n "-kernel $CONFIG_QEMU_KERNEL "
fi
}
append_args()
{
# Disabled, not needed anymore with virtconsole (hvc0)
# [ "$CONFIG_QEMU_CONSOLE" ] && echo -n "console=$CONFIG_QEMU_CONSOLE "
echo -n "console=hvc0 "
if [ "$CONFIG_QEMU_ROOTFS_INITRD" = "y" ]; then
# Size of initrd, rounded up to nearest kb
local size=$((($(stat -c %s $CONFIG_QEMU_ROOTFS) + 1023) >> 10))
echo -n "root=/dev/ram ramdisk_size=${size} "
elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
echo -n "root=PARTLABEL=primary "
fi
if [ "$V" != "1" ]; then
echo -n "quiet "
else
echo -n "debug "
fi
echo -n "${QEMU_APPEND} ${QEMU_EXTRA_APPEND} "
}
rootfs_args()
{
if [ "$CONFIG_QEMU_ROOTFS_INITRD" = "y" ]; then
echo -n "-initrd $CONFIG_QEMU_ROOTFS "
elif [ "$CONFIG_QEMU_ROOTFS_MMC" = "y" ]; then
echo -n "-device sdhci-pci "
echo -n "-device sd-card,drive=mmc "
echo -n "-drive id=mmc,file=$CONFIG_QEMU_ROOTFS,if=none,format=raw "
elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
echo -n "-drive file=$CONFIG_QEMU_ROOTFS,if=virtio,format=raw,bus=0,unit=0 "
fi
}
rw_args()
{
[ "$CONFIG_QEMU_RW" ] || return
if ! [ -f "$CONFIG_QEMU_RW" ]; then
dd if=/dev/zero of="$CONFIG_QEMU_RW" bs=16M count=1 >/dev/null 2>&1
mkfs.ext4 -L cfg "$CONFIG_QEMU_RW" >/dev/null 2>&1
fi
echo -n "-drive file=$CONFIG_QEMU_RW,if=virtio,format=raw,bus=0,unit=1 "
if [ "$CONFIG_QEMU_RW_VAR_OPT" ]; then
if ! [ -f "$CONFIG_QEMU_RW_VAR" ]; then
dd if=/dev/zero of="$CONFIG_QEMU_RW_VAR" bs=256M count=1 >/dev/null 2>&1
mkfs.ext4 -L var "$CONFIG_QEMU_RW_VAR" >/dev/null 2>&1
fi
echo -n "-drive file=$CONFIG_QEMU_RW_VAR,if=virtio,format=raw,bus=0,unit=2 "
fi
}
host_args()
{
[ "${QEMU_HOST}" ] || return
echo -n "-virtfs local,path=${QEMU_HOST},security_model=none,writeout=immediate,mount_tag=hostfs "
}
net_args()
{
QEMU_NET_MODEL=${QEMU_NET_MODEL:-virtio}
if [ "$CONFIG_QEMU_NET_BRIDGE" = "y" ]; then
QEMU_NET_BRIDGE_DEV=${QEMU_NET_BRIDGE_DEV:-virbr0}
echo -n "-nic bridge,br=$CONFIG_QEMU_NET_BRIDGE_DEV,model=$CONFIG_QEMU_NET_MODEL "
elif [ "$CONFIG_QEMU_NET_TAP" = "y" ]; then
QEMU_NET_TAP_N=${QEMU_NET_TAP_N:-1}
mactab=$(dirname "$CONFIG_QEMU_ROOTFS")/mactab
rm -f "$mactab"
for i in $(seq 0 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
printf "e$i 52:54:00:12:34:%02x\n" $((0x56 + i)) >>"$mactab"
echo -n "-netdev tap,id=nd$i,ifname=qtap$i -device e1000,netdev=nd$i "
done
echo -n "-fw_cfg name=opt/mactab,file=$mactab "
elif [ "$CONFIG_QEMU_NET_USER" = "y" ]; then
[ "$CONFIG_QEMU_NET_USER_OPTS" ] && QEMU_NET_USER_OPTS="$CONFIG_QEMU_NET_USER_OPTS,"
echo -n "-nic user,${QEMU_NET_USER_OPTS}model=$CONFIG_QEMU_NET_MODEL "
else
echo -n "-nic none"
fi
}
wdt_args()
{
echo -n "-device i6300esb -rtc clock=host"
}
run_qemu()
{
local qemu
read qemu <<EOF
$CONFIG_QEMU_MACHINE \
-display none -rtc base=utc,clock=vm \
-device virtio-serial -chardev stdio,mux=on,id=console0 \
-device virtconsole,chardev=console0 -mon chardev=console0 \
-chardev socket,id=gdbserver,path=gdbserver.sock,server=on,wait=off \
-device virtconsole,name=console1,chardev=gdbserver \
$(loader_args) \
$(rootfs_args) \
$(rw_args) \
$(host_args) \
$(net_args) \
$(wdt_args) \
$CONFIG_QEMU_EXTRA
EOF
if [ "$CONFIG_QEMU_KERNEL" ]; then
$qemu -append "$(append_args)" "$@"
else
$qemu "$@"
fi
}
dtb_args()
{
[ "$CONFIG_QEMU_LOADER_UBOOT" ] || return
if [ "$CONFIG_QEMU_DTB_EXTEND" ]; then
# On the current architecture, QEMU will generate an internal
# DT based on the system configuration.
# So we extract a copy of that
run_qemu -M dumpdtb=qemu.dtb >/dev/null 2>&1
# Extend it with the environment and signing information in
# u-boot.dtb.
echo "qemu.dtb u-boot.dtb" | \
xargs -n 1 dtc -I dtb -O dts | \
{ echo "/dts-v1/;"; sed -e 's:/dts-v[0-9]\+/;::'; } | \
dtc >qemu-extended.dtb 2>/dev/null
# And use the combined result to start the instance
echo -n "-dtb qemu-extended.dtb "
else
# Otherwise we just use the unmodified one
echo -n "-dtb u-boot.dtb "
fi
}
generate_dot()
{
[ "$CONFIG_QEMU_NET_TAP" = "y" ] || return
hostports="<qtap0> qtap0"
targetports="<e0> e0"
edges="host:qtap0 -- target:e0;"
for tap in $(seq 1 $(($CONFIG_QEMU_NET_TAP_N - 1))); do
hostports="$hostports | <qtap$tap> qtap$tap "
targetports="$targetports | <e$tap> e$tap "
edges="$edges host:qtap$tap -- target:e$tap;"
done
cat >qemu.dot <<EOF
graph "qemu" {
layout="neato";
overlap="false";
esep="+20";
node [shape=record, fontname="monospace"];
edge [color="cornflowerblue", penwidth="2"];
host [
label="host | { $hostports }"
pos="0,0!",
kind="controller",
];
target [
label="{ $targetports } | target",
pos="10,0!",
kind="infix",
];
$edges
}
EOF
}
menuconfig()
{
grep -q QEMU_MACHINE Config.in || die "$prognm: must be run from the output/images directory"
command -v kconfig-mconf >/dev/null || die "$prognm: cannot find kconfig-mconf for menuconfig"
exec kconfig-mconf Config.in
}
cd $(dirname $(readlink -f "$0"))
while [ "$1" != "" ]; do
case $1 in
-c)
menuconfig
;;
-h)
usage
;;
*)
break
esac
shift
done
if [ -f .config ]; then
# Customized settings from 'qemu.sh -c'
load_qemucfg .config
else
# Shipped defaults from release tarball
load_qemucfg qemu.cfg
fi
generate_dot
echo "Starting Qemu :: Ctrl-a x -- exit | Ctrl-a c -- toggle console/monitor"
line=$(stty -g)
stty raw
run_qemu $(dtb_args)
stty "$line"
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
set -e
case "$1" in
slot-post-install)
[ "$RAUC_SLOT_CLASS" = "rootfs" ] || break
echo "Updating signature information for $RAUC_SLOT_BOOTNAME"
itbh=$(dirname $RAUC_IMAGE_NAME)/rootfs.itbh
cp $itbh /mnt/aux/$RAUC_SLOT_BOOTNAME.itbh
sync
;;
*)
exit 1
;;
esac
+28
View File
@@ -0,0 +1,28 @@
/dts-v1/;
/ {
description = "Infix";
creator = "infix";
#address-cells = <0x1>;
images {
rootfs {
description = "Infix";
type = "ramdisk";
os = "linux";
compression = "none";
data = /incbin/("rootfs.squashfs");
signature-1 {
algo = "sha256,rsa4096";
key-name-hint = "infix";
};
};
};
configurations {
default = "verity";
verity {
ramdisk = "rootfs";
};
};
};
+1
View File
@@ -0,0 +1 @@
/sbin/ip
View File
View File
@@ -0,0 +1,5 @@
{
"ietf-system:system": {
"hostname": "infix"
}
}
+18
View File
@@ -0,0 +1,18 @@
# System-wide .bashrc file for interactive bash(1) shells.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Reevaluate for each line, in case hostname changes
function prompt_command
{
PS1="\u@$(hostname):\w\$ "
}
export PROMPT_COMMAND=prompt_command
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Disble built-ins
enable -n help
@@ -0,0 +1,77 @@
# For more information on this configuration file, see containers-registries.conf(5).
#
# NOTE: RISK OF USING UNQUALIFIED IMAGE NAMES
# We recommend always using fully qualified image names including the registry
# server (full dns name), namespace, image name, and tag
# (e.g., registry.redhat.io/ubi8/ubi:latest). Pulling by digest (i.e.,
# quay.io/repository/name@digest) further eliminates the ambiguity of tags.
# When using short names, there is always an inherent risk that the image being
# pulled could be spoofed. For example, a user wants to pull an image named
# `foobar` from a registry and expects it to come from myregistry.com. If
# myregistry.com is not first in the search list, an attacker could place a
# different `foobar` image at a registry earlier in the search list. The user
# would accidentally pull and run the attacker's image and code rather than the
# intended content. We recommend only adding registries which are completely
# trusted (i.e., registries which don't allow unknown or anonymous users to
# create accounts with arbitrary names). This will prevent an image from being
# spoofed, squatted or otherwise made insecure. If it is necessary to use one
# of these registries, it should be added at the end of the list.
#
# # An array of host[:port] registries to try when pulling an unqualified image, in order.
# unqualified-search-registries = ["example.com"]
#
# [[registry]]
# # The "prefix" field is used to choose the relevant [[registry]] TOML table;
# # (only) the TOML table with the longest match for the input image name
# # (taking into account namespace/repo/tag/digest separators) is used.
# #
# # The prefix can also be of the form: *.example.com for wildcard subdomain
# # matching.
# #
# # If the prefix field is missing, it defaults to be the same as the "location" field.
# prefix = "example.com/foo"
#
# # If true, unencrypted HTTP as well as TLS connections with untrusted
# # certificates are allowed.
# insecure = false
#
# # If true, pulling images with matching names is forbidden.
# blocked = false
#
# # The physical location of the "prefix"-rooted namespace.
# #
# # By default, this is equal to "prefix" (in which case "prefix" can be omitted
# # and the [[registry]] TOML table can only specify "location").
# #
# # Example: Given
# # prefix = "example.com/foo"
# # location = "internal-registry-for-example.net/bar"
# # requests for the image example.com/foo/myimage:latest will actually work with the
# # internal-registry-for-example.net/bar/myimage:latest image.
#
# # The location can be empty iff prefix is in a
# # wildcarded format: "*.example.com". In this case, the input reference will
# # be used as-is without any rewrite.
# location = internal-registry-for-example.com/bar"
#
# # (Possibly-partial) mirrors for the "prefix"-rooted namespace.
# #
# # The mirrors are attempted in the specified order; the first one that can be
# # contacted and contains the image will be used (and if none of the mirrors contains the image,
# # the primary location specified by the "registry.location" field, or using the unmodified
# # user-specified reference, is tried last).
# #
# # Each TOML table in the "mirror" array can contain the following fields, with the same semantics
# # as if specified in the [[registry]] TOML table directly:
# # - location
# # - insecure
# [[registry.mirror]]
# location = "example-mirror-0.local/mirror-for-foo"
# [[registry.mirror]]
# location = "example-mirror-1.local/mirrors/foo"
# insecure = true
# # Given the above, a pull of example.com/foo/image:latest will try:
# # 1. example-mirror-0.local/mirror-for-foo/image:latest
# # 2. example-mirror-1.local/mirrors/foo/image:latest
# # 3. internal-registry-for-example.net/bar/image:latest
# # in order, and use the first one that exists.
@@ -0,0 +1,78 @@
[aliases]
# almalinux
"almalinux" = "docker.io/library/almalinux"
"almalinux-minimal" = "docker.io/library/almalinux-minimal"
# centos
"centos" = "quay.io/centos/centos"
# containers
"skopeo" = "quay.io/skopeo/stable"
"buildah" = "quay.io/buildah/stable"
"podman" = "quay.io/podman/stable"
# docker
"alpine" = "docker.io/library/alpine"
"docker" = "docker.io/library/docker"
"registry" = "docker.io/library/registry"
"hello-world" = "docker.io/library/hello-world"
"swarm" = "docker.io/library/swarm"
# Fedora
"fedora-minimal" = "registry.fedoraproject.org/fedora-minimal"
"fedora" = "registry.fedoraproject.org/fedora"
# openSUSE
"opensuse/tumbleweed" = "registry.opensuse.org/opensuse/tumbleweed"
"opensuse/tumbleweed-dnf" = "registry.opensuse.org/opensuse/tumbleweed-dnf"
"opensuse/tumbleweed-microdnf" = "registry.opensuse.org/opensuse/tumbleweed-microdnf"
"opensuse/leap" = "registry.opensuse.org/opensuse/leap"
"opensuse/busybox" = "registry.opensuse.org/opensuse/busybox"
"tumbleweed" = "registry.opensuse.org/opensuse/tumbleweed"
"tumbleweed-dnf" = "registry.opensuse.org/opensuse/tumbleweed-dnf"
"tumbleweed-microdnf" = "registry.opensuse.org/opensuse/tumbleweed-microdnf"
"leap" = "registry.opensuse.org/opensuse/leap"
"leap-dnf" = "registry.opensuse.org/opensuse/leap-dnf"
"leap-microdnf" = "registry.opensuse.org/opensuse/leap-microdnf"
"tw-busybox" = "registry.opensuse.org/opensuse/busybox"
# SUSE
"suse/sle15" = "registry.suse.com/suse/sle15"
"suse/sles12sp5" = "registry.suse.com/suse/sles12sp5"
"suse/sles12sp4" = "registry.suse.com/suse/sles12sp4"
"suse/sles12sp3" = "registry.suse.com/suse/sles12sp3"
"sle15" = "registry.suse.com/suse/sle15"
"sles12sp5" = "registry.suse.com/suse/sles12sp5"
"sles12sp4" = "registry.suse.com/suse/sles12sp4"
"sles12sp3" = "registry.suse.com/suse/sles12sp3"
# Red Hat Enterprise Linux
"rhel" = "registry.access.redhat.com/rhel"
"rhel6" = "registry.access.redhat.com/rhel6"
"rhel7" = "registry.access.redhat.com/rhel7"
"ubi7" = "registry.access.redhat.com/ubi7"
"ubi7-init" = "registry.access.redhat.com/ubi7-init"
"ubi7-minimal" = "registry.access.redhat.com/ubi7-minimal"
"ubi8" = "registry.access.redhat.com/ubi8"
"ubi8-minimal" = "registry.access.redhat.com/ubi8-minimal"
"ubi8-init" = "registry.access.redhat.com/ubi8-init"
"ubi8-micro" = "registry.access.redhat.com/ubi8-micro"
"ubi8/ubi" = "registry.access.redhat.com/ubi8/ubi"
"ubi8/ubi-minimal" = "registry.access.redhat.com/ubi8-minimal"
"ubi8/ubi-init" = "registry.access.redhat.com/ubi8-init"
"ubi8/ubi-micro" = "registry.access.redhat.com/ubi8-micro"
# Rocky Linux
"rockylinux" = "docker.io/library/rockylinux"
# Debian
"debian" = "docker.io/library/debian"
# Kali Linux
"kali-bleeding-edge" = "docker.io/kalilinux/kali-bleeding-edge"
"kali-dev" = "docker.io/kalilinux/kali-dev"
"kali-experimental" = "docker.io/kalilinux/kali-experimental"
"kali-last-release" = "docker.io/kalilinux/kali-last-release"
"kali-rolling" = "docker.io/kalilinux/kali-rolling"
# Ubuntu
"ubuntu" = "docker.io/library/ubuntu"
# Oracle Linux
"oraclelinux" = "container-registry.oracle.com/os/oraclelinux"
# busybox
"busybox" = "docker.io/library/busybox"
# php
"php" = "docker.io/library/php"
# python
"python" = "docker.io/library/python"
# node
"node" = "docker.io/library/node"
+14
View File
@@ -0,0 +1,14 @@
# dnsmasq is the system resolver, the file /etc/resolv.conf is
# managed by openresolv. DHCP lease, VPN tunnel establishment,
# and similar events feed servers and configuration to dnsmasq.
domain-needed
#interface=lo
listen-address=127.0.0.1
enable-dbus
# Generated by openresolv
resolv-file=/var/lib/misc/resolv.conf
# Include all files in a directory which end in .conf
conf-dir=/etc/dnsmasq.d/,*.conf
+2
View File
@@ -0,0 +1,2 @@
set COLORTERM=yes
runparts /cfg/start.d
@@ -0,0 +1,2 @@
run [S] /lib/infix/sysctl-sync-ip-conf --
run [S] /lib/infix/nameif -- Probing network interfaces
@@ -0,0 +1,2 @@
task [S] /lib/infix/ssh-hostkeys --
service [2345789] <usr/ssh-hostkeys> /usr/sbin/sshd -D -- OpenSSH daemon
+1
View File
@@ -0,0 +1 @@
../available/sshd.conf
+25
View File
@@ -0,0 +1,25 @@
# Virtual filesystems
devtmpfs /dev devtmpfs defaults 0 0
mkdir#-p /dev/pts helper none 0 0
devpts /dev/pts devpts mode=620,ptmxmode=0666 0 0
mkdir#-p /dev/shm helper none 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
debugfs /sys/kernel/debug debugfs nofail 0 0
cfgfs /config configfs nofail,noauto 0 0
# Optional host share when running in Qemu
hostfs /host 9p nofail,cache=none,msize=16384 0 0
# The chosen backing storage for the overlays placed on /cfg, /etc,
# /home, /root, and /var, are determined dynamically by /lib/infix/mnt
# depending on the available devices.
mnttmp /mnt/tmp tmpfs defaults 0 0
LABEL=aux /mnt/aux auto noatime,nodiratime,noauto 0 0
LABEL=var /mnt/var auto noatime,nodiratime,noauto 0 0
LABEL=cfg /mnt/cfg auto noatime,nodiratime,noauto 0 0
hostfs /mnt/host 9p cache=none,msize=16384,noauto 0 0
/lib/infix/mnt# /cfg helper none 0 0
+1
View File
@@ -0,0 +1 @@
/mnt/aux/uboot.env 0 0x4000
+2
View File
@@ -0,0 +1,2 @@
1 port
2 iface
+1
View File
@@ -0,0 +1 @@
\s (\l)
+1
View File
@@ -0,0 +1 @@
\s
+3
View File
@@ -0,0 +1,3 @@
# /etc/mactab: rename interfaces, use 'eN' to classify as bridge ports
# MAC IFNAME
# 01:02:03:c0:ff:ee e0
+1
View File
@@ -0,0 +1 @@
make-backup-files 0
@@ -0,0 +1,2 @@
options bonding max_bonds=0
@@ -0,0 +1,2 @@
options dummy numdummies=0
+122
View File
@@ -0,0 +1,122 @@
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /restconf/ {
fastcgi_pass unix:/var/run/clixon/restconf.sock;
include fastcgi_params;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
+27
View File
@@ -0,0 +1,27 @@
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
if [ "$PS1" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
export PS1='# '
else
export PS1='$ '
fi
fi
export COLORTERM=truecolor
fi
export EDITOR='/bin/vi'
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
@@ -0,0 +1,20 @@
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
export EDITOR=/usr/bin/edit
alias vim='vi'
alias view='vi -R'
alias emacs='mg'
alias sensible-editor=edit
alias sensible-pager=pager
alias ip='ip --color=auto'
alias ipb='ip -br'
alias ipaddr='ip addr'
alias iplink='ip link'
alias bridge='bridge --color=auto'
alias cli='klish'
alias docker=podman
+1
View File
@@ -0,0 +1 @@
PS1='\u@\h:\w\$ '
@@ -0,0 +1,2 @@
TTY=`resize`
eval $TTY
+10
View File
@@ -0,0 +1,10 @@
# dnsmasq is the system resolver
name_servers="127.0.0.1"
resolv_conf=/etc/resolv.conf
resolv_conf_options="edns0 trust-ad"
# dnsmasq specific settings and list of
# nameservers in non-standard locations
dnsmasq_conf=/etc/dnsmasq.d/resolvconf.conf
dnsmasq_resolv=/var/lib/misc/resolv.conf
@@ -0,0 +1 @@
lo
+1
View File
@@ -0,0 +1 @@
Include /etc/ssh/sshd_config.d/*.conf
@@ -0,0 +1 @@
Subsystem cli /usr/bin/klish
@@ -0,0 +1,3 @@
HostKey /var/lib/ssh/ssh_host_rsa_key
HostKey /var/lib/ssh/ssh_host_ecdsa_key
HostKey /var/lib/ssh/ssh_host_ed25519_key
+68
View File
@@ -0,0 +1,68 @@
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
###################################################################
# Functions previously found in netbase
#
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1
###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
###################################################################
# Magic system request Key
# 0=disable, 1=enable all, >1 bitmask of sysrq functions
# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html
# for what other values do
#kernel.sysrq=438
@@ -0,0 +1,4 @@
# https://addiva-elektronik.github.io/2023/03/29/bridge-firewalling/
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
@@ -0,0 +1,2 @@
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
@@ -0,0 +1 @@
net.core.fb_tunnels_only_for_init_net=2
@@ -0,0 +1,3 @@
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
@@ -0,0 +1 @@
local7.* -/var/log/profinet.log
@@ -0,0 +1 @@
d /var/lib/chrony 0755 chrony chrony
@@ -0,0 +1,2 @@
d /var/cache/nginx 0755 www-data www-data

Some files were not shown because too many files have changed in this diff Show More