m/node: add /dev/tty0 and /dev/ttyS0 to erofs
... alongside a few other 'critical' /dev chardevs.
This is in preparation for making minit log into /dev/tty0 and
/dev/ttyS0, as currently it does not log at all (broken by
review.monogon.dev/517).
While we're at it, we chip away at the move-everything-to-fsspec
refactor, and unify initramfs/erofs /dev structure into a dedicated
fsspec file, plus move directories from extra_dirs into its own fsspec
file as well. Fsspec targets can now take files in the fsspecs
attribute, which we point at the newly created files.
Alternatively we could've made a 'fsspec_bundle' rule that would
generate an fsspec provider from a definition (either as native starlark
types or a prototext). We'll have to do something like this later so
that we can get rid of the files attribute in erofs_image, but let's not
make this change too large.
Since we've cleaned up some starlark attribute usage, we then pull on
that thread to remove some now unused code, like the builtin_fsspec
functionality for fsspec-based rules, and the extra_dirs attribute.
Change-Id: I0df6c60df20e38abfc9632d0a701d547292f3697
Reviewed-on: https://review.monogon.dev/c/monogon/+/650
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/build/earlydev.fsspec b/metropolis/node/build/earlydev.fsspec
new file mode 100644
index 0000000..0e88e43
--- /dev/null
+++ b/metropolis/node/build/earlydev.fsspec
@@ -0,0 +1,48 @@
+# Critical /dev files which should be present as early as possible, ie. be baked
+# into filesystem images.
+
+# At least /dev/console and /dev/null are required to exist for Linux
+# to properly boot an init. Here we additionally include important device nodes
+# like /dev/kmsg and /dev/ptmx which might need to be available before a proper
+# device manager (ie. devtmpfs) is launched.
+special_file <
+ path: "/dev/console"
+ type: CHARACTER_DEV
+ major: 1 minor: 1
+ mode: 0600 uid: 0 gid: 0
+>
+special_file <
+ path: "/dev/ptmx"
+ type: CHARACTER_DEV
+ major: 5 minor: 2
+ mode: 0644 uid: 0 gid: 0
+>
+special_file <
+ path: "/dev/null"
+ type: CHARACTER_DEV
+ major: 1 minor: 3
+ mode: 0644 uid: 0 gid: 0
+>
+special_file <
+ path: "/dev/kmsg"
+ type: CHARACTER_DEV
+ major: 1 minor: 11
+ mode: 0644 uid: 0 gid: 0
+>
+
+
+# Metropolis core logs to /dev/ttyS0 and /dev/tty0 by default, we want
+# these to also be present before devtmpfs is mounted so that minit can
+# log there, too.
+special_file <
+ path: "/dev/tty0"
+ type: CHARACTER_DEV
+ major: 4 minor: 0
+ mode: 0600 uid: 0 gid: 0
+>
+special_file <
+ path: "/dev/ttyS0"
+ type: CHARACTER_DEV
+ major: 4 minor: 64
+ mode: 0660 uid: 0 gid: 0
+>