Bring UKI to a working state (#97)

- Mount the needed base mounts (/proc /dev /sys /tmp)
 - Use our own console for yip (required to add the PATH under uki)
 - Order the DAG in a proper way (was out of order and not working)

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka
2023-03-14 10:33:38 +01:00
committed by GitHub
parent a66799f97c
commit 8f7d808dec
7 changed files with 175 additions and 21 deletions

View File

@@ -7,27 +7,31 @@ import (
// RegisterUKI registers the dag for booting from UKI.
func (s *State) RegisterUKI(g *herd.Graph) error {
// Write sentinel
s.LogIfError(s.WriteSentinelDagStep(g), "sentinel")
// Mount basic mounts
s.LogIfError(s.UKIMountBaseSystem(g), "mounting base mounts")
// Write sentinel
s.LogIfError(s.WriteSentinelDagStep(g, cnst.OpUkiBaseMounts), "sentinel")
// Load needed kernel modules
s.LogIfError(s.LoadKernelModules(g), "kernel modules")
// Udev for devices discovery
s.LogIfError(s.UKIUdevDaemon(g), "udev")
// Run rootfs stage
s.LogIfError(s.RootfsStageDagStep(g, cnst.OpSentinel), "uki rootfs")
s.LogIfError(s.RootfsStageDagStep(g, cnst.OpSentinel, cnst.OpUkiUdev), "uki rootfs")
// Remount root RO
s.LogIfError(s.UKIRemountRootRODagStep(g, cnst.OpRootfsHook), "remount root")
// Mount base overlay under /run/overlay
s.LogIfError(s.MountBaseOverlayDagStep(g), "base overlay")
s.LogIfError(s.UKIRemountRootRODagStep(g), "remount root")
// Populate state bind mounts, overlay mounts, custom-mounts from /run/cos/cos-layout.env
// Requires stage rootfs to have run, which usually creates the cos-layout.env file
s.LogIfError(s.LoadEnvLayoutDagStep(g, cnst.OpRootfsHook), "loading cos-layout.env")
// Mount base overlay under /run/overlay
s.LogIfError(s.MountBaseOverlayDagStep(g), "base overlay")
// Mount custom overlays loaded from the /run/cos/cos-layout.env file
s.LogIfError(s.MountCustomOverlayDagStep(g), "custom overlays mount")
@@ -47,6 +51,6 @@ func (s *State) RegisterUKI(g *herd.Graph) error {
herd.WithCallback(s.WriteFstab(s.path("/etc/fstab")))), "fstab")
// Handover to /sbin/init
_ = s.UKIBootInitDagStep(g, cnst.OpRemountRootRO, cnst.OpRootfsHook, cnst.OpInitramfsHook)
_ = s.UKIBootInitDagStep(g)
return nil
}