m/node: build Linux with modules

This introduces modules into our Linux build. I originally didn't want
to do this, this is why this wasn't done until now. But various things
in the kernel weren't set up for this, for example the AMD and Intel KVM
modules cannot both be loaded, only the first one loaded works. Also,
the Linux kernel cannot load firmware for built-in modules reliably as
the filesystem it tries to load it from is not always mounted first,
even if the kernel itself mounts it.

The firmware issue was brought up multiple times on LKML, but Linus is
of the opinion that the firmware should be next to the kernel module,
thus either built-in (not viable for licensing and size reasons) or the
modules need to be loadable and on the same filesystem as the firmware.

Thus unless we want to carry signifcant patches against the Kernel in a
deadlock-prone area, we are forced to adopt a design with loadable
modules (or ship everything twice in an initramfs which is also not
desirable).

The kernel config currently only has the modules as non-builtin which
require firmware, everything else has been left as-is. For boot-time
performance it would eventually be a good idea to move to a setup with
more modules once we're confident in the implementation and everything
can deal with late-loaded modules/devices.

As a drive-by fix this also moves the kernel builds to out-of-tree so
that we no longer pollute the source folder. Bazel protected us from
serious issues due to this, but it's still bad practice.

Change-Id: Iced8e12234565e5b7447e732716651e05e67d55b
Reviewed-on: https://review.monogon.dev/c/monogon/+/1791
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
10 files changed
tree: 4cff8bb2fac00df28699559256ce7649b38877e1
  1. .github/
  2. build/
  3. cloud/
  4. go/
  5. intellij/
  6. metropolis/
  7. net/
  8. third_party/
  9. tools/
  10. .bazelignore
  11. .bazelproject
  12. .bazelrc
  13. .bazelrc.sandboxroot
  14. .bazelversion
  15. .git-ignore-revs
  16. .gitignore
  17. BUILD.bazel
  18. CODING_STANDARDS.md
  19. go.mod
  20. go.sum
  21. LICENSE
  22. README.md
  23. SETUP.md
  24. WORKSPACE
README.md

Monogon Monorepo

This is the main repository containing the source code for the Monogon Platform.

This is pre-release software - take a look, and check back later!

Environment

Our build environment is self-contained and requires only minimal host dependencies:

  • A Linux machine or VM.
  • Bazelisk >= v1.15.0
  • A reasonably recent kernel with user namespaces enabled.
  • Working KVM with access to /dev/kvm (if you want to run tests).

Our docs assume that Bazelisk is available as bazel on your PATH.

Refer to SETUP.md for detailed instructions.

Monogon OS

Run a single node demo cluster

Build CLI and node image:

bazel build //metropolis/cli/dbg //:launch -c dbg

Launch an ephemeral test node:

bazel test //:launch -c dbg --test_output=streamed

Run a kubectl command while the test is running:

bazel-bin/metropolis/cli/dbg/dbg_/dbg kubectl describe node

Test suite

Run full test suite:

bazel test -c dbg //...