* [PATCH 0/4] Generate file lists from a script
@ 2025-09-04 1:56 Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 1/4] Move all files for the image into a subdirectory Demi Marie Obenour
` (4 more replies)
0 siblings, 5 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-04 1:56 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts.
Avoid this problem by moving the files used in the erofs images to an
image/ directory and using what Git knows about this directory to
generate the lists via a script. This makes maintenance easier and
avoids conflating code used in the build (anything not in image/) and
code for the image (anything that is in image/).
This reveals that there is a lot of duplicated make logic around image
generation, so consolidate it in a single makefile that is included by
all three of the makefiles. This, in turn, makes tree-wide changes
easier, as shown by the final patch in this series.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Demi Marie Obenour (4):
Move all files for the image into a subdirectory
Generate makefile file lists from a script
Common make rules for building erofs images
Use /etc/s6-rc/compiled for compiled s6-rc directory
Documentation/development/built-in-vms.adoc | 7 +
host/rootfs/Makefile | 144 +--------------------
host/rootfs/default.nix | 1 +
host/rootfs/file-list.mk | 100 ++++++++++++++
host/rootfs/{ => image}/bin | 0
host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
host/rootfs/{ => image}/etc/fstab | 0
host/rootfs/{ => image}/etc/group | 0
host/rootfs/{ => image}/etc/group.license | 0
host/rootfs/{ => image}/etc/init | 0
host/rootfs/{ => image}/etc/login | 0
host/rootfs/{ => image}/etc/mdev.conf | 0
host/rootfs/{ => image}/etc/mdev/listen | 0
host/rootfs/{ => image}/etc/mdev/net/add | 0
host/rootfs/{ => image}/etc/mdev/wait | 0
host/rootfs/{ => image}/etc/parse-devname | 0
host/rootfs/{ => image}/etc/passwd | 0
host/rootfs/{ => image}/etc/passwd.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../etc/s6-linux-init/run-image/opengl-driver | 0
.../run-image/service/dbus/notification-fd | 0
.../run-image/service/dbus/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/dbus/run | 0
.../service/dbus/template/notification-fd | 0
.../service/dbus/template/notification-fd.license | 0
.../run-image/service/dbus/template/run | 0
.../s6-linux-init/run-image/service/getty-tty1/run | 0
.../s6-linux-init/run-image/service/getty-tty2/run | 0
.../s6-linux-init/run-image/service/getty-tty3/run | 0
.../s6-linux-init/run-image/service/getty-tty4/run | 0
.../service/s6-svscan-log/notification-fd | 0
.../service/s6-svscan-log/notification-fd.license | 0
.../run-image/service/s6-svscan-log/run | 0
.../run-image/service/serial-getty-generator/run | 0
.../run-image/service/serial-getty/notification-fd | 0
.../service/serial-getty/notification-fd.license | 0
.../run-image/service/serial-getty/run | 0
.../run-image/service/serial-getty/template/run | 0
.../service/vhost-user-fs/notification-fd | 0
.../service/vhost-user-fs/notification-fd.license | 0
.../run-image/service/vhost-user-fs/run | 0
.../service/vhost-user-fs/template/notification-fd | 0
.../vhost-user-fs/template/notification-fd.license | 0
.../run-image/service/vhost-user-fs/template/run | 0
.../service/vhost-user-gpu/notification-fd | 0
.../service/vhost-user-gpu/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/run | 0
.../service/vhost-user-gpu/template/data/check | 0
.../vhost-user-gpu/template/notification-fd | 0
.../template/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/template/run | 0
.../run-image/service/vhost-user-gpu/template/type | 0
.../service/vhost-user-gpu/template/type.license | 0
.../run-image/service/vmm/notification-fd | 0
.../run-image/service/vmm/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vmm/run | 0
.../run-image/service/vmm/template/notification-fd | 0
.../service/vmm/template/notification-fd.license | 0
.../run-image/service/vmm/template/run | 0
.../notification-fd | 0
.../notification-fd.license | 0
.../service/xdg-desktop-portal-spectrum-host/run | 0
.../template/notification-fd | 0
.../template/notification-fd.license | 0
.../xdg-desktop-portal-spectrum-host/template/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 2 +-
host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
.../{ => image}/etc/s6-rc/card0/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
host/rootfs/{ => image}/etc/s6-rc/core/type | 0
.../rootfs/{ => image}/etc/s6-rc/core/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/core/up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
.../{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
.../{ => image}/etc/s6-rc/mdevd/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
.../{ => image}/etc/s6-rc/ok-all/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
.../etc/s6-rc/static-nodes/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
.../{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
.../{ => image}/etc/s6-rc/sys-vmms/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
.../{ => image}/etc/s6-rc/vm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
.../{ => image}/etc/s6-rc/vmm-env/type.license | 0
.../{ => image}/etc/s6-rc/weston/dependencies | 0
.../{ => image}/etc/s6-rc/weston/notification-fd | 0
.../etc/s6-rc/weston/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
.../{ => image}/etc/s6-rc/weston/type.license | 0
host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
host/rootfs/{ => image}/lib | 0
host/rootfs/{ => image}/sbin | 0
host/rootfs/{ => image}/usr/bin/assign-devices | 0
.../{ => image}/usr/bin/create-vm-dependencies | 0
host/rootfs/{ => image}/usr/bin/run-appimage | 0
host/rootfs/{ => image}/usr/bin/run-vmm | 0
host/rootfs/{ => image}/usr/bin/vm-console | 0
host/rootfs/{ => image}/usr/bin/vm-import | 0
host/rootfs/{ => image}/usr/bin/vm-start | 0
host/rootfs/{ => image}/usr/bin/vm-stop | 0
host/rootfs/{ => image}/usr/bin/xdg-open | 0
.../org.freedesktop.portal.Documents.service | 0
img/app/Makefile | 98 +-------------
img/app/default.nix | 1 +
img/app/file-list.mk | 65 ++++++++++
img/app/{ => image}/bin | 0
img/app/{ => image}/etc/dbus-1/session.conf | 0
img/app/{ => image}/etc/fonts/fonts.conf | 0
img/app/{ => image}/etc/fstab | 0
img/app/{ => image}/etc/init | 0
img/app/{ => image}/etc/mdev.conf | 0
img/app/{ => image}/etc/mdev/iface | 0
img/app/{ => image}/etc/mdev/listen | 0
img/app/{ => image}/etc/mdev/virtiofs | 0
img/app/{ => image}/etc/mdev/wait | 0
img/app/{ => image}/etc/passwd | 0
img/app/{ => image}/etc/passwd.license | 0
img/app/{ => image}/etc/pipewire/pipewire.conf | 0
img/app/{ => image}/etc/resolv.conf | 0
.../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
.../env/DBUS_SESSION_BUS_ADDRESS.license | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
.../etc/s6-linux-init/env/DISPLAY.license | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
.../s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
.../env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../s6-linux-init-shutdownd/notification-fd | 0
.../notification-fd.license | 0
.../run-image/service/s6-linux-init-shutdownd/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 2 +-
.../etc/s6-linux-init/scripts/rc.shutdown | 0
.../etc/s6-linux-init/scripts/rc.shutdown.final | 0
.../{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
.../etc/s6-rc/app/dependencies.d/pipewire | 0
.../s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
img/app/{ => image}/etc/s6-rc/app/run | 0
img/app/{ => image}/etc/s6-rc/app/type | 0
img/app/{ => image}/etc/s6-rc/app/type.license | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/dbus/run | 0
img/app/{ => image}/etc/s6-rc/dbus/type | 0
img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/mdevd/run | 0
img/app/{ => image}/etc/s6-rc/mdevd/type | 0
img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
img/app/{ => image}/etc/s6-rc/ok-all/type | 0
img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
.../{ => image}/etc/s6-rc/pipewire/notification-fd | 0
.../etc/s6-rc/pipewire/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/run | 0
img/app/{ => image}/etc/s6-rc/pipewire/type | 0
.../{ => image}/etc/s6-rc/pipewire/type.license | 0
.../etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
.../wayland-proxy-virtwl/notification-fd.license | 0
.../{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
.../etc/s6-rc/wayland-proxy-virtwl/type | 0
.../etc/s6-rc/wayland-proxy-virtwl/type.license | 0
.../etc/s6-rc/wireplumber/dependencies.d/dbus | 0
.../etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
.../{ => image}/etc/s6-rc/wireplumber/type.license | 0
.../{ => image}/etc/ssl/certs/ca-certificates.crt | 0
.../wireplumber.conf.d/99_spectrum.conf | 0
.../etc/xdg/xdg-desktop-portal/portals.conf | 0
img/app/{ => image}/sbin | 0
lib/common.mk | 1 +
lib/erofs.mk | 51 ++++++++
scripts/genfiles.awk | 115 ++++++++++++++++
vm/sys/net/Makefile | 68 +---------
vm/sys/net/default.nix | 1 +
vm/sys/net/file-list.mk | 41 ++++++
vm/sys/net/{ => image}/bin | 0
vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
vm/sys/net/{ => image}/etc/fstab | 0
vm/sys/net/{ => image}/etc/init | 0
vm/sys/net/{ => image}/etc/mdev.conf | 0
vm/sys/net/{ => image}/etc/mdev/iface | 0
vm/sys/net/{ => image}/etc/nftables.conf | 0
vm/sys/net/{ => image}/etc/passwd | 0
vm/sys/net/{ => image}/etc/passwd.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 2 +-
.../net/{ => image}/etc/s6-rc/connman/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
.../net/{ => image}/etc/s6-rc/connman/type.license | 0
.../net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
.../net/{ => image}/etc/s6-rc/mdevd/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
.../{ => image}/etc/s6-rc/nftables/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
.../net/{ => image}/etc/s6-rc/ok-all/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
.../net/{ => image}/etc/s6-rc/sysctl/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
vm/sys/net/{ => image}/etc/sysctl.conf | 0
vm/sys/net/{ => image}/lib | 0
vm/sys/net/{ => image}/sbin | 0
vm/sys/net/{ => image}/var/run | 0
251 files changed, 400 insertions(+), 299 deletions(-)
---
base-commit: 0ac65013a1a29e91ea8476f39113e3598eb0e535
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 1/4] Move all files for the image into a subdirectory
2025-09-04 1:56 [PATCH 0/4] Generate file lists from a script Demi Marie Obenour
@ 2025-09-04 1:56 ` Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 2/4] Generate makefile file lists from a script Demi Marie Obenour
` (3 subsequent siblings)
4 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-04 1:56 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
This avoids conflating files that will only be used during the build
with files that will be included in the generated image. It also makes
it vastly easier to generate the lists of files in the Makefile from a
script.
---
host/rootfs/Makefile | 8 ++++----
host/rootfs/{ => image}/bin | 0
host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
host/rootfs/{ => image}/etc/fstab | 0
host/rootfs/{ => image}/etc/group | 0
host/rootfs/{ => image}/etc/group.license | 0
host/rootfs/{ => image}/etc/init | 0
host/rootfs/{ => image}/etc/login | 0
host/rootfs/{ => image}/etc/mdev.conf | 0
host/rootfs/{ => image}/etc/mdev/listen | 0
host/rootfs/{ => image}/etc/mdev/net/add | 0
host/rootfs/{ => image}/etc/mdev/wait | 0
host/rootfs/{ => image}/etc/parse-devname | 0
host/rootfs/{ => image}/etc/passwd | 0
host/rootfs/{ => image}/etc/passwd.license | 0
host/rootfs/{ => image}/etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../{ => image}/etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
host/rootfs/{ => image}/etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../{ => image}/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
host/rootfs/{ => image}/etc/s6-linux-init/run-image/opengl-driver | 0
.../etc/s6-linux-init/run-image/service/dbus/notification-fd | 0
.../s6-linux-init/run-image/service/dbus/notification-fd.license | 0
.../{ => image}/etc/s6-linux-init/run-image/service/dbus/run | 0
.../s6-linux-init/run-image/service/dbus/template/notification-fd | 0
.../run-image/service/dbus/template/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/dbus/template/run | 0
.../etc/s6-linux-init/run-image/service/getty-tty1/run | 0
.../etc/s6-linux-init/run-image/service/getty-tty2/run | 0
.../etc/s6-linux-init/run-image/service/getty-tty3/run | 0
.../etc/s6-linux-init/run-image/service/getty-tty4/run | 0
.../s6-linux-init/run-image/service/s6-svscan-log/notification-fd | 0
.../run-image/service/s6-svscan-log/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/s6-svscan-log/run | 0
.../s6-linux-init/run-image/service/serial-getty-generator/run | 0
.../s6-linux-init/run-image/service/serial-getty/notification-fd | 0
.../run-image/service/serial-getty/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/serial-getty/run | 0
.../etc/s6-linux-init/run-image/service/serial-getty/template/run | 0
.../s6-linux-init/run-image/service/vhost-user-fs/notification-fd | 0
.../run-image/service/vhost-user-fs/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vhost-user-fs/run | 0
.../run-image/service/vhost-user-fs/template/notification-fd | 0
.../service/vhost-user-fs/template/notification-fd.license | 0
.../s6-linux-init/run-image/service/vhost-user-fs/template/run | 0
.../run-image/service/vhost-user-gpu/notification-fd | 0
.../run-image/service/vhost-user-gpu/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vhost-user-gpu/run | 0
.../run-image/service/vhost-user-gpu/template/data/check | 0
.../run-image/service/vhost-user-gpu/template/notification-fd | 0
.../service/vhost-user-gpu/template/notification-fd.license | 0
.../s6-linux-init/run-image/service/vhost-user-gpu/template/run | 0
.../s6-linux-init/run-image/service/vhost-user-gpu/template/type | 0
.../run-image/service/vhost-user-gpu/template/type.license | 0
.../etc/s6-linux-init/run-image/service/vmm/notification-fd | 0
.../s6-linux-init/run-image/service/vmm/notification-fd.license | 0
.../{ => image}/etc/s6-linux-init/run-image/service/vmm/run | 0
.../s6-linux-init/run-image/service/vmm/template/notification-fd | 0
.../run-image/service/vmm/template/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vmm/template/run | 0
.../service/xdg-desktop-portal-spectrum-host/notification-fd | 0
.../xdg-desktop-portal-spectrum-host/notification-fd.license | 0
.../run-image/service/xdg-desktop-portal-spectrum-host/run | 0
.../xdg-desktop-portal-spectrum-host/template/notification-fd | 0
.../template/notification-fd.license | 0
.../service/xdg-desktop-portal-spectrum-host/template/run | 0
host/rootfs/{ => image}/etc/s6-linux-init/scripts/rc.init | 0
host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
host/rootfs/{ => image}/etc/s6-rc/card0/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
host/rootfs/{ => image}/etc/s6-rc/core/type | 0
host/rootfs/{ => image}/etc/s6-rc/core/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/core/up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/notification-fd | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/weston/notification-fd | 0
host/rootfs/{ => image}/etc/s6-rc/weston/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type.license | 0
host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
host/rootfs/{ => image}/lib | 0
host/rootfs/{ => image}/sbin | 0
host/rootfs/{ => image}/usr/bin/assign-devices | 0
host/rootfs/{ => image}/usr/bin/create-vm-dependencies | 0
host/rootfs/{ => image}/usr/bin/run-appimage | 0
host/rootfs/{ => image}/usr/bin/run-vmm | 0
host/rootfs/{ => image}/usr/bin/vm-console | 0
host/rootfs/{ => image}/usr/bin/vm-import | 0
host/rootfs/{ => image}/usr/bin/vm-start | 0
host/rootfs/{ => image}/usr/bin/vm-stop | 0
host/rootfs/{ => image}/usr/bin/xdg-open | 0
.../dbus-1/services/org.freedesktop.portal.Documents.service | 0
img/app/Makefile | 8 ++++----
img/app/{ => image}/bin | 0
img/app/{ => image}/etc/dbus-1/session.conf | 0
img/app/{ => image}/etc/fonts/fonts.conf | 0
img/app/{ => image}/etc/fstab | 0
img/app/{ => image}/etc/init | 0
img/app/{ => image}/etc/mdev.conf | 0
img/app/{ => image}/etc/mdev/iface | 0
img/app/{ => image}/etc/mdev/listen | 0
img/app/{ => image}/etc/mdev/virtiofs | 0
img/app/{ => image}/etc/mdev/wait | 0
img/app/{ => image}/etc/passwd | 0
img/app/{ => image}/etc/passwd.license | 0
img/app/{ => image}/etc/pipewire/pipewire.conf | 0
img/app/{ => image}/etc/resolv.conf | 0
.../{ => image}/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
.../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY.license | 0
img/app/{ => image}/etc/s6-linux-init/env/GTK_USE_PORTAL | 0
img/app/{ => image}/etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
.../{ => image}/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
.../etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
img/app/{ => image}/etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
img/app/{ => image}/etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
img/app/{ => image}/etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
img/app/{ => image}/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../etc/s6-linux-init/run-image/service/getty-hvc0/run | 0
.../run-image/service/s6-linux-init-shutdownd/notification-fd | 0
.../service/s6-linux-init-shutdownd/notification-fd.license | 0
.../s6-linux-init/run-image/service/s6-linux-init-shutdownd/run | 0
img/app/{ => image}/etc/s6-linux-init/scripts/rc.init | 0
img/app/{ => image}/etc/s6-linux-init/scripts/rc.shutdown | 0
img/app/{ => image}/etc/s6-linux-init/scripts/rc.shutdown.final | 0
img/app/{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
img/app/{ => image}/etc/s6-rc/app/dependencies.d/pipewire | 0
.../{ => image}/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
img/app/{ => image}/etc/s6-rc/app/run | 0
img/app/{ => image}/etc/s6-rc/app/type | 0
img/app/{ => image}/etc/s6-rc/app/type.license | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/dbus/run | 0
img/app/{ => image}/etc/s6-rc/dbus/type | 0
img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/dependencies | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
img/app/{ => image}/etc/s6-rc/mdevd/notification-fd | 0
img/app/{ => image}/etc/s6-rc/mdevd/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/mdevd/run | 0
img/app/{ => image}/etc/s6-rc/mdevd/type | 0
img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
img/app/{ => image}/etc/s6-rc/ok-all/type | 0
img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/notification-fd | 0
img/app/{ => image}/etc/s6-rc/pipewire/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/run | 0
img/app/{ => image}/etc/s6-rc/pipewire/type | 0
img/app/{ => image}/etc/s6-rc/pipewire/type.license | 0
.../{ => image}/etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
.../etc/s6-rc/wayland-proxy-virtwl/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
img/app/{ => image}/etc/s6-rc/wayland-proxy-virtwl/type | 0
img/app/{ => image}/etc/s6-rc/wayland-proxy-virtwl/type.license | 0
img/app/{ => image}/etc/s6-rc/wireplumber/dependencies.d/dbus | 0
img/app/{ => image}/etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type.license | 0
img/app/{ => image}/etc/ssl/certs/ca-certificates.crt | 0
.../etc/wireplumber/wireplumber.conf.d/99_spectrum.conf | 0
img/app/{ => image}/etc/xdg/xdg-desktop-portal/portals.conf | 0
img/app/{ => image}/sbin | 0
vm/sys/net/Makefile | 8 ++++----
vm/sys/net/{ => image}/bin | 0
vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
vm/sys/net/{ => image}/etc/fstab | 0
vm/sys/net/{ => image}/etc/init | 0
vm/sys/net/{ => image}/etc/mdev.conf | 0
vm/sys/net/{ => image}/etc/mdev/iface | 0
vm/sys/net/{ => image}/etc/nftables.conf | 0
vm/sys/net/{ => image}/etc/passwd | 0
vm/sys/net/{ => image}/etc/passwd.license | 0
.../etc/s6-linux-init/run-image/service/getty-hvc0/run | 0
vm/sys/net/{ => image}/etc/s6-linux-init/scripts/rc.init | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/notification-fd | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
vm/sys/net/{ => image}/etc/sysctl.conf | 0
vm/sys/net/{ => image}/lib | 0
vm/sys/net/{ => image}/sbin | 0
vm/sys/net/{ => image}/var/run | 0
241 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index f677fe580f2e2be58113457e63468d97f49a49f6..3e77bb8c9ff0dfe8c9325c470fb1c632876c3dc3 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -112,10 +112,10 @@ LINKS = \
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo
( \
cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(DIRS) ;\
printf 'build/fifo\n%s\n' $(FIFOS) ;\
@@ -165,12 +165,12 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES))
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/host/rootfs/bin b/host/rootfs/image/bin
similarity index 100%
rename from host/rootfs/bin
rename to host/rootfs/image/bin
diff --git a/host/rootfs/etc/fonts/fonts.conf b/host/rootfs/image/etc/fonts/fonts.conf
similarity index 100%
rename from host/rootfs/etc/fonts/fonts.conf
rename to host/rootfs/image/etc/fonts/fonts.conf
diff --git a/host/rootfs/etc/fstab b/host/rootfs/image/etc/fstab
similarity index 100%
rename from host/rootfs/etc/fstab
rename to host/rootfs/image/etc/fstab
diff --git a/host/rootfs/etc/group b/host/rootfs/image/etc/group
similarity index 100%
rename from host/rootfs/etc/group
rename to host/rootfs/image/etc/group
diff --git a/host/rootfs/etc/group.license b/host/rootfs/image/etc/group.license
similarity index 100%
rename from host/rootfs/etc/group.license
rename to host/rootfs/image/etc/group.license
diff --git a/host/rootfs/etc/init b/host/rootfs/image/etc/init
similarity index 100%
rename from host/rootfs/etc/init
rename to host/rootfs/image/etc/init
diff --git a/host/rootfs/etc/login b/host/rootfs/image/etc/login
similarity index 100%
rename from host/rootfs/etc/login
rename to host/rootfs/image/etc/login
diff --git a/host/rootfs/etc/mdev.conf b/host/rootfs/image/etc/mdev.conf
similarity index 100%
rename from host/rootfs/etc/mdev.conf
rename to host/rootfs/image/etc/mdev.conf
diff --git a/host/rootfs/etc/mdev/listen b/host/rootfs/image/etc/mdev/listen
similarity index 100%
rename from host/rootfs/etc/mdev/listen
rename to host/rootfs/image/etc/mdev/listen
diff --git a/host/rootfs/etc/mdev/net/add b/host/rootfs/image/etc/mdev/net/add
similarity index 100%
rename from host/rootfs/etc/mdev/net/add
rename to host/rootfs/image/etc/mdev/net/add
diff --git a/host/rootfs/etc/mdev/wait b/host/rootfs/image/etc/mdev/wait
similarity index 100%
rename from host/rootfs/etc/mdev/wait
rename to host/rootfs/image/etc/mdev/wait
diff --git a/host/rootfs/etc/parse-devname b/host/rootfs/image/etc/parse-devname
similarity index 100%
rename from host/rootfs/etc/parse-devname
rename to host/rootfs/image/etc/parse-devname
diff --git a/host/rootfs/etc/passwd b/host/rootfs/image/etc/passwd
similarity index 100%
rename from host/rootfs/etc/passwd
rename to host/rootfs/image/etc/passwd
diff --git a/host/rootfs/etc/passwd.license b/host/rootfs/image/etc/passwd.license
similarity index 100%
rename from host/rootfs/etc/passwd.license
rename to host/rootfs/image/etc/passwd.license
diff --git a/host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY b/host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY
rename to host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
diff --git a/host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY.license b/host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
rename to host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
diff --git a/host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR b/host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR
rename to host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
diff --git a/host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license b/host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
rename to host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/opengl-driver b/host/rootfs/image/etc/s6-linux-init/run-image/opengl-driver
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/opengl-driver
rename to host/rootfs/image/etc/s6-linux-init/run-image/opengl-driver
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty1/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty1/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty1/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty1/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty2/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty2/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty2/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty2/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty3/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty3/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty3/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty3/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty4/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty4/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty4/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty4/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty-generator/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty-generator/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
diff --git a/host/rootfs/etc/s6-linux-init/scripts/rc.init b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/scripts/rc.init
rename to host/rootfs/image/etc/s6-linux-init/scripts/rc.init
diff --git a/host/rootfs/etc/s6-rc/card0/type b/host/rootfs/image/etc/s6-rc/card0/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/type
rename to host/rootfs/image/etc/s6-rc/card0/type
diff --git a/host/rootfs/etc/s6-rc/card0/type.license b/host/rootfs/image/etc/s6-rc/card0/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/type.license
rename to host/rootfs/image/etc/s6-rc/card0/type.license
diff --git a/host/rootfs/etc/s6-rc/card0/up b/host/rootfs/image/etc/s6-rc/card0/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/up
rename to host/rootfs/image/etc/s6-rc/card0/up
diff --git a/host/rootfs/etc/s6-rc/core/type b/host/rootfs/image/etc/s6-rc/core/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/type
rename to host/rootfs/image/etc/s6-rc/core/type
diff --git a/host/rootfs/etc/s6-rc/core/type.license b/host/rootfs/image/etc/s6-rc/core/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/type.license
rename to host/rootfs/image/etc/s6-rc/core/type.license
diff --git a/host/rootfs/etc/s6-rc/core/up b/host/rootfs/image/etc/s6-rc/core/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/up
rename to host/rootfs/image/etc/s6-rc/core/up
diff --git a/host/rootfs/etc/s6-rc/kvm/timeout-up b/host/rootfs/image/etc/s6-rc/kvm/timeout-up
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/timeout-up
rename to host/rootfs/image/etc/s6-rc/kvm/timeout-up
diff --git a/host/rootfs/etc/s6-rc/kvm/timeout-up.license b/host/rootfs/image/etc/s6-rc/kvm/timeout-up.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/timeout-up.license
rename to host/rootfs/image/etc/s6-rc/kvm/timeout-up.license
diff --git a/host/rootfs/etc/s6-rc/kvm/type b/host/rootfs/image/etc/s6-rc/kvm/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/type
rename to host/rootfs/image/etc/s6-rc/kvm/type
diff --git a/host/rootfs/etc/s6-rc/kvm/type.license b/host/rootfs/image/etc/s6-rc/kvm/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/type.license
rename to host/rootfs/image/etc/s6-rc/kvm/type.license
diff --git a/host/rootfs/etc/s6-rc/kvm/up b/host/rootfs/image/etc/s6-rc/kvm/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/up
rename to host/rootfs/image/etc/s6-rc/kvm/up
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/dependencies b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/dependencies
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/type b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/type
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/type.license b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/type.license
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/up b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/up
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/host/rootfs/etc/s6-rc/mdevd/notification-fd b/host/rootfs/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/notification-fd
rename to host/rootfs/image/etc/s6-rc/mdevd/notification-fd
diff --git a/host/rootfs/etc/s6-rc/mdevd/notification-fd.license b/host/rootfs/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/notification-fd.license
rename to host/rootfs/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/host/rootfs/etc/s6-rc/mdevd/run b/host/rootfs/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/run
rename to host/rootfs/image/etc/s6-rc/mdevd/run
diff --git a/host/rootfs/etc/s6-rc/mdevd/type b/host/rootfs/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/type
rename to host/rootfs/image/etc/s6-rc/mdevd/type
diff --git a/host/rootfs/etc/s6-rc/mdevd/type.license b/host/rootfs/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/type.license
rename to host/rootfs/image/etc/s6-rc/mdevd/type.license
diff --git a/host/rootfs/etc/s6-rc/ok-all/contents b/host/rootfs/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/contents
rename to host/rootfs/image/etc/s6-rc/ok-all/contents
diff --git a/host/rootfs/etc/s6-rc/ok-all/type b/host/rootfs/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/type
rename to host/rootfs/image/etc/s6-rc/ok-all/type
diff --git a/host/rootfs/etc/s6-rc/ok-all/type.license b/host/rootfs/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/type.license
rename to host/rootfs/image/etc/s6-rc/ok-all/type.license
diff --git a/host/rootfs/etc/s6-rc/static-nodes/type b/host/rootfs/image/etc/s6-rc/static-nodes/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/type
rename to host/rootfs/image/etc/s6-rc/static-nodes/type
diff --git a/host/rootfs/etc/s6-rc/static-nodes/type.license b/host/rootfs/image/etc/s6-rc/static-nodes/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/type.license
rename to host/rootfs/image/etc/s6-rc/static-nodes/type.license
diff --git a/host/rootfs/etc/s6-rc/static-nodes/up b/host/rootfs/image/etc/s6-rc/static-nodes/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/up
rename to host/rootfs/image/etc/s6-rc/static-nodes/up
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/dependencies b/host/rootfs/image/etc/s6-rc/sys-vmms/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/dependencies
rename to host/rootfs/image/etc/s6-rc/sys-vmms/dependencies
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/type b/host/rootfs/image/etc/s6-rc/sys-vmms/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/type
rename to host/rootfs/image/etc/s6-rc/sys-vmms/type
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/type.license b/host/rootfs/image/etc/s6-rc/sys-vmms/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/type.license
rename to host/rootfs/image/etc/s6-rc/sys-vmms/type.license
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/up b/host/rootfs/image/etc/s6-rc/sys-vmms/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/up
rename to host/rootfs/image/etc/s6-rc/sys-vmms/up
diff --git a/host/rootfs/etc/s6-rc/vm-env/contents b/host/rootfs/image/etc/s6-rc/vm-env/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/contents
rename to host/rootfs/image/etc/s6-rc/vm-env/contents
diff --git a/host/rootfs/etc/s6-rc/vm-env/type b/host/rootfs/image/etc/s6-rc/vm-env/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/type
rename to host/rootfs/image/etc/s6-rc/vm-env/type
diff --git a/host/rootfs/etc/s6-rc/vm-env/type.license b/host/rootfs/image/etc/s6-rc/vm-env/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/type.license
rename to host/rootfs/image/etc/s6-rc/vm-env/type.license
diff --git a/host/rootfs/etc/s6-rc/vmm-env/contents b/host/rootfs/image/etc/s6-rc/vmm-env/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/contents
rename to host/rootfs/image/etc/s6-rc/vmm-env/contents
diff --git a/host/rootfs/etc/s6-rc/vmm-env/type b/host/rootfs/image/etc/s6-rc/vmm-env/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/type
rename to host/rootfs/image/etc/s6-rc/vmm-env/type
diff --git a/host/rootfs/etc/s6-rc/vmm-env/type.license b/host/rootfs/image/etc/s6-rc/vmm-env/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/type.license
rename to host/rootfs/image/etc/s6-rc/vmm-env/type.license
diff --git a/host/rootfs/etc/s6-rc/weston/dependencies b/host/rootfs/image/etc/s6-rc/weston/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/dependencies
rename to host/rootfs/image/etc/s6-rc/weston/dependencies
diff --git a/host/rootfs/etc/s6-rc/weston/notification-fd b/host/rootfs/image/etc/s6-rc/weston/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/notification-fd
rename to host/rootfs/image/etc/s6-rc/weston/notification-fd
diff --git a/host/rootfs/etc/s6-rc/weston/notification-fd.license b/host/rootfs/image/etc/s6-rc/weston/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/notification-fd.license
rename to host/rootfs/image/etc/s6-rc/weston/notification-fd.license
diff --git a/host/rootfs/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/run
rename to host/rootfs/image/etc/s6-rc/weston/run
diff --git a/host/rootfs/etc/s6-rc/weston/type b/host/rootfs/image/etc/s6-rc/weston/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/type
rename to host/rootfs/image/etc/s6-rc/weston/type
diff --git a/host/rootfs/etc/s6-rc/weston/type.license b/host/rootfs/image/etc/s6-rc/weston/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/type.license
rename to host/rootfs/image/etc/s6-rc/weston/type.license
diff --git a/host/rootfs/etc/xdg/weston/autolaunch b/host/rootfs/image/etc/xdg/weston/autolaunch
similarity index 100%
rename from host/rootfs/etc/xdg/weston/autolaunch
rename to host/rootfs/image/etc/xdg/weston/autolaunch
diff --git a/host/rootfs/etc/xdg/weston/weston.ini b/host/rootfs/image/etc/xdg/weston/weston.ini
similarity index 100%
rename from host/rootfs/etc/xdg/weston/weston.ini
rename to host/rootfs/image/etc/xdg/weston/weston.ini
diff --git a/host/rootfs/lib b/host/rootfs/image/lib
similarity index 100%
rename from host/rootfs/lib
rename to host/rootfs/image/lib
diff --git a/host/rootfs/sbin b/host/rootfs/image/sbin
similarity index 100%
rename from host/rootfs/sbin
rename to host/rootfs/image/sbin
diff --git a/host/rootfs/usr/bin/assign-devices b/host/rootfs/image/usr/bin/assign-devices
similarity index 100%
rename from host/rootfs/usr/bin/assign-devices
rename to host/rootfs/image/usr/bin/assign-devices
diff --git a/host/rootfs/usr/bin/create-vm-dependencies b/host/rootfs/image/usr/bin/create-vm-dependencies
similarity index 100%
rename from host/rootfs/usr/bin/create-vm-dependencies
rename to host/rootfs/image/usr/bin/create-vm-dependencies
diff --git a/host/rootfs/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
similarity index 100%
rename from host/rootfs/usr/bin/run-appimage
rename to host/rootfs/image/usr/bin/run-appimage
diff --git a/host/rootfs/usr/bin/run-vmm b/host/rootfs/image/usr/bin/run-vmm
similarity index 100%
rename from host/rootfs/usr/bin/run-vmm
rename to host/rootfs/image/usr/bin/run-vmm
diff --git a/host/rootfs/usr/bin/vm-console b/host/rootfs/image/usr/bin/vm-console
similarity index 100%
rename from host/rootfs/usr/bin/vm-console
rename to host/rootfs/image/usr/bin/vm-console
diff --git a/host/rootfs/usr/bin/vm-import b/host/rootfs/image/usr/bin/vm-import
similarity index 100%
rename from host/rootfs/usr/bin/vm-import
rename to host/rootfs/image/usr/bin/vm-import
diff --git a/host/rootfs/usr/bin/vm-start b/host/rootfs/image/usr/bin/vm-start
similarity index 100%
rename from host/rootfs/usr/bin/vm-start
rename to host/rootfs/image/usr/bin/vm-start
diff --git a/host/rootfs/usr/bin/vm-stop b/host/rootfs/image/usr/bin/vm-stop
similarity index 100%
rename from host/rootfs/usr/bin/vm-stop
rename to host/rootfs/image/usr/bin/vm-stop
diff --git a/host/rootfs/usr/bin/xdg-open b/host/rootfs/image/usr/bin/xdg-open
similarity index 100%
rename from host/rootfs/usr/bin/xdg-open
rename to host/rootfs/image/usr/bin/xdg-open
diff --git a/host/rootfs/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service b/host/rootfs/image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
similarity index 100%
rename from host/rootfs/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
rename to host/rootfs/image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
diff --git a/img/app/Makefile b/img/app/Makefile
index 9665a6b7158f2d8b183831202a4559ae06d53d16..e3bee305339a84ae2cc7f1b6c12c50ff7eafb051 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -76,10 +76,10 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(VM_FILES)) $(VM_BUILD_FILES) build/empty build/fifo
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(VM_FILES) $(VM_LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
@@ -113,12 +113,12 @@ VM_S6_RC_FILES = \
etc/s6-rc/wireplumber/run \
etc/s6-rc/wireplumber/type
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(addprefix image/,$(VM_S6_RC_FILES))
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -C image -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/bin b/img/app/image/bin
similarity index 100%
rename from img/app/bin
rename to img/app/image/bin
diff --git a/img/app/etc/dbus-1/session.conf b/img/app/image/etc/dbus-1/session.conf
similarity index 100%
rename from img/app/etc/dbus-1/session.conf
rename to img/app/image/etc/dbus-1/session.conf
diff --git a/img/app/etc/fonts/fonts.conf b/img/app/image/etc/fonts/fonts.conf
similarity index 100%
rename from img/app/etc/fonts/fonts.conf
rename to img/app/image/etc/fonts/fonts.conf
diff --git a/img/app/etc/fstab b/img/app/image/etc/fstab
similarity index 100%
rename from img/app/etc/fstab
rename to img/app/image/etc/fstab
diff --git a/img/app/etc/init b/img/app/image/etc/init
similarity index 100%
rename from img/app/etc/init
rename to img/app/image/etc/init
diff --git a/img/app/etc/mdev.conf b/img/app/image/etc/mdev.conf
similarity index 100%
rename from img/app/etc/mdev.conf
rename to img/app/image/etc/mdev.conf
diff --git a/img/app/etc/mdev/iface b/img/app/image/etc/mdev/iface
similarity index 100%
rename from img/app/etc/mdev/iface
rename to img/app/image/etc/mdev/iface
diff --git a/img/app/etc/mdev/listen b/img/app/image/etc/mdev/listen
similarity index 100%
rename from img/app/etc/mdev/listen
rename to img/app/image/etc/mdev/listen
diff --git a/img/app/etc/mdev/virtiofs b/img/app/image/etc/mdev/virtiofs
similarity index 100%
rename from img/app/etc/mdev/virtiofs
rename to img/app/image/etc/mdev/virtiofs
diff --git a/img/app/etc/mdev/wait b/img/app/image/etc/mdev/wait
similarity index 100%
rename from img/app/etc/mdev/wait
rename to img/app/image/etc/mdev/wait
diff --git a/img/app/etc/passwd b/img/app/image/etc/passwd
similarity index 100%
rename from img/app/etc/passwd
rename to img/app/image/etc/passwd
diff --git a/img/app/etc/passwd.license b/img/app/image/etc/passwd.license
similarity index 100%
rename from img/app/etc/passwd.license
rename to img/app/image/etc/passwd.license
diff --git a/img/app/etc/pipewire/pipewire.conf b/img/app/image/etc/pipewire/pipewire.conf
similarity index 100%
rename from img/app/etc/pipewire/pipewire.conf
rename to img/app/image/etc/pipewire/pipewire.conf
diff --git a/img/app/etc/resolv.conf b/img/app/image/etc/resolv.conf
similarity index 100%
rename from img/app/etc/resolv.conf
rename to img/app/image/etc/resolv.conf
diff --git a/img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS b/img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
rename to img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
diff --git a/img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license b/img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
rename to img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
diff --git a/img/app/etc/s6-linux-init/env/DISPLAY b/img/app/image/etc/s6-linux-init/env/DISPLAY
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DISPLAY
rename to img/app/image/etc/s6-linux-init/env/DISPLAY
diff --git a/img/app/etc/s6-linux-init/env/DISPLAY.license b/img/app/image/etc/s6-linux-init/env/DISPLAY.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DISPLAY.license
rename to img/app/image/etc/s6-linux-init/env/DISPLAY.license
diff --git a/img/app/etc/s6-linux-init/env/GTK_USE_PORTAL b/img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL
similarity index 100%
rename from img/app/etc/s6-linux-init/env/GTK_USE_PORTAL
rename to img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL
diff --git a/img/app/etc/s6-linux-init/env/GTK_USE_PORTAL.license b/img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/GTK_USE_PORTAL.license
rename to img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL.license
diff --git a/img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR b/img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
similarity index 100%
rename from img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
rename to img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
diff --git a/img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license b/img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
rename to img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
diff --git a/img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY b/img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
similarity index 100%
rename from img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY
rename to img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
diff --git a/img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY.license b/img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
rename to img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
diff --git a/img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR b/img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
similarity index 100%
rename from img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR
rename to img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
diff --git a/img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license b/img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
rename to img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
diff --git a/img/app/etc/s6-linux-init/run-image/service/getty-hvc0/run b/img/app/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/getty-hvc0/run
rename to img/app/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
diff --git a/img/app/etc/s6-linux-init/scripts/rc.init b/img/app/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.init
rename to img/app/image/etc/s6-linux-init/scripts/rc.init
diff --git a/img/app/etc/s6-linux-init/scripts/rc.shutdown b/img/app/image/etc/s6-linux-init/scripts/rc.shutdown
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.shutdown
rename to img/app/image/etc/s6-linux-init/scripts/rc.shutdown
diff --git a/img/app/etc/s6-linux-init/scripts/rc.shutdown.final b/img/app/image/etc/s6-linux-init/scripts/rc.shutdown.final
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.shutdown.final
rename to img/app/image/etc/s6-linux-init/scripts/rc.shutdown.final
diff --git a/img/app/etc/s6-rc/app/dependencies.d/dbus b/img/app/image/etc/s6-rc/app/dependencies.d/dbus
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/dbus
rename to img/app/image/etc/s6-rc/app/dependencies.d/dbus
diff --git a/img/app/etc/s6-rc/app/dependencies.d/pipewire b/img/app/image/etc/s6-rc/app/dependencies.d/pipewire
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/pipewire
rename to img/app/image/etc/s6-rc/app/dependencies.d/pipewire
diff --git a/img/app/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl b/img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
rename to img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
diff --git a/img/app/etc/s6-rc/app/run b/img/app/image/etc/s6-rc/app/run
similarity index 100%
rename from img/app/etc/s6-rc/app/run
rename to img/app/image/etc/s6-rc/app/run
diff --git a/img/app/etc/s6-rc/app/type b/img/app/image/etc/s6-rc/app/type
similarity index 100%
rename from img/app/etc/s6-rc/app/type
rename to img/app/image/etc/s6-rc/app/type
diff --git a/img/app/etc/s6-rc/app/type.license b/img/app/image/etc/s6-rc/app/type.license
similarity index 100%
rename from img/app/etc/s6-rc/app/type.license
rename to img/app/image/etc/s6-rc/app/type.license
diff --git a/img/app/etc/s6-rc/dbus/notification-fd b/img/app/image/etc/s6-rc/dbus/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/dbus/notification-fd
rename to img/app/image/etc/s6-rc/dbus/notification-fd
diff --git a/img/app/etc/s6-rc/dbus/notification-fd.license b/img/app/image/etc/s6-rc/dbus/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/dbus/notification-fd.license
rename to img/app/image/etc/s6-rc/dbus/notification-fd.license
diff --git a/img/app/etc/s6-rc/dbus/run b/img/app/image/etc/s6-rc/dbus/run
similarity index 100%
rename from img/app/etc/s6-rc/dbus/run
rename to img/app/image/etc/s6-rc/dbus/run
diff --git a/img/app/etc/s6-rc/dbus/type b/img/app/image/etc/s6-rc/dbus/type
similarity index 100%
rename from img/app/etc/s6-rc/dbus/type
rename to img/app/image/etc/s6-rc/dbus/type
diff --git a/img/app/etc/s6-rc/dbus/type.license b/img/app/image/etc/s6-rc/dbus/type.license
similarity index 100%
rename from img/app/etc/s6-rc/dbus/type.license
rename to img/app/image/etc/s6-rc/dbus/type.license
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/dependencies b/img/app/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/dependencies
rename to img/app/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/type b/img/app/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/type
rename to img/app/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/type.license b/img/app/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/type.license
rename to img/app/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/up b/img/app/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/up
rename to img/app/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/img/app/etc/s6-rc/mdevd/notification-fd b/img/app/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/notification-fd
rename to img/app/image/etc/s6-rc/mdevd/notification-fd
diff --git a/img/app/etc/s6-rc/mdevd/notification-fd.license b/img/app/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/notification-fd.license
rename to img/app/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/img/app/etc/s6-rc/mdevd/run b/img/app/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/run
rename to img/app/image/etc/s6-rc/mdevd/run
diff --git a/img/app/etc/s6-rc/mdevd/type b/img/app/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/type
rename to img/app/image/etc/s6-rc/mdevd/type
diff --git a/img/app/etc/s6-rc/mdevd/type.license b/img/app/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/type.license
rename to img/app/image/etc/s6-rc/mdevd/type.license
diff --git a/img/app/etc/s6-rc/ok-all/contents b/img/app/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/contents
rename to img/app/image/etc/s6-rc/ok-all/contents
diff --git a/img/app/etc/s6-rc/ok-all/type b/img/app/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/type
rename to img/app/image/etc/s6-rc/ok-all/type
diff --git a/img/app/etc/s6-rc/ok-all/type.license b/img/app/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/type.license
rename to img/app/image/etc/s6-rc/ok-all/type.license
diff --git a/img/app/etc/s6-rc/pipewire/notification-fd b/img/app/image/etc/s6-rc/pipewire/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/notification-fd
rename to img/app/image/etc/s6-rc/pipewire/notification-fd
diff --git a/img/app/etc/s6-rc/pipewire/notification-fd.license b/img/app/image/etc/s6-rc/pipewire/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/notification-fd.license
rename to img/app/image/etc/s6-rc/pipewire/notification-fd.license
diff --git a/img/app/etc/s6-rc/pipewire/run b/img/app/image/etc/s6-rc/pipewire/run
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/run
rename to img/app/image/etc/s6-rc/pipewire/run
diff --git a/img/app/etc/s6-rc/pipewire/type b/img/app/image/etc/s6-rc/pipewire/type
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/type
rename to img/app/image/etc/s6-rc/pipewire/type
diff --git a/img/app/etc/s6-rc/pipewire/type.license b/img/app/image/etc/s6-rc/pipewire/type.license
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/type.license
rename to img/app/image/etc/s6-rc/pipewire/type.license
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/run b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/run
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/type b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/type
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/type.license b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/type.license
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
diff --git a/img/app/etc/s6-rc/wireplumber/dependencies.d/dbus b/img/app/image/etc/s6-rc/wireplumber/dependencies.d/dbus
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/dependencies.d/dbus
rename to img/app/image/etc/s6-rc/wireplumber/dependencies.d/dbus
diff --git a/img/app/etc/s6-rc/wireplumber/dependencies.d/pipewire b/img/app/image/etc/s6-rc/wireplumber/dependencies.d/pipewire
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/dependencies.d/pipewire
rename to img/app/image/etc/s6-rc/wireplumber/dependencies.d/pipewire
diff --git a/img/app/etc/s6-rc/wireplumber/run b/img/app/image/etc/s6-rc/wireplumber/run
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/run
rename to img/app/image/etc/s6-rc/wireplumber/run
diff --git a/img/app/etc/s6-rc/wireplumber/type b/img/app/image/etc/s6-rc/wireplumber/type
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/type
rename to img/app/image/etc/s6-rc/wireplumber/type
diff --git a/img/app/etc/s6-rc/wireplumber/type.license b/img/app/image/etc/s6-rc/wireplumber/type.license
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/type.license
rename to img/app/image/etc/s6-rc/wireplumber/type.license
diff --git a/img/app/etc/ssl/certs/ca-certificates.crt b/img/app/image/etc/ssl/certs/ca-certificates.crt
similarity index 100%
rename from img/app/etc/ssl/certs/ca-certificates.crt
rename to img/app/image/etc/ssl/certs/ca-certificates.crt
diff --git a/img/app/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf b/img/app/image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
similarity index 100%
rename from img/app/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
rename to img/app/image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
diff --git a/img/app/etc/xdg/xdg-desktop-portal/portals.conf b/img/app/image/etc/xdg/xdg-desktop-portal/portals.conf
similarity index 100%
rename from img/app/etc/xdg/xdg-desktop-portal/portals.conf
rename to img/app/image/etc/xdg/xdg-desktop-portal/portals.conf
diff --git a/img/app/sbin b/img/app/image/sbin
similarity index 100%
rename from img/app/sbin
rename to img/app/image/sbin
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index e6819400b2079e3eaa9d24737b2fc4b816a592c8..e7024fb5011ed9dbf706b9de6083c80e344b24e3 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -50,10 +50,10 @@ VM_BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(VM_FILES)) $(VM_BUILD_FILES) build/empty
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(VM_FILES) $(VM_LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
@@ -78,12 +78,12 @@ VM_S6_RC_FILES = \
etc/s6-rc/sysctl/type \
etc/s6-rc/sysctl/up
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(addprefix image/,$(VM_S6_RC_FILES))
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -C image -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/bin b/vm/sys/net/image/bin
similarity index 100%
rename from vm/sys/net/bin
rename to vm/sys/net/image/bin
diff --git a/vm/sys/net/etc/dbus-1/system.conf b/vm/sys/net/image/etc/dbus-1/system.conf
similarity index 100%
rename from vm/sys/net/etc/dbus-1/system.conf
rename to vm/sys/net/image/etc/dbus-1/system.conf
diff --git a/vm/sys/net/etc/fstab b/vm/sys/net/image/etc/fstab
similarity index 100%
rename from vm/sys/net/etc/fstab
rename to vm/sys/net/image/etc/fstab
diff --git a/vm/sys/net/etc/init b/vm/sys/net/image/etc/init
similarity index 100%
rename from vm/sys/net/etc/init
rename to vm/sys/net/image/etc/init
diff --git a/vm/sys/net/etc/mdev.conf b/vm/sys/net/image/etc/mdev.conf
similarity index 100%
rename from vm/sys/net/etc/mdev.conf
rename to vm/sys/net/image/etc/mdev.conf
diff --git a/vm/sys/net/etc/mdev/iface b/vm/sys/net/image/etc/mdev/iface
similarity index 100%
rename from vm/sys/net/etc/mdev/iface
rename to vm/sys/net/image/etc/mdev/iface
diff --git a/vm/sys/net/etc/nftables.conf b/vm/sys/net/image/etc/nftables.conf
similarity index 100%
rename from vm/sys/net/etc/nftables.conf
rename to vm/sys/net/image/etc/nftables.conf
diff --git a/vm/sys/net/etc/passwd b/vm/sys/net/image/etc/passwd
similarity index 100%
rename from vm/sys/net/etc/passwd
rename to vm/sys/net/image/etc/passwd
diff --git a/vm/sys/net/etc/passwd.license b/vm/sys/net/image/etc/passwd.license
similarity index 100%
rename from vm/sys/net/etc/passwd.license
rename to vm/sys/net/image/etc/passwd.license
diff --git a/vm/sys/net/etc/s6-linux-init/run-image/service/getty-hvc0/run b/vm/sys/net/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
similarity index 100%
rename from vm/sys/net/etc/s6-linux-init/run-image/service/getty-hvc0/run
rename to vm/sys/net/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
diff --git a/vm/sys/net/etc/s6-linux-init/scripts/rc.init b/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from vm/sys/net/etc/s6-linux-init/scripts/rc.init
rename to vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
diff --git a/vm/sys/net/etc/s6-rc/connman/dependencies b/vm/sys/net/image/etc/s6-rc/connman/dependencies
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/dependencies
rename to vm/sys/net/image/etc/s6-rc/connman/dependencies
diff --git a/vm/sys/net/etc/s6-rc/connman/run b/vm/sys/net/image/etc/s6-rc/connman/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/run
rename to vm/sys/net/image/etc/s6-rc/connman/run
diff --git a/vm/sys/net/etc/s6-rc/connman/type b/vm/sys/net/image/etc/s6-rc/connman/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/type
rename to vm/sys/net/image/etc/s6-rc/connman/type
diff --git a/vm/sys/net/etc/s6-rc/connman/type.license b/vm/sys/net/image/etc/s6-rc/connman/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/type.license
rename to vm/sys/net/image/etc/s6-rc/connman/type.license
diff --git a/vm/sys/net/etc/s6-rc/dbus/notification-fd b/vm/sys/net/image/etc/s6-rc/dbus/notification-fd
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/notification-fd
rename to vm/sys/net/image/etc/s6-rc/dbus/notification-fd
diff --git a/vm/sys/net/etc/s6-rc/dbus/notification-fd.license b/vm/sys/net/image/etc/s6-rc/dbus/notification-fd.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/notification-fd.license
rename to vm/sys/net/image/etc/s6-rc/dbus/notification-fd.license
diff --git a/vm/sys/net/etc/s6-rc/dbus/run b/vm/sys/net/image/etc/s6-rc/dbus/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/run
rename to vm/sys/net/image/etc/s6-rc/dbus/run
diff --git a/vm/sys/net/etc/s6-rc/dbus/type b/vm/sys/net/image/etc/s6-rc/dbus/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/type
rename to vm/sys/net/image/etc/s6-rc/dbus/type
diff --git a/vm/sys/net/etc/s6-rc/dbus/type.license b/vm/sys/net/image/etc/s6-rc/dbus/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/type.license
rename to vm/sys/net/image/etc/s6-rc/dbus/type.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/dependencies b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/dependencies
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/type b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/type
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/type.license b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/type.license
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/up b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/up
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/vm/sys/net/etc/s6-rc/mdevd/notification-fd b/vm/sys/net/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/notification-fd
rename to vm/sys/net/image/etc/s6-rc/mdevd/notification-fd
diff --git a/vm/sys/net/etc/s6-rc/mdevd/notification-fd.license b/vm/sys/net/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/notification-fd.license
rename to vm/sys/net/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd/run b/vm/sys/net/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/run
rename to vm/sys/net/image/etc/s6-rc/mdevd/run
diff --git a/vm/sys/net/etc/s6-rc/mdevd/type b/vm/sys/net/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/type
rename to vm/sys/net/image/etc/s6-rc/mdevd/type
diff --git a/vm/sys/net/etc/s6-rc/mdevd/type.license b/vm/sys/net/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/type.license
rename to vm/sys/net/image/etc/s6-rc/mdevd/type.license
diff --git a/vm/sys/net/etc/s6-rc/nftables/type b/vm/sys/net/image/etc/s6-rc/nftables/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/type
rename to vm/sys/net/image/etc/s6-rc/nftables/type
diff --git a/vm/sys/net/etc/s6-rc/nftables/type.license b/vm/sys/net/image/etc/s6-rc/nftables/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/type.license
rename to vm/sys/net/image/etc/s6-rc/nftables/type.license
diff --git a/vm/sys/net/etc/s6-rc/nftables/up b/vm/sys/net/image/etc/s6-rc/nftables/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/up
rename to vm/sys/net/image/etc/s6-rc/nftables/up
diff --git a/vm/sys/net/etc/s6-rc/ok-all/contents b/vm/sys/net/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/contents
rename to vm/sys/net/image/etc/s6-rc/ok-all/contents
diff --git a/vm/sys/net/etc/s6-rc/ok-all/type b/vm/sys/net/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/type
rename to vm/sys/net/image/etc/s6-rc/ok-all/type
diff --git a/vm/sys/net/etc/s6-rc/ok-all/type.license b/vm/sys/net/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/type.license
rename to vm/sys/net/image/etc/s6-rc/ok-all/type.license
diff --git a/vm/sys/net/etc/s6-rc/sysctl/type b/vm/sys/net/image/etc/s6-rc/sysctl/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/type
rename to vm/sys/net/image/etc/s6-rc/sysctl/type
diff --git a/vm/sys/net/etc/s6-rc/sysctl/type.license b/vm/sys/net/image/etc/s6-rc/sysctl/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/type.license
rename to vm/sys/net/image/etc/s6-rc/sysctl/type.license
diff --git a/vm/sys/net/etc/s6-rc/sysctl/up b/vm/sys/net/image/etc/s6-rc/sysctl/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/up
rename to vm/sys/net/image/etc/s6-rc/sysctl/up
diff --git a/vm/sys/net/etc/sysctl.conf b/vm/sys/net/image/etc/sysctl.conf
similarity index 100%
rename from vm/sys/net/etc/sysctl.conf
rename to vm/sys/net/image/etc/sysctl.conf
diff --git a/vm/sys/net/lib b/vm/sys/net/image/lib
similarity index 100%
rename from vm/sys/net/lib
rename to vm/sys/net/image/lib
diff --git a/vm/sys/net/sbin b/vm/sys/net/image/sbin
similarity index 100%
rename from vm/sys/net/sbin
rename to vm/sys/net/image/sbin
diff --git a/vm/sys/net/var/run b/vm/sys/net/image/var/run
similarity index 100%
rename from vm/sys/net/var/run
rename to vm/sys/net/image/var/run
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH 2/4] Generate makefile file lists from a script
2025-09-04 1:56 [PATCH 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 1/4] Move all files for the image into a subdirectory Demi Marie Obenour
@ 2025-09-04 1:56 ` Demi Marie Obenour
2025-09-08 9:59 ` Alyssa Ross
2025-09-04 1:56 ` [PATCH 3/4] Common make rules for building erofs images Demi Marie Obenour
` (2 subsequent siblings)
4 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-04 1:56 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
The script will always get them right, whereas humans (the author of
this commit included) generally will not.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 107 ++------------------------
host/rootfs/file-list.mk | 100 ++++++++++++++++++++++++
img/app/Makefile | 74 +++---------------
img/app/file-list.mk | 65 ++++++++++++++++
lib/common.mk | 1 +
scripts/genfiles.awk | 115 ++++++++++++++++++++++++++++
vm/sys/net/Makefile | 51 +++---------
vm/sys/net/file-list.mk | 41 ++++++++++
9 files changed, 357 insertions(+), 204 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..82d78705a6020bbdb06fbc123a32dbdd6fd50085 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -44,6 +44,13 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for the VM image is stored in a separate file,
+`file-lists.mk`. You can edit it manually when developing. However,
+after each commit that adds or removes files from it, you should run
+`make update-file-list`, which will regenerate it from the output of
+`git ls-files`. Any changes you made will be lost. This ensures
+that the file lists are always in sync with the git repository.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 3e77bb8c9ff0dfe8c9325c470fb1c632876c3dc3..3560707d21bcf53e4f3ad5e916d21e8be56cc3a1 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- etc/fonts/fonts.conf \
- etc/fstab \
- etc/group \
- etc/init \
- etc/login \
- etc/mdev.conf \
- etc/mdev/listen \
- etc/mdev/net/add \
- etc/mdev/wait \
- etc/parse-devname \
- etc/passwd \
- etc/s6-linux-init/env/WAYLAND_DISPLAY \
- etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- etc/s6-linux-init/run-image/service/dbus/notification-fd \
- etc/s6-linux-init/run-image/service/dbus/run \
- etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- etc/s6-linux-init/run-image/service/dbus/template/run \
- etc/s6-linux-init/run-image/service/getty-tty1/run \
- etc/s6-linux-init/run-image/service/getty-tty2/run \
- etc/s6-linux-init/run-image/service/getty-tty3/run \
- etc/s6-linux-init/run-image/service/getty-tty4/run \
- etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- etc/s6-linux-init/run-image/service/serial-getty/run \
- etc/s6-linux-init/run-image/service/serial-getty/template/run \
- etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- etc/s6-linux-init/run-image/service/vmm/notification-fd \
- etc/s6-linux-init/run-image/service/vmm/run \
- etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/xdg/weston/autolaunch \
- etc/xdg/weston/weston.ini \
- usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
- usr/bin/assign-devices \
- usr/bin/create-vm-dependencies \
- usr/bin/run-appimage \
- usr/bin/run-vmm \
- usr/bin/vm-console \
- usr/bin/vm-import \
- usr/bin/vm-start \
- usr/bin/vm-stop \
- usr/bin/xdg-open
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- bin \
- etc/s6-linux-init/run-image/opengl-driver \
- etc/s6-linux-init/run-image/service/vmm/template/run \
- lib \
- sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
@@ -128,36 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- etc/s6-rc/card0/type \
- etc/s6-rc/card0/up \
- etc/s6-rc/core/type \
- etc/s6-rc/core/up \
- etc/s6-rc/kvm/timeout-up \
- etc/s6-rc/kvm/type \
- etc/s6-rc/kvm/up \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/static-nodes/type \
- etc/s6-rc/static-nodes/up \
- etc/s6-rc/sys-vmms/dependencies \
- etc/s6-rc/sys-vmms/type \
- etc/s6-rc/sys-vmms/up \
- etc/s6-rc/vm-env/contents \
- etc/s6-rc/vm-env/type \
- etc/s6-rc/vmm-env/contents \
- etc/s6-rc/vmm-env/type \
- etc/s6-rc/weston/dependencies \
- etc/s6-rc/weston/notification-fd \
- etc/s6-rc/weston/type \
- etc/s6-rc/weston/run
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -165,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES))
+build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
@@ -207,6 +111,11 @@ debug:
$(VMLINUX)
.PHONY: debug
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
@set -x && \
ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..0817887d0bb25ab47e777f6a130a3b6214b25f0f
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyRightText: Not Copyrightable (machine-written)
+# Generated by scripts/genfile.awk, DO NOT EDIT!
+override FILES ::= \
+ etc/fonts/fonts.conf \
+ etc/fstab \
+ etc/group \
+ etc/init \
+ etc/login \
+ etc/mdev.conf \
+ etc/mdev/listen \
+ etc/mdev/net/add \
+ etc/mdev/wait \
+ etc/parse-devname \
+ etc/passwd \
+ etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ etc/s6-linux-init/run-image/service/dbus/run \
+ etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ etc/s6-linux-init/run-image/service/dbus/template/run \
+ etc/s6-linux-init/run-image/service/getty-tty1/run \
+ etc/s6-linux-init/run-image/service/getty-tty2/run \
+ etc/s6-linux-init/run-image/service/getty-tty3/run \
+ etc/s6-linux-init/run-image/service/getty-tty4/run \
+ etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ etc/s6-linux-init/run-image/service/serial-getty/run \
+ etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type \
+ etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ etc/s6-linux-init/run-image/service/vmm/run \
+ etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ etc/s6-linux-init/scripts/rc.init \
+ etc/xdg/weston/autolaunch \
+ etc/xdg/weston/weston.ini \
+ usr/bin/assign-devices \
+ usr/bin/create-vm-dependencies \
+ usr/bin/run-appimage \
+ usr/bin/run-vmm \
+ usr/bin/vm-console \
+ usr/bin/vm-import \
+ usr/bin/vm-start \
+ usr/bin/vm-stop \
+ usr/bin/xdg-open \
+ usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+override LINKS ::= \
+ bin \
+ etc/s6-linux-init/run-image/opengl-driver \
+ etc/s6-linux-init/run-image/service/vmm/template/run \
+ lib \
+ sbin
+
+override S6_RC_FILES ::= \
+ etc/s6-rc/card0/type \
+ etc/s6-rc/card0/up \
+ etc/s6-rc/core/type \
+ etc/s6-rc/core/up \
+ etc/s6-rc/kvm/timeout-up \
+ etc/s6-rc/kvm/type \
+ etc/s6-rc/kvm/up \
+ etc/s6-rc/mdevd-coldplug/dependencies \
+ etc/s6-rc/mdevd-coldplug/type \
+ etc/s6-rc/mdevd-coldplug/up \
+ etc/s6-rc/mdevd/notification-fd \
+ etc/s6-rc/mdevd/run \
+ etc/s6-rc/mdevd/type \
+ etc/s6-rc/ok-all/contents \
+ etc/s6-rc/ok-all/type \
+ etc/s6-rc/static-nodes/type \
+ etc/s6-rc/static-nodes/up \
+ etc/s6-rc/sys-vmms/dependencies \
+ etc/s6-rc/sys-vmms/type \
+ etc/s6-rc/sys-vmms/up \
+ etc/s6-rc/vm-env/contents \
+ etc/s6-rc/vm-env/type \
+ etc/s6-rc/vmm-env/contents \
+ etc/s6-rc/vmm-env/type \
+ etc/s6-rc/weston/dependencies \
+ etc/s6-rc/weston/notification-fd \
+ etc/s6-rc/weston/run \
+ etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index e3bee305339a84ae2cc7f1b6c12c50ff7eafb051..5bb1a6a2f9acd13aba95abb0e918a7f21943b230 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,44 +30,12 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- etc/dbus-1/session.conf \
- etc/fonts/fonts.conf \
- etc/fstab \
- etc/init \
- etc/mdev.conf \
- etc/mdev/iface \
- etc/mdev/listen \
- etc/mdev/virtiofs \
- etc/mdev/wait \
- etc/passwd \
- etc/pipewire/pipewire.conf \
- etc/resolv.conf \
- etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- etc/s6-linux-init/env/DISPLAY \
- etc/s6-linux-init/env/GTK_USE_PORTAL \
- etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- etc/s6-linux-init/env/WAYLAND_DISPLAY \
- etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- etc/s6-linux-init/run-image/service/getty-hvc0/run \
- etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/s6-linux-init/scripts/rc.shutdown \
- etc/s6-linux-init/scripts/rc.shutdown.final \
- etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- etc/xdg/xdg-desktop-portal/portals.conf
-
VM_DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = bin etc/ssl/certs/ca-certificates.crt sbin
-
VM_BUILD_FILES = build/etc/s6-rc
build/fifo:
@@ -76,49 +45,21 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(VM_FILES)) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
+ for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- etc/s6-rc/app/dependencies.d/dbus \
- etc/s6-rc/app/dependencies.d/pipewire \
- etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- etc/s6-rc/app/run \
- etc/s6-rc/app/type \
- etc/s6-rc/dbus/notification-fd \
- etc/s6-rc/dbus/run \
- etc/s6-rc/dbus/type \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/pipewire/notification-fd \
- etc/s6-rc/pipewire/run \
- etc/s6-rc/pipewire/type \
- etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- etc/s6-rc/wayland-proxy-virtwl/run \
- etc/s6-rc/wayland-proxy-virtwl/type \
- etc/s6-rc/wireplumber/dependencies.d/dbus \
- etc/s6-rc/wireplumber/dependencies.d/pipewire \
- etc/s6-rc/wireplumber/run \
- etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(addprefix image/,$(VM_S6_RC_FILES))
+build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -C image -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
@@ -197,6 +138,11 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
$(KERNEL)
.PHONY: run-crosvm
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: run-$(VMM)
.PHONY: run
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..f689ef55c530dfbe456eef1a9239ca671ddc6f49
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyRightText: Not Copyrightable (machine-written)
+# Generated by scripts/genfile.awk, DO NOT EDIT!
+override FILES ::= \
+ etc/dbus-1/session.conf \
+ etc/fonts/fonts.conf \
+ etc/fstab \
+ etc/init \
+ etc/mdev.conf \
+ etc/mdev/iface \
+ etc/mdev/listen \
+ etc/mdev/virtiofs \
+ etc/mdev/wait \
+ etc/passwd \
+ etc/pipewire/pipewire.conf \
+ etc/resolv.conf \
+ etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ etc/s6-linux-init/env/DISPLAY \
+ etc/s6-linux-init/env/GTK_USE_PORTAL \
+ etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ etc/s6-linux-init/scripts/rc.init \
+ etc/s6-linux-init/scripts/rc.shutdown \
+ etc/s6-linux-init/scripts/rc.shutdown.final \
+ etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ etc/xdg/xdg-desktop-portal/portals.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+override LINKS ::= \
+ bin \
+ etc/ssl/certs/ca-certificates.crt \
+ sbin
+
+override S6_RC_FILES ::= \
+ etc/s6-rc/app/dependencies.d/dbus \
+ etc/s6-rc/app/dependencies.d/pipewire \
+ etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ etc/s6-rc/app/run \
+ etc/s6-rc/app/type \
+ etc/s6-rc/dbus/notification-fd \
+ etc/s6-rc/dbus/run \
+ etc/s6-rc/dbus/type \
+ etc/s6-rc/mdevd-coldplug/dependencies \
+ etc/s6-rc/mdevd-coldplug/type \
+ etc/s6-rc/mdevd-coldplug/up \
+ etc/s6-rc/mdevd/notification-fd \
+ etc/s6-rc/mdevd/run \
+ etc/s6-rc/mdevd/type \
+ etc/s6-rc/ok-all/contents \
+ etc/s6-rc/ok-all/type \
+ etc/s6-rc/pipewire/notification-fd \
+ etc/s6-rc/pipewire/run \
+ etc/s6-rc/pipewire/type \
+ etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ etc/s6-rc/wayland-proxy-virtwl/run \
+ etc/s6-rc/wayland-proxy-virtwl/type \
+ etc/s6-rc/wireplumber/dependencies.d/dbus \
+ etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ etc/s6-rc/wireplumber/run \
+ etc/s6-rc/wireplumber/type
diff --git a/lib/common.mk b/lib/common.mk
index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
BACKGROUND = background
CPIO = cpio
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100755
index 0000000000000000000000000000000000000000..62863e78f157f1d9a0f6dbdb0f4380db9c9d48cb
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,115 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+function check_status(status) {
+ if (status < 0) {
+ printf "FATAL: getline: %s\n", status > "/dev/stderr";
+ exit 1;
+ }
+ return status;
+}
+
+function check_close(value, status) {
+ status = check_status(close(value));
+ if (status != 0) {
+ printf "FATAL: command exited with status %d\n", status > "/dev/stderr";
+ exit status;
+ }
+}
+
+function shell_quote(command) {
+ gsub(/'/, "'\\\\&'", command);
+ return ("'" command "'");
+}
+
+function get(command, line, path, array_index, inode_type, mode, modes, symlink_count, symlinks, file_count, files, rc_count, rc_files, is_license, is_rc) {
+ file_count = 0;
+ symlink_count = 0;
+ rc_count = 0;
+ modes["120000"] = "symlink";
+ modes["040644"] = "directory";
+ modes["040755"] = "directory";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+ print "# SPDX-License-Identifier: CC0-1.0";
+ print "# SPDX-FileCopyRightText: Not Copyrightable (machine-written)";
+ print "# Generated by scripts/genfile.awk, DO NOT EDIT!";
+ while (check_status(command | getline line)) {
+ if (line !~ /^[0-7]{6}\t/) {
+ # this is a git bug
+ print "FATAL: git ls-files output didn't start with a valid mode" > "/dev/stderr";
+ exit 1;
+ }
+ path = substr(line, 8);
+ if (path !~ /^[ -~]+$/) {
+ # also a git bug
+ print "FATAL: git ls-files didn't quote properly" > "/dev/stderr";
+ exit 1;
+ }
+ if (path ~ /^\/|((^|\/)\.{0,2}($|\/))/) {
+ # also a git bug
+ printf "FATAL: git ls-files output non-canonical path '%s'\n", path > "/dev/stderr";
+ exit 1;
+ }
+ if (path !~ /^[[:alnum:]_.+@/-]+$/) {
+ printf "FATAL: filename '%s' has forbidden characters\n", path > "/dev/stderr";
+ exit 1;
+ }
+ mode = modes[substr(line, 1, 6)];
+ is_license = path ~ /\.license$/;
+ is_rc = path ~ /^etc\/s6-rc\//;
+ if (mode == "regular") {
+ if (is_license) {
+ continue;
+ }
+ if (is_rc) {
+ rc_count += 1;
+ rc_files[rc_count] = path;
+ } else {
+ file_count += 1;
+ files[file_count] = path;
+ }
+ continue;
+ }
+ if (mode == "symlink") {
+ if (is_rc) {
+ printf "FATAL: symlink in s6-rc-compile input: %s\n", path;
+ exit 1;
+ }
+ symlink_count += 1;
+ symlinks[symlink_count] = path;
+ } else if (mode != "directory") {
+ printf "FATAL: file %s has unknown mode %s\n", path, substr(line, 1, 6) > "/dev/stderr";
+ exit 1;
+ }
+ if (is_license) {
+ printf "FATAL: %s (type %s) ends in .license\n", path, mode > "/dev/stderr";
+ exit 1;
+ }
+ }
+ check_close(command);
+
+ printf "override FILES ::=";
+ for (array_index = 1; array_index <= file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index];
+ }
+ printf ("\n\n" \
+"# These are separate because they need to be included, but putting\n" \
+"# them as make dependencies would confuse make.\n" \
+"override LINKS ::=");
+ for (array_index = 1; array_index <= symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index];
+ }
+ printf "\n\noverride S6_RC_FILES ::=";
+ for (array_index = 1; array_index <= rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index];
+ }
+ printf "\n"
+}
+
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ get("set -euo pipefail && { git -c core.quotePath=true -C " shell_quote(ARGV[1]) " ls-files '--format=%(objectmode)\t%(path)' -- .|sort -t '\t' -k 2;}");
+ exit 0;
+}
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index e7024fb5011ed9dbf706b9de6083c80e344b24e3..e731bcea7fc61f9b2019689e52a600f3741dd55f 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,25 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- etc/dbus-1/system.conf \
- etc/fstab \
- etc/init \
- etc/mdev.conf \
- etc/mdev/iface \
- etc/nftables.conf \
- etc/passwd \
- etc/s6-linux-init/run-image/service/getty-hvc0/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = bin lib sbin var/run
-
VM_BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(VM_FILES)) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
+ for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- etc/s6-rc/connman/dependencies \
- etc/s6-rc/connman/run \
- etc/s6-rc/connman/type \
- etc/s6-rc/dbus/notification-fd \
- etc/s6-rc/dbus/run \
- etc/s6-rc/dbus/type \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/nftables/type \
- etc/s6-rc/nftables/up \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/sysctl/type \
- etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(addprefix image/,$(VM_S6_RC_FILES))
+build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -C image -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
@@ -138,6 +102,11 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
$(KERNEL)
.PHONY: run-crosvm
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: run-$(VMM)
.PHONY: run
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..1614b8e64297fd977fb4c9acdb3205069516dad1
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyRightText: Not Copyrightable (machine-written)
+# Generated by scripts/genfile.awk, DO NOT EDIT!
+override FILES ::= \
+ etc/dbus-1/system.conf \
+ etc/fstab \
+ etc/init \
+ etc/mdev.conf \
+ etc/mdev/iface \
+ etc/nftables.conf \
+ etc/passwd \
+ etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ etc/s6-linux-init/scripts/rc.init \
+ etc/sysctl.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+override LINKS ::= \
+ bin \
+ lib \
+ sbin
+
+override S6_RC_FILES ::= \
+ etc/s6-rc/connman/dependencies \
+ etc/s6-rc/connman/run \
+ etc/s6-rc/connman/type \
+ etc/s6-rc/dbus/notification-fd \
+ etc/s6-rc/dbus/run \
+ etc/s6-rc/dbus/type \
+ etc/s6-rc/mdevd-coldplug/dependencies \
+ etc/s6-rc/mdevd-coldplug/type \
+ etc/s6-rc/mdevd-coldplug/up \
+ etc/s6-rc/mdevd/notification-fd \
+ etc/s6-rc/mdevd/run \
+ etc/s6-rc/mdevd/type \
+ etc/s6-rc/nftables/type \
+ etc/s6-rc/nftables/up \
+ etc/s6-rc/ok-all/contents \
+ etc/s6-rc/ok-all/type \
+ etc/s6-rc/sysctl/type \
+ etc/s6-rc/sysctl/up
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH 3/4] Common make rules for building erofs images
2025-09-04 1:56 [PATCH 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 1/4] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 2/4] Generate makefile file lists from a script Demi Marie Obenour
@ 2025-09-04 1:56 ` Demi Marie Obenour
2025-09-08 10:01 ` Alyssa Ross
2025-09-04 1:56 ` [PATCH 4/4] Use /etc/s6-rc/compiled for compiled s6-rc directory Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
4 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-04 1:56 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
Instead of duplicating the logic in three different places, write common
code for all three makefiles to use instead. This will make future
changes much easier.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/Makefile | 51 ++++---------------------------------------------
host/rootfs/default.nix | 1 +
img/app/Makefile | 42 ++++------------------------------------
img/app/default.nix | 1 +
lib/erofs.mk | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
vm/sys/net/Makefile | 35 +++------------------------------
vm/sys/net/default.nix | 1 +
7 files changed, 65 insertions(+), 117 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 3560707d21bcf53e4f3ad5e916d21e8be56cc3a1..dce8315fe5be19d2569d6c9a429276e4abd696ad 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,11 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include ../../lib/erofs.mk
include file-list.mk
-dest = build/rootfs.erofs
-
-DIRS = \
+override DIRS ::= \
dev \
etc/s6-linux-init/env \
etc/s6-linux-init/run-image/configs \
@@ -42,46 +41,9 @@ DIRS = \
proc \
sys
-FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-
-BUILD_FILES = build/etc/s6-rc
-
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- printf 'build/fifo\n%s\n' $(FIFOS) ;\
- ) | ../../scripts/make-erofs.sh $@
-
-build/fifo:
- mkdir -p build
- mkfifo -m 0600 $@
-
-build/empty:
- mkdir -p $@
+override FIFOS ::= etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# s6-rc-compile's input is a directory, but that doesn't play nice
-# with Make, because it won't know to update if some file in the
-# directory is changed, or a file is created or removed in a
-# subdirectory. Using the whole source directory could also end up
-# including files that aren't intended to be part of the input, like
-# temporary editor files or .license files. So for all these reasons,
-# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- dir=$$(mktemp -d) && \
- tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
-
-clean:
- -chmod -Rf +w build
- rm -rf build
-.PHONY: clean
+all: $(dest)
# veritysetup format produces two files, but Make only (portably)
# supports one output per rule, so we combine the two outputs then
@@ -111,11 +73,6 @@ debug:
$(VMLINUX)
.PHONY: debug
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
@set -x && \
ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 998220d7b6ed322f64ee52c704e71ec9b4643f59..561bf660829dcd5f5e2ee841662727b262d43ed3 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -178,6 +178,7 @@ stdenvNoCC.mkDerivation {
fileset = fileset.intersection src (fileset.unions [
./.
../../lib/common.mk
+ ../../lib/erofs.mk
../../scripts/make-erofs.sh
]);
};
diff --git a/img/app/Makefile b/img/app/Makefile
index 5bb1a6a2f9acd13aba95abb0e918a7f21943b230..0c3a8311973f5f82eb2af6ea3ba43f67d36dec2e 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include ../../lib/erofs.mk
include file-list.mk
prefix = build/host
@@ -18,7 +19,6 @@ HOST_BUILD_FILES = \
$(imgdir)/appvm/vmlinux
all: $(HOST_BUILD_FILES)
-.PHONY: all
$(imgdir)/appvm/vmlinux: $(KERNEL)
mkdir -p $$(dirname $@)
@@ -30,38 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-VM_BUILD_FILES = build/etc/s6-rc
-
-build/fifo:
- mkdir -p build
- mkfifo -m 0600 $@
-
-build/empty:
- mkdir -p $@
-
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty build/fifo file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
- ) | ../../scripts/make-erofs.sh $@
-
-build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- dir=$$(mktemp -d) && \
- tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
+BUILD_FILES =
debug:
$(GDB) -q \
@@ -138,14 +113,5 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
$(KERNEL)
.PHONY: run-crosvm
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: run-$(VMM)
.PHONY: run
-
-clean:
- rm -rf build
-.PHONY: clean
diff --git a/img/app/default.nix b/img/app/default.nix
index d3eed1f0accdc8968d1ba5bdec74ab597789082f..cf10e712ab84a9e85cb1373024be5f64deef0370 100644
--- a/img/app/default.nix
+++ b/img/app/default.nix
@@ -107,6 +107,7 @@ stdenvNoCC.mkDerivation {
fileset = lib.fileset.intersection src (lib.fileset.unions [
./.
../../lib/common.mk
+ ../../lib/erofs.mk
../../scripts/make-erofs.sh
../../scripts/make-gpt.sh
../../scripts/sfdisk-field.awk
diff --git a/lib/erofs.mk b/lib/erofs.mk
new file mode 100644
index 0000000000000000000000000000000000000000..b3fc112f5e793725977cd8c4b2e71d6ed8d888c4
--- /dev/null
+++ b/lib/erofs.mk
@@ -0,0 +1,51 @@
+override basedir ::= $(dir $(lastword $(MAKEFILE_LIST)))/..
+
+override BUILD_FILES ::= $(BUILD_FILES) build/etc/s6-rc
+# No override here so that it can be overridden in host/rootfs/default.nix.
+dest ::= build/rootfs.erofs
+
+all:
+.PHONY: all
+$(dest): $(basedir)/scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
+ set -euo pipefail; ( \
+ cat $(PACKAGES_FILE) ;\
+ for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' "$$file" "$$file"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' "$$file" "$${file#build/}"; done ;\
+ $(and $(DIRS),printf 'build/empty\n%s\n' $(DIRS);)\
+ $(and $(FIFOS),printf 'build/fifo\n%s\n' $(FIFOS);)\
+ ) | $(basedir)/scripts/make-erofs.sh $@
+
+clean:
+ -chmod -Rf +w build
+ rm -rf build
+.PHONY: clean
+
+build/fifo:
+ mkdir -p build
+ mkfifo -m 0600 $@
+
+build/empty:
+ mkdir -p $@
+
+update-file-list:
+ $(basedir)/scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+.PHONY:
+ $(error cannot make .PHONY!)
+
+# s6-rc-compile's input is a directory, but that doesn't play nice
+# with Make, because it won't know to update if some file in the
+# directory is changed, or a file is created or removed in a
+# subdirectory. Using the whole source directory could also end up
+# including files that aren't intended to be part of the input, like
+# temporary editor files or .license files. So for all these reasons,
+# only explicitly listed files are made available to s6-rc-compile.
+build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
+ mkdir -p build/etc
+ rm -rf $@
+ set -euo pipefail; \
+ dir=$$(mktemp -d); \
+ { tar -C image -c $(S6_RC_FILES) | tar -C "$$dir" -x --strip-components 2;}; \
+ s6-rc-compile $@ $$dir; \
+ exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index e731bcea7fc61f9b2019689e52a600f3741dd55f..3f8493b9bf2364f7b2d01b7f114dba72126965cc 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include ../../../lib/erofs.mk
include file-list.mk
prefix = build/host
@@ -11,13 +12,14 @@ libdir = $(prefix)/lib
vmdir = $(libdir)/spectrum/vm
VMM = cloud-hypervisor
+override DIRS ::=
+override FIFOS ::=
HOST_BUILD_FILES = \
$(vmdir)/netvm/blk/root.img \
$(vmdir)/netvm/vmlinux
all: $(HOST_BUILD_FILES)
-.PHONY: all
$(vmdir)/netvm/vmlinux: $(KERNEL)
mkdir -p $$(dirname $@)
@@ -29,28 +31,6 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_BUILD_FILES = build/etc/s6-rc
-
-build/empty:
- mkdir -p $@
-
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- ) | ../../../scripts/make-erofs.sh $@
-
-build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- dir=$$(mktemp -d) && \
- tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
-
debug:
$(GDB) -q \
-ex 'set substitute-path .. $(LINUX_SRC)' \
@@ -102,14 +82,5 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
$(KERNEL)
.PHONY: run-crosvm
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: run-$(VMM)
.PHONY: run
-
-clean:
- rm -rf build
-.PHONY: clean
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index b5873ebe1e80dd88c1ba997f7ebd3ee7369bb40f..7b03264bd30fe2e9157730e5338cd2501b255f7e 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -104,6 +104,7 @@ stdenvNoCC.mkDerivation {
fileset = lib.fileset.intersection src (lib.fileset.unions [
./.
../../../lib/common.mk
+ ../../../lib/erofs.mk
../../../scripts/make-erofs.sh
../../../scripts/make-gpt.sh
../../../scripts/sfdisk-field.awk
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH 4/4] Use /etc/s6-rc/compiled for compiled s6-rc directory
2025-09-04 1:56 [PATCH 0/4] Generate file lists from a script Demi Marie Obenour
` (2 preceding siblings ...)
2025-09-04 1:56 ` [PATCH 3/4] Common make rules for building erofs images Demi Marie Obenour
@ 2025-09-04 1:56 ` Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
4 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-04 1:56 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
This is the default, so it makes things simpler and avoids having to
specify "-c /etc/s6-rc" in every s6-rc-init invocation.
This is not logically part of this patch series, but it shows how
centralizing the make code makes changes easier.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/image/etc/s6-linux-init/scripts/rc.init | 2 +-
img/app/image/etc/s6-linux-init/scripts/rc.init | 2 +-
lib/erofs.mk | 6 +++---
vm/sys/net/image/etc/s6-linux-init/scripts/rc.init | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/host/rootfs/image/etc/s6-linux-init/scripts/rc.init b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init
index 674fd38cc76837c7be25a5ef060f0f4d4b786394..b06a4ab7518f0af204475c41ee77ea5f8d657718 100755
--- a/host/rootfs/image/etc/s6-linux-init/scripts/rc.init
+++ b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2020-2022, 2024 Alyssa Ross <hi@alyssa.is>
-if { s6-rc-init -c /etc/s6-rc /run/service }
+if { s6-rc-init /run/service }
if { mount --make-shared /run }
if { mount -a --mkdir }
diff --git a/img/app/image/etc/s6-linux-init/scripts/rc.init b/img/app/image/etc/s6-linux-init/scripts/rc.init
index 0bf350a7015b01072c1fe8dab6be2fb51fa71d5a..e4932e4ad478db7c51ab8c63ccb601d7a60efb85 100755
--- a/img/app/image/etc/s6-linux-init/scripts/rc.init
+++ b/img/app/image/etc/s6-linux-init/scripts/rc.init
@@ -8,7 +8,7 @@ if { ln -s /proc/self/fd/0 /dev/stdin }
if { ln -s /proc/self/fd/1 /dev/stdout }
if { ln -s /proc/self/fd/2 /dev/stderr }
-if { s6-rc-init -c /etc/s6-rc /run/service }
+if { s6-rc-init /run/service }
if { modprobe overlay }
if { mount -a --mkdir }
diff --git a/lib/erofs.mk b/lib/erofs.mk
index b3fc112f5e793725977cd8c4b2e71d6ed8d888c4..a65f2d004efed9dcf218dd806cf66071fb115db1 100644
--- a/lib/erofs.mk
+++ b/lib/erofs.mk
@@ -1,6 +1,6 @@
override basedir ::= $(dir $(lastword $(MAKEFILE_LIST)))/..
-override BUILD_FILES ::= $(BUILD_FILES) build/etc/s6-rc
+override BUILD_FILES ::= $(BUILD_FILES) build/etc/s6-rc/compiled
# No override here so that it can be overridden in host/rootfs/default.nix.
dest ::= build/rootfs.erofs
@@ -41,8 +41,8 @@ update-file-list:
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
- mkdir -p build/etc
+build/etc/s6-rc/compiled: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
+ mkdir -p build/etc/s6-rc
rm -rf $@
set -euo pipefail; \
dir=$$(mktemp -d); \
diff --git a/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init b/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
index 1016d0c62bc6103bc9e865a389f5d482ef6c2b76..5b3261f0356f6615bac4e1aa33352f15d4842317 100755
--- a/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
+++ b/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2020-2022 Alyssa Ross <hi@alyssa.is>
-if { s6-rc-init -c /etc/s6-rc /run/service }
+if { s6-rc-init /run/service }
if { mkdir -p /dev/pts /dev/shm }
if { mount -a }
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH 2/4] Generate makefile file lists from a script
2025-09-04 1:56 ` [PATCH 2/4] Generate makefile file lists from a script Demi Marie Obenour
@ 2025-09-08 9:59 ` Alyssa Ross
2025-09-08 18:45 ` Demi Marie Obenour
0 siblings, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-08 9:59 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 8633 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> The script will always get them right, whereas humans (the author of
> this commit included) generally will not.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
I like the idea!
> ---
> Documentation/development/built-in-vms.adoc | 7 ++
> host/rootfs/Makefile | 107 ++------------------------
> host/rootfs/file-list.mk | 100 ++++++++++++++++++++++++
> img/app/Makefile | 74 +++---------------
> img/app/file-list.mk | 65 ++++++++++++++++
> lib/common.mk | 1 +
> scripts/genfiles.awk | 115 ++++++++++++++++++++++++++++
> vm/sys/net/Makefile | 51 +++---------
> vm/sys/net/file-list.mk | 41 ++++++++++
> 9 files changed, 357 insertions(+), 204 deletions(-)
>
> diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
> index e90009ee5a3c2c254a7ae11e36121576b819eee7..82d78705a6020bbdb06fbc123a32dbdd6fd50085 100644
> --- a/Documentation/development/built-in-vms.adoc
> +++ b/Documentation/development/built-in-vms.adoc
> @@ -44,6 +44,13 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
> if the only change to the Nix files is modifying the packages
> installed in the VM.
>
> +The list of files used for the VM image is stored in a separate file,
> +`file-lists.mk`. You can edit it manually when developing. However,
> +after each commit that adds or removes files from it, you should run
> +`make update-file-list`, which will regenerate it from the output of
> +`git ls-files`. Any changes you made will be lost. This ensures
> +that the file lists are always in sync with the git repository.
> +
TBH editing it manually and then losing your changes is probably going
to be more of a footgun than anything else. You can get the same result
by staging new files and rerunning the script, so I'd avoid mentioning
the manual editing option, especially given you have a "DO NOT EDIT"
comment.
> -$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo
> +$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
Given that we don't include Makefile as a dependency, it probably
doesn't make sense to depend on other included Makefile fragments
either?
> @@ -207,6 +111,11 @@ debug:
> $(VMLINUX)
> .PHONY: debug
>
> +update-file-list:
> + ../../scripts/genfiles.awk image > file-list.mk
> +
> +.PHONY: update-file-list
> +
Given this doesn't use any features of Make, it probably makes more
sense to just run the script directly. It could output into
file-list.mk by default for ergonomics.
> run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
> @set -x && \
> ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
> diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
> new file mode 100644
> index 0000000000000000000000000000000000000000..0817887d0bb25ab47e777f6a130a3b6214b25f0f
> --- /dev/null
> +++ b/host/rootfs/file-list.mk
> @@ -0,0 +1,100 @@
> +# SPDX-License-Identifier: CC0-1.0
> +# SPDX-FileCopyRightText: Not Copyrightable (machine-written)
SPDX-FileCopy*r*ightText, and should probably say that you're the owner,
for consistency with e.g. lib/nixpkgs.default.nix, which is also
generated. You at least made the template.
> +# Generated by scripts/genfile.awk, DO NOT EDIT!
> +override FILES ::= \
Our Makefiles are POSIX. (Mostly because it's the only sensible way to
draw the line, and keep all the really advanced easy to misuse GNU stuff
out.)
> diff --git a/lib/common.mk b/lib/common.mk
> index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
> --- a/lib/common.mk
> +++ b/lib/common.mk
> @@ -1,5 +1,6 @@
> # SPDX-License-Identifier: EUPL-1.2+
> # SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>
> BACKGROUND = background
> CPIO = cpio
This change looks like an accident?
> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
> new file mode 100755
> index 0000000000000000000000000000000000000000..62863e78f157f1d9a0f6dbdb0f4380db9c9d48cb
> --- /dev/null
> +++ b/scripts/genfiles.awk
> @@ -0,0 +1,115 @@
> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +function check_status(status) {
> + if (status < 0) {
> + printf "FATAL: getline: %s\n", status > "/dev/stderr";
> + exit 1;
> + }
> + return status;
> +}
> +
> +function check_close(value, status) {
> + status = check_status(close(value));
> + if (status != 0) {
> + printf "FATAL: command exited with status %d\n", status > "/dev/stderr";
> + exit status;
> + }
> +}
> +
> +function shell_quote(command) {
> + gsub(/'/, "'\\\\&'", command);
> + return ("'" command "'");
> +}
> +
> +function get(command, line, path, array_index, inode_type, mode, modes, symlink_count, symlinks, file_count, files, rc_count, rc_files, is_license, is_rc) {
> + file_count = 0;
> + symlink_count = 0;
> + rc_count = 0;
> + modes["120000"] = "symlink";
> + modes["040644"] = "directory";
> + modes["040755"] = "directory";
> + modes["100644"] = "regular";
> + modes["100755"] = "regular";
> + print "# SPDX-License-Identifier: CC0-1.0";
> + print "# SPDX-FileCopyRightText: Not Copyrightable (machine-written)";
> + print "# Generated by scripts/genfile.awk, DO NOT EDIT!";
> + while (check_status(command | getline line)) {
> + if (line !~ /^[0-7]{6}\t/) {
> + # this is a git bug
> + print "FATAL: git ls-files output didn't start with a valid mode" > "/dev/stderr";
> + exit 1;
> + }
> + path = substr(line, 8);
> + if (path !~ /^[ -~]+$/) {
> + # also a git bug
> + print "FATAL: git ls-files didn't quote properly" > "/dev/stderr";
> + exit 1;
> + }
> + if (path ~ /^\/|((^|\/)\.{0,2}($|\/))/) {
> + # also a git bug
> + printf "FATAL: git ls-files output non-canonical path '%s'\n", path > "/dev/stderr";
> + exit 1;
> + }
> + if (path !~ /^[[:alnum:]_.+@/-]+$/) {
> + printf "FATAL: filename '%s' has forbidden characters\n", path > "/dev/stderr";
> + exit 1;
> + }
I feel like this could be a lot nicer if we ran git ls-files outside
awk, and could then use its nice top-level matching syntax?
> + mode = modes[substr(line, 1, 6)];
> + is_license = path ~ /\.license$/;
> + is_rc = path ~ /^etc\/s6-rc\//;
> + if (mode == "regular") {
> + if (is_license) {
> + continue;
> + }
> + if (is_rc) {
> + rc_count += 1;
> + rc_files[rc_count] = path;
> + } else {
> + file_count += 1;
> + files[file_count] = path;
> + }
> + continue;
> + }
> + if (mode == "symlink") {
> + if (is_rc) {
> + printf "FATAL: symlink in s6-rc-compile input: %s\n", path;
> + exit 1;
> + }
> + symlink_count += 1;
> + symlinks[symlink_count] = path;
> + } else if (mode != "directory") {
> + printf "FATAL: file %s has unknown mode %s\n", path, substr(line, 1, 6) > "/dev/stderr";
> + exit 1;
> + }
> + if (is_license) {
> + printf "FATAL: %s (type %s) ends in .license\n", path, mode > "/dev/stderr";
> + exit 1;
> + }
> + }
> + check_close(command);
> +
> + printf "override FILES ::=";
> + for (array_index = 1; array_index <= file_count; array_index += 1) {
> + printf " \\\n\t%s", files[array_index];
> + }
> + printf ("\n\n" \
> +"# These are separate because they need to be included, but putting\n" \
> +"# them as make dependencies would confuse make.\n" \
> +"override LINKS ::=");
> + for (array_index = 1; array_index <= symlink_count; array_index += 1) {
> + printf " \\\n\t%s", symlinks[array_index];
> + }
> + printf "\n\noverride S6_RC_FILES ::=";
> + for (array_index = 1; array_index <= rc_count; array_index += 1) {
> + printf " \\\n\t%s", rc_files[array_index];
> + }
> + printf "\n"
> +}
> +
> +BEGIN {
> + RS = "\n";
> + FS = "\t";
> + get("set -euo pipefail && { git -c core.quotePath=true -C " shell_quote(ARGV[1]) " ls-files '--format=%(objectmode)\t%(path)' -- .|sort -t '\t' -k 2;}");
> + exit 0;
> +}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 3/4] Common make rules for building erofs images
2025-09-04 1:56 ` [PATCH 3/4] Common make rules for building erofs images Demi Marie Obenour
@ 2025-09-08 10:01 ` Alyssa Ross
2025-09-08 18:53 ` Demi Marie Obenour
0 siblings, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-08 10:01 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 12191 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> Instead of duplicating the logic in three different places, write common
> code for all three makefiles to use instead. This will make future
> changes much easier.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
Makes sense, and we could do this now for the s6-rc directory without
having to wait for the generated file list stuff. Does need to be
updated for my review comments from the previous patch though (stick to
POSIX).
> ---
> host/rootfs/Makefile | 51 ++++---------------------------------------------
> host/rootfs/default.nix | 1 +
> img/app/Makefile | 42 ++++------------------------------------
> img/app/default.nix | 1 +
> lib/erofs.mk | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
> vm/sys/net/Makefile | 35 +++------------------------------
> vm/sys/net/default.nix | 1 +
> 7 files changed, 65 insertions(+), 117 deletions(-)
>
> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
> index 3560707d21bcf53e4f3ad5e916d21e8be56cc3a1..dce8315fe5be19d2569d6c9a429276e4abd696ad 100644
> --- a/host/rootfs/Makefile
> +++ b/host/rootfs/Makefile
> @@ -4,11 +4,10 @@
> .POSIX:
>
> include ../../lib/common.mk
> +include ../../lib/erofs.mk
> include file-list.mk
>
> -dest = build/rootfs.erofs
> -
> -DIRS = \
> +override DIRS ::= \
> dev \
> etc/s6-linux-init/env \
> etc/s6-linux-init/run-image/configs \
> @@ -42,46 +41,9 @@ DIRS = \
> proc \
> sys
>
> -FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
> -
> -BUILD_FILES = build/etc/s6-rc
> -
> -$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
> - ( \
> - cat $(PACKAGES_FILE) ;\
> - for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
> - for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
> - printf 'build/empty\n%s\n' $(DIRS) ;\
> - printf 'build/fifo\n%s\n' $(FIFOS) ;\
> - ) | ../../scripts/make-erofs.sh $@
> -
> -build/fifo:
> - mkdir -p build
> - mkfifo -m 0600 $@
> -
> -build/empty:
> - mkdir -p $@
> +override FIFOS ::= etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
>
> -# s6-rc-compile's input is a directory, but that doesn't play nice
> -# with Make, because it won't know to update if some file in the
> -# directory is changed, or a file is created or removed in a
> -# subdirectory. Using the whole source directory could also end up
> -# including files that aren't intended to be part of the input, like
> -# temporary editor files or .license files. So for all these reasons,
> -# only explicitly listed files are made available to s6-rc-compile.
> -build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
> - mkdir -p $$(dirname $@)
> - rm -rf $@
> -
> - dir=$$(mktemp -d) && \
> - tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> - s6-rc-compile $@ $$dir; \
> - exit=$$?; rm -r $$dir; exit $$exit
> -
> -clean:
> - -chmod -Rf +w build
> - rm -rf build
> -.PHONY: clean
> +all: $(dest)
>
> # veritysetup format produces two files, but Make only (portably)
> # supports one output per rule, so we combine the two outputs then
> @@ -111,11 +73,6 @@ debug:
> $(VMLINUX)
> .PHONY: debug
>
> -update-file-list:
> - ../../scripts/genfiles.awk image > file-list.mk
> -
> -.PHONY: update-file-list
> -
> run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
> @set -x && \
> ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
> diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
> index 998220d7b6ed322f64ee52c704e71ec9b4643f59..561bf660829dcd5f5e2ee841662727b262d43ed3 100644
> --- a/host/rootfs/default.nix
> +++ b/host/rootfs/default.nix
> @@ -178,6 +178,7 @@ stdenvNoCC.mkDerivation {
> fileset = fileset.intersection src (fileset.unions [
> ./.
> ../../lib/common.mk
> + ../../lib/erofs.mk
> ../../scripts/make-erofs.sh
> ]);
> };
> diff --git a/img/app/Makefile b/img/app/Makefile
> index 5bb1a6a2f9acd13aba95abb0e918a7f21943b230..0c3a8311973f5f82eb2af6ea3ba43f67d36dec2e 100644
> --- a/img/app/Makefile
> +++ b/img/app/Makefile
> @@ -5,6 +5,7 @@
> .POSIX:
>
> include ../../lib/common.mk
> +include ../../lib/erofs.mk
> include file-list.mk
>
> prefix = build/host
> @@ -18,7 +19,6 @@ HOST_BUILD_FILES = \
> $(imgdir)/appvm/vmlinux
>
> all: $(HOST_BUILD_FILES)
> -.PHONY: all
>
> $(imgdir)/appvm/vmlinux: $(KERNEL)
> mkdir -p $$(dirname $@)
> @@ -30,38 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
> build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
> mv $@.tmp $@
>
> -VM_DIRS = dev run proc sys tmp \
> +DIRS = dev run proc sys tmp \
> etc/s6-linux-init/run-image/service \
> etc/s6-linux-init/run-image/user \
> etc/s6-linux-init/run-image/wait
> -VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
> +FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
>
> -VM_BUILD_FILES = build/etc/s6-rc
> -
> -build/fifo:
> - mkdir -p build
> - mkfifo -m 0600 $@
> -
> -build/empty:
> - mkdir -p $@
> -
> -build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty build/fifo file-list.mk
> - ( \
> - cat $(PACKAGES_FILE) ;\
> - for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
> - for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
> - printf 'build/empty\n%s\n' $(VM_DIRS) ;\
> - printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
> - ) | ../../scripts/make-erofs.sh $@
> -
> -build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
> - mkdir -p $$(dirname $@)
> - rm -rf $@
> -
> - dir=$$(mktemp -d) && \
> - tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> - s6-rc-compile $@ $$dir; \
> - exit=$$?; rm -r $$dir; exit $$exit
> +BUILD_FILES =
>
> debug:
> $(GDB) -q \
> @@ -138,14 +113,5 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
> $(KERNEL)
> .PHONY: run-crosvm
>
> -update-file-list:
> - ../../scripts/genfiles.awk image > file-list.mk
> -
> -.PHONY: update-file-list
> -
> run: run-$(VMM)
> .PHONY: run
> -
> -clean:
> - rm -rf build
> -.PHONY: clean
> diff --git a/img/app/default.nix b/img/app/default.nix
> index d3eed1f0accdc8968d1ba5bdec74ab597789082f..cf10e712ab84a9e85cb1373024be5f64deef0370 100644
> --- a/img/app/default.nix
> +++ b/img/app/default.nix
> @@ -107,6 +107,7 @@ stdenvNoCC.mkDerivation {
> fileset = lib.fileset.intersection src (lib.fileset.unions [
> ./.
> ../../lib/common.mk
> + ../../lib/erofs.mk
> ../../scripts/make-erofs.sh
> ../../scripts/make-gpt.sh
> ../../scripts/sfdisk-field.awk
> diff --git a/lib/erofs.mk b/lib/erofs.mk
> new file mode 100644
> index 0000000000000000000000000000000000000000..b3fc112f5e793725977cd8c4b2e71d6ed8d888c4
> --- /dev/null
> +++ b/lib/erofs.mk
> @@ -0,0 +1,51 @@
> +override basedir ::= $(dir $(lastword $(MAKEFILE_LIST)))/..
> +
> +override BUILD_FILES ::= $(BUILD_FILES) build/etc/s6-rc
> +# No override here so that it can be overridden in host/rootfs/default.nix.
> +dest ::= build/rootfs.erofs
> +
> +all:
> +.PHONY: all
> +$(dest): $(basedir)/scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
> + set -euo pipefail; ( \
> + cat $(PACKAGES_FILE) ;\
> + for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' "$$file" "$$file"; done ;\
> + for file in $(BUILD_FILES); do printf '%s\n%s\n' "$$file" "$${file#build/}"; done ;\
> + $(and $(DIRS),printf 'build/empty\n%s\n' $(DIRS);)\
> + $(and $(FIFOS),printf 'build/fifo\n%s\n' $(FIFOS);)\
> + ) | $(basedir)/scripts/make-erofs.sh $@
> +
> +clean:
> + -chmod -Rf +w build
> + rm -rf build
> +.PHONY: clean
> +
> +build/fifo:
> + mkdir -p build
> + mkfifo -m 0600 $@
> +
> +build/empty:
> + mkdir -p $@
> +
> +update-file-list:
> + $(basedir)/scripts/genfiles.awk image > file-list.mk
> +
> +.PHONY: update-file-list
> +.PHONY:
> + $(error cannot make .PHONY!)
> +
> +# s6-rc-compile's input is a directory, but that doesn't play nice
> +# with Make, because it won't know to update if some file in the
> +# directory is changed, or a file is created or removed in a
> +# subdirectory. Using the whole source directory could also end up
> +# including files that aren't intended to be part of the input, like
> +# temporary editor files or .license files. So for all these reasons,
> +# only explicitly listed files are made available to s6-rc-compile.
> +build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
> + mkdir -p build/etc
> + rm -rf $@
> + set -euo pipefail; \
> + dir=$$(mktemp -d); \
> + { tar -C image -c $(S6_RC_FILES) | tar -C "$$dir" -x --strip-components 2;}; \
> + s6-rc-compile $@ $$dir; \
> + exit=$$?; rm -r $$dir; exit $$exit
> diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
> index e731bcea7fc61f9b2019689e52a600f3741dd55f..3f8493b9bf2364f7b2d01b7f114dba72126965cc 100644
> --- a/vm/sys/net/Makefile
> +++ b/vm/sys/net/Makefile
> @@ -4,6 +4,7 @@
> .POSIX:
>
> include ../../../lib/common.mk
> +include ../../../lib/erofs.mk
> include file-list.mk
>
> prefix = build/host
> @@ -11,13 +12,14 @@ libdir = $(prefix)/lib
> vmdir = $(libdir)/spectrum/vm
>
> VMM = cloud-hypervisor
> +override DIRS ::=
> +override FIFOS ::=
>
> HOST_BUILD_FILES = \
> $(vmdir)/netvm/blk/root.img \
> $(vmdir)/netvm/vmlinux
>
> all: $(HOST_BUILD_FILES)
> -.PHONY: all
>
> $(vmdir)/netvm/vmlinux: $(KERNEL)
> mkdir -p $$(dirname $@)
> @@ -29,28 +31,6 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
> build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
> mv $@.tmp $@
>
> -VM_BUILD_FILES = build/etc/s6-rc
> -
> -build/empty:
> - mkdir -p $@
> -
> -build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty file-list.mk
> - ( \
> - cat $(PACKAGES_FILE) ;\
> - for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
> - for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
> - printf 'build/empty\n%s\n' $(VM_DIRS) ;\
> - ) | ../../../scripts/make-erofs.sh $@
> -
> -build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
> - mkdir -p $$(dirname $@)
> - rm -rf $@
> -
> - dir=$$(mktemp -d) && \
> - tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> - s6-rc-compile $@ $$dir; \
> - exit=$$?; rm -r $$dir; exit $$exit
> -
> debug:
> $(GDB) -q \
> -ex 'set substitute-path .. $(LINUX_SRC)' \
> @@ -102,14 +82,5 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
> $(KERNEL)
> .PHONY: run-crosvm
>
> -update-file-list:
> - ../../scripts/genfiles.awk image > file-list.mk
> -
> -.PHONY: update-file-list
> -
> run: run-$(VMM)
> .PHONY: run
> -
> -clean:
> - rm -rf build
> -.PHONY: clean
> diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
> index b5873ebe1e80dd88c1ba997f7ebd3ee7369bb40f..7b03264bd30fe2e9157730e5338cd2501b255f7e 100644
> --- a/vm/sys/net/default.nix
> +++ b/vm/sys/net/default.nix
> @@ -104,6 +104,7 @@ stdenvNoCC.mkDerivation {
> fileset = lib.fileset.intersection src (lib.fileset.unions [
> ./.
> ../../../lib/common.mk
> + ../../../lib/erofs.mk
> ../../../scripts/make-erofs.sh
> ../../../scripts/make-gpt.sh
> ../../../scripts/sfdisk-field.awk
>
> --
> 2.51.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 2/4] Generate makefile file lists from a script
2025-09-08 9:59 ` Alyssa Ross
@ 2025-09-08 18:45 ` Demi Marie Obenour
2025-09-09 14:51 ` Alyssa Ross
0 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-08 18:45 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 9382 bytes --]
On 9/8/25 05:59, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> The script will always get them right, whereas humans (the author of
>> this commit included) generally will not.
>>
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>
> I like the idea!
>
>> ---
>> Documentation/development/built-in-vms.adoc | 7 ++
>> host/rootfs/Makefile | 107 ++------------------------
>> host/rootfs/file-list.mk | 100 ++++++++++++++++++++++++
>> img/app/Makefile | 74 +++---------------
>> img/app/file-list.mk | 65 ++++++++++++++++
>> lib/common.mk | 1 +
>> scripts/genfiles.awk | 115 ++++++++++++++++++++++++++++
>> vm/sys/net/Makefile | 51 +++---------
>> vm/sys/net/file-list.mk | 41 ++++++++++
>> 9 files changed, 357 insertions(+), 204 deletions(-)
>>
>> diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
>> index e90009ee5a3c2c254a7ae11e36121576b819eee7..82d78705a6020bbdb06fbc123a32dbdd6fd50085 100644
>> --- a/Documentation/development/built-in-vms.adoc
>> +++ b/Documentation/development/built-in-vms.adoc
>> @@ -44,6 +44,13 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
>> if the only change to the Nix files is modifying the packages
>> installed in the VM.
>>
>> +The list of files used for the VM image is stored in a separate file,
>> +`file-lists.mk`. You can edit it manually when developing. However,
>> +after each commit that adds or removes files from it, you should run
>> +`make update-file-list`, which will regenerate it from the output of
>> +`git ls-files`. Any changes you made will be lost. This ensures
>> +that the file lists are always in sync with the git repository.
>> +
>
> TBH editing it manually and then losing your changes is probably going
> to be more of a footgun than anything else. You can get the same result
> by staging new files and rerunning the script, so I'd avoid mentioning
> the manual editing option, especially given you have a "DO NOT EDIT"
> comment.
>
>> -$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo
>> +$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
>
> Given that we don't include Makefile as a dependency, it probably
> doesn't make sense to depend on other included Makefile fragments
> either?
If the user regenerates the file lists, it is more convenient for
them to not need to call 'make clean', and having the dependency is
harmless.
>> @@ -207,6 +111,11 @@ debug:
>> $(VMLINUX)
>> .PHONY: debug
>>
>> +update-file-list:
>> + ../../scripts/genfiles.awk image > file-list.mk
>> +
>> +.PHONY: update-file-list
>> +
>
> Given this doesn't use any features of Make, it probably makes more
> sense to just run the script directly. It could output into
> file-list.mk by default for ergonomics.
Makes sense.
>> run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
>> @set -x && \
>> ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
>> diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..0817887d0bb25ab47e777f6a130a3b6214b25f0f
>> --- /dev/null
>> +++ b/host/rootfs/file-list.mk
>> @@ -0,0 +1,100 @@
>> +# SPDX-License-Identifier: CC0-1.0
>> +# SPDX-FileCopyRightText: Not Copyrightable (machine-written)
>
> SPDX-FileCopy*r*ightText, and should probably say that you're the owner,
> for consistency with e.g. lib/nixpkgs.default.nix, which is also
> generated. You at least made the template.
Makes sense.
>> +# Generated by scripts/genfile.awk, DO NOT EDIT!
>> +override FILES ::= \
>
> Our Makefiles are POSIX. (Mostly because it's the only sensible way to
> draw the line, and keep all the really advanced easy to misuse GNU stuff
> out.)
This is going to make factoring out common logic more difficult.
I'll go into detail in the reply to your review to the next patch.
>> diff --git a/lib/common.mk b/lib/common.mk
>> index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
>> --- a/lib/common.mk
>> +++ b/lib/common.mk
>> @@ -1,5 +1,6 @@
>> # SPDX-License-Identifier: EUPL-1.2+
>> # SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>>
>> BACKGROUND = background
>> CPIO = cpio
>
> This change looks like an accident?
Should have gone in the next patch.
>> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
>> new file mode 100755
>> index 0000000000000000000000000000000000000000..62863e78f157f1d9a0f6dbdb0f4380db9c9d48cb
>> --- /dev/null
>> +++ b/scripts/genfiles.awk
>> @@ -0,0 +1,115 @@
>> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
>> +# SPDX-License-Identifier: EUPL-1.2+
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>> +function check_status(status) {
>> + if (status < 0) {
>> + printf "FATAL: getline: %s\n", status > "/dev/stderr";
>> + exit 1;
>> + }
>> + return status;
>> +}
>> +
>> +function check_close(value, status) {
>> + status = check_status(close(value));
>> + if (status != 0) {
>> + printf "FATAL: command exited with status %d\n", status > "/dev/stderr";
>> + exit status;
>> + }
>> +}
>> +
>> +function shell_quote(command) {
>> + gsub(/'/, "'\\\\&'", command);
>> + return ("'" command "'");
>> +}
>> +
>> +function get(command, line, path, array_index, inode_type, mode, modes, symlink_count, symlinks, file_count, files, rc_count, rc_files, is_license, is_rc) {
>> + file_count = 0;
>> + symlink_count = 0;
>> + rc_count = 0;
>> + modes["120000"] = "symlink";
>> + modes["040644"] = "directory";
>> + modes["040755"] = "directory";
>> + modes["100644"] = "regular";
>> + modes["100755"] = "regular";
>> + print "# SPDX-License-Identifier: CC0-1.0";
>> + print "# SPDX-FileCopyRightText: Not Copyrightable (machine-written)";
>> + print "# Generated by scripts/genfile.awk, DO NOT EDIT!";
>> + while (check_status(command | getline line)) {
>> + if (line !~ /^[0-7]{6}\t/) {
>> + # this is a git bug
>> + print "FATAL: git ls-files output didn't start with a valid mode" > "/dev/stderr";
>> + exit 1;
>> + }
>> + path = substr(line, 8);
>> + if (path !~ /^[ -~]+$/) {
>> + # also a git bug
>> + print "FATAL: git ls-files didn't quote properly" > "/dev/stderr";
>> + exit 1;
>> + }
>> + if (path ~ /^\/|((^|\/)\.{0,2}($|\/))/) {
>> + # also a git bug
>> + printf "FATAL: git ls-files output non-canonical path '%s'\n", path > "/dev/stderr";
>> + exit 1;
>> + }
>> + if (path !~ /^[[:alnum:]_.+@/-]+$/) {
>> + printf "FATAL: filename '%s' has forbidden characters\n", path > "/dev/stderr";
>> + exit 1;
>> + }
>
> I feel like this could be a lot nicer if we ran git ls-files outside
> awk, and could then use its nice top-level matching syntax?
That would work, but would need a wrapper script.
>> + mode = modes[substr(line, 1, 6)];
>> + is_license = path ~ /\.license$/;
>> + is_rc = path ~ /^etc\/s6-rc\//;
>> + if (mode == "regular") {
>> + if (is_license) {
>> + continue;
>> + }
>> + if (is_rc) {
>> + rc_count += 1;
>> + rc_files[rc_count] = path;
>> + } else {
>> + file_count += 1;
>> + files[file_count] = path;
>> + }
>> + continue;
>> + }
>> + if (mode == "symlink") {
>> + if (is_rc) {
>> + printf "FATAL: symlink in s6-rc-compile input: %s\n", path;
>> + exit 1;
>> + }
>> + symlink_count += 1;
>> + symlinks[symlink_count] = path;
>> + } else if (mode != "directory") {
>> + printf "FATAL: file %s has unknown mode %s\n", path, substr(line, 1, 6) > "/dev/stderr";
>> + exit 1;
>> + }
>> + if (is_license) {
>> + printf "FATAL: %s (type %s) ends in .license\n", path, mode > "/dev/stderr";
>> + exit 1;
>> + }
>> + }
>> + check_close(command);
>> +
>> + printf "override FILES ::=";
>> + for (array_index = 1; array_index <= file_count; array_index += 1) {
>> + printf " \\\n\t%s", files[array_index];
>> + }
>> + printf ("\n\n" \
>> +"# These are separate because they need to be included, but putting\n" \
>> +"# them as make dependencies would confuse make.\n" \
>> +"override LINKS ::=");
>> + for (array_index = 1; array_index <= symlink_count; array_index += 1) {
>> + printf " \\\n\t%s", symlinks[array_index];
>> + }
>> + printf "\n\noverride S6_RC_FILES ::=";
>> + for (array_index = 1; array_index <= rc_count; array_index += 1) {
>> + printf " \\\n\t%s", rc_files[array_index];
>> + }
>> + printf "\n"
>> +}
>> +
>> +BEGIN {
>> + RS = "\n";
>> + FS = "\t";
>> + get("set -euo pipefail && { git -c core.quotePath=true -C " shell_quote(ARGV[1]) " ls-files '--format=%(objectmode)\t%(path)' -- .|sort -t '\t' -k 2;}");
>> + exit 0;
>> +}
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 3/4] Common make rules for building erofs images
2025-09-08 10:01 ` Alyssa Ross
@ 2025-09-08 18:53 ` Demi Marie Obenour
2025-09-09 14:56 ` Alyssa Ross
0 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-08 18:53 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 9040 bytes --]
On 9/8/25 06:01, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> Instead of duplicating the logic in three different places, write common
>> code for all three makefiles to use instead. This will make future
>> changes much easier.
>>
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>
> Makes sense, and we could do this now for the s6-rc directory without
> having to wait for the generated file list stuff. Does need to be
> updated for my review comments from the previous patch though (stick to
> POSIX).
If we are going to stick with POSIX, I think it is best to test with both
GNU make and BSD make. Otherwise, GNUisms are bound to creep in.
As an aside, BSD make has an amazing feature ("meta" mode) that would be
awesome to support in GNU make.
>> ---
>> host/rootfs/Makefile | 51 ++++---------------------------------------------
>> host/rootfs/default.nix | 1 +
>> img/app/Makefile | 42 ++++------------------------------------
>> img/app/default.nix | 1 +
>> lib/erofs.mk | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
>> vm/sys/net/Makefile | 35 +++------------------------------
>> vm/sys/net/default.nix | 1 +
>> 7 files changed, 65 insertions(+), 117 deletions(-)
>>
>> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
>> index 3560707d21bcf53e4f3ad5e916d21e8be56cc3a1..dce8315fe5be19d2569d6c9a429276e4abd696ad 100644
>> --- a/host/rootfs/Makefile
>> +++ b/host/rootfs/Makefile
>> @@ -4,11 +4,10 @@
>> .POSIX:
>>
>> include ../../lib/common.mk
>> +include ../../lib/erofs.mk
>> include file-list.mk
>>
>> -dest = build/rootfs.erofs
>> -
>> -DIRS = \
>> +override DIRS ::= \
>> dev \
>> etc/s6-linux-init/env \
>> etc/s6-linux-init/run-image/configs \
>> @@ -42,46 +41,9 @@ DIRS = \
>> proc \
>> sys
>>
>> -FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
>> -
>> -BUILD_FILES = build/etc/s6-rc
>> -
>> -$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
>> - ( \
>> - cat $(PACKAGES_FILE) ;\
>> - for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
>> - for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
>> - printf 'build/empty\n%s\n' $(DIRS) ;\
>> - printf 'build/fifo\n%s\n' $(FIFOS) ;\
>> - ) | ../../scripts/make-erofs.sh $@
>> -
>> -build/fifo:
>> - mkdir -p build
>> - mkfifo -m 0600 $@
>> -
>> -build/empty:
>> - mkdir -p $@
>> +override FIFOS ::= etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
>>
>> -# s6-rc-compile's input is a directory, but that doesn't play nice
>> -# with Make, because it won't know to update if some file in the
>> -# directory is changed, or a file is created or removed in a
>> -# subdirectory. Using the whole source directory could also end up
>> -# including files that aren't intended to be part of the input, like
>> -# temporary editor files or .license files. So for all these reasons,
>> -# only explicitly listed files are made available to s6-rc-compile.
>> -build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
>> - mkdir -p $$(dirname $@)
>> - rm -rf $@
>> -
>> - dir=$$(mktemp -d) && \
>> - tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>> - s6-rc-compile $@ $$dir; \
>> - exit=$$?; rm -r $$dir; exit $$exit
>> -
>> -clean:
>> - -chmod -Rf +w build
>> - rm -rf build
>> -.PHONY: clean
>> +all: $(dest)
>>
>> # veritysetup format produces two files, but Make only (portably)
>> # supports one output per rule, so we combine the two outputs then
>> @@ -111,11 +73,6 @@ debug:
>> $(VMLINUX)
>> .PHONY: debug
>>
>> -update-file-list:
>> - ../../scripts/genfiles.awk image > file-list.mk
>> -
>> -.PHONY: update-file-list
>> -
>> run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
>> @set -x && \
>> ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
>> diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
>> index 998220d7b6ed322f64ee52c704e71ec9b4643f59..561bf660829dcd5f5e2ee841662727b262d43ed3 100644
>> --- a/host/rootfs/default.nix
>> +++ b/host/rootfs/default.nix
>> @@ -178,6 +178,7 @@ stdenvNoCC.mkDerivation {
>> fileset = fileset.intersection src (fileset.unions [
>> ./.
>> ../../lib/common.mk
>> + ../../lib/erofs.mk
>> ../../scripts/make-erofs.sh
>> ]);
>> };
>> diff --git a/img/app/Makefile b/img/app/Makefile
>> index 5bb1a6a2f9acd13aba95abb0e918a7f21943b230..0c3a8311973f5f82eb2af6ea3ba43f67d36dec2e 100644
>> --- a/img/app/Makefile
>> +++ b/img/app/Makefile
>> @@ -5,6 +5,7 @@
>> .POSIX:
>>
>> include ../../lib/common.mk
>> +include ../../lib/erofs.mk
>> include file-list.mk
>>
>> prefix = build/host
>> @@ -18,7 +19,6 @@ HOST_BUILD_FILES = \
>> $(imgdir)/appvm/vmlinux
>>
>> all: $(HOST_BUILD_FILES)
>> -.PHONY: all
>>
>> $(imgdir)/appvm/vmlinux: $(KERNEL)
>> mkdir -p $$(dirname $@)
>> @@ -30,38 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
>> build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
>> mv $@.tmp $@
>>
>> -VM_DIRS = dev run proc sys tmp \
>> +DIRS = dev run proc sys tmp \
>> etc/s6-linux-init/run-image/service \
>> etc/s6-linux-init/run-image/user \
>> etc/s6-linux-init/run-image/wait
>> -VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
>> +FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
>>
>> -VM_BUILD_FILES = build/etc/s6-rc
>> -
>> -build/fifo:
>> - mkdir -p build
>> - mkfifo -m 0600 $@
>> -
>> -build/empty:
>> - mkdir -p $@
>> -
>> -build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(VM_BUILD_FILES) build/empty build/fifo file-list.mk
>> - ( \
>> - cat $(PACKAGES_FILE) ;\
>> - for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
>> - for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
>> - printf 'build/empty\n%s\n' $(VM_DIRS) ;\
>> - printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
>> - ) | ../../scripts/make-erofs.sh $@
>> -
>> -build/etc/s6-rc: $(addprefix image/,$(S6_RC_FILES)) file-list.mk
>> - mkdir -p $$(dirname $@)
>> - rm -rf $@
>> -
>> - dir=$$(mktemp -d) && \
>> - tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>> - s6-rc-compile $@ $$dir; \
>> - exit=$$?; rm -r $$dir; exit $$exit
>> +BUILD_FILES =
>>
>> debug:
>> $(GDB) -q \
>> @@ -138,14 +113,5 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
>> $(KERNEL)
>> .PHONY: run-crosvm
>>
>> -update-file-list:
>> - ../../scripts/genfiles.awk image > file-list.mk
>> -
>> -.PHONY: update-file-list
>> -
>> run: run-$(VMM)
>> .PHONY: run
>> -
>> -clean:
>> - rm -rf build
>> -.PHONY: clean
>> diff --git a/img/app/default.nix b/img/app/default.nix
>> index d3eed1f0accdc8968d1ba5bdec74ab597789082f..cf10e712ab84a9e85cb1373024be5f64deef0370 100644
>> --- a/img/app/default.nix
>> +++ b/img/app/default.nix
>> @@ -107,6 +107,7 @@ stdenvNoCC.mkDerivation {
>> fileset = lib.fileset.intersection src (lib.fileset.unions [
>> ./.
>> ../../lib/common.mk
>> + ../../lib/erofs.mk
>> ../../scripts/make-erofs.sh
>> ../../scripts/make-gpt.sh
>> ../../scripts/sfdisk-field.awk
>> diff --git a/lib/erofs.mk b/lib/erofs.mk
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..b3fc112f5e793725977cd8c4b2e71d6ed8d888c4
>> --- /dev/null
>> +++ b/lib/erofs.mk
>> @@ -0,0 +1,51 @@
>> +override basedir ::= $(dir $(lastword $(MAKEFILE_LIST)))/..
This is one part that is not possible in POSIX make. Without
this, there is no way for the included makefile to know where
its wrapper scripts are.
>> +override BUILD_FILES ::= $(BUILD_FILES) build/etc/s6-rc
>> +# No override here so that it can be overridden in host/rootfs/default.nix.
>> +dest ::= build/rootfs.erofs
>> +
>> +all:
>> +.PHONY: all
>> +$(dest): $(basedir)/scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
>> + set -euo pipefail; ( \
>> + cat $(PACKAGES_FILE) ;\
>> + for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' "$$file" "$$file"; done ;\
>> + for file in $(BUILD_FILES); do printf '%s\n%s\n' "$$file" "$${file#build/}"; done ;\
>> + $(and $(DIRS),printf 'build/empty\n%s\n' $(DIRS);)\
>> + $(and $(FIFOS),printf 'build/fifo\n%s\n' $(FIFOS);)\
This also has no analog in POSIX make, though it might be possible
to emulate it with some shell hacks.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 2/4] Generate makefile file lists from a script
2025-09-08 18:45 ` Demi Marie Obenour
@ 2025-09-09 14:51 ` Alyssa Ross
0 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-09 14:51 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 3881 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
>>> -$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo
>>> +$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
>>
>> Given that we don't include Makefile as a dependency, it probably
>> doesn't make sense to depend on other included Makefile fragments
>> either?
>
> If the user regenerates the file lists, it is more convenient for
> them to not need to call 'make clean', and having the dependency is
> harmless.
I just feel a bit weird about it. It would of course be nice if
changing the make rules didn't require a make clean, but to actually get
that behaviour we'd need to add a dependency on Makefile to every single
rule (or this functionality would have to be built in to make, which
would make more sense…). I worry that having it so that /sometimes/ you
don't have to run make clean after changing the make rules makes things
more confusing, because then you have to understand when…
Open to being told I'm putting theory ahead of practicality here, though.
>>> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
>>> new file mode 100755
>>> index 0000000000000000000000000000000000000000..62863e78f157f1d9a0f6dbdb0f4380db9c9d48cb
>>> --- /dev/null
>>> +++ b/scripts/genfiles.awk
>>> @@ -0,0 +1,115 @@
>>> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
>>> +# SPDX-License-Identifier: EUPL-1.2+
>>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>>> +function check_status(status) {
>>> + if (status < 0) {
>>> + printf "FATAL: getline: %s\n", status > "/dev/stderr";
>>> + exit 1;
>>> + }
>>> + return status;
>>> +}
>>> +
>>> +function check_close(value, status) {
>>> + status = check_status(close(value));
>>> + if (status != 0) {
>>> + printf "FATAL: command exited with status %d\n", status > "/dev/stderr";
>>> + exit status;
>>> + }
>>> +}
>>> +
>>> +function shell_quote(command) {
>>> + gsub(/'/, "'\\\\&'", command);
>>> + return ("'" command "'");
>>> +}
>>> +
>>> +function get(command, line, path, array_index, inode_type, mode, modes, symlink_count, symlinks, file_count, files, rc_count, rc_files, is_license, is_rc) {
>>> + file_count = 0;
>>> + symlink_count = 0;
>>> + rc_count = 0;
>>> + modes["120000"] = "symlink";
>>> + modes["040644"] = "directory";
>>> + modes["040755"] = "directory";
>>> + modes["100644"] = "regular";
>>> + modes["100755"] = "regular";
>>> + print "# SPDX-License-Identifier: CC0-1.0";
>>> + print "# SPDX-FileCopyRightText: Not Copyrightable (machine-written)";
>>> + print "# Generated by scripts/genfile.awk, DO NOT EDIT!";
>>> + while (check_status(command | getline line)) {
>>> + if (line !~ /^[0-7]{6}\t/) {
>>> + # this is a git bug
>>> + print "FATAL: git ls-files output didn't start with a valid mode" > "/dev/stderr";
>>> + exit 1;
>>> + }
>>> + path = substr(line, 8);
>>> + if (path !~ /^[ -~]+$/) {
>>> + # also a git bug
>>> + print "FATAL: git ls-files didn't quote properly" > "/dev/stderr";
>>> + exit 1;
>>> + }
>>> + if (path ~ /^\/|((^|\/)\.{0,2}($|\/))/) {
>>> + # also a git bug
>>> + printf "FATAL: git ls-files output non-canonical path '%s'\n", path > "/dev/stderr";
>>> + exit 1;
>>> + }
>>> + if (path !~ /^[[:alnum:]_.+@/-]+$/) {
>>> + printf "FATAL: filename '%s' has forbidden characters\n", path > "/dev/stderr";
>>> + exit 1;
>>> + }
>>
>> I feel like this could be a lot nicer if we ran git ls-files outside
>> awk, and could then use its nice top-level matching syntax?
>
> That would work, but would need a wrapper script.
That's fine. Make a scripts/genfiles.sh that runs scripts/genfiles.awk.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 3/4] Common make rules for building erofs images
2025-09-08 18:53 ` Demi Marie Obenour
@ 2025-09-09 14:56 ` Alyssa Ross
0 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-09 14:56 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 2476 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> On 9/8/25 06:01, Alyssa Ross wrote:
>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>>
>>> Instead of duplicating the logic in three different places, write common
>>> code for all three makefiles to use instead. This will make future
>>> changes much easier.
>>>
>>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>>
>> Makes sense, and we could do this now for the s6-rc directory without
>> having to wait for the generated file list stuff. Does need to be
>> updated for my review comments from the previous patch though (stick to
>> POSIX).
>
> If we are going to stick with POSIX, I think it is best to test with both
> GNU make and BSD make. Otherwise, GNUisms are bound to creep in.
I wish there was something like shellcheck for Makefiles, but I'm not
aware of one. If you can find a good way to ensure it (ideally without
building everything twice), I'm all for it.
>>> diff --git a/lib/erofs.mk b/lib/erofs.mk
>>> new file mode 100644
>>> index 0000000000000000000000000000000000000000..b3fc112f5e793725977cd8c4b2e71d6ed8d888c4
>>> --- /dev/null
>>> +++ b/lib/erofs.mk
>>> @@ -0,0 +1,51 @@
>>> +override basedir ::= $(dir $(lastword $(MAKEFILE_LIST)))/..
>
> This is one part that is not possible in POSIX make. Without
> this, there is no way for the included makefile to know where
> its wrapper scripts are.
Maybe we can just have each Makefile define a "root" variable that
points to the root of the source tree? Not very onerous if it works.
>>> +override BUILD_FILES ::= $(BUILD_FILES) build/etc/s6-rc
>>> +# No override here so that it can be overridden in host/rootfs/default.nix.
>>> +dest ::= build/rootfs.erofs
>>> +
>>> +all:
>>> +.PHONY: all
>>> +$(dest): $(basedir)/scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
>>> + set -euo pipefail; ( \
>>> + cat $(PACKAGES_FILE) ;\
>>> + for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' "$$file" "$$file"; done ;\
>>> + for file in $(BUILD_FILES); do printf '%s\n%s\n' "$$file" "$${file#build/}"; done ;\
>>> + $(and $(DIRS),printf 'build/empty\n%s\n' $(DIRS);)\
>>> + $(and $(FIFOS),printf 'build/fifo\n%s\n' $(FIFOS);)\
>
> This also has no analog in POSIX make, though it might be possible
> to emulate it with some shell hacks.
Can be a for loop like above I think?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v2 0/3] Generate file lists from a script
2025-09-04 1:56 [PATCH 0/4] Generate file lists from a script Demi Marie Obenour
` (3 preceding siblings ...)
2025-09-04 1:56 ` [PATCH 4/4] Use /etc/s6-rc/compiled for compiled s6-rc directory Demi Marie Obenour
@ 2025-09-10 5:29 ` Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 1/3] Move all files for the image into a subdirectory Demi Marie Obenour
` (4 more replies)
4 siblings, 5 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-10 5:29 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts.
Avoid this problem by moving the files used in the erofs images to an
image/ directory and using what Git knows about this directory to
generate the lists via a script. This makes maintenance easier and
avoids conflating code used in the build (anything not in image/) and
code for the image (anything that is in image/).
This reveals that there is a lot of duplicated make logic around image
generation, so consolidate it in a single makefile that is included by
all three of the makefiles.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Demi Marie Obenour (3):
Move all files for the image into a subdirectory
Generate makefile file lists from a script
Common make rules for building erofs images
Documentation/development/built-in-vms.adoc | 18 +++
host/rootfs/Makefile | 141 +--------------------
host/rootfs/default.nix | 1 +
host/rootfs/file-list.mk | 100 +++++++++++++++
host/rootfs/{ => image}/bin | 0
host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
host/rootfs/{ => image}/etc/fstab | 0
host/rootfs/{ => image}/etc/group | 0
host/rootfs/{ => image}/etc/group.license | 0
host/rootfs/{ => image}/etc/init | 0
host/rootfs/{ => image}/etc/login | 0
host/rootfs/{ => image}/etc/mdev.conf | 0
host/rootfs/{ => image}/etc/mdev/listen | 0
host/rootfs/{ => image}/etc/mdev/net/add | 0
host/rootfs/{ => image}/etc/mdev/wait | 0
host/rootfs/{ => image}/etc/parse-devname | 0
host/rootfs/{ => image}/etc/passwd | 0
host/rootfs/{ => image}/etc/passwd.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../etc/s6-linux-init/run-image/opengl-driver | 0
.../run-image/service/dbus/notification-fd | 0
.../run-image/service/dbus/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/dbus/run | 0
.../service/dbus/template/notification-fd | 0
.../service/dbus/template/notification-fd.license | 0
.../run-image/service/dbus/template/run | 0
.../s6-linux-init/run-image/service/getty-tty1/run | 0
.../s6-linux-init/run-image/service/getty-tty2/run | 0
.../s6-linux-init/run-image/service/getty-tty3/run | 0
.../s6-linux-init/run-image/service/getty-tty4/run | 0
.../service/s6-svscan-log/notification-fd | 0
.../service/s6-svscan-log/notification-fd.license | 0
.../run-image/service/s6-svscan-log/run | 0
.../run-image/service/serial-getty-generator/run | 0
.../run-image/service/serial-getty/notification-fd | 0
.../service/serial-getty/notification-fd.license | 0
.../run-image/service/serial-getty/run | 0
.../run-image/service/serial-getty/template/run | 0
.../service/vhost-user-fs/notification-fd | 0
.../service/vhost-user-fs/notification-fd.license | 0
.../run-image/service/vhost-user-fs/run | 0
.../service/vhost-user-fs/template/notification-fd | 0
.../vhost-user-fs/template/notification-fd.license | 0
.../run-image/service/vhost-user-fs/template/run | 0
.../service/vhost-user-gpu/notification-fd | 0
.../service/vhost-user-gpu/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/run | 0
.../service/vhost-user-gpu/template/data/check | 0
.../vhost-user-gpu/template/notification-fd | 0
.../template/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/template/run | 0
.../run-image/service/vhost-user-gpu/template/type | 0
.../service/vhost-user-gpu/template/type.license | 0
.../run-image/service/vmm/notification-fd | 0
.../run-image/service/vmm/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vmm/run | 0
.../run-image/service/vmm/template/notification-fd | 0
.../service/vmm/template/notification-fd.license | 0
.../run-image/service/vmm/template/run | 0
.../notification-fd | 0
.../notification-fd.license | 0
.../service/xdg-desktop-portal-spectrum-host/run | 0
.../template/notification-fd | 0
.../template/notification-fd.license | 0
.../xdg-desktop-portal-spectrum-host/template/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
.../{ => image}/etc/s6-rc/card0/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
host/rootfs/{ => image}/etc/s6-rc/core/type | 0
.../rootfs/{ => image}/etc/s6-rc/core/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/core/up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
.../{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
.../{ => image}/etc/s6-rc/mdevd/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
.../{ => image}/etc/s6-rc/ok-all/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
.../etc/s6-rc/static-nodes/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
.../{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
.../{ => image}/etc/s6-rc/sys-vmms/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
.../{ => image}/etc/s6-rc/vm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
.../{ => image}/etc/s6-rc/vmm-env/type.license | 0
.../{ => image}/etc/s6-rc/weston/dependencies | 0
.../{ => image}/etc/s6-rc/weston/notification-fd | 0
.../etc/s6-rc/weston/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
.../{ => image}/etc/s6-rc/weston/type.license | 0
host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
host/rootfs/{ => image}/lib | 0
host/rootfs/{ => image}/sbin | 0
host/rootfs/{ => image}/usr/bin/assign-devices | 0
.../{ => image}/usr/bin/create-vm-dependencies | 0
host/rootfs/{ => image}/usr/bin/run-appimage | 0
host/rootfs/{ => image}/usr/bin/run-vmm | 0
host/rootfs/{ => image}/usr/bin/vm-console | 0
host/rootfs/{ => image}/usr/bin/vm-import | 0
host/rootfs/{ => image}/usr/bin/vm-start | 0
host/rootfs/{ => image}/usr/bin/vm-stop | 0
host/rootfs/{ => image}/usr/bin/xdg-open | 0
.../org.freedesktop.portal.Documents.service | 0
img/app/Makefile | 98 +-------------
img/app/default.nix | 1 +
img/app/file-list.mk | 65 ++++++++++
img/app/{ => image}/bin | 0
img/app/{ => image}/etc/dbus-1/session.conf | 0
img/app/{ => image}/etc/fonts/fonts.conf | 0
img/app/{ => image}/etc/fstab | 0
img/app/{ => image}/etc/init | 0
img/app/{ => image}/etc/mdev.conf | 0
img/app/{ => image}/etc/mdev/iface | 0
img/app/{ => image}/etc/mdev/listen | 0
img/app/{ => image}/etc/mdev/virtiofs | 0
img/app/{ => image}/etc/mdev/wait | 0
img/app/{ => image}/etc/passwd | 0
img/app/{ => image}/etc/passwd.license | 0
img/app/{ => image}/etc/pipewire/pipewire.conf | 0
img/app/{ => image}/etc/resolv.conf | 0
.../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
.../env/DBUS_SESSION_BUS_ADDRESS.license | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
.../etc/s6-linux-init/env/DISPLAY.license | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
.../s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
.../env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../s6-linux-init-shutdownd/notification-fd | 0
.../notification-fd.license | 0
.../run-image/service/s6-linux-init-shutdownd/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../etc/s6-linux-init/scripts/rc.shutdown | 0
.../etc/s6-linux-init/scripts/rc.shutdown.final | 0
.../{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
.../etc/s6-rc/app/dependencies.d/pipewire | 0
.../s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
img/app/{ => image}/etc/s6-rc/app/run | 0
img/app/{ => image}/etc/s6-rc/app/type | 0
img/app/{ => image}/etc/s6-rc/app/type.license | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/dbus/run | 0
img/app/{ => image}/etc/s6-rc/dbus/type | 0
img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/mdevd/run | 0
img/app/{ => image}/etc/s6-rc/mdevd/type | 0
img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
img/app/{ => image}/etc/s6-rc/ok-all/type | 0
img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
.../{ => image}/etc/s6-rc/pipewire/notification-fd | 0
.../etc/s6-rc/pipewire/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/run | 0
img/app/{ => image}/etc/s6-rc/pipewire/type | 0
.../{ => image}/etc/s6-rc/pipewire/type.license | 0
.../etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
.../wayland-proxy-virtwl/notification-fd.license | 0
.../{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
.../etc/s6-rc/wayland-proxy-virtwl/type | 0
.../etc/s6-rc/wayland-proxy-virtwl/type.license | 0
.../etc/s6-rc/wireplumber/dependencies.d/dbus | 0
.../etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
.../{ => image}/etc/s6-rc/wireplumber/type.license | 0
.../{ => image}/etc/ssl/certs/ca-certificates.crt | 0
.../wireplumber.conf.d/99_spectrum.conf | 0
.../etc/xdg/xdg-desktop-portal/portals.conf | 0
img/app/{ => image}/sbin | 0
lib/common.mk | 1 +
lib/erofs.mk | 49 +++++++
scripts/genfiles.awk | 120 ++++++++++++++++++
scripts/genfiles.sh | 26 ++++
scripts/git-rebase | 17 +++
scripts/pre-commit.sh | 11 ++
vm/sys/net/Makefile | 69 +---------
vm/sys/net/default.nix | 1 +
vm/sys/net/file-list.mk | 42 ++++++
vm/sys/net/{ => image}/bin | 0
vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
vm/sys/net/{ => image}/etc/fstab | 0
vm/sys/net/{ => image}/etc/init | 0
vm/sys/net/{ => image}/etc/mdev.conf | 0
vm/sys/net/{ => image}/etc/mdev/iface | 0
vm/sys/net/{ => image}/etc/nftables.conf | 0
vm/sys/net/{ => image}/etc/passwd | 0
vm/sys/net/{ => image}/etc/passwd.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../net/{ => image}/etc/s6-rc/connman/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
.../net/{ => image}/etc/s6-rc/connman/type.license | 0
.../net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
.../net/{ => image}/etc/s6-rc/mdevd/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
.../{ => image}/etc/s6-rc/nftables/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
.../net/{ => image}/etc/s6-rc/ok-all/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
.../net/{ => image}/etc/s6-rc/sysctl/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
vm/sys/net/{ => image}/etc/sysctl.conf | 0
vm/sys/net/{ => image}/lib | 0
vm/sys/net/{ => image}/sbin | 0
vm/sys/net/{ => image}/var/run | 0
254 files changed, 463 insertions(+), 297 deletions(-)
---
base-commit: cbb10b15f36a7ac35400e226b284b1cb091cb3c9
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v2 1/3] Move all files for the image into a subdirectory
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
@ 2025-09-10 5:29 ` Demi Marie Obenour
2025-09-10 18:58 ` Alyssa Ross
2025-09-10 5:29 ` [PATCH v2 2/3] Generate makefile file lists from a script Demi Marie Obenour
` (3 subsequent siblings)
4 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-10 5:29 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
This avoids conflating files that will only be used during the build
with files that will be included in the generated image. It also makes
it vastly easier to generate the lists of files in the Makefile from a
script.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/Makefile | 182 ++++++++++-----------
host/rootfs/{ => image}/bin | 0
host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
host/rootfs/{ => image}/etc/fstab | 0
host/rootfs/{ => image}/etc/group | 0
host/rootfs/{ => image}/etc/group.license | 0
host/rootfs/{ => image}/etc/init | 0
host/rootfs/{ => image}/etc/login | 0
host/rootfs/{ => image}/etc/mdev.conf | 0
host/rootfs/{ => image}/etc/mdev/listen | 0
host/rootfs/{ => image}/etc/mdev/net/add | 0
host/rootfs/{ => image}/etc/mdev/wait | 0
host/rootfs/{ => image}/etc/parse-devname | 0
host/rootfs/{ => image}/etc/passwd | 0
host/rootfs/{ => image}/etc/passwd.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../etc/s6-linux-init/run-image/opengl-driver | 0
.../run-image/service/dbus/notification-fd | 0
.../run-image/service/dbus/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/dbus/run | 0
.../service/dbus/template/notification-fd | 0
.../service/dbus/template/notification-fd.license | 0
.../run-image/service/dbus/template/run | 0
.../s6-linux-init/run-image/service/getty-tty1/run | 0
.../s6-linux-init/run-image/service/getty-tty2/run | 0
.../s6-linux-init/run-image/service/getty-tty3/run | 0
.../s6-linux-init/run-image/service/getty-tty4/run | 0
.../service/s6-svscan-log/notification-fd | 0
.../service/s6-svscan-log/notification-fd.license | 0
.../run-image/service/s6-svscan-log/run | 0
.../run-image/service/serial-getty-generator/run | 0
.../run-image/service/serial-getty/notification-fd | 0
.../service/serial-getty/notification-fd.license | 0
.../run-image/service/serial-getty/run | 0
.../run-image/service/serial-getty/template/run | 0
.../service/vhost-user-fs/notification-fd | 0
.../service/vhost-user-fs/notification-fd.license | 0
.../run-image/service/vhost-user-fs/run | 0
.../service/vhost-user-fs/template/notification-fd | 0
.../vhost-user-fs/template/notification-fd.license | 0
.../run-image/service/vhost-user-fs/template/run | 0
.../service/vhost-user-gpu/notification-fd | 0
.../service/vhost-user-gpu/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/run | 0
.../service/vhost-user-gpu/template/data/check | 0
.../vhost-user-gpu/template/notification-fd | 0
.../template/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/template/run | 0
.../run-image/service/vhost-user-gpu/template/type | 0
.../service/vhost-user-gpu/template/type.license | 0
.../run-image/service/vmm/notification-fd | 0
.../run-image/service/vmm/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vmm/run | 0
.../run-image/service/vmm/template/notification-fd | 0
.../service/vmm/template/notification-fd.license | 0
.../run-image/service/vmm/template/run | 0
.../notification-fd | 0
.../notification-fd.license | 0
.../service/xdg-desktop-portal-spectrum-host/run | 0
.../template/notification-fd | 0
.../template/notification-fd.license | 0
.../xdg-desktop-portal-spectrum-host/template/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
.../{ => image}/etc/s6-rc/card0/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
host/rootfs/{ => image}/etc/s6-rc/core/type | 0
.../rootfs/{ => image}/etc/s6-rc/core/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/core/up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
.../{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
.../{ => image}/etc/s6-rc/mdevd/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
.../{ => image}/etc/s6-rc/ok-all/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
.../etc/s6-rc/static-nodes/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
.../{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
.../{ => image}/etc/s6-rc/sys-vmms/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
.../{ => image}/etc/s6-rc/vm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
.../{ => image}/etc/s6-rc/vmm-env/type.license | 0
.../{ => image}/etc/s6-rc/weston/dependencies | 0
.../{ => image}/etc/s6-rc/weston/notification-fd | 0
.../etc/s6-rc/weston/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
.../{ => image}/etc/s6-rc/weston/type.license | 0
host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
host/rootfs/{ => image}/lib | 0
host/rootfs/{ => image}/sbin | 0
host/rootfs/{ => image}/usr/bin/assign-devices | 0
.../{ => image}/usr/bin/create-vm-dependencies | 0
host/rootfs/{ => image}/usr/bin/run-appimage | 0
host/rootfs/{ => image}/usr/bin/run-vmm | 0
host/rootfs/{ => image}/usr/bin/vm-console | 0
host/rootfs/{ => image}/usr/bin/vm-import | 0
host/rootfs/{ => image}/usr/bin/vm-start | 0
host/rootfs/{ => image}/usr/bin/vm-stop | 0
host/rootfs/{ => image}/usr/bin/xdg-open | 0
.../org.freedesktop.portal.Documents.service | 0
img/app/Makefile | 110 ++++++-------
img/app/{ => image}/bin | 0
img/app/{ => image}/etc/dbus-1/session.conf | 0
img/app/{ => image}/etc/fonts/fonts.conf | 0
img/app/{ => image}/etc/fstab | 0
img/app/{ => image}/etc/init | 0
img/app/{ => image}/etc/mdev.conf | 0
img/app/{ => image}/etc/mdev/iface | 0
img/app/{ => image}/etc/mdev/listen | 0
img/app/{ => image}/etc/mdev/virtiofs | 0
img/app/{ => image}/etc/mdev/wait | 0
img/app/{ => image}/etc/passwd | 0
img/app/{ => image}/etc/passwd.license | 0
img/app/{ => image}/etc/pipewire/pipewire.conf | 0
img/app/{ => image}/etc/resolv.conf | 0
.../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
.../env/DBUS_SESSION_BUS_ADDRESS.license | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
.../etc/s6-linux-init/env/DISPLAY.license | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
.../s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
.../env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../s6-linux-init-shutdownd/notification-fd | 0
.../notification-fd.license | 0
.../run-image/service/s6-linux-init-shutdownd/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../etc/s6-linux-init/scripts/rc.shutdown | 0
.../etc/s6-linux-init/scripts/rc.shutdown.final | 0
.../{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
.../etc/s6-rc/app/dependencies.d/pipewire | 0
.../s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
img/app/{ => image}/etc/s6-rc/app/run | 0
img/app/{ => image}/etc/s6-rc/app/type | 0
img/app/{ => image}/etc/s6-rc/app/type.license | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/dbus/run | 0
img/app/{ => image}/etc/s6-rc/dbus/type | 0
img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/mdevd/run | 0
img/app/{ => image}/etc/s6-rc/mdevd/type | 0
img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
img/app/{ => image}/etc/s6-rc/ok-all/type | 0
img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
.../{ => image}/etc/s6-rc/pipewire/notification-fd | 0
.../etc/s6-rc/pipewire/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/run | 0
img/app/{ => image}/etc/s6-rc/pipewire/type | 0
.../{ => image}/etc/s6-rc/pipewire/type.license | 0
.../etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
.../wayland-proxy-virtwl/notification-fd.license | 0
.../{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
.../etc/s6-rc/wayland-proxy-virtwl/type | 0
.../etc/s6-rc/wayland-proxy-virtwl/type.license | 0
.../etc/s6-rc/wireplumber/dependencies.d/dbus | 0
.../etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
.../{ => image}/etc/s6-rc/wireplumber/type.license | 0
.../{ => image}/etc/ssl/certs/ca-certificates.crt | 0
.../wireplumber.conf.d/99_spectrum.conf | 0
.../etc/xdg/xdg-desktop-portal/portals.conf | 0
img/app/{ => image}/sbin | 0
vm/sys/net/Makefile | 64 ++++----
vm/sys/net/{ => image}/bin | 0
vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
vm/sys/net/{ => image}/etc/fstab | 0
vm/sys/net/{ => image}/etc/init | 0
vm/sys/net/{ => image}/etc/mdev.conf | 0
vm/sys/net/{ => image}/etc/mdev/iface | 0
vm/sys/net/{ => image}/etc/nftables.conf | 0
vm/sys/net/{ => image}/etc/passwd | 0
vm/sys/net/{ => image}/etc/passwd.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../net/{ => image}/etc/s6-rc/connman/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
.../net/{ => image}/etc/s6-rc/connman/type.license | 0
.../net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
.../net/{ => image}/etc/s6-rc/mdevd/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
.../{ => image}/etc/s6-rc/nftables/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
.../net/{ => image}/etc/s6-rc/ok-all/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
.../net/{ => image}/etc/s6-rc/sysctl/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
vm/sys/net/{ => image}/etc/sysctl.conf | 0
vm/sys/net/{ => image}/lib | 0
vm/sys/net/{ => image}/sbin | 0
vm/sys/net/{ => image}/var/run | 0
241 files changed, 178 insertions(+), 178 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index e96458dba06ae31129b115b2b649962f8d88187a..4872699d88107feab3e695c6be0b1503a6566520 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -8,62 +8,62 @@ include ../../lib/common.mk
dest = build/rootfs.erofs
FILES = \
- etc/fonts/fonts.conf \
- etc/fstab \
- etc/group \
- etc/init \
- etc/login \
- etc/mdev.conf \
- etc/mdev/listen \
- etc/mdev/net/add \
- etc/mdev/wait \
- etc/parse-devname \
- etc/passwd \
- etc/s6-linux-init/env/WAYLAND_DISPLAY \
- etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- etc/s6-linux-init/run-image/service/dbus/notification-fd \
- etc/s6-linux-init/run-image/service/dbus/run \
- etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- etc/s6-linux-init/run-image/service/dbus/template/run \
- etc/s6-linux-init/run-image/service/getty-tty1/run \
- etc/s6-linux-init/run-image/service/getty-tty2/run \
- etc/s6-linux-init/run-image/service/getty-tty3/run \
- etc/s6-linux-init/run-image/service/getty-tty4/run \
- etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- etc/s6-linux-init/run-image/service/serial-getty/run \
- etc/s6-linux-init/run-image/service/serial-getty/template/run \
- etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- etc/s6-linux-init/run-image/service/vmm/notification-fd \
- etc/s6-linux-init/run-image/service/vmm/run \
- etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/xdg/weston/autolaunch \
- etc/xdg/weston/weston.ini \
- usr/bin/assign-devices \
- usr/bin/create-vm-dependencies \
- usr/bin/run-appimage \
- usr/bin/run-vmm \
- usr/bin/vm-console \
- usr/bin/vm-import \
- usr/bin/vm-start \
- usr/bin/vm-stop \
- usr/bin/xdg-open \
- usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open
DIRS = \
dev \
@@ -104,18 +104,18 @@ FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
# These are separate because they need to be included, but putting
# them as make dependencies would confuse make.
LINKS = \
- bin \
- etc/s6-linux-init/run-image/opengl-driver \
- etc/s6-linux-init/run-image/service/vmm/template/run \
- lib \
- sbin
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
BUILD_FILES = build/etc/s6-rc
$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
( \
cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(DIRS) ;\
printf 'build/fifo\n%s\n' $(FIFOS) ;\
@@ -129,34 +129,34 @@ build/empty:
mkdir -p $@
S6_RC_FILES = \
- etc/s6-rc/card0/type \
- etc/s6-rc/card0/up \
- etc/s6-rc/core/type \
- etc/s6-rc/core/up \
- etc/s6-rc/kvm/timeout-up \
- etc/s6-rc/kvm/type \
- etc/s6-rc/kvm/up \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/static-nodes/type \
- etc/s6-rc/static-nodes/up \
- etc/s6-rc/sys-vmms/dependencies \
- etc/s6-rc/sys-vmms/type \
- etc/s6-rc/sys-vmms/up \
- etc/s6-rc/vm-env/contents \
- etc/s6-rc/vm-env/type \
- etc/s6-rc/vmm-env/contents \
- etc/s6-rc/vmm-env/type \
- etc/s6-rc/weston/dependencies \
- etc/s6-rc/weston/notification-fd \
- etc/s6-rc/weston/run \
- etc/s6-rc/weston/type
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/type \
+ image/etc/s6-rc/weston/run
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
@@ -170,7 +170,7 @@ build/etc/s6-rc: $(S6_RC_FILES)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/host/rootfs/bin b/host/rootfs/image/bin
similarity index 100%
rename from host/rootfs/bin
rename to host/rootfs/image/bin
diff --git a/host/rootfs/etc/fonts/fonts.conf b/host/rootfs/image/etc/fonts/fonts.conf
similarity index 100%
rename from host/rootfs/etc/fonts/fonts.conf
rename to host/rootfs/image/etc/fonts/fonts.conf
diff --git a/host/rootfs/etc/fstab b/host/rootfs/image/etc/fstab
similarity index 100%
rename from host/rootfs/etc/fstab
rename to host/rootfs/image/etc/fstab
diff --git a/host/rootfs/etc/group b/host/rootfs/image/etc/group
similarity index 100%
rename from host/rootfs/etc/group
rename to host/rootfs/image/etc/group
diff --git a/host/rootfs/etc/group.license b/host/rootfs/image/etc/group.license
similarity index 100%
rename from host/rootfs/etc/group.license
rename to host/rootfs/image/etc/group.license
diff --git a/host/rootfs/etc/init b/host/rootfs/image/etc/init
similarity index 100%
rename from host/rootfs/etc/init
rename to host/rootfs/image/etc/init
diff --git a/host/rootfs/etc/login b/host/rootfs/image/etc/login
similarity index 100%
rename from host/rootfs/etc/login
rename to host/rootfs/image/etc/login
diff --git a/host/rootfs/etc/mdev.conf b/host/rootfs/image/etc/mdev.conf
similarity index 100%
rename from host/rootfs/etc/mdev.conf
rename to host/rootfs/image/etc/mdev.conf
diff --git a/host/rootfs/etc/mdev/listen b/host/rootfs/image/etc/mdev/listen
similarity index 100%
rename from host/rootfs/etc/mdev/listen
rename to host/rootfs/image/etc/mdev/listen
diff --git a/host/rootfs/etc/mdev/net/add b/host/rootfs/image/etc/mdev/net/add
similarity index 100%
rename from host/rootfs/etc/mdev/net/add
rename to host/rootfs/image/etc/mdev/net/add
diff --git a/host/rootfs/etc/mdev/wait b/host/rootfs/image/etc/mdev/wait
similarity index 100%
rename from host/rootfs/etc/mdev/wait
rename to host/rootfs/image/etc/mdev/wait
diff --git a/host/rootfs/etc/parse-devname b/host/rootfs/image/etc/parse-devname
similarity index 100%
rename from host/rootfs/etc/parse-devname
rename to host/rootfs/image/etc/parse-devname
diff --git a/host/rootfs/etc/passwd b/host/rootfs/image/etc/passwd
similarity index 100%
rename from host/rootfs/etc/passwd
rename to host/rootfs/image/etc/passwd
diff --git a/host/rootfs/etc/passwd.license b/host/rootfs/image/etc/passwd.license
similarity index 100%
rename from host/rootfs/etc/passwd.license
rename to host/rootfs/image/etc/passwd.license
diff --git a/host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY b/host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY
rename to host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
diff --git a/host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY.license b/host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
rename to host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
diff --git a/host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR b/host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR
rename to host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
diff --git a/host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license b/host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
rename to host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/opengl-driver b/host/rootfs/image/etc/s6-linux-init/run-image/opengl-driver
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/opengl-driver
rename to host/rootfs/image/etc/s6-linux-init/run-image/opengl-driver
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty1/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty1/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty1/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty1/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty2/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty2/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty2/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty2/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty3/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty3/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty3/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty3/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty4/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty4/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty4/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty4/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty-generator/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty-generator/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
diff --git a/host/rootfs/etc/s6-linux-init/scripts/rc.init b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/scripts/rc.init
rename to host/rootfs/image/etc/s6-linux-init/scripts/rc.init
diff --git a/host/rootfs/etc/s6-rc/card0/type b/host/rootfs/image/etc/s6-rc/card0/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/type
rename to host/rootfs/image/etc/s6-rc/card0/type
diff --git a/host/rootfs/etc/s6-rc/card0/type.license b/host/rootfs/image/etc/s6-rc/card0/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/type.license
rename to host/rootfs/image/etc/s6-rc/card0/type.license
diff --git a/host/rootfs/etc/s6-rc/card0/up b/host/rootfs/image/etc/s6-rc/card0/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/up
rename to host/rootfs/image/etc/s6-rc/card0/up
diff --git a/host/rootfs/etc/s6-rc/core/type b/host/rootfs/image/etc/s6-rc/core/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/type
rename to host/rootfs/image/etc/s6-rc/core/type
diff --git a/host/rootfs/etc/s6-rc/core/type.license b/host/rootfs/image/etc/s6-rc/core/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/type.license
rename to host/rootfs/image/etc/s6-rc/core/type.license
diff --git a/host/rootfs/etc/s6-rc/core/up b/host/rootfs/image/etc/s6-rc/core/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/up
rename to host/rootfs/image/etc/s6-rc/core/up
diff --git a/host/rootfs/etc/s6-rc/kvm/timeout-up b/host/rootfs/image/etc/s6-rc/kvm/timeout-up
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/timeout-up
rename to host/rootfs/image/etc/s6-rc/kvm/timeout-up
diff --git a/host/rootfs/etc/s6-rc/kvm/timeout-up.license b/host/rootfs/image/etc/s6-rc/kvm/timeout-up.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/timeout-up.license
rename to host/rootfs/image/etc/s6-rc/kvm/timeout-up.license
diff --git a/host/rootfs/etc/s6-rc/kvm/type b/host/rootfs/image/etc/s6-rc/kvm/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/type
rename to host/rootfs/image/etc/s6-rc/kvm/type
diff --git a/host/rootfs/etc/s6-rc/kvm/type.license b/host/rootfs/image/etc/s6-rc/kvm/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/type.license
rename to host/rootfs/image/etc/s6-rc/kvm/type.license
diff --git a/host/rootfs/etc/s6-rc/kvm/up b/host/rootfs/image/etc/s6-rc/kvm/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/up
rename to host/rootfs/image/etc/s6-rc/kvm/up
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/dependencies b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/dependencies
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/type b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/type
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/type.license b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/type.license
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/up b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/up
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/host/rootfs/etc/s6-rc/mdevd/notification-fd b/host/rootfs/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/notification-fd
rename to host/rootfs/image/etc/s6-rc/mdevd/notification-fd
diff --git a/host/rootfs/etc/s6-rc/mdevd/notification-fd.license b/host/rootfs/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/notification-fd.license
rename to host/rootfs/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/host/rootfs/etc/s6-rc/mdevd/run b/host/rootfs/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/run
rename to host/rootfs/image/etc/s6-rc/mdevd/run
diff --git a/host/rootfs/etc/s6-rc/mdevd/type b/host/rootfs/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/type
rename to host/rootfs/image/etc/s6-rc/mdevd/type
diff --git a/host/rootfs/etc/s6-rc/mdevd/type.license b/host/rootfs/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/type.license
rename to host/rootfs/image/etc/s6-rc/mdevd/type.license
diff --git a/host/rootfs/etc/s6-rc/ok-all/contents b/host/rootfs/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/contents
rename to host/rootfs/image/etc/s6-rc/ok-all/contents
diff --git a/host/rootfs/etc/s6-rc/ok-all/type b/host/rootfs/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/type
rename to host/rootfs/image/etc/s6-rc/ok-all/type
diff --git a/host/rootfs/etc/s6-rc/ok-all/type.license b/host/rootfs/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/type.license
rename to host/rootfs/image/etc/s6-rc/ok-all/type.license
diff --git a/host/rootfs/etc/s6-rc/static-nodes/type b/host/rootfs/image/etc/s6-rc/static-nodes/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/type
rename to host/rootfs/image/etc/s6-rc/static-nodes/type
diff --git a/host/rootfs/etc/s6-rc/static-nodes/type.license b/host/rootfs/image/etc/s6-rc/static-nodes/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/type.license
rename to host/rootfs/image/etc/s6-rc/static-nodes/type.license
diff --git a/host/rootfs/etc/s6-rc/static-nodes/up b/host/rootfs/image/etc/s6-rc/static-nodes/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/up
rename to host/rootfs/image/etc/s6-rc/static-nodes/up
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/dependencies b/host/rootfs/image/etc/s6-rc/sys-vmms/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/dependencies
rename to host/rootfs/image/etc/s6-rc/sys-vmms/dependencies
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/type b/host/rootfs/image/etc/s6-rc/sys-vmms/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/type
rename to host/rootfs/image/etc/s6-rc/sys-vmms/type
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/type.license b/host/rootfs/image/etc/s6-rc/sys-vmms/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/type.license
rename to host/rootfs/image/etc/s6-rc/sys-vmms/type.license
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/up b/host/rootfs/image/etc/s6-rc/sys-vmms/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/up
rename to host/rootfs/image/etc/s6-rc/sys-vmms/up
diff --git a/host/rootfs/etc/s6-rc/vm-env/contents b/host/rootfs/image/etc/s6-rc/vm-env/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/contents
rename to host/rootfs/image/etc/s6-rc/vm-env/contents
diff --git a/host/rootfs/etc/s6-rc/vm-env/type b/host/rootfs/image/etc/s6-rc/vm-env/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/type
rename to host/rootfs/image/etc/s6-rc/vm-env/type
diff --git a/host/rootfs/etc/s6-rc/vm-env/type.license b/host/rootfs/image/etc/s6-rc/vm-env/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/type.license
rename to host/rootfs/image/etc/s6-rc/vm-env/type.license
diff --git a/host/rootfs/etc/s6-rc/vmm-env/contents b/host/rootfs/image/etc/s6-rc/vmm-env/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/contents
rename to host/rootfs/image/etc/s6-rc/vmm-env/contents
diff --git a/host/rootfs/etc/s6-rc/vmm-env/type b/host/rootfs/image/etc/s6-rc/vmm-env/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/type
rename to host/rootfs/image/etc/s6-rc/vmm-env/type
diff --git a/host/rootfs/etc/s6-rc/vmm-env/type.license b/host/rootfs/image/etc/s6-rc/vmm-env/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/type.license
rename to host/rootfs/image/etc/s6-rc/vmm-env/type.license
diff --git a/host/rootfs/etc/s6-rc/weston/dependencies b/host/rootfs/image/etc/s6-rc/weston/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/dependencies
rename to host/rootfs/image/etc/s6-rc/weston/dependencies
diff --git a/host/rootfs/etc/s6-rc/weston/notification-fd b/host/rootfs/image/etc/s6-rc/weston/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/notification-fd
rename to host/rootfs/image/etc/s6-rc/weston/notification-fd
diff --git a/host/rootfs/etc/s6-rc/weston/notification-fd.license b/host/rootfs/image/etc/s6-rc/weston/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/notification-fd.license
rename to host/rootfs/image/etc/s6-rc/weston/notification-fd.license
diff --git a/host/rootfs/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/run
rename to host/rootfs/image/etc/s6-rc/weston/run
diff --git a/host/rootfs/etc/s6-rc/weston/type b/host/rootfs/image/etc/s6-rc/weston/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/type
rename to host/rootfs/image/etc/s6-rc/weston/type
diff --git a/host/rootfs/etc/s6-rc/weston/type.license b/host/rootfs/image/etc/s6-rc/weston/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/type.license
rename to host/rootfs/image/etc/s6-rc/weston/type.license
diff --git a/host/rootfs/etc/xdg/weston/autolaunch b/host/rootfs/image/etc/xdg/weston/autolaunch
similarity index 100%
rename from host/rootfs/etc/xdg/weston/autolaunch
rename to host/rootfs/image/etc/xdg/weston/autolaunch
diff --git a/host/rootfs/etc/xdg/weston/weston.ini b/host/rootfs/image/etc/xdg/weston/weston.ini
similarity index 100%
rename from host/rootfs/etc/xdg/weston/weston.ini
rename to host/rootfs/image/etc/xdg/weston/weston.ini
diff --git a/host/rootfs/lib b/host/rootfs/image/lib
similarity index 100%
rename from host/rootfs/lib
rename to host/rootfs/image/lib
diff --git a/host/rootfs/sbin b/host/rootfs/image/sbin
similarity index 100%
rename from host/rootfs/sbin
rename to host/rootfs/image/sbin
diff --git a/host/rootfs/usr/bin/assign-devices b/host/rootfs/image/usr/bin/assign-devices
similarity index 100%
rename from host/rootfs/usr/bin/assign-devices
rename to host/rootfs/image/usr/bin/assign-devices
diff --git a/host/rootfs/usr/bin/create-vm-dependencies b/host/rootfs/image/usr/bin/create-vm-dependencies
similarity index 100%
rename from host/rootfs/usr/bin/create-vm-dependencies
rename to host/rootfs/image/usr/bin/create-vm-dependencies
diff --git a/host/rootfs/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
similarity index 100%
rename from host/rootfs/usr/bin/run-appimage
rename to host/rootfs/image/usr/bin/run-appimage
diff --git a/host/rootfs/usr/bin/run-vmm b/host/rootfs/image/usr/bin/run-vmm
similarity index 100%
rename from host/rootfs/usr/bin/run-vmm
rename to host/rootfs/image/usr/bin/run-vmm
diff --git a/host/rootfs/usr/bin/vm-console b/host/rootfs/image/usr/bin/vm-console
similarity index 100%
rename from host/rootfs/usr/bin/vm-console
rename to host/rootfs/image/usr/bin/vm-console
diff --git a/host/rootfs/usr/bin/vm-import b/host/rootfs/image/usr/bin/vm-import
similarity index 100%
rename from host/rootfs/usr/bin/vm-import
rename to host/rootfs/image/usr/bin/vm-import
diff --git a/host/rootfs/usr/bin/vm-start b/host/rootfs/image/usr/bin/vm-start
similarity index 100%
rename from host/rootfs/usr/bin/vm-start
rename to host/rootfs/image/usr/bin/vm-start
diff --git a/host/rootfs/usr/bin/vm-stop b/host/rootfs/image/usr/bin/vm-stop
similarity index 100%
rename from host/rootfs/usr/bin/vm-stop
rename to host/rootfs/image/usr/bin/vm-stop
diff --git a/host/rootfs/usr/bin/xdg-open b/host/rootfs/image/usr/bin/xdg-open
similarity index 100%
rename from host/rootfs/usr/bin/xdg-open
rename to host/rootfs/image/usr/bin/xdg-open
diff --git a/host/rootfs/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service b/host/rootfs/image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
similarity index 100%
rename from host/rootfs/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
rename to host/rootfs/image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
diff --git a/img/app/Makefile b/img/app/Makefile
index 9665a6b7158f2d8b183831202a4559ae06d53d16..cc209710cb3d521110ce560ce956cdab228db178 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -30,32 +30,32 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
mv $@.tmp $@
VM_FILES = \
- etc/dbus-1/session.conf \
- etc/fonts/fonts.conf \
- etc/fstab \
- etc/init \
- etc/mdev.conf \
- etc/mdev/iface \
- etc/mdev/listen \
- etc/mdev/virtiofs \
- etc/mdev/wait \
- etc/passwd \
- etc/pipewire/pipewire.conf \
- etc/resolv.conf \
- etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- etc/s6-linux-init/env/DISPLAY \
- etc/s6-linux-init/env/GTK_USE_PORTAL \
- etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- etc/s6-linux-init/env/WAYLAND_DISPLAY \
- etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- etc/s6-linux-init/run-image/service/getty-hvc0/run \
- etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/s6-linux-init/scripts/rc.shutdown \
- etc/s6-linux-init/scripts/rc.shutdown.final \
- etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- etc/xdg/xdg-desktop-portal/portals.conf
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
VM_DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
@@ -65,7 +65,7 @@ VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
# These are separate because they need to be included, but putting
# them as make dependencies would confuse make.
-VM_LINKS = bin etc/ssl/certs/ca-certificates.crt sbin
+VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
VM_BUILD_FILES = build/etc/s6-rc
@@ -79,46 +79,46 @@ build/empty:
build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
VM_S6_RC_FILES = \
- etc/s6-rc/app/dependencies.d/dbus \
- etc/s6-rc/app/dependencies.d/pipewire \
- etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- etc/s6-rc/app/run \
- etc/s6-rc/app/type \
- etc/s6-rc/dbus/notification-fd \
- etc/s6-rc/dbus/run \
- etc/s6-rc/dbus/type \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/pipewire/notification-fd \
- etc/s6-rc/pipewire/run \
- etc/s6-rc/pipewire/type \
- etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- etc/s6-rc/wayland-proxy-virtwl/run \
- etc/s6-rc/wayland-proxy-virtwl/type \
- etc/s6-rc/wireplumber/dependencies.d/dbus \
- etc/s6-rc/wireplumber/dependencies.d/pipewire \
- etc/s6-rc/wireplumber/run \
- etc/s6-rc/wireplumber/type
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
build/etc/s6-rc: $(VM_S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -C image -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/bin b/img/app/image/bin
similarity index 100%
rename from img/app/bin
rename to img/app/image/bin
diff --git a/img/app/etc/dbus-1/session.conf b/img/app/image/etc/dbus-1/session.conf
similarity index 100%
rename from img/app/etc/dbus-1/session.conf
rename to img/app/image/etc/dbus-1/session.conf
diff --git a/img/app/etc/fonts/fonts.conf b/img/app/image/etc/fonts/fonts.conf
similarity index 100%
rename from img/app/etc/fonts/fonts.conf
rename to img/app/image/etc/fonts/fonts.conf
diff --git a/img/app/etc/fstab b/img/app/image/etc/fstab
similarity index 100%
rename from img/app/etc/fstab
rename to img/app/image/etc/fstab
diff --git a/img/app/etc/init b/img/app/image/etc/init
similarity index 100%
rename from img/app/etc/init
rename to img/app/image/etc/init
diff --git a/img/app/etc/mdev.conf b/img/app/image/etc/mdev.conf
similarity index 100%
rename from img/app/etc/mdev.conf
rename to img/app/image/etc/mdev.conf
diff --git a/img/app/etc/mdev/iface b/img/app/image/etc/mdev/iface
similarity index 100%
rename from img/app/etc/mdev/iface
rename to img/app/image/etc/mdev/iface
diff --git a/img/app/etc/mdev/listen b/img/app/image/etc/mdev/listen
similarity index 100%
rename from img/app/etc/mdev/listen
rename to img/app/image/etc/mdev/listen
diff --git a/img/app/etc/mdev/virtiofs b/img/app/image/etc/mdev/virtiofs
similarity index 100%
rename from img/app/etc/mdev/virtiofs
rename to img/app/image/etc/mdev/virtiofs
diff --git a/img/app/etc/mdev/wait b/img/app/image/etc/mdev/wait
similarity index 100%
rename from img/app/etc/mdev/wait
rename to img/app/image/etc/mdev/wait
diff --git a/img/app/etc/passwd b/img/app/image/etc/passwd
similarity index 100%
rename from img/app/etc/passwd
rename to img/app/image/etc/passwd
diff --git a/img/app/etc/passwd.license b/img/app/image/etc/passwd.license
similarity index 100%
rename from img/app/etc/passwd.license
rename to img/app/image/etc/passwd.license
diff --git a/img/app/etc/pipewire/pipewire.conf b/img/app/image/etc/pipewire/pipewire.conf
similarity index 100%
rename from img/app/etc/pipewire/pipewire.conf
rename to img/app/image/etc/pipewire/pipewire.conf
diff --git a/img/app/etc/resolv.conf b/img/app/image/etc/resolv.conf
similarity index 100%
rename from img/app/etc/resolv.conf
rename to img/app/image/etc/resolv.conf
diff --git a/img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS b/img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
rename to img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
diff --git a/img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license b/img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
rename to img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
diff --git a/img/app/etc/s6-linux-init/env/DISPLAY b/img/app/image/etc/s6-linux-init/env/DISPLAY
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DISPLAY
rename to img/app/image/etc/s6-linux-init/env/DISPLAY
diff --git a/img/app/etc/s6-linux-init/env/DISPLAY.license b/img/app/image/etc/s6-linux-init/env/DISPLAY.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DISPLAY.license
rename to img/app/image/etc/s6-linux-init/env/DISPLAY.license
diff --git a/img/app/etc/s6-linux-init/env/GTK_USE_PORTAL b/img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL
similarity index 100%
rename from img/app/etc/s6-linux-init/env/GTK_USE_PORTAL
rename to img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL
diff --git a/img/app/etc/s6-linux-init/env/GTK_USE_PORTAL.license b/img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/GTK_USE_PORTAL.license
rename to img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL.license
diff --git a/img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR b/img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
similarity index 100%
rename from img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
rename to img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
diff --git a/img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license b/img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
rename to img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
diff --git a/img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY b/img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
similarity index 100%
rename from img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY
rename to img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
diff --git a/img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY.license b/img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
rename to img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
diff --git a/img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR b/img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
similarity index 100%
rename from img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR
rename to img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
diff --git a/img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license b/img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
rename to img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
diff --git a/img/app/etc/s6-linux-init/run-image/service/getty-hvc0/run b/img/app/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/getty-hvc0/run
rename to img/app/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
diff --git a/img/app/etc/s6-linux-init/scripts/rc.init b/img/app/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.init
rename to img/app/image/etc/s6-linux-init/scripts/rc.init
diff --git a/img/app/etc/s6-linux-init/scripts/rc.shutdown b/img/app/image/etc/s6-linux-init/scripts/rc.shutdown
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.shutdown
rename to img/app/image/etc/s6-linux-init/scripts/rc.shutdown
diff --git a/img/app/etc/s6-linux-init/scripts/rc.shutdown.final b/img/app/image/etc/s6-linux-init/scripts/rc.shutdown.final
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.shutdown.final
rename to img/app/image/etc/s6-linux-init/scripts/rc.shutdown.final
diff --git a/img/app/etc/s6-rc/app/dependencies.d/dbus b/img/app/image/etc/s6-rc/app/dependencies.d/dbus
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/dbus
rename to img/app/image/etc/s6-rc/app/dependencies.d/dbus
diff --git a/img/app/etc/s6-rc/app/dependencies.d/pipewire b/img/app/image/etc/s6-rc/app/dependencies.d/pipewire
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/pipewire
rename to img/app/image/etc/s6-rc/app/dependencies.d/pipewire
diff --git a/img/app/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl b/img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
rename to img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
diff --git a/img/app/etc/s6-rc/app/run b/img/app/image/etc/s6-rc/app/run
similarity index 100%
rename from img/app/etc/s6-rc/app/run
rename to img/app/image/etc/s6-rc/app/run
diff --git a/img/app/etc/s6-rc/app/type b/img/app/image/etc/s6-rc/app/type
similarity index 100%
rename from img/app/etc/s6-rc/app/type
rename to img/app/image/etc/s6-rc/app/type
diff --git a/img/app/etc/s6-rc/app/type.license b/img/app/image/etc/s6-rc/app/type.license
similarity index 100%
rename from img/app/etc/s6-rc/app/type.license
rename to img/app/image/etc/s6-rc/app/type.license
diff --git a/img/app/etc/s6-rc/dbus/notification-fd b/img/app/image/etc/s6-rc/dbus/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/dbus/notification-fd
rename to img/app/image/etc/s6-rc/dbus/notification-fd
diff --git a/img/app/etc/s6-rc/dbus/notification-fd.license b/img/app/image/etc/s6-rc/dbus/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/dbus/notification-fd.license
rename to img/app/image/etc/s6-rc/dbus/notification-fd.license
diff --git a/img/app/etc/s6-rc/dbus/run b/img/app/image/etc/s6-rc/dbus/run
similarity index 100%
rename from img/app/etc/s6-rc/dbus/run
rename to img/app/image/etc/s6-rc/dbus/run
diff --git a/img/app/etc/s6-rc/dbus/type b/img/app/image/etc/s6-rc/dbus/type
similarity index 100%
rename from img/app/etc/s6-rc/dbus/type
rename to img/app/image/etc/s6-rc/dbus/type
diff --git a/img/app/etc/s6-rc/dbus/type.license b/img/app/image/etc/s6-rc/dbus/type.license
similarity index 100%
rename from img/app/etc/s6-rc/dbus/type.license
rename to img/app/image/etc/s6-rc/dbus/type.license
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/dependencies b/img/app/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/dependencies
rename to img/app/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/type b/img/app/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/type
rename to img/app/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/type.license b/img/app/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/type.license
rename to img/app/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/up b/img/app/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/up
rename to img/app/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/img/app/etc/s6-rc/mdevd/notification-fd b/img/app/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/notification-fd
rename to img/app/image/etc/s6-rc/mdevd/notification-fd
diff --git a/img/app/etc/s6-rc/mdevd/notification-fd.license b/img/app/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/notification-fd.license
rename to img/app/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/img/app/etc/s6-rc/mdevd/run b/img/app/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/run
rename to img/app/image/etc/s6-rc/mdevd/run
diff --git a/img/app/etc/s6-rc/mdevd/type b/img/app/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/type
rename to img/app/image/etc/s6-rc/mdevd/type
diff --git a/img/app/etc/s6-rc/mdevd/type.license b/img/app/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/type.license
rename to img/app/image/etc/s6-rc/mdevd/type.license
diff --git a/img/app/etc/s6-rc/ok-all/contents b/img/app/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/contents
rename to img/app/image/etc/s6-rc/ok-all/contents
diff --git a/img/app/etc/s6-rc/ok-all/type b/img/app/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/type
rename to img/app/image/etc/s6-rc/ok-all/type
diff --git a/img/app/etc/s6-rc/ok-all/type.license b/img/app/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/type.license
rename to img/app/image/etc/s6-rc/ok-all/type.license
diff --git a/img/app/etc/s6-rc/pipewire/notification-fd b/img/app/image/etc/s6-rc/pipewire/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/notification-fd
rename to img/app/image/etc/s6-rc/pipewire/notification-fd
diff --git a/img/app/etc/s6-rc/pipewire/notification-fd.license b/img/app/image/etc/s6-rc/pipewire/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/notification-fd.license
rename to img/app/image/etc/s6-rc/pipewire/notification-fd.license
diff --git a/img/app/etc/s6-rc/pipewire/run b/img/app/image/etc/s6-rc/pipewire/run
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/run
rename to img/app/image/etc/s6-rc/pipewire/run
diff --git a/img/app/etc/s6-rc/pipewire/type b/img/app/image/etc/s6-rc/pipewire/type
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/type
rename to img/app/image/etc/s6-rc/pipewire/type
diff --git a/img/app/etc/s6-rc/pipewire/type.license b/img/app/image/etc/s6-rc/pipewire/type.license
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/type.license
rename to img/app/image/etc/s6-rc/pipewire/type.license
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/run b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/run
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/type b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/type
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/type.license b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/type.license
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
diff --git a/img/app/etc/s6-rc/wireplumber/dependencies.d/dbus b/img/app/image/etc/s6-rc/wireplumber/dependencies.d/dbus
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/dependencies.d/dbus
rename to img/app/image/etc/s6-rc/wireplumber/dependencies.d/dbus
diff --git a/img/app/etc/s6-rc/wireplumber/dependencies.d/pipewire b/img/app/image/etc/s6-rc/wireplumber/dependencies.d/pipewire
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/dependencies.d/pipewire
rename to img/app/image/etc/s6-rc/wireplumber/dependencies.d/pipewire
diff --git a/img/app/etc/s6-rc/wireplumber/run b/img/app/image/etc/s6-rc/wireplumber/run
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/run
rename to img/app/image/etc/s6-rc/wireplumber/run
diff --git a/img/app/etc/s6-rc/wireplumber/type b/img/app/image/etc/s6-rc/wireplumber/type
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/type
rename to img/app/image/etc/s6-rc/wireplumber/type
diff --git a/img/app/etc/s6-rc/wireplumber/type.license b/img/app/image/etc/s6-rc/wireplumber/type.license
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/type.license
rename to img/app/image/etc/s6-rc/wireplumber/type.license
diff --git a/img/app/etc/ssl/certs/ca-certificates.crt b/img/app/image/etc/ssl/certs/ca-certificates.crt
similarity index 100%
rename from img/app/etc/ssl/certs/ca-certificates.crt
rename to img/app/image/etc/ssl/certs/ca-certificates.crt
diff --git a/img/app/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf b/img/app/image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
similarity index 100%
rename from img/app/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
rename to img/app/image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
diff --git a/img/app/etc/xdg/xdg-desktop-portal/portals.conf b/img/app/image/etc/xdg/xdg-desktop-portal/portals.conf
similarity index 100%
rename from img/app/etc/xdg/xdg-desktop-portal/portals.conf
rename to img/app/image/etc/xdg/xdg-desktop-portal/portals.conf
diff --git a/img/app/sbin b/img/app/image/sbin
similarity index 100%
rename from img/app/sbin
rename to img/app/image/sbin
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 755b145175199aa97049dbd7feadc0e76230cf30..7e6da494db83e99042e2b50e72af2e9cd4e1190c 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -29,21 +29,21 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
mv $@.tmp $@
VM_FILES = \
- etc/dbus-1/system.conf \
- etc/fstab \
- etc/init \
- etc/mdev.conf \
- etc/mdev/iface \
- etc/nftables.conf \
- etc/passwd \
- etc/s6-linux-init/run-image/service/getty-hvc0/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
# These are separate because they need to be included, but putting
# them as make dependencies would confuse make.
-VM_LINKS = bin lib sbin var/run
+VM_LINKS = image/bin image/lib image/sbin image/var/run
VM_BUILD_FILES = build/etc/s6-rc
@@ -53,37 +53,37 @@ build/empty:
build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
VM_S6_RC_FILES = \
- etc/s6-rc/connman/dependencies \
- etc/s6-rc/connman/run \
- etc/s6-rc/connman/type \
- etc/s6-rc/dbus/notification-fd \
- etc/s6-rc/dbus/run \
- etc/s6-rc/dbus/type \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/nftables/type \
- etc/s6-rc/nftables/up \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/sysctl/type \
- etc/s6-rc/sysctl/up
+ image/etc/s6-rc/connman/dependencies \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
build/etc/s6-rc: $(VM_S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/bin b/vm/sys/net/image/bin
similarity index 100%
rename from vm/sys/net/bin
rename to vm/sys/net/image/bin
diff --git a/vm/sys/net/etc/dbus-1/system.conf b/vm/sys/net/image/etc/dbus-1/system.conf
similarity index 100%
rename from vm/sys/net/etc/dbus-1/system.conf
rename to vm/sys/net/image/etc/dbus-1/system.conf
diff --git a/vm/sys/net/etc/fstab b/vm/sys/net/image/etc/fstab
similarity index 100%
rename from vm/sys/net/etc/fstab
rename to vm/sys/net/image/etc/fstab
diff --git a/vm/sys/net/etc/init b/vm/sys/net/image/etc/init
similarity index 100%
rename from vm/sys/net/etc/init
rename to vm/sys/net/image/etc/init
diff --git a/vm/sys/net/etc/mdev.conf b/vm/sys/net/image/etc/mdev.conf
similarity index 100%
rename from vm/sys/net/etc/mdev.conf
rename to vm/sys/net/image/etc/mdev.conf
diff --git a/vm/sys/net/etc/mdev/iface b/vm/sys/net/image/etc/mdev/iface
similarity index 100%
rename from vm/sys/net/etc/mdev/iface
rename to vm/sys/net/image/etc/mdev/iface
diff --git a/vm/sys/net/etc/nftables.conf b/vm/sys/net/image/etc/nftables.conf
similarity index 100%
rename from vm/sys/net/etc/nftables.conf
rename to vm/sys/net/image/etc/nftables.conf
diff --git a/vm/sys/net/etc/passwd b/vm/sys/net/image/etc/passwd
similarity index 100%
rename from vm/sys/net/etc/passwd
rename to vm/sys/net/image/etc/passwd
diff --git a/vm/sys/net/etc/passwd.license b/vm/sys/net/image/etc/passwd.license
similarity index 100%
rename from vm/sys/net/etc/passwd.license
rename to vm/sys/net/image/etc/passwd.license
diff --git a/vm/sys/net/etc/s6-linux-init/run-image/service/getty-hvc0/run b/vm/sys/net/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
similarity index 100%
rename from vm/sys/net/etc/s6-linux-init/run-image/service/getty-hvc0/run
rename to vm/sys/net/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
diff --git a/vm/sys/net/etc/s6-linux-init/scripts/rc.init b/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from vm/sys/net/etc/s6-linux-init/scripts/rc.init
rename to vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
diff --git a/vm/sys/net/etc/s6-rc/connman/dependencies b/vm/sys/net/image/etc/s6-rc/connman/dependencies
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/dependencies
rename to vm/sys/net/image/etc/s6-rc/connman/dependencies
diff --git a/vm/sys/net/etc/s6-rc/connman/run b/vm/sys/net/image/etc/s6-rc/connman/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/run
rename to vm/sys/net/image/etc/s6-rc/connman/run
diff --git a/vm/sys/net/etc/s6-rc/connman/type b/vm/sys/net/image/etc/s6-rc/connman/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/type
rename to vm/sys/net/image/etc/s6-rc/connman/type
diff --git a/vm/sys/net/etc/s6-rc/connman/type.license b/vm/sys/net/image/etc/s6-rc/connman/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/type.license
rename to vm/sys/net/image/etc/s6-rc/connman/type.license
diff --git a/vm/sys/net/etc/s6-rc/dbus/notification-fd b/vm/sys/net/image/etc/s6-rc/dbus/notification-fd
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/notification-fd
rename to vm/sys/net/image/etc/s6-rc/dbus/notification-fd
diff --git a/vm/sys/net/etc/s6-rc/dbus/notification-fd.license b/vm/sys/net/image/etc/s6-rc/dbus/notification-fd.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/notification-fd.license
rename to vm/sys/net/image/etc/s6-rc/dbus/notification-fd.license
diff --git a/vm/sys/net/etc/s6-rc/dbus/run b/vm/sys/net/image/etc/s6-rc/dbus/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/run
rename to vm/sys/net/image/etc/s6-rc/dbus/run
diff --git a/vm/sys/net/etc/s6-rc/dbus/type b/vm/sys/net/image/etc/s6-rc/dbus/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/type
rename to vm/sys/net/image/etc/s6-rc/dbus/type
diff --git a/vm/sys/net/etc/s6-rc/dbus/type.license b/vm/sys/net/image/etc/s6-rc/dbus/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/type.license
rename to vm/sys/net/image/etc/s6-rc/dbus/type.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/dependencies b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/dependencies
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/type b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/type
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/type.license b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/type.license
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/up b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/up
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/vm/sys/net/etc/s6-rc/mdevd/notification-fd b/vm/sys/net/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/notification-fd
rename to vm/sys/net/image/etc/s6-rc/mdevd/notification-fd
diff --git a/vm/sys/net/etc/s6-rc/mdevd/notification-fd.license b/vm/sys/net/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/notification-fd.license
rename to vm/sys/net/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd/run b/vm/sys/net/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/run
rename to vm/sys/net/image/etc/s6-rc/mdevd/run
diff --git a/vm/sys/net/etc/s6-rc/mdevd/type b/vm/sys/net/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/type
rename to vm/sys/net/image/etc/s6-rc/mdevd/type
diff --git a/vm/sys/net/etc/s6-rc/mdevd/type.license b/vm/sys/net/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/type.license
rename to vm/sys/net/image/etc/s6-rc/mdevd/type.license
diff --git a/vm/sys/net/etc/s6-rc/nftables/type b/vm/sys/net/image/etc/s6-rc/nftables/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/type
rename to vm/sys/net/image/etc/s6-rc/nftables/type
diff --git a/vm/sys/net/etc/s6-rc/nftables/type.license b/vm/sys/net/image/etc/s6-rc/nftables/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/type.license
rename to vm/sys/net/image/etc/s6-rc/nftables/type.license
diff --git a/vm/sys/net/etc/s6-rc/nftables/up b/vm/sys/net/image/etc/s6-rc/nftables/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/up
rename to vm/sys/net/image/etc/s6-rc/nftables/up
diff --git a/vm/sys/net/etc/s6-rc/ok-all/contents b/vm/sys/net/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/contents
rename to vm/sys/net/image/etc/s6-rc/ok-all/contents
diff --git a/vm/sys/net/etc/s6-rc/ok-all/type b/vm/sys/net/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/type
rename to vm/sys/net/image/etc/s6-rc/ok-all/type
diff --git a/vm/sys/net/etc/s6-rc/ok-all/type.license b/vm/sys/net/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/type.license
rename to vm/sys/net/image/etc/s6-rc/ok-all/type.license
diff --git a/vm/sys/net/etc/s6-rc/sysctl/type b/vm/sys/net/image/etc/s6-rc/sysctl/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/type
rename to vm/sys/net/image/etc/s6-rc/sysctl/type
diff --git a/vm/sys/net/etc/s6-rc/sysctl/type.license b/vm/sys/net/image/etc/s6-rc/sysctl/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/type.license
rename to vm/sys/net/image/etc/s6-rc/sysctl/type.license
diff --git a/vm/sys/net/etc/s6-rc/sysctl/up b/vm/sys/net/image/etc/s6-rc/sysctl/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/up
rename to vm/sys/net/image/etc/s6-rc/sysctl/up
diff --git a/vm/sys/net/etc/sysctl.conf b/vm/sys/net/image/etc/sysctl.conf
similarity index 100%
rename from vm/sys/net/etc/sysctl.conf
rename to vm/sys/net/image/etc/sysctl.conf
diff --git a/vm/sys/net/lib b/vm/sys/net/image/lib
similarity index 100%
rename from vm/sys/net/lib
rename to vm/sys/net/image/lib
diff --git a/vm/sys/net/sbin b/vm/sys/net/image/sbin
similarity index 100%
rename from vm/sys/net/sbin
rename to vm/sys/net/image/sbin
diff --git a/vm/sys/net/var/run b/vm/sys/net/image/var/run
similarity index 100%
rename from vm/sys/net/var/run
rename to vm/sys/net/image/var/run
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v2 2/3] Generate makefile file lists from a script
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 1/3] Move all files for the image into a subdirectory Demi Marie Obenour
@ 2025-09-10 5:29 ` Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 3/3] Common make rules for building erofs images Demi Marie Obenour
` (2 subsequent siblings)
4 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-10 5:29 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
The script will always get them right, whereas humans (the author of
this commit included) generally will not.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Documentation/development/built-in-vms.adoc | 18 +++++
host/rootfs/Makefile | 102 +----------------------
host/rootfs/file-list.mk | 100 +++++++++++++++++++++++
img/app/Makefile | 87 ++++----------------
img/app/file-list.mk | 65 +++++++++++++++
lib/common.mk | 1 +
scripts/genfiles.awk | 120 ++++++++++++++++++++++++++++
scripts/genfiles.sh | 26 ++++++
scripts/git-rebase | 17 ++++
scripts/pre-commit.sh | 11 +++
vm/sys/net/Makefile | 58 ++++----------
vm/sys/net/file-list.mk | 42 ++++++++++
12 files changed, 434 insertions(+), 213 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..66b53f414c8d0101ff5dc9dff1c39e0f28ba9237 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -44,6 +44,24 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for the VM image is stored in a separate file,
+`file-lists.mk`. To update it, run `scripts/genfiles.sh` from the
+same directory as the `file-lists.mk` file you want to update.
+which will regenerate it from the output of `git ls-files`. Any
+changes you made will be lost. This script uses uses Git's index to
+generate the list, so you need to use `git add`, `git rm`, and `git mv`
+to ensure that Git knows about your changes. It is not necessary to
+commit the changes.
+
+It is recommended that you add a Git pre-commit hook that calls
+`scripts/pre-commit.sh`. This updates the `file-list.mk` files
+for you, so that each commit always includes the correct
+`file-list.mk`. Sadly, Git does not run the pre-commit hook
+during rebases, so if you rebase you should use the script
+`scripts/git-rebase` instead of `git rebase`. It tells
+Git to run `scripts/pre-commit.sh` after each commit and then
+calls `git commit --amend` to fixup the commit if needed.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 4872699d88107feab3e695c6be0b1503a6566520..795d0018ea2858c4d21a9ec42370597fd102473a 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,36 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/type \
- image/etc/s6-rc/weston/run
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -165,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..8e5385752d5927d7c67fe4e91812f44e8c9ec033
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES := \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS := \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES := \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index cc209710cb3d521110ce560ce956cdab228db178..04fbf99c7d2e30527aa54e5e549043d03ce6362b 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,49 +45,22 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -C image -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
+ tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
@@ -197,6 +139,11 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
$(KERNEL)
.PHONY: run-crosvm
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: run-$(VMM)
.PHONY: run
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..2a249c27af3c5c7ab5158e3acf52400878ac6b4d
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES := \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS := \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES := \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/lib/common.mk b/lib/common.mk
index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
BACKGROUND = background
CPIO = cpio
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..88a2824c671dbf1fabca184a9e29c28d564d1cee
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,120 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ file_count = 0;
+ symlink_count = 0;
+ rc_count = 0;
+ is_rc = 0;
+ exit_code = 0;
+ done = 0;
+ modes["120000"] = "symlink";
+ modes["040755"] = "directory";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg, status) {
+ if (status ~ /^([1-9][0-9]?|1[0-9]{2}|2[0-4][1-9]|25[1-5])$/) {
+ exit_code = status;
+ } else {
+ exit_code = 1;
+ status = 1;
+ }
+ print ("FATAL: " msg) > "/dev/stderr";
+ exit status;
+}
+done { fail("Junk after DONE", 1); }
+/^DONE$/ {
+ done = 1
+ next
+}
+
+# Make sure git produced valid output.
+!/^[0-7]{6}\t[ -~]+$/ {
+ fail("git ls-files produced invalid output", 1);
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+# Another check for a git bug.
+filename ~ /^\/|((^|\/)\.{0,2}($|\/))/ {
+ fail("git ls-files output non-canonical or absolute path '" filename "'", 1);
+}
+
+filename ~ /[^[:alnum:]_.+@/-]/ {
+ fail("filename '" filename "' has forbidden characters", 1);
+}
+
+/\.license$/ {
+ if (raw_mode != "100644") {
+ fail("License file '" filename "' is executable or not regular file", 1);
+ }
+ next;
+}
+
+mode == "directory" { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_count += 1;
+ rc_files[rc_count] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlink_count += 1;
+ symlinks[symlink_count] = filename;
+ next;
+}
+
+mode == "regular" {
+ file_count += 1;
+ files[file_count] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file, directory, or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ if (!done) {
+ fail("Did not receive DONE line", 1);
+ }
+ printf ("# SPDX-License-Identifier: CC0-1.0\n" \
+ "# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+ "# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
+ "FILES :=") > out_file;
+ for (array_index = 1; array_index <= file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index] > out_file;
+ }
+ printf ("\n\n" \
+"# These are separate because they need to be included, but putting\n" \
+"# them as make dependencies would confuse make.\n" \
+"LINKS :=") > out_file;
+ for (array_index = 1; array_index <= symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index] > out_file;
+ }
+ printf "\n\nS6_RC_FILES :=" > out_file;
+ for (array_index = 1; array_index <= rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index] > out_file;
+ }
+ printf "\n" > out_file;
+ if (close(out_file)) {
+ print ("Cannot close output file: " ERRNO "\n") > "/dev/stderr";
+ exit 1;
+ }
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..cdd24c122e6223bc162612ffc86b1bbaa5503dfa
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C bash --
+set -euo pipefail
+script_file=genfiles.awk
+case $0 in
+(/*) script_file=${0%/*}/$script_file;;
+(*/*) script_file=./${0%/*}/$script_file;;
+(*) script_file=./$script_file;;
+esac
+case ${1-.} in
+('') echo 'Directory name cannot be empty' >&2; exit 1;;
+(*/) output_file=${1}file-list.mk;;
+(*) output_file=${1-.}/file-list.mk;;
+esac
+{
+ git ${1+-C} ${1+"$1"} -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ echo DONE
+} |
+gawk -v "out_file=$output_file.tmp" -E "$script_file"
+status=0
+cmp -s -- "$output_file.tmp" "$output_file" || status=$?
+case $status in
+(0) rm -- "$output_file.tmp";;
+(1) mv -- "$output_file.tmp" "$output_file";;
+(*) exit "$?";;
+esac
diff --git a/scripts/git-rebase b/scripts/git-rebase
new file mode 100755
index 0000000000000000000000000000000000000000..593f9299ddfd2c553ceacc68e738629ca8dec019
--- /dev/null
+++ b/scripts/git-rebase
@@ -0,0 +1,17 @@
+#!/usr/bin/env -S bash --
+set -eu
+case $0 in
+(/*) dir=${0%/*}/..;;
+(*/*) dir=./${0%/*}/..;;
+(*) dir=..;;
+esac
+exec git rebase -x "set -eu; \
+cd '${dir//\'/\'\\\'\'}'; \
+scripts/pre-commit.sh; \
+set +e;\
+git diff --quiet HEAD -- host/rootfs/gen/file-list.mk img/app/file-list.mk vm/sys/net/file-list.mk;\
+case \$? in \
+(0) :;;\
+(1) git commit --amend -- host/rootfs/gen/file-list.mk img/app/file-list.mk vm/sys/net/file-list.mk;;\
+(*) exit \"\$?\";;\
+esac" "$@"
diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh
new file mode 100755
index 0000000000000000000000000000000000000000..517ea0c1f51abbbdf4553c3dcc65a6dbd5531b91
--- /dev/null
+++ b/scripts/pre-commit.sh
@@ -0,0 +1,11 @@
+#!/bin/sh --
+set -eu
+case $0 in
+(/*) cd ${0%/*}/..;;
+(*/*) cd ./${0%/*}/..;;
+(*) cd ..;;
+esac
+for i in host/rootfs img/app vm/sys/net; do
+ scripts/genfiles.sh "$i"
+ git add -- "$i/file-list.mk"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 7e6da494db83e99042e2b50e72af2e9cd4e1190c..11f9215b58a89569ead0c5cc7a4a24b0cc4eec22 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,26 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
+ tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
@@ -138,6 +103,11 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
$(KERNEL)
.PHONY: run-crosvm
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: run-$(VMM)
.PHONY: run
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..a8df7e1e0d16b6854bfe716b1134947241916119
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES := \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS := \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES := \
+ image/etc/s6-rc/connman/dependencies \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v2 3/3] Common make rules for building erofs images
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 1/3] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 2/3] Generate makefile file lists from a script Demi Marie Obenour
@ 2025-09-10 5:29 ` Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-21 2:23 ` [PATCH v3] Generate file lists from a script Demi Marie Obenour
4 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-10 5:29 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
Instead of duplicating the logic in three different places, write common
code for all three makefiles to use instead. This will make future
changes much easier.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/Makefile | 45 +++------------------------------------------
host/rootfs/default.nix | 1 +
img/app/Makefile | 41 ++---------------------------------------
img/app/default.nix | 1 +
lib/erofs.mk | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
vm/sys/net/Makefile | 39 ++++-----------------------------------
vm/sys/net/default.nix | 1 +
7 files changed, 61 insertions(+), 116 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 795d0018ea2858c4d21a9ec42370597fd102473a..e100c9fa240d76a0210b553f5aaa34de93b05e78 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -3,10 +3,8 @@
.POSIX:
-include ../../lib/common.mk
-include file-list.mk
-
-dest = build/rootfs.erofs
+basedir = ../..
+include $(basedir)/lib/erofs.mk
DIRS = \
dev \
@@ -44,44 +42,7 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-BUILD_FILES = build/etc/s6-rc
-
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- printf 'build/fifo\n%s\n' $(FIFOS) ;\
- ) | ../../scripts/make-erofs.sh $@
-
-build/fifo:
- mkdir -p build
- mkfifo -m 0600 $@
-
-build/empty:
- mkdir -p $@
-
-# s6-rc-compile's input is a directory, but that doesn't play nice
-# with Make, because it won't know to update if some file in the
-# directory is changed, or a file is created or removed in a
-# subdirectory. Using the whole source directory could also end up
-# including files that aren't intended to be part of the input, like
-# temporary editor files or .license files. So for all these reasons,
-# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- dir=$$(mktemp -d) && \
- tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
-
-clean:
- -chmod -Rf +w build
- rm -rf build
-.PHONY: clean
+all: $(dest)
# veritysetup format produces two files, but Make only (portably)
# supports one output per rule, so we combine the two outputs then
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 998220d7b6ed322f64ee52c704e71ec9b4643f59..561bf660829dcd5f5e2ee841662727b262d43ed3 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -178,6 +178,7 @@ stdenvNoCC.mkDerivation {
fileset = fileset.intersection src (fileset.unions [
./.
../../lib/common.mk
+ ../../lib/erofs.mk
../../scripts/make-erofs.sh
]);
};
diff --git a/img/app/Makefile b/img/app/Makefile
index 04fbf99c7d2e30527aa54e5e549043d03ce6362b..409c0156bf0d336c17dec6e2324e6fbd6bd4c788 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -4,8 +4,8 @@
.POSIX:
-include ../../lib/common.mk
-include file-list.mk
+basedir = ../..
+include $(basedir)/lib/erofs.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -18,7 +18,6 @@ HOST_BUILD_FILES = \
$(imgdir)/appvm/vmlinux
all: $(HOST_BUILD_FILES)
-.PHONY: all
$(imgdir)/appvm/vmlinux: $(KERNEL)
mkdir -p $$(dirname $@)
@@ -36,33 +35,6 @@ DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/wait
FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-BUILD_FILES = build/etc/s6-rc
-
-build/fifo:
- mkdir -p build
- mkfifo -m 0600 $@
-
-build/empty:
- mkdir -p $@
-
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(addprefix image/,$(FILES)) $(BUILD_FILES) build/empty build/fifo file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf 'image/%s\n%s\n' $$file $$file; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- printf 'build/fifo\n%s\n' $(FIFOS) ;\
- ) | ../../scripts/make-erofs.sh $@
-
-
-build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- dir=$$(mktemp -d) && \
- tar -C image -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
debug:
$(GDB) -q \
@@ -139,14 +111,5 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
$(KERNEL)
.PHONY: run-crosvm
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: run-$(VMM)
.PHONY: run
-
-clean:
- rm -rf build
-.PHONY: clean
diff --git a/img/app/default.nix b/img/app/default.nix
index 71a939c1c053ebd37fc02fa4eed49b883d50ef49..8c2a114e6b4db52afe9c92f9adb3d5ec52ea2260 100644
--- a/img/app/default.nix
+++ b/img/app/default.nix
@@ -105,6 +105,7 @@ stdenvNoCC.mkDerivation {
fileset = lib.fileset.intersection src (lib.fileset.unions [
./.
../../lib/common.mk
+ ../../lib/erofs.mk
../../scripts/make-erofs.sh
../../scripts/make-gpt.sh
../../scripts/sfdisk-field.awk
diff --git a/lib/erofs.mk b/lib/erofs.mk
new file mode 100644
index 0000000000000000000000000000000000000000..1166e2153eb8fde48558affb2a59198a0f0ea917
--- /dev/null
+++ b/lib/erofs.mk
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022 Unikie
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+include $(basedir)/lib/common.mk
+include file-list.mk
+BUILD_FILES += build/etc/s6-rc
+dest = build/rootfs.erofs
+
+all:
+.PHONY: all
+$(dest): $(basedir)/scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
+ set -euo pipefail; ( \
+ cat $(PACKAGES_FILE);\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' "$$file" "$${file#image/}"; done;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' "$$file" "$${file#build/}"; done;\
+ for dir in $(DIRS); do printf 'build/empty\n%s\n' "$$dir"; done;\
+ for fifo in $(FIFOS); do printf 'build/fifo\n%s\n' "$$fifo"; done;\
+ ) | $(basedir)/scripts/make-erofs.sh $@
+
+clean:
+ -chmod -Rf +w build
+ rm -rf build
+.PHONY: clean
+ false
+
+build/fifo:
+ mkdir -p build
+ mkfifo -m 0600 $@
+
+build/empty:
+ mkdir -p $@
+
+# s6-rc-compile's input is a directory, but that doesn't play nice
+# with Make, because it won't know to update if some file in the
+# directory is changed, or a file is created or removed in a
+# subdirectory. Using the whole source directory could also end up
+# including files that aren't intended to be part of the input, like
+# temporary editor files or .license files. So for all these reasons,
+# only explicitly listed files are made available to s6-rc-compile.
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
+ mkdir -p build/etc
+ rm -rf $@
+ set -euo pipefail; \
+ dir=$$(mktemp -d); \
+ { tar -c $(S6_RC_FILES) | tar -C "$$dir" -x --strip-components 3;}; \
+ s6-rc-compile $@ $$dir; \
+ exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 11f9215b58a89569ead0c5cc7a4a24b0cc4eec22..217f95bfeabd80bc6fea1e3264296891ee495ee5 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -3,21 +3,22 @@
.POSIX:
-include ../../../lib/common.mk
-include file-list.mk
+basedir = ../../..
+include $(basedir)/lib/erofs.mk
prefix = build/host
libdir = $(prefix)/lib
vmdir = $(libdir)/spectrum/vm
VMM = cloud-hypervisor
+DIRS =
+FIFOS =
HOST_BUILD_FILES = \
$(vmdir)/netvm/blk/root.img \
$(vmdir)/netvm/vmlinux
all: $(HOST_BUILD_FILES)
-.PHONY: all
$(vmdir)/netvm/vmlinux: $(KERNEL)
mkdir -p $$(dirname $@)
@@ -29,29 +30,6 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-BUILD_FILES = build/etc/s6-rc
-
-build/empty:
- mkdir -p $@
-
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- ) | ../../../scripts/make-erofs.sh $@
-
-
-build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- dir=$$(mktemp -d) && \
- tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3 && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
-
debug:
$(GDB) -q \
-ex 'set substitute-path .. $(LINUX_SRC)' \
@@ -103,14 +81,5 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
$(KERNEL)
.PHONY: run-crosvm
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: run-$(VMM)
.PHONY: run
-
-clean:
- rm -rf build
-.PHONY: clean
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index 7b2b8b1fbb9b9027781812307bed0551b80f5a78..c453f02cb204e97d0627b18c66c29a9767159d40 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -104,6 +104,7 @@ stdenvNoCC.mkDerivation {
fileset = lib.fileset.intersection src (lib.fileset.unions [
./.
../../../lib/common.mk
+ ../../../lib/erofs.mk
../../../scripts/make-erofs.sh
../../../scripts/make-gpt.sh
../../../scripts/sfdisk-field.awk
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v2 1/3] Move all files for the image into a subdirectory
2025-09-10 5:29 ` [PATCH v2 1/3] Move all files for the image into a subdirectory Demi Marie Obenour
@ 2025-09-10 18:58 ` Alyssa Ross
2025-09-11 12:21 ` Demi Marie Obenour
0 siblings, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-10 18:58 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 531 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> This avoids conflating files that will only be used during the build
> with files that will be included in the generated image. It also makes
> it vastly easier to generate the lists of files in the Makefile from a
> script.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
I like it, but release/checks/wayland.nix fails for me with this applied
on top of cbb10b15f36a7ac35400e226b284b1cb091cb3c9, as well as possibly
the integration tests. Can you reproduce?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v2 1/3] Move all files for the image into a subdirectory
2025-09-10 18:58 ` Alyssa Ross
@ 2025-09-11 12:21 ` Demi Marie Obenour
0 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-11 12:21 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 1126 bytes --]
On 9/10/25 14:58, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> This avoids conflating files that will only be used during the build
>> with files that will be included in the generated image. It also makes
>> it vastly easier to generate the lists of files in the Makefile from a
>> script.
>>
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>
> I like it, but release/checks/wayland.nix fails for me with this applied
> on top of cbb10b15f36a7ac35400e226b284b1cb091cb3c9, as well as possibly
> the integration tests. Can you reproduce?
Yes, I can. The problem is that tar is passed -C image, so
instead of image/etc/s6-rc/<something> it tries to access
image/image/etc/s6-rc/<something>, which doesn't exist. This
error gets swallowed, though, so s6-rc-compile gets passed an
empty directory. This causes s6-rc to not know about any
services, and hilarity ensues.
I'll fix this in v3, but also ensure that such problems would
prevent an image from being built instead of producing a broken
image.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v3 0/4] Generate file lists from a script
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
` (2 preceding siblings ...)
2025-09-10 5:29 ` [PATCH v2 3/3] Common make rules for building erofs images Demi Marie Obenour
@ 2025-09-11 12:47 ` Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 1/4] Do not ignore errors from tar Demi Marie Obenour
` (3 more replies)
2025-09-21 2:23 ` [PATCH v3] Generate file lists from a script Demi Marie Obenour
4 siblings, 4 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-11 12:47 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts.
Avoid this problem by moving the files used in the erofs images to an
image/ directory and using what Git knows about this directory to
generate the lists via a script. This makes maintenance easier and
avoids conflating code used in the build (anything not in image/) and
code for the image (anything that is in image/).
This reveals that there is a lot of duplicated make logic around image
generation, so consolidate it in a single makefile that is included by
all three of the makefiles.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Changes in v3:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v2: https://lore.kernel.org/r/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Demi Marie Obenour (4):
Do not ignore errors from tar
Move all files for the image into a subdirectory
Generate makefile file lists from a script
Common make rules for building erofs images
Documentation/development/built-in-vms.adoc | 17 +++
host/rootfs/Makefile | 141 +--------------------
host/rootfs/default.nix | 1 +
host/rootfs/file-list.mk | 100 +++++++++++++++
host/rootfs/{ => image}/bin | 0
host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
host/rootfs/{ => image}/etc/fstab | 0
host/rootfs/{ => image}/etc/group | 0
host/rootfs/{ => image}/etc/group.license | 0
host/rootfs/{ => image}/etc/init | 0
host/rootfs/{ => image}/etc/login | 0
host/rootfs/{ => image}/etc/mdev.conf | 0
host/rootfs/{ => image}/etc/mdev/listen | 0
host/rootfs/{ => image}/etc/mdev/net/add | 0
host/rootfs/{ => image}/etc/mdev/wait | 0
host/rootfs/{ => image}/etc/parse-devname | 0
host/rootfs/{ => image}/etc/passwd | 0
host/rootfs/{ => image}/etc/passwd.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../etc/s6-linux-init/run-image/opengl-driver | 0
.../run-image/service/dbus/notification-fd | 0
.../run-image/service/dbus/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/dbus/run | 0
.../service/dbus/template/notification-fd | 0
.../service/dbus/template/notification-fd.license | 0
.../run-image/service/dbus/template/run | 0
.../s6-linux-init/run-image/service/getty-tty1/run | 0
.../s6-linux-init/run-image/service/getty-tty2/run | 0
.../s6-linux-init/run-image/service/getty-tty3/run | 0
.../s6-linux-init/run-image/service/getty-tty4/run | 0
.../service/s6-svscan-log/notification-fd | 0
.../service/s6-svscan-log/notification-fd.license | 0
.../run-image/service/s6-svscan-log/run | 0
.../run-image/service/serial-getty-generator/run | 0
.../run-image/service/serial-getty/notification-fd | 0
.../service/serial-getty/notification-fd.license | 0
.../run-image/service/serial-getty/run | 0
.../run-image/service/serial-getty/template/run | 0
.../service/vhost-user-fs/notification-fd | 0
.../service/vhost-user-fs/notification-fd.license | 0
.../run-image/service/vhost-user-fs/run | 0
.../service/vhost-user-fs/template/notification-fd | 0
.../vhost-user-fs/template/notification-fd.license | 0
.../run-image/service/vhost-user-fs/template/run | 0
.../service/vhost-user-gpu/notification-fd | 0
.../service/vhost-user-gpu/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/run | 0
.../service/vhost-user-gpu/template/data/check | 0
.../vhost-user-gpu/template/notification-fd | 0
.../template/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/template/run | 0
.../run-image/service/vhost-user-gpu/template/type | 0
.../service/vhost-user-gpu/template/type.license | 0
.../run-image/service/vmm/notification-fd | 0
.../run-image/service/vmm/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vmm/run | 0
.../run-image/service/vmm/template/notification-fd | 0
.../service/vmm/template/notification-fd.license | 0
.../run-image/service/vmm/template/run | 0
.../notification-fd | 0
.../notification-fd.license | 0
.../service/xdg-desktop-portal-spectrum-host/run | 0
.../template/notification-fd | 0
.../template/notification-fd.license | 0
.../xdg-desktop-portal-spectrum-host/template/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
.../{ => image}/etc/s6-rc/card0/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
host/rootfs/{ => image}/etc/s6-rc/core/type | 0
.../rootfs/{ => image}/etc/s6-rc/core/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/core/up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
.../{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
.../{ => image}/etc/s6-rc/mdevd/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
.../{ => image}/etc/s6-rc/ok-all/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
.../etc/s6-rc/static-nodes/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
.../{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
.../{ => image}/etc/s6-rc/sys-vmms/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
.../{ => image}/etc/s6-rc/vm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
.../{ => image}/etc/s6-rc/vmm-env/type.license | 0
.../{ => image}/etc/s6-rc/weston/dependencies | 0
.../{ => image}/etc/s6-rc/weston/notification-fd | 0
.../etc/s6-rc/weston/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
.../{ => image}/etc/s6-rc/weston/type.license | 0
host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
host/rootfs/{ => image}/lib | 0
host/rootfs/{ => image}/sbin | 0
host/rootfs/{ => image}/usr/bin/assign-devices | 0
.../{ => image}/usr/bin/create-vm-dependencies | 0
host/rootfs/{ => image}/usr/bin/run-appimage | 0
host/rootfs/{ => image}/usr/bin/run-vmm | 0
host/rootfs/{ => image}/usr/bin/vm-console | 0
host/rootfs/{ => image}/usr/bin/vm-import | 0
host/rootfs/{ => image}/usr/bin/vm-start | 0
host/rootfs/{ => image}/usr/bin/vm-stop | 0
host/rootfs/{ => image}/usr/bin/xdg-open | 0
.../org.freedesktop.portal.Documents.service | 0
img/app/Makefile | 98 +-------------
img/app/default.nix | 1 +
img/app/file-list.mk | 65 ++++++++++
img/app/{ => image}/bin | 0
img/app/{ => image}/etc/dbus-1/session.conf | 0
img/app/{ => image}/etc/fonts/fonts.conf | 0
img/app/{ => image}/etc/fstab | 0
img/app/{ => image}/etc/init | 0
img/app/{ => image}/etc/mdev.conf | 0
img/app/{ => image}/etc/mdev/iface | 0
img/app/{ => image}/etc/mdev/listen | 0
img/app/{ => image}/etc/mdev/virtiofs | 0
img/app/{ => image}/etc/mdev/wait | 0
img/app/{ => image}/etc/passwd | 0
img/app/{ => image}/etc/passwd.license | 0
img/app/{ => image}/etc/pipewire/pipewire.conf | 0
img/app/{ => image}/etc/resolv.conf | 0
.../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
.../env/DBUS_SESSION_BUS_ADDRESS.license | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
.../etc/s6-linux-init/env/DISPLAY.license | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
.../s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
.../env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../s6-linux-init-shutdownd/notification-fd | 0
.../notification-fd.license | 0
.../run-image/service/s6-linux-init-shutdownd/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../etc/s6-linux-init/scripts/rc.shutdown | 0
.../etc/s6-linux-init/scripts/rc.shutdown.final | 0
.../{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
.../etc/s6-rc/app/dependencies.d/pipewire | 0
.../s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
img/app/{ => image}/etc/s6-rc/app/run | 0
img/app/{ => image}/etc/s6-rc/app/type | 0
img/app/{ => image}/etc/s6-rc/app/type.license | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/dbus/run | 0
img/app/{ => image}/etc/s6-rc/dbus/type | 0
img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/mdevd/run | 0
img/app/{ => image}/etc/s6-rc/mdevd/type | 0
img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
img/app/{ => image}/etc/s6-rc/ok-all/type | 0
img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
.../{ => image}/etc/s6-rc/pipewire/notification-fd | 0
.../etc/s6-rc/pipewire/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/run | 0
img/app/{ => image}/etc/s6-rc/pipewire/type | 0
.../{ => image}/etc/s6-rc/pipewire/type.license | 0
.../etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
.../wayland-proxy-virtwl/notification-fd.license | 0
.../{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
.../etc/s6-rc/wayland-proxy-virtwl/type | 0
.../etc/s6-rc/wayland-proxy-virtwl/type.license | 0
.../etc/s6-rc/wireplumber/dependencies.d/dbus | 0
.../etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
.../{ => image}/etc/s6-rc/wireplumber/type.license | 0
.../{ => image}/etc/ssl/certs/ca-certificates.crt | 0
.../wireplumber.conf.d/99_spectrum.conf | 0
.../etc/xdg/xdg-desktop-portal/portals.conf | 0
img/app/{ => image}/sbin | 0
lib/common.mk | 1 +
lib/erofs.mk | 49 +++++++
scripts/genfiles.awk | 120 ++++++++++++++++++
scripts/genfiles.sh | 23 ++++
scripts/git-rebase | 17 +++
scripts/pre-commit.sh | 9 ++
vm/sys/net/Makefile | 69 +---------
vm/sys/net/default.nix | 1 +
vm/sys/net/file-list.mk | 42 ++++++
vm/sys/net/{ => image}/bin | 0
vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
vm/sys/net/{ => image}/etc/fstab | 0
vm/sys/net/{ => image}/etc/init | 0
vm/sys/net/{ => image}/etc/mdev.conf | 0
vm/sys/net/{ => image}/etc/mdev/iface | 0
vm/sys/net/{ => image}/etc/nftables.conf | 0
vm/sys/net/{ => image}/etc/passwd | 0
vm/sys/net/{ => image}/etc/passwd.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../net/{ => image}/etc/s6-rc/connman/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
.../net/{ => image}/etc/s6-rc/connman/type.license | 0
.../net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
.../net/{ => image}/etc/s6-rc/mdevd/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
.../{ => image}/etc/s6-rc/nftables/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
.../net/{ => image}/etc/s6-rc/ok-all/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
.../net/{ => image}/etc/s6-rc/sysctl/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
vm/sys/net/{ => image}/etc/sysctl.conf | 0
vm/sys/net/{ => image}/lib | 0
vm/sys/net/{ => image}/sbin | 0
vm/sys/net/{ => image}/var/run | 0
254 files changed, 457 insertions(+), 297 deletions(-)
---
base-commit: cbb10b15f36a7ac35400e226b284b1cb091cb3c9
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v3 1/4] Do not ignore errors from tar
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
@ 2025-09-11 12:47 ` Demi Marie Obenour
2025-09-17 11:48 ` Alyssa Ross
2025-09-19 7:55 ` Alyssa Ross
2025-09-11 12:47 ` [PATCH v3 2/4] Move all files for the image into a subdirectory Demi Marie Obenour
` (2 subsequent siblings)
3 siblings, 2 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-11 12:47 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
These would be ignored due to a missing -o pipefail in the shell script.
As a result, listing nonexistent s6-rc-compile inputs would cause a
broken image to be successfully built.
Reported-by: Alyssa Ross <hi@alyssa.is>
Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/Makefile | 4 ++--
img/app/Makefile | 4 ++--
vm/sys/net/Makefile | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
- dir=$$(mktemp -d) && \
- tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ set -uo pipefail; dir=$$(mktemp -d) || exit; \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/Makefile b/img/app/Makefile
index 9665a6b7158f2d8b183831202a4559ae06d53d16..73db07cc4c781d9c41cdf41a6214298aae8de58a 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -117,8 +117,8 @@ build/etc/s6-rc: $(VM_S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
- dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ set -uo pipefail; dir=$$(mktemp -d) || exit; \
+ { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 755b145175199aa97049dbd7feadc0e76230cf30..88ae20de79cd21b06263837f90310e8800b3d4e2 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -82,8 +82,8 @@ build/etc/s6-rc: $(VM_S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
- dir=$$(mktemp -d) && \
- tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
+ set -uo pipefail; dir=$$(mktemp -d) || exit; \
+ { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v3 2/4] Move all files for the image into a subdirectory
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 1/4] Do not ignore errors from tar Demi Marie Obenour
@ 2025-09-11 12:47 ` Demi Marie Obenour
2025-09-17 12:30 ` Alyssa Ross
` (2 more replies)
2025-09-11 12:47 ` [PATCH v3 3/4] Generate makefile file lists from a script Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 4/4] Common make rules for building erofs images Demi Marie Obenour
3 siblings, 3 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-11 12:47 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
This avoids conflating files that will only be used during the build
with files that will be included in the generated image. It also makes
it vastly easier to generate the lists of files in the Makefile from a
script.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/Makefile | 182 ++++++++++-----------
host/rootfs/{ => image}/bin | 0
host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
host/rootfs/{ => image}/etc/fstab | 0
host/rootfs/{ => image}/etc/group | 0
host/rootfs/{ => image}/etc/group.license | 0
host/rootfs/{ => image}/etc/init | 0
host/rootfs/{ => image}/etc/login | 0
host/rootfs/{ => image}/etc/mdev.conf | 0
host/rootfs/{ => image}/etc/mdev/listen | 0
host/rootfs/{ => image}/etc/mdev/net/add | 0
host/rootfs/{ => image}/etc/mdev/wait | 0
host/rootfs/{ => image}/etc/parse-devname | 0
host/rootfs/{ => image}/etc/passwd | 0
host/rootfs/{ => image}/etc/passwd.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../etc/s6-linux-init/run-image/opengl-driver | 0
.../run-image/service/dbus/notification-fd | 0
.../run-image/service/dbus/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/dbus/run | 0
.../service/dbus/template/notification-fd | 0
.../service/dbus/template/notification-fd.license | 0
.../run-image/service/dbus/template/run | 0
.../s6-linux-init/run-image/service/getty-tty1/run | 0
.../s6-linux-init/run-image/service/getty-tty2/run | 0
.../s6-linux-init/run-image/service/getty-tty3/run | 0
.../s6-linux-init/run-image/service/getty-tty4/run | 0
.../service/s6-svscan-log/notification-fd | 0
.../service/s6-svscan-log/notification-fd.license | 0
.../run-image/service/s6-svscan-log/run | 0
.../run-image/service/serial-getty-generator/run | 0
.../run-image/service/serial-getty/notification-fd | 0
.../service/serial-getty/notification-fd.license | 0
.../run-image/service/serial-getty/run | 0
.../run-image/service/serial-getty/template/run | 0
.../service/vhost-user-fs/notification-fd | 0
.../service/vhost-user-fs/notification-fd.license | 0
.../run-image/service/vhost-user-fs/run | 0
.../service/vhost-user-fs/template/notification-fd | 0
.../vhost-user-fs/template/notification-fd.license | 0
.../run-image/service/vhost-user-fs/template/run | 0
.../service/vhost-user-gpu/notification-fd | 0
.../service/vhost-user-gpu/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/run | 0
.../service/vhost-user-gpu/template/data/check | 0
.../vhost-user-gpu/template/notification-fd | 0
.../template/notification-fd.license | 0
.../run-image/service/vhost-user-gpu/template/run | 0
.../run-image/service/vhost-user-gpu/template/type | 0
.../service/vhost-user-gpu/template/type.license | 0
.../run-image/service/vmm/notification-fd | 0
.../run-image/service/vmm/notification-fd.license | 0
.../etc/s6-linux-init/run-image/service/vmm/run | 0
.../run-image/service/vmm/template/notification-fd | 0
.../service/vmm/template/notification-fd.license | 0
.../run-image/service/vmm/template/run | 0
.../notification-fd | 0
.../notification-fd.license | 0
.../service/xdg-desktop-portal-spectrum-host/run | 0
.../template/notification-fd | 0
.../template/notification-fd.license | 0
.../xdg-desktop-portal-spectrum-host/template/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
.../{ => image}/etc/s6-rc/card0/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
host/rootfs/{ => image}/etc/s6-rc/core/type | 0
.../rootfs/{ => image}/etc/s6-rc/core/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/core/up | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
.../{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
.../{ => image}/etc/s6-rc/mdevd/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
.../{ => image}/etc/s6-rc/ok-all/type.license | 0
.../rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
.../etc/s6-rc/static-nodes/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
.../{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
.../{ => image}/etc/s6-rc/sys-vmms/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
.../{ => image}/etc/s6-rc/vm-env/type.license | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
.../{ => image}/etc/s6-rc/vmm-env/type.license | 0
.../{ => image}/etc/s6-rc/weston/dependencies | 0
.../{ => image}/etc/s6-rc/weston/notification-fd | 0
.../etc/s6-rc/weston/notification-fd.license | 0
host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
.../{ => image}/etc/s6-rc/weston/type.license | 0
host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
host/rootfs/{ => image}/lib | 0
host/rootfs/{ => image}/sbin | 0
host/rootfs/{ => image}/usr/bin/assign-devices | 0
.../{ => image}/usr/bin/create-vm-dependencies | 0
host/rootfs/{ => image}/usr/bin/run-appimage | 0
host/rootfs/{ => image}/usr/bin/run-vmm | 0
host/rootfs/{ => image}/usr/bin/vm-console | 0
host/rootfs/{ => image}/usr/bin/vm-import | 0
host/rootfs/{ => image}/usr/bin/vm-start | 0
host/rootfs/{ => image}/usr/bin/vm-stop | 0
host/rootfs/{ => image}/usr/bin/xdg-open | 0
.../org.freedesktop.portal.Documents.service | 0
img/app/Makefile | 110 ++++++-------
img/app/{ => image}/bin | 0
img/app/{ => image}/etc/dbus-1/session.conf | 0
img/app/{ => image}/etc/fonts/fonts.conf | 0
img/app/{ => image}/etc/fstab | 0
img/app/{ => image}/etc/init | 0
img/app/{ => image}/etc/mdev.conf | 0
img/app/{ => image}/etc/mdev/iface | 0
img/app/{ => image}/etc/mdev/listen | 0
img/app/{ => image}/etc/mdev/virtiofs | 0
img/app/{ => image}/etc/mdev/wait | 0
img/app/{ => image}/etc/passwd | 0
img/app/{ => image}/etc/passwd.license | 0
img/app/{ => image}/etc/pipewire/pipewire.conf | 0
img/app/{ => image}/etc/resolv.conf | 0
.../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
.../env/DBUS_SESSION_BUS_ADDRESS.license | 0
img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
.../etc/s6-linux-init/env/DISPLAY.license | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL | 0
.../etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
.../s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
.../env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
.../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
.../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../s6-linux-init-shutdownd/notification-fd | 0
.../notification-fd.license | 0
.../run-image/service/s6-linux-init-shutdownd/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../etc/s6-linux-init/scripts/rc.shutdown | 0
.../etc/s6-linux-init/scripts/rc.shutdown.final | 0
.../{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
.../etc/s6-rc/app/dependencies.d/pipewire | 0
.../s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
img/app/{ => image}/etc/s6-rc/app/run | 0
img/app/{ => image}/etc/s6-rc/app/type | 0
img/app/{ => image}/etc/s6-rc/app/type.license | 0
img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/dbus/run | 0
img/app/{ => image}/etc/s6-rc/dbus/type | 0
img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/mdevd/run | 0
img/app/{ => image}/etc/s6-rc/mdevd/type | 0
img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
img/app/{ => image}/etc/s6-rc/ok-all/type | 0
img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
.../{ => image}/etc/s6-rc/pipewire/notification-fd | 0
.../etc/s6-rc/pipewire/notification-fd.license | 0
img/app/{ => image}/etc/s6-rc/pipewire/run | 0
img/app/{ => image}/etc/s6-rc/pipewire/type | 0
.../{ => image}/etc/s6-rc/pipewire/type.license | 0
.../etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
.../wayland-proxy-virtwl/notification-fd.license | 0
.../{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
.../etc/s6-rc/wayland-proxy-virtwl/type | 0
.../etc/s6-rc/wayland-proxy-virtwl/type.license | 0
.../etc/s6-rc/wireplumber/dependencies.d/dbus | 0
.../etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
.../{ => image}/etc/s6-rc/wireplumber/type.license | 0
.../{ => image}/etc/ssl/certs/ca-certificates.crt | 0
.../wireplumber.conf.d/99_spectrum.conf | 0
.../etc/xdg/xdg-desktop-portal/portals.conf | 0
img/app/{ => image}/sbin | 0
vm/sys/net/Makefile | 64 ++++----
vm/sys/net/{ => image}/bin | 0
vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
vm/sys/net/{ => image}/etc/fstab | 0
vm/sys/net/{ => image}/etc/init | 0
vm/sys/net/{ => image}/etc/mdev.conf | 0
vm/sys/net/{ => image}/etc/mdev/iface | 0
vm/sys/net/{ => image}/etc/nftables.conf | 0
vm/sys/net/{ => image}/etc/passwd | 0
vm/sys/net/{ => image}/etc/passwd.license | 0
.../s6-linux-init/run-image/service/getty-hvc0/run | 0
.../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
.../net/{ => image}/etc/s6-rc/connman/dependencies | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
.../net/{ => image}/etc/s6-rc/connman/type.license | 0
.../net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
.../etc/s6-rc/dbus/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
.../etc/s6-rc/mdevd-coldplug/dependencies | 0
.../net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
.../etc/s6-rc/mdevd-coldplug/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
.../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
.../etc/s6-rc/mdevd/notification-fd.license | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
.../net/{ => image}/etc/s6-rc/mdevd/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
.../{ => image}/etc/s6-rc/nftables/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
.../net/{ => image}/etc/s6-rc/ok-all/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
.../net/{ => image}/etc/s6-rc/sysctl/type.license | 0
vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
vm/sys/net/{ => image}/etc/sysctl.conf | 0
vm/sys/net/{ => image}/lib | 0
vm/sys/net/{ => image}/sbin | 0
vm/sys/net/{ => image}/var/run | 0
241 files changed, 178 insertions(+), 178 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 2288ae4d22ca817ba9fe8ebfc42326fe38b27c27..e88a9e81e59abe461bebc9326fc861ecf47526b8 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -8,62 +8,62 @@ include ../../lib/common.mk
dest = build/rootfs.erofs
FILES = \
- etc/fonts/fonts.conf \
- etc/fstab \
- etc/group \
- etc/init \
- etc/login \
- etc/mdev.conf \
- etc/mdev/listen \
- etc/mdev/net/add \
- etc/mdev/wait \
- etc/parse-devname \
- etc/passwd \
- etc/s6-linux-init/env/WAYLAND_DISPLAY \
- etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- etc/s6-linux-init/run-image/service/dbus/notification-fd \
- etc/s6-linux-init/run-image/service/dbus/run \
- etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- etc/s6-linux-init/run-image/service/dbus/template/run \
- etc/s6-linux-init/run-image/service/getty-tty1/run \
- etc/s6-linux-init/run-image/service/getty-tty2/run \
- etc/s6-linux-init/run-image/service/getty-tty3/run \
- etc/s6-linux-init/run-image/service/getty-tty4/run \
- etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- etc/s6-linux-init/run-image/service/serial-getty/run \
- etc/s6-linux-init/run-image/service/serial-getty/template/run \
- etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- etc/s6-linux-init/run-image/service/vmm/notification-fd \
- etc/s6-linux-init/run-image/service/vmm/run \
- etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/xdg/weston/autolaunch \
- etc/xdg/weston/weston.ini \
- usr/bin/assign-devices \
- usr/bin/create-vm-dependencies \
- usr/bin/run-appimage \
- usr/bin/run-vmm \
- usr/bin/vm-console \
- usr/bin/vm-import \
- usr/bin/vm-start \
- usr/bin/vm-stop \
- usr/bin/xdg-open \
- usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open
DIRS = \
dev \
@@ -104,18 +104,18 @@ FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
# These are separate because they need to be included, but putting
# them as make dependencies would confuse make.
LINKS = \
- bin \
- etc/s6-linux-init/run-image/opengl-driver \
- etc/s6-linux-init/run-image/service/vmm/template/run \
- lib \
- sbin
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
BUILD_FILES = build/etc/s6-rc
$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
( \
cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(DIRS) ;\
printf 'build/fifo\n%s\n' $(FIFOS) ;\
@@ -129,34 +129,34 @@ build/empty:
mkdir -p $@
S6_RC_FILES = \
- etc/s6-rc/card0/type \
- etc/s6-rc/card0/up \
- etc/s6-rc/core/type \
- etc/s6-rc/core/up \
- etc/s6-rc/kvm/timeout-up \
- etc/s6-rc/kvm/type \
- etc/s6-rc/kvm/up \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/static-nodes/type \
- etc/s6-rc/static-nodes/up \
- etc/s6-rc/sys-vmms/dependencies \
- etc/s6-rc/sys-vmms/type \
- etc/s6-rc/sys-vmms/up \
- etc/s6-rc/vm-env/contents \
- etc/s6-rc/vm-env/type \
- etc/s6-rc/vmm-env/contents \
- etc/s6-rc/vmm-env/type \
- etc/s6-rc/weston/dependencies \
- etc/s6-rc/weston/notification-fd \
- etc/s6-rc/weston/run \
- etc/s6-rc/weston/type
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/type \
+ image/etc/s6-rc/weston/run
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
@@ -170,7 +170,7 @@ build/etc/s6-rc: $(S6_RC_FILES)
rm -rf $@
set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/host/rootfs/bin b/host/rootfs/image/bin
similarity index 100%
rename from host/rootfs/bin
rename to host/rootfs/image/bin
diff --git a/host/rootfs/etc/fonts/fonts.conf b/host/rootfs/image/etc/fonts/fonts.conf
similarity index 100%
rename from host/rootfs/etc/fonts/fonts.conf
rename to host/rootfs/image/etc/fonts/fonts.conf
diff --git a/host/rootfs/etc/fstab b/host/rootfs/image/etc/fstab
similarity index 100%
rename from host/rootfs/etc/fstab
rename to host/rootfs/image/etc/fstab
diff --git a/host/rootfs/etc/group b/host/rootfs/image/etc/group
similarity index 100%
rename from host/rootfs/etc/group
rename to host/rootfs/image/etc/group
diff --git a/host/rootfs/etc/group.license b/host/rootfs/image/etc/group.license
similarity index 100%
rename from host/rootfs/etc/group.license
rename to host/rootfs/image/etc/group.license
diff --git a/host/rootfs/etc/init b/host/rootfs/image/etc/init
similarity index 100%
rename from host/rootfs/etc/init
rename to host/rootfs/image/etc/init
diff --git a/host/rootfs/etc/login b/host/rootfs/image/etc/login
similarity index 100%
rename from host/rootfs/etc/login
rename to host/rootfs/image/etc/login
diff --git a/host/rootfs/etc/mdev.conf b/host/rootfs/image/etc/mdev.conf
similarity index 100%
rename from host/rootfs/etc/mdev.conf
rename to host/rootfs/image/etc/mdev.conf
diff --git a/host/rootfs/etc/mdev/listen b/host/rootfs/image/etc/mdev/listen
similarity index 100%
rename from host/rootfs/etc/mdev/listen
rename to host/rootfs/image/etc/mdev/listen
diff --git a/host/rootfs/etc/mdev/net/add b/host/rootfs/image/etc/mdev/net/add
similarity index 100%
rename from host/rootfs/etc/mdev/net/add
rename to host/rootfs/image/etc/mdev/net/add
diff --git a/host/rootfs/etc/mdev/wait b/host/rootfs/image/etc/mdev/wait
similarity index 100%
rename from host/rootfs/etc/mdev/wait
rename to host/rootfs/image/etc/mdev/wait
diff --git a/host/rootfs/etc/parse-devname b/host/rootfs/image/etc/parse-devname
similarity index 100%
rename from host/rootfs/etc/parse-devname
rename to host/rootfs/image/etc/parse-devname
diff --git a/host/rootfs/etc/passwd b/host/rootfs/image/etc/passwd
similarity index 100%
rename from host/rootfs/etc/passwd
rename to host/rootfs/image/etc/passwd
diff --git a/host/rootfs/etc/passwd.license b/host/rootfs/image/etc/passwd.license
similarity index 100%
rename from host/rootfs/etc/passwd.license
rename to host/rootfs/image/etc/passwd.license
diff --git a/host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY b/host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY
rename to host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
diff --git a/host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY.license b/host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
rename to host/rootfs/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
diff --git a/host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR b/host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR
rename to host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
diff --git a/host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license b/host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
rename to host/rootfs/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/opengl-driver b/host/rootfs/image/etc/s6-linux-init/run-image/opengl-driver
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/opengl-driver
rename to host/rootfs/image/etc/s6-linux-init/run-image/opengl-driver
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/dbus/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/dbus/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty1/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty1/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty1/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty1/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty2/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty2/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty2/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty2/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty3/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty3/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty3/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty3/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/getty-tty4/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty4/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/getty-tty4/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/getty-tty4/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/s6-svscan-log/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/s6-svscan-log/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty-generator/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty-generator/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/serial-getty/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/serial-getty/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/vmm/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/vmm/template/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd.license
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
rename to host/rootfs/image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run
diff --git a/host/rootfs/etc/s6-linux-init/scripts/rc.init b/host/rootfs/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from host/rootfs/etc/s6-linux-init/scripts/rc.init
rename to host/rootfs/image/etc/s6-linux-init/scripts/rc.init
diff --git a/host/rootfs/etc/s6-rc/card0/type b/host/rootfs/image/etc/s6-rc/card0/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/type
rename to host/rootfs/image/etc/s6-rc/card0/type
diff --git a/host/rootfs/etc/s6-rc/card0/type.license b/host/rootfs/image/etc/s6-rc/card0/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/type.license
rename to host/rootfs/image/etc/s6-rc/card0/type.license
diff --git a/host/rootfs/etc/s6-rc/card0/up b/host/rootfs/image/etc/s6-rc/card0/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/card0/up
rename to host/rootfs/image/etc/s6-rc/card0/up
diff --git a/host/rootfs/etc/s6-rc/core/type b/host/rootfs/image/etc/s6-rc/core/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/type
rename to host/rootfs/image/etc/s6-rc/core/type
diff --git a/host/rootfs/etc/s6-rc/core/type.license b/host/rootfs/image/etc/s6-rc/core/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/type.license
rename to host/rootfs/image/etc/s6-rc/core/type.license
diff --git a/host/rootfs/etc/s6-rc/core/up b/host/rootfs/image/etc/s6-rc/core/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/core/up
rename to host/rootfs/image/etc/s6-rc/core/up
diff --git a/host/rootfs/etc/s6-rc/kvm/timeout-up b/host/rootfs/image/etc/s6-rc/kvm/timeout-up
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/timeout-up
rename to host/rootfs/image/etc/s6-rc/kvm/timeout-up
diff --git a/host/rootfs/etc/s6-rc/kvm/timeout-up.license b/host/rootfs/image/etc/s6-rc/kvm/timeout-up.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/timeout-up.license
rename to host/rootfs/image/etc/s6-rc/kvm/timeout-up.license
diff --git a/host/rootfs/etc/s6-rc/kvm/type b/host/rootfs/image/etc/s6-rc/kvm/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/type
rename to host/rootfs/image/etc/s6-rc/kvm/type
diff --git a/host/rootfs/etc/s6-rc/kvm/type.license b/host/rootfs/image/etc/s6-rc/kvm/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/type.license
rename to host/rootfs/image/etc/s6-rc/kvm/type.license
diff --git a/host/rootfs/etc/s6-rc/kvm/up b/host/rootfs/image/etc/s6-rc/kvm/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/kvm/up
rename to host/rootfs/image/etc/s6-rc/kvm/up
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/dependencies b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/dependencies
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/type b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/type
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/type.license b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/type.license
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/host/rootfs/etc/s6-rc/mdevd-coldplug/up b/host/rootfs/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd-coldplug/up
rename to host/rootfs/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/host/rootfs/etc/s6-rc/mdevd/notification-fd b/host/rootfs/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/notification-fd
rename to host/rootfs/image/etc/s6-rc/mdevd/notification-fd
diff --git a/host/rootfs/etc/s6-rc/mdevd/notification-fd.license b/host/rootfs/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/notification-fd.license
rename to host/rootfs/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/host/rootfs/etc/s6-rc/mdevd/run b/host/rootfs/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/run
rename to host/rootfs/image/etc/s6-rc/mdevd/run
diff --git a/host/rootfs/etc/s6-rc/mdevd/type b/host/rootfs/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/type
rename to host/rootfs/image/etc/s6-rc/mdevd/type
diff --git a/host/rootfs/etc/s6-rc/mdevd/type.license b/host/rootfs/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/mdevd/type.license
rename to host/rootfs/image/etc/s6-rc/mdevd/type.license
diff --git a/host/rootfs/etc/s6-rc/ok-all/contents b/host/rootfs/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/contents
rename to host/rootfs/image/etc/s6-rc/ok-all/contents
diff --git a/host/rootfs/etc/s6-rc/ok-all/type b/host/rootfs/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/type
rename to host/rootfs/image/etc/s6-rc/ok-all/type
diff --git a/host/rootfs/etc/s6-rc/ok-all/type.license b/host/rootfs/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/ok-all/type.license
rename to host/rootfs/image/etc/s6-rc/ok-all/type.license
diff --git a/host/rootfs/etc/s6-rc/static-nodes/type b/host/rootfs/image/etc/s6-rc/static-nodes/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/type
rename to host/rootfs/image/etc/s6-rc/static-nodes/type
diff --git a/host/rootfs/etc/s6-rc/static-nodes/type.license b/host/rootfs/image/etc/s6-rc/static-nodes/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/type.license
rename to host/rootfs/image/etc/s6-rc/static-nodes/type.license
diff --git a/host/rootfs/etc/s6-rc/static-nodes/up b/host/rootfs/image/etc/s6-rc/static-nodes/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/static-nodes/up
rename to host/rootfs/image/etc/s6-rc/static-nodes/up
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/dependencies b/host/rootfs/image/etc/s6-rc/sys-vmms/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/dependencies
rename to host/rootfs/image/etc/s6-rc/sys-vmms/dependencies
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/type b/host/rootfs/image/etc/s6-rc/sys-vmms/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/type
rename to host/rootfs/image/etc/s6-rc/sys-vmms/type
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/type.license b/host/rootfs/image/etc/s6-rc/sys-vmms/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/type.license
rename to host/rootfs/image/etc/s6-rc/sys-vmms/type.license
diff --git a/host/rootfs/etc/s6-rc/sys-vmms/up b/host/rootfs/image/etc/s6-rc/sys-vmms/up
similarity index 100%
rename from host/rootfs/etc/s6-rc/sys-vmms/up
rename to host/rootfs/image/etc/s6-rc/sys-vmms/up
diff --git a/host/rootfs/etc/s6-rc/vm-env/contents b/host/rootfs/image/etc/s6-rc/vm-env/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/contents
rename to host/rootfs/image/etc/s6-rc/vm-env/contents
diff --git a/host/rootfs/etc/s6-rc/vm-env/type b/host/rootfs/image/etc/s6-rc/vm-env/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/type
rename to host/rootfs/image/etc/s6-rc/vm-env/type
diff --git a/host/rootfs/etc/s6-rc/vm-env/type.license b/host/rootfs/image/etc/s6-rc/vm-env/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/vm-env/type.license
rename to host/rootfs/image/etc/s6-rc/vm-env/type.license
diff --git a/host/rootfs/etc/s6-rc/vmm-env/contents b/host/rootfs/image/etc/s6-rc/vmm-env/contents
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/contents
rename to host/rootfs/image/etc/s6-rc/vmm-env/contents
diff --git a/host/rootfs/etc/s6-rc/vmm-env/type b/host/rootfs/image/etc/s6-rc/vmm-env/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/type
rename to host/rootfs/image/etc/s6-rc/vmm-env/type
diff --git a/host/rootfs/etc/s6-rc/vmm-env/type.license b/host/rootfs/image/etc/s6-rc/vmm-env/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/vmm-env/type.license
rename to host/rootfs/image/etc/s6-rc/vmm-env/type.license
diff --git a/host/rootfs/etc/s6-rc/weston/dependencies b/host/rootfs/image/etc/s6-rc/weston/dependencies
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/dependencies
rename to host/rootfs/image/etc/s6-rc/weston/dependencies
diff --git a/host/rootfs/etc/s6-rc/weston/notification-fd b/host/rootfs/image/etc/s6-rc/weston/notification-fd
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/notification-fd
rename to host/rootfs/image/etc/s6-rc/weston/notification-fd
diff --git a/host/rootfs/etc/s6-rc/weston/notification-fd.license b/host/rootfs/image/etc/s6-rc/weston/notification-fd.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/notification-fd.license
rename to host/rootfs/image/etc/s6-rc/weston/notification-fd.license
diff --git a/host/rootfs/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/run
rename to host/rootfs/image/etc/s6-rc/weston/run
diff --git a/host/rootfs/etc/s6-rc/weston/type b/host/rootfs/image/etc/s6-rc/weston/type
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/type
rename to host/rootfs/image/etc/s6-rc/weston/type
diff --git a/host/rootfs/etc/s6-rc/weston/type.license b/host/rootfs/image/etc/s6-rc/weston/type.license
similarity index 100%
rename from host/rootfs/etc/s6-rc/weston/type.license
rename to host/rootfs/image/etc/s6-rc/weston/type.license
diff --git a/host/rootfs/etc/xdg/weston/autolaunch b/host/rootfs/image/etc/xdg/weston/autolaunch
similarity index 100%
rename from host/rootfs/etc/xdg/weston/autolaunch
rename to host/rootfs/image/etc/xdg/weston/autolaunch
diff --git a/host/rootfs/etc/xdg/weston/weston.ini b/host/rootfs/image/etc/xdg/weston/weston.ini
similarity index 100%
rename from host/rootfs/etc/xdg/weston/weston.ini
rename to host/rootfs/image/etc/xdg/weston/weston.ini
diff --git a/host/rootfs/lib b/host/rootfs/image/lib
similarity index 100%
rename from host/rootfs/lib
rename to host/rootfs/image/lib
diff --git a/host/rootfs/sbin b/host/rootfs/image/sbin
similarity index 100%
rename from host/rootfs/sbin
rename to host/rootfs/image/sbin
diff --git a/host/rootfs/usr/bin/assign-devices b/host/rootfs/image/usr/bin/assign-devices
similarity index 100%
rename from host/rootfs/usr/bin/assign-devices
rename to host/rootfs/image/usr/bin/assign-devices
diff --git a/host/rootfs/usr/bin/create-vm-dependencies b/host/rootfs/image/usr/bin/create-vm-dependencies
similarity index 100%
rename from host/rootfs/usr/bin/create-vm-dependencies
rename to host/rootfs/image/usr/bin/create-vm-dependencies
diff --git a/host/rootfs/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
similarity index 100%
rename from host/rootfs/usr/bin/run-appimage
rename to host/rootfs/image/usr/bin/run-appimage
diff --git a/host/rootfs/usr/bin/run-vmm b/host/rootfs/image/usr/bin/run-vmm
similarity index 100%
rename from host/rootfs/usr/bin/run-vmm
rename to host/rootfs/image/usr/bin/run-vmm
diff --git a/host/rootfs/usr/bin/vm-console b/host/rootfs/image/usr/bin/vm-console
similarity index 100%
rename from host/rootfs/usr/bin/vm-console
rename to host/rootfs/image/usr/bin/vm-console
diff --git a/host/rootfs/usr/bin/vm-import b/host/rootfs/image/usr/bin/vm-import
similarity index 100%
rename from host/rootfs/usr/bin/vm-import
rename to host/rootfs/image/usr/bin/vm-import
diff --git a/host/rootfs/usr/bin/vm-start b/host/rootfs/image/usr/bin/vm-start
similarity index 100%
rename from host/rootfs/usr/bin/vm-start
rename to host/rootfs/image/usr/bin/vm-start
diff --git a/host/rootfs/usr/bin/vm-stop b/host/rootfs/image/usr/bin/vm-stop
similarity index 100%
rename from host/rootfs/usr/bin/vm-stop
rename to host/rootfs/image/usr/bin/vm-stop
diff --git a/host/rootfs/usr/bin/xdg-open b/host/rootfs/image/usr/bin/xdg-open
similarity index 100%
rename from host/rootfs/usr/bin/xdg-open
rename to host/rootfs/image/usr/bin/xdg-open
diff --git a/host/rootfs/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service b/host/rootfs/image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
similarity index 100%
rename from host/rootfs/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
rename to host/rootfs/image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
diff --git a/img/app/Makefile b/img/app/Makefile
index 73db07cc4c781d9c41cdf41a6214298aae8de58a..0099aa3b9626bfcc2079e5c67401db4e5316caeb 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -30,32 +30,32 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
mv $@.tmp $@
VM_FILES = \
- etc/dbus-1/session.conf \
- etc/fonts/fonts.conf \
- etc/fstab \
- etc/init \
- etc/mdev.conf \
- etc/mdev/iface \
- etc/mdev/listen \
- etc/mdev/virtiofs \
- etc/mdev/wait \
- etc/passwd \
- etc/pipewire/pipewire.conf \
- etc/resolv.conf \
- etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- etc/s6-linux-init/env/DISPLAY \
- etc/s6-linux-init/env/GTK_USE_PORTAL \
- etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- etc/s6-linux-init/env/WAYLAND_DISPLAY \
- etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- etc/s6-linux-init/run-image/service/getty-hvc0/run \
- etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/s6-linux-init/scripts/rc.shutdown \
- etc/s6-linux-init/scripts/rc.shutdown.final \
- etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- etc/xdg/xdg-desktop-portal/portals.conf
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
VM_DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
@@ -65,7 +65,7 @@ VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
# These are separate because they need to be included, but putting
# them as make dependencies would confuse make.
-VM_LINKS = bin etc/ssl/certs/ca-certificates.crt sbin
+VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
VM_BUILD_FILES = build/etc/s6-rc
@@ -79,46 +79,46 @@ build/empty:
build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
VM_S6_RC_FILES = \
- etc/s6-rc/app/dependencies.d/dbus \
- etc/s6-rc/app/dependencies.d/pipewire \
- etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- etc/s6-rc/app/run \
- etc/s6-rc/app/type \
- etc/s6-rc/dbus/notification-fd \
- etc/s6-rc/dbus/run \
- etc/s6-rc/dbus/type \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/pipewire/notification-fd \
- etc/s6-rc/pipewire/run \
- etc/s6-rc/pipewire/type \
- etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- etc/s6-rc/wayland-proxy-virtwl/run \
- etc/s6-rc/wayland-proxy-virtwl/type \
- etc/s6-rc/wireplumber/dependencies.d/dbus \
- etc/s6-rc/wireplumber/dependencies.d/pipewire \
- etc/s6-rc/wireplumber/run \
- etc/s6-rc/wireplumber/type
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
build/etc/s6-rc: $(VM_S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
+ { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/bin b/img/app/image/bin
similarity index 100%
rename from img/app/bin
rename to img/app/image/bin
diff --git a/img/app/etc/dbus-1/session.conf b/img/app/image/etc/dbus-1/session.conf
similarity index 100%
rename from img/app/etc/dbus-1/session.conf
rename to img/app/image/etc/dbus-1/session.conf
diff --git a/img/app/etc/fonts/fonts.conf b/img/app/image/etc/fonts/fonts.conf
similarity index 100%
rename from img/app/etc/fonts/fonts.conf
rename to img/app/image/etc/fonts/fonts.conf
diff --git a/img/app/etc/fstab b/img/app/image/etc/fstab
similarity index 100%
rename from img/app/etc/fstab
rename to img/app/image/etc/fstab
diff --git a/img/app/etc/init b/img/app/image/etc/init
similarity index 100%
rename from img/app/etc/init
rename to img/app/image/etc/init
diff --git a/img/app/etc/mdev.conf b/img/app/image/etc/mdev.conf
similarity index 100%
rename from img/app/etc/mdev.conf
rename to img/app/image/etc/mdev.conf
diff --git a/img/app/etc/mdev/iface b/img/app/image/etc/mdev/iface
similarity index 100%
rename from img/app/etc/mdev/iface
rename to img/app/image/etc/mdev/iface
diff --git a/img/app/etc/mdev/listen b/img/app/image/etc/mdev/listen
similarity index 100%
rename from img/app/etc/mdev/listen
rename to img/app/image/etc/mdev/listen
diff --git a/img/app/etc/mdev/virtiofs b/img/app/image/etc/mdev/virtiofs
similarity index 100%
rename from img/app/etc/mdev/virtiofs
rename to img/app/image/etc/mdev/virtiofs
diff --git a/img/app/etc/mdev/wait b/img/app/image/etc/mdev/wait
similarity index 100%
rename from img/app/etc/mdev/wait
rename to img/app/image/etc/mdev/wait
diff --git a/img/app/etc/passwd b/img/app/image/etc/passwd
similarity index 100%
rename from img/app/etc/passwd
rename to img/app/image/etc/passwd
diff --git a/img/app/etc/passwd.license b/img/app/image/etc/passwd.license
similarity index 100%
rename from img/app/etc/passwd.license
rename to img/app/image/etc/passwd.license
diff --git a/img/app/etc/pipewire/pipewire.conf b/img/app/image/etc/pipewire/pipewire.conf
similarity index 100%
rename from img/app/etc/pipewire/pipewire.conf
rename to img/app/image/etc/pipewire/pipewire.conf
diff --git a/img/app/etc/resolv.conf b/img/app/image/etc/resolv.conf
similarity index 100%
rename from img/app/etc/resolv.conf
rename to img/app/image/etc/resolv.conf
diff --git a/img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS b/img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
rename to img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS
diff --git a/img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license b/img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
rename to img/app/image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS.license
diff --git a/img/app/etc/s6-linux-init/env/DISPLAY b/img/app/image/etc/s6-linux-init/env/DISPLAY
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DISPLAY
rename to img/app/image/etc/s6-linux-init/env/DISPLAY
diff --git a/img/app/etc/s6-linux-init/env/DISPLAY.license b/img/app/image/etc/s6-linux-init/env/DISPLAY.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/DISPLAY.license
rename to img/app/image/etc/s6-linux-init/env/DISPLAY.license
diff --git a/img/app/etc/s6-linux-init/env/GTK_USE_PORTAL b/img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL
similarity index 100%
rename from img/app/etc/s6-linux-init/env/GTK_USE_PORTAL
rename to img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL
diff --git a/img/app/etc/s6-linux-init/env/GTK_USE_PORTAL.license b/img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/GTK_USE_PORTAL.license
rename to img/app/image/etc/s6-linux-init/env/GTK_USE_PORTAL.license
diff --git a/img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR b/img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
similarity index 100%
rename from img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
rename to img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR
diff --git a/img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license b/img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
rename to img/app/image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR.license
diff --git a/img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY b/img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
similarity index 100%
rename from img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY
rename to img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY
diff --git a/img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY.license b/img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
rename to img/app/image/etc/s6-linux-init/env/WAYLAND_DISPLAY.license
diff --git a/img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR b/img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
similarity index 100%
rename from img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR
rename to img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR
diff --git a/img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license b/img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
similarity index 100%
rename from img/app/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
rename to img/app/image/etc/s6-linux-init/env/XDG_RUNTIME_DIR.license
diff --git a/img/app/etc/s6-linux-init/run-image/service/getty-hvc0/run b/img/app/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/getty-hvc0/run
rename to img/app/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd.license
diff --git a/img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run b/img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
similarity index 100%
rename from img/app/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
rename to img/app/image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run
diff --git a/img/app/etc/s6-linux-init/scripts/rc.init b/img/app/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.init
rename to img/app/image/etc/s6-linux-init/scripts/rc.init
diff --git a/img/app/etc/s6-linux-init/scripts/rc.shutdown b/img/app/image/etc/s6-linux-init/scripts/rc.shutdown
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.shutdown
rename to img/app/image/etc/s6-linux-init/scripts/rc.shutdown
diff --git a/img/app/etc/s6-linux-init/scripts/rc.shutdown.final b/img/app/image/etc/s6-linux-init/scripts/rc.shutdown.final
similarity index 100%
rename from img/app/etc/s6-linux-init/scripts/rc.shutdown.final
rename to img/app/image/etc/s6-linux-init/scripts/rc.shutdown.final
diff --git a/img/app/etc/s6-rc/app/dependencies.d/dbus b/img/app/image/etc/s6-rc/app/dependencies.d/dbus
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/dbus
rename to img/app/image/etc/s6-rc/app/dependencies.d/dbus
diff --git a/img/app/etc/s6-rc/app/dependencies.d/pipewire b/img/app/image/etc/s6-rc/app/dependencies.d/pipewire
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/pipewire
rename to img/app/image/etc/s6-rc/app/dependencies.d/pipewire
diff --git a/img/app/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl b/img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
similarity index 100%
rename from img/app/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
rename to img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
diff --git a/img/app/etc/s6-rc/app/run b/img/app/image/etc/s6-rc/app/run
similarity index 100%
rename from img/app/etc/s6-rc/app/run
rename to img/app/image/etc/s6-rc/app/run
diff --git a/img/app/etc/s6-rc/app/type b/img/app/image/etc/s6-rc/app/type
similarity index 100%
rename from img/app/etc/s6-rc/app/type
rename to img/app/image/etc/s6-rc/app/type
diff --git a/img/app/etc/s6-rc/app/type.license b/img/app/image/etc/s6-rc/app/type.license
similarity index 100%
rename from img/app/etc/s6-rc/app/type.license
rename to img/app/image/etc/s6-rc/app/type.license
diff --git a/img/app/etc/s6-rc/dbus/notification-fd b/img/app/image/etc/s6-rc/dbus/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/dbus/notification-fd
rename to img/app/image/etc/s6-rc/dbus/notification-fd
diff --git a/img/app/etc/s6-rc/dbus/notification-fd.license b/img/app/image/etc/s6-rc/dbus/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/dbus/notification-fd.license
rename to img/app/image/etc/s6-rc/dbus/notification-fd.license
diff --git a/img/app/etc/s6-rc/dbus/run b/img/app/image/etc/s6-rc/dbus/run
similarity index 100%
rename from img/app/etc/s6-rc/dbus/run
rename to img/app/image/etc/s6-rc/dbus/run
diff --git a/img/app/etc/s6-rc/dbus/type b/img/app/image/etc/s6-rc/dbus/type
similarity index 100%
rename from img/app/etc/s6-rc/dbus/type
rename to img/app/image/etc/s6-rc/dbus/type
diff --git a/img/app/etc/s6-rc/dbus/type.license b/img/app/image/etc/s6-rc/dbus/type.license
similarity index 100%
rename from img/app/etc/s6-rc/dbus/type.license
rename to img/app/image/etc/s6-rc/dbus/type.license
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/dependencies b/img/app/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/dependencies
rename to img/app/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/type b/img/app/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/type
rename to img/app/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/type.license b/img/app/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/type.license
rename to img/app/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/img/app/etc/s6-rc/mdevd-coldplug/up b/img/app/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from img/app/etc/s6-rc/mdevd-coldplug/up
rename to img/app/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/img/app/etc/s6-rc/mdevd/notification-fd b/img/app/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/notification-fd
rename to img/app/image/etc/s6-rc/mdevd/notification-fd
diff --git a/img/app/etc/s6-rc/mdevd/notification-fd.license b/img/app/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/notification-fd.license
rename to img/app/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/img/app/etc/s6-rc/mdevd/run b/img/app/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/run
rename to img/app/image/etc/s6-rc/mdevd/run
diff --git a/img/app/etc/s6-rc/mdevd/type b/img/app/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/type
rename to img/app/image/etc/s6-rc/mdevd/type
diff --git a/img/app/etc/s6-rc/mdevd/type.license b/img/app/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from img/app/etc/s6-rc/mdevd/type.license
rename to img/app/image/etc/s6-rc/mdevd/type.license
diff --git a/img/app/etc/s6-rc/ok-all/contents b/img/app/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/contents
rename to img/app/image/etc/s6-rc/ok-all/contents
diff --git a/img/app/etc/s6-rc/ok-all/type b/img/app/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/type
rename to img/app/image/etc/s6-rc/ok-all/type
diff --git a/img/app/etc/s6-rc/ok-all/type.license b/img/app/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from img/app/etc/s6-rc/ok-all/type.license
rename to img/app/image/etc/s6-rc/ok-all/type.license
diff --git a/img/app/etc/s6-rc/pipewire/notification-fd b/img/app/image/etc/s6-rc/pipewire/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/notification-fd
rename to img/app/image/etc/s6-rc/pipewire/notification-fd
diff --git a/img/app/etc/s6-rc/pipewire/notification-fd.license b/img/app/image/etc/s6-rc/pipewire/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/notification-fd.license
rename to img/app/image/etc/s6-rc/pipewire/notification-fd.license
diff --git a/img/app/etc/s6-rc/pipewire/run b/img/app/image/etc/s6-rc/pipewire/run
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/run
rename to img/app/image/etc/s6-rc/pipewire/run
diff --git a/img/app/etc/s6-rc/pipewire/type b/img/app/image/etc/s6-rc/pipewire/type
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/type
rename to img/app/image/etc/s6-rc/pipewire/type
diff --git a/img/app/etc/s6-rc/pipewire/type.license b/img/app/image/etc/s6-rc/pipewire/type.license
similarity index 100%
rename from img/app/etc/s6-rc/pipewire/type.license
rename to img/app/image/etc/s6-rc/pipewire/type.license
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/run b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/run
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/type b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/type
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
diff --git a/img/app/etc/s6-rc/wayland-proxy-virtwl/type.license b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
similarity index 100%
rename from img/app/etc/s6-rc/wayland-proxy-virtwl/type.license
rename to img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
diff --git a/img/app/etc/s6-rc/wireplumber/dependencies.d/dbus b/img/app/image/etc/s6-rc/wireplumber/dependencies.d/dbus
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/dependencies.d/dbus
rename to img/app/image/etc/s6-rc/wireplumber/dependencies.d/dbus
diff --git a/img/app/etc/s6-rc/wireplumber/dependencies.d/pipewire b/img/app/image/etc/s6-rc/wireplumber/dependencies.d/pipewire
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/dependencies.d/pipewire
rename to img/app/image/etc/s6-rc/wireplumber/dependencies.d/pipewire
diff --git a/img/app/etc/s6-rc/wireplumber/run b/img/app/image/etc/s6-rc/wireplumber/run
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/run
rename to img/app/image/etc/s6-rc/wireplumber/run
diff --git a/img/app/etc/s6-rc/wireplumber/type b/img/app/image/etc/s6-rc/wireplumber/type
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/type
rename to img/app/image/etc/s6-rc/wireplumber/type
diff --git a/img/app/etc/s6-rc/wireplumber/type.license b/img/app/image/etc/s6-rc/wireplumber/type.license
similarity index 100%
rename from img/app/etc/s6-rc/wireplumber/type.license
rename to img/app/image/etc/s6-rc/wireplumber/type.license
diff --git a/img/app/etc/ssl/certs/ca-certificates.crt b/img/app/image/etc/ssl/certs/ca-certificates.crt
similarity index 100%
rename from img/app/etc/ssl/certs/ca-certificates.crt
rename to img/app/image/etc/ssl/certs/ca-certificates.crt
diff --git a/img/app/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf b/img/app/image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
similarity index 100%
rename from img/app/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
rename to img/app/image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf
diff --git a/img/app/etc/xdg/xdg-desktop-portal/portals.conf b/img/app/image/etc/xdg/xdg-desktop-portal/portals.conf
similarity index 100%
rename from img/app/etc/xdg/xdg-desktop-portal/portals.conf
rename to img/app/image/etc/xdg/xdg-desktop-portal/portals.conf
diff --git a/img/app/sbin b/img/app/image/sbin
similarity index 100%
rename from img/app/sbin
rename to img/app/image/sbin
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 88ae20de79cd21b06263837f90310e8800b3d4e2..b3ea49bc7065edb3411dbf5eaa3d8517ef2a61bd 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -29,21 +29,21 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
mv $@.tmp $@
VM_FILES = \
- etc/dbus-1/system.conf \
- etc/fstab \
- etc/init \
- etc/mdev.conf \
- etc/mdev/iface \
- etc/nftables.conf \
- etc/passwd \
- etc/s6-linux-init/run-image/service/getty-hvc0/run \
- etc/s6-linux-init/scripts/rc.init \
- etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
# These are separate because they need to be included, but putting
# them as make dependencies would confuse make.
-VM_LINKS = bin lib sbin var/run
+VM_LINKS = image/bin image/lib image/sbin image/var/run
VM_BUILD_FILES = build/etc/s6-rc
@@ -53,37 +53,37 @@ build/empty:
build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file $$file; done ;\
+ for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
printf 'build/empty\n%s\n' $(VM_DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
VM_S6_RC_FILES = \
- etc/s6-rc/connman/dependencies \
- etc/s6-rc/connman/run \
- etc/s6-rc/connman/type \
- etc/s6-rc/dbus/notification-fd \
- etc/s6-rc/dbus/run \
- etc/s6-rc/dbus/type \
- etc/s6-rc/mdevd-coldplug/dependencies \
- etc/s6-rc/mdevd-coldplug/type \
- etc/s6-rc/mdevd-coldplug/up \
- etc/s6-rc/mdevd/notification-fd \
- etc/s6-rc/mdevd/run \
- etc/s6-rc/mdevd/type \
- etc/s6-rc/nftables/type \
- etc/s6-rc/nftables/up \
- etc/s6-rc/ok-all/contents \
- etc/s6-rc/ok-all/type \
- etc/s6-rc/sysctl/type \
- etc/s6-rc/sysctl/up
+ image/etc/s6-rc/connman/dependencies \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
build/etc/s6-rc: $(VM_S6_RC_FILES)
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
+ { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/bin b/vm/sys/net/image/bin
similarity index 100%
rename from vm/sys/net/bin
rename to vm/sys/net/image/bin
diff --git a/vm/sys/net/etc/dbus-1/system.conf b/vm/sys/net/image/etc/dbus-1/system.conf
similarity index 100%
rename from vm/sys/net/etc/dbus-1/system.conf
rename to vm/sys/net/image/etc/dbus-1/system.conf
diff --git a/vm/sys/net/etc/fstab b/vm/sys/net/image/etc/fstab
similarity index 100%
rename from vm/sys/net/etc/fstab
rename to vm/sys/net/image/etc/fstab
diff --git a/vm/sys/net/etc/init b/vm/sys/net/image/etc/init
similarity index 100%
rename from vm/sys/net/etc/init
rename to vm/sys/net/image/etc/init
diff --git a/vm/sys/net/etc/mdev.conf b/vm/sys/net/image/etc/mdev.conf
similarity index 100%
rename from vm/sys/net/etc/mdev.conf
rename to vm/sys/net/image/etc/mdev.conf
diff --git a/vm/sys/net/etc/mdev/iface b/vm/sys/net/image/etc/mdev/iface
similarity index 100%
rename from vm/sys/net/etc/mdev/iface
rename to vm/sys/net/image/etc/mdev/iface
diff --git a/vm/sys/net/etc/nftables.conf b/vm/sys/net/image/etc/nftables.conf
similarity index 100%
rename from vm/sys/net/etc/nftables.conf
rename to vm/sys/net/image/etc/nftables.conf
diff --git a/vm/sys/net/etc/passwd b/vm/sys/net/image/etc/passwd
similarity index 100%
rename from vm/sys/net/etc/passwd
rename to vm/sys/net/image/etc/passwd
diff --git a/vm/sys/net/etc/passwd.license b/vm/sys/net/image/etc/passwd.license
similarity index 100%
rename from vm/sys/net/etc/passwd.license
rename to vm/sys/net/image/etc/passwd.license
diff --git a/vm/sys/net/etc/s6-linux-init/run-image/service/getty-hvc0/run b/vm/sys/net/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
similarity index 100%
rename from vm/sys/net/etc/s6-linux-init/run-image/service/getty-hvc0/run
rename to vm/sys/net/image/etc/s6-linux-init/run-image/service/getty-hvc0/run
diff --git a/vm/sys/net/etc/s6-linux-init/scripts/rc.init b/vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
similarity index 100%
rename from vm/sys/net/etc/s6-linux-init/scripts/rc.init
rename to vm/sys/net/image/etc/s6-linux-init/scripts/rc.init
diff --git a/vm/sys/net/etc/s6-rc/connman/dependencies b/vm/sys/net/image/etc/s6-rc/connman/dependencies
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/dependencies
rename to vm/sys/net/image/etc/s6-rc/connman/dependencies
diff --git a/vm/sys/net/etc/s6-rc/connman/run b/vm/sys/net/image/etc/s6-rc/connman/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/run
rename to vm/sys/net/image/etc/s6-rc/connman/run
diff --git a/vm/sys/net/etc/s6-rc/connman/type b/vm/sys/net/image/etc/s6-rc/connman/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/type
rename to vm/sys/net/image/etc/s6-rc/connman/type
diff --git a/vm/sys/net/etc/s6-rc/connman/type.license b/vm/sys/net/image/etc/s6-rc/connman/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/connman/type.license
rename to vm/sys/net/image/etc/s6-rc/connman/type.license
diff --git a/vm/sys/net/etc/s6-rc/dbus/notification-fd b/vm/sys/net/image/etc/s6-rc/dbus/notification-fd
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/notification-fd
rename to vm/sys/net/image/etc/s6-rc/dbus/notification-fd
diff --git a/vm/sys/net/etc/s6-rc/dbus/notification-fd.license b/vm/sys/net/image/etc/s6-rc/dbus/notification-fd.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/notification-fd.license
rename to vm/sys/net/image/etc/s6-rc/dbus/notification-fd.license
diff --git a/vm/sys/net/etc/s6-rc/dbus/run b/vm/sys/net/image/etc/s6-rc/dbus/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/run
rename to vm/sys/net/image/etc/s6-rc/dbus/run
diff --git a/vm/sys/net/etc/s6-rc/dbus/type b/vm/sys/net/image/etc/s6-rc/dbus/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/type
rename to vm/sys/net/image/etc/s6-rc/dbus/type
diff --git a/vm/sys/net/etc/s6-rc/dbus/type.license b/vm/sys/net/image/etc/s6-rc/dbus/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/dbus/type.license
rename to vm/sys/net/image/etc/s6-rc/dbus/type.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/dependencies b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/dependencies
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/dependencies
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/dependencies
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/type b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/type
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/type.license b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/type.license
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/type.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd-coldplug/up b/vm/sys/net/image/etc/s6-rc/mdevd-coldplug/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd-coldplug/up
rename to vm/sys/net/image/etc/s6-rc/mdevd-coldplug/up
diff --git a/vm/sys/net/etc/s6-rc/mdevd/notification-fd b/vm/sys/net/image/etc/s6-rc/mdevd/notification-fd
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/notification-fd
rename to vm/sys/net/image/etc/s6-rc/mdevd/notification-fd
diff --git a/vm/sys/net/etc/s6-rc/mdevd/notification-fd.license b/vm/sys/net/image/etc/s6-rc/mdevd/notification-fd.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/notification-fd.license
rename to vm/sys/net/image/etc/s6-rc/mdevd/notification-fd.license
diff --git a/vm/sys/net/etc/s6-rc/mdevd/run b/vm/sys/net/image/etc/s6-rc/mdevd/run
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/run
rename to vm/sys/net/image/etc/s6-rc/mdevd/run
diff --git a/vm/sys/net/etc/s6-rc/mdevd/type b/vm/sys/net/image/etc/s6-rc/mdevd/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/type
rename to vm/sys/net/image/etc/s6-rc/mdevd/type
diff --git a/vm/sys/net/etc/s6-rc/mdevd/type.license b/vm/sys/net/image/etc/s6-rc/mdevd/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/mdevd/type.license
rename to vm/sys/net/image/etc/s6-rc/mdevd/type.license
diff --git a/vm/sys/net/etc/s6-rc/nftables/type b/vm/sys/net/image/etc/s6-rc/nftables/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/type
rename to vm/sys/net/image/etc/s6-rc/nftables/type
diff --git a/vm/sys/net/etc/s6-rc/nftables/type.license b/vm/sys/net/image/etc/s6-rc/nftables/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/type.license
rename to vm/sys/net/image/etc/s6-rc/nftables/type.license
diff --git a/vm/sys/net/etc/s6-rc/nftables/up b/vm/sys/net/image/etc/s6-rc/nftables/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/nftables/up
rename to vm/sys/net/image/etc/s6-rc/nftables/up
diff --git a/vm/sys/net/etc/s6-rc/ok-all/contents b/vm/sys/net/image/etc/s6-rc/ok-all/contents
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/contents
rename to vm/sys/net/image/etc/s6-rc/ok-all/contents
diff --git a/vm/sys/net/etc/s6-rc/ok-all/type b/vm/sys/net/image/etc/s6-rc/ok-all/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/type
rename to vm/sys/net/image/etc/s6-rc/ok-all/type
diff --git a/vm/sys/net/etc/s6-rc/ok-all/type.license b/vm/sys/net/image/etc/s6-rc/ok-all/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/ok-all/type.license
rename to vm/sys/net/image/etc/s6-rc/ok-all/type.license
diff --git a/vm/sys/net/etc/s6-rc/sysctl/type b/vm/sys/net/image/etc/s6-rc/sysctl/type
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/type
rename to vm/sys/net/image/etc/s6-rc/sysctl/type
diff --git a/vm/sys/net/etc/s6-rc/sysctl/type.license b/vm/sys/net/image/etc/s6-rc/sysctl/type.license
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/type.license
rename to vm/sys/net/image/etc/s6-rc/sysctl/type.license
diff --git a/vm/sys/net/etc/s6-rc/sysctl/up b/vm/sys/net/image/etc/s6-rc/sysctl/up
similarity index 100%
rename from vm/sys/net/etc/s6-rc/sysctl/up
rename to vm/sys/net/image/etc/s6-rc/sysctl/up
diff --git a/vm/sys/net/etc/sysctl.conf b/vm/sys/net/image/etc/sysctl.conf
similarity index 100%
rename from vm/sys/net/etc/sysctl.conf
rename to vm/sys/net/image/etc/sysctl.conf
diff --git a/vm/sys/net/lib b/vm/sys/net/image/lib
similarity index 100%
rename from vm/sys/net/lib
rename to vm/sys/net/image/lib
diff --git a/vm/sys/net/sbin b/vm/sys/net/image/sbin
similarity index 100%
rename from vm/sys/net/sbin
rename to vm/sys/net/image/sbin
diff --git a/vm/sys/net/var/run b/vm/sys/net/image/var/run
similarity index 100%
rename from vm/sys/net/var/run
rename to vm/sys/net/image/var/run
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v3 3/4] Generate makefile file lists from a script
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 1/4] Do not ignore errors from tar Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 2/4] Move all files for the image into a subdirectory Demi Marie Obenour
@ 2025-09-11 12:47 ` Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 4/4] Common make rules for building erofs images Demi Marie Obenour
3 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-11 12:47 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
The script will always get them right, whereas humans (the author of
this commit included) generally will not.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Documentation/development/built-in-vms.adoc | 17 ++++
host/rootfs/Makefile | 102 +----------------------
host/rootfs/file-list.mk | 100 +++++++++++++++++++++++
img/app/Makefile | 87 ++++----------------
img/app/file-list.mk | 65 +++++++++++++++
lib/common.mk | 1 +
scripts/genfiles.awk | 120 ++++++++++++++++++++++++++++
scripts/genfiles.sh | 23 ++++++
scripts/git-rebase | 17 ++++
scripts/pre-commit.sh | 9 +++
vm/sys/net/Makefile | 58 ++++----------
vm/sys/net/file-list.mk | 42 ++++++++++
12 files changed, 428 insertions(+), 213 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..0addc7d1a2fd322fa12918656baa3d169478504d 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -44,6 +44,23 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for the VM image is stored in a separate file,
+`file-lists.mk`. To update it, run `scripts/genfiles.sh`
+which will regenerate it from the output of `git ls-files`. Any
+changes you made will be lost. This script uses uses Git's index to
+generate the list, so you need to use `git add`, `git rm`, and `git mv`
+to ensure that Git knows about your changes. It is not necessary to
+commit the changes.
+
+It is recommended that you add a Git pre-commit hook that calls
+`scripts/pre-commit.sh`. This updates the `file-list.mk` files
+for you, so that each commit always includes the correct
+`file-list.mk`. Sadly, Git does not run the pre-commit hook
+during rebases, so if you rebase you should use the script
+`scripts/git-rebase` instead of `git rebase`. It tells
+Git to run `scripts/pre-commit.sh` after each commit and then
+calls `git commit --amend` to fixup the commit if needed.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index e88a9e81e59abe461bebc9326fc861ecf47526b8..5191701c009a38062c8433a7d99288f2eaa0d1a5 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,36 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/type \
- image/etc/s6-rc/weston/run
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -165,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..8e5385752d5927d7c67fe4e91812f44e8c9ec033
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES := \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/type \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS := \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES := \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index 0099aa3b9626bfcc2079e5c67401db4e5316caeb..8be05a4781e516ee60628e2f40822cf4d6b0629e 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,49 +45,22 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
@@ -197,6 +139,11 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
$(KERNEL)
.PHONY: run-crosvm
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: run-$(VMM)
.PHONY: run
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..2a249c27af3c5c7ab5158e3acf52400878ac6b4d
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES := \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS := \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES := \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/lib/common.mk b/lib/common.mk
index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
BACKGROUND = background
CPIO = cpio
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..88a2824c671dbf1fabca184a9e29c28d564d1cee
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,120 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ file_count = 0;
+ symlink_count = 0;
+ rc_count = 0;
+ is_rc = 0;
+ exit_code = 0;
+ done = 0;
+ modes["120000"] = "symlink";
+ modes["040755"] = "directory";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg, status) {
+ if (status ~ /^([1-9][0-9]?|1[0-9]{2}|2[0-4][1-9]|25[1-5])$/) {
+ exit_code = status;
+ } else {
+ exit_code = 1;
+ status = 1;
+ }
+ print ("FATAL: " msg) > "/dev/stderr";
+ exit status;
+}
+done { fail("Junk after DONE", 1); }
+/^DONE$/ {
+ done = 1
+ next
+}
+
+# Make sure git produced valid output.
+!/^[0-7]{6}\t[ -~]+$/ {
+ fail("git ls-files produced invalid output", 1);
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+# Another check for a git bug.
+filename ~ /^\/|((^|\/)\.{0,2}($|\/))/ {
+ fail("git ls-files output non-canonical or absolute path '" filename "'", 1);
+}
+
+filename ~ /[^[:alnum:]_.+@/-]/ {
+ fail("filename '" filename "' has forbidden characters", 1);
+}
+
+/\.license$/ {
+ if (raw_mode != "100644") {
+ fail("License file '" filename "' is executable or not regular file", 1);
+ }
+ next;
+}
+
+mode == "directory" { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_count += 1;
+ rc_files[rc_count] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlink_count += 1;
+ symlinks[symlink_count] = filename;
+ next;
+}
+
+mode == "regular" {
+ file_count += 1;
+ files[file_count] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file, directory, or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ if (!done) {
+ fail("Did not receive DONE line", 1);
+ }
+ printf ("# SPDX-License-Identifier: CC0-1.0\n" \
+ "# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+ "# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
+ "FILES :=") > out_file;
+ for (array_index = 1; array_index <= file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index] > out_file;
+ }
+ printf ("\n\n" \
+"# These are separate because they need to be included, but putting\n" \
+"# them as make dependencies would confuse make.\n" \
+"LINKS :=") > out_file;
+ for (array_index = 1; array_index <= symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index] > out_file;
+ }
+ printf "\n\nS6_RC_FILES :=" > out_file;
+ for (array_index = 1; array_index <= rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index] > out_file;
+ }
+ printf "\n" > out_file;
+ if (close(out_file)) {
+ print ("Cannot close output file: " ERRNO "\n") > "/dev/stderr";
+ exit 1;
+ }
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d90c911c98ff96e9dc2ca93103dcca902e15b09a
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C bash --
+set -euo pipefail
+case $0 in
+(/*) cd "${0%/*}/..";;
+(*/*) cd "./${0%/*}/..";;
+(*) cd ..;;
+esac
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ echo DONE
+ } |
+ gawk -v "out_file=$output_file.tmp" -E scripts/genfiles.awk
+ status=0
+ cmp -s -- "$output_file.tmp" "$output_file" || status=$?
+ case $status in
+ (0) rm -- "$output_file.tmp";;
+ (1) mv -- "$output_file.tmp" "$output_file";;
+ (*) exit "$?";;
+ esac
+done
diff --git a/scripts/git-rebase b/scripts/git-rebase
new file mode 100755
index 0000000000000000000000000000000000000000..593f9299ddfd2c553ceacc68e738629ca8dec019
--- /dev/null
+++ b/scripts/git-rebase
@@ -0,0 +1,17 @@
+#!/usr/bin/env -S bash --
+set -eu
+case $0 in
+(/*) dir=${0%/*}/..;;
+(*/*) dir=./${0%/*}/..;;
+(*) dir=..;;
+esac
+exec git rebase -x "set -eu; \
+cd '${dir//\'/\'\\\'\'}'; \
+scripts/pre-commit.sh; \
+set +e;\
+git diff --quiet HEAD -- host/rootfs/gen/file-list.mk img/app/file-list.mk vm/sys/net/file-list.mk;\
+case \$? in \
+(0) :;;\
+(1) git commit --amend -- host/rootfs/gen/file-list.mk img/app/file-list.mk vm/sys/net/file-list.mk;;\
+(*) exit \"\$?\";;\
+esac" "$@"
diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh
new file mode 100755
index 0000000000000000000000000000000000000000..29df8c0030ffeb2e611511391089de9c29763202
--- /dev/null
+++ b/scripts/pre-commit.sh
@@ -0,0 +1,9 @@
+#!/bin/sh --
+set -eu
+case $0 in
+(/*) cd ${0%/*}/..;;
+(*/*) cd ./${0%/*}/..;;
+(*) cd ..;;
+esac
+scripts/genfiles.sh
+git add -- "$i/file-list.mk"
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index b3ea49bc7065edb3411dbf5eaa3d8517ef2a61bd..23f3adcddd47a4453c4b8b7871af4516190b662d 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,26 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
@@ -138,6 +103,11 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
$(KERNEL)
.PHONY: run-crosvm
+update-file-list:
+ ../../scripts/genfiles.awk image > file-list.mk
+
+.PHONY: update-file-list
+
run: run-$(VMM)
.PHONY: run
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..a8df7e1e0d16b6854bfe716b1134947241916119
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES := \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS := \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES := \
+ image/etc/s6-rc/connman/dependencies \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v3 4/4] Common make rules for building erofs images
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
` (2 preceding siblings ...)
2025-09-11 12:47 ` [PATCH v3 3/4] Generate makefile file lists from a script Demi Marie Obenour
@ 2025-09-11 12:47 ` Demi Marie Obenour
3 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-11 12:47 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Demi Marie Obenour, Alyssa Ross
Instead of duplicating the logic in three different places, write common
code for all three makefiles to use instead. This will make future
changes much easier.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
host/rootfs/Makefile | 45 +++------------------------------------------
host/rootfs/default.nix | 1 +
img/app/Makefile | 41 ++---------------------------------------
img/app/default.nix | 1 +
lib/erofs.mk | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
vm/sys/net/Makefile | 39 ++++-----------------------------------
vm/sys/net/default.nix | 1 +
7 files changed, 61 insertions(+), 116 deletions(-)
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 5191701c009a38062c8433a7d99288f2eaa0d1a5..e100c9fa240d76a0210b553f5aaa34de93b05e78 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -3,10 +3,8 @@
.POSIX:
-include ../../lib/common.mk
-include file-list.mk
-
-dest = build/rootfs.erofs
+basedir = ../..
+include $(basedir)/lib/erofs.mk
DIRS = \
dev \
@@ -44,44 +42,7 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-BUILD_FILES = build/etc/s6-rc
-
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- printf 'build/fifo\n%s\n' $(FIFOS) ;\
- ) | ../../scripts/make-erofs.sh $@
-
-build/fifo:
- mkdir -p build
- mkfifo -m 0600 $@
-
-build/empty:
- mkdir -p $@
-
-# s6-rc-compile's input is a directory, but that doesn't play nice
-# with Make, because it won't know to update if some file in the
-# directory is changed, or a file is created or removed in a
-# subdirectory. Using the whole source directory could also end up
-# including files that aren't intended to be part of the input, like
-# temporary editor files or .license files. So for all these reasons,
-# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
-
-clean:
- -chmod -Rf +w build
- rm -rf build
-.PHONY: clean
+all: $(dest)
# veritysetup format produces two files, but Make only (portably)
# supports one output per rule, so we combine the two outputs then
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 998220d7b6ed322f64ee52c704e71ec9b4643f59..561bf660829dcd5f5e2ee841662727b262d43ed3 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -178,6 +178,7 @@ stdenvNoCC.mkDerivation {
fileset = fileset.intersection src (fileset.unions [
./.
../../lib/common.mk
+ ../../lib/erofs.mk
../../scripts/make-erofs.sh
]);
};
diff --git a/img/app/Makefile b/img/app/Makefile
index 8be05a4781e516ee60628e2f40822cf4d6b0629e..409c0156bf0d336c17dec6e2324e6fbd6bd4c788 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -4,8 +4,8 @@
.POSIX:
-include ../../lib/common.mk
-include file-list.mk
+basedir = ../..
+include $(basedir)/lib/erofs.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -18,7 +18,6 @@ HOST_BUILD_FILES = \
$(imgdir)/appvm/vmlinux
all: $(HOST_BUILD_FILES)
-.PHONY: all
$(imgdir)/appvm/vmlinux: $(KERNEL)
mkdir -p $$(dirname $@)
@@ -36,33 +35,6 @@ DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/wait
FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-BUILD_FILES = build/etc/s6-rc
-
-build/fifo:
- mkdir -p build
- mkfifo -m 0600 $@
-
-build/empty:
- mkdir -p $@
-
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- printf 'build/fifo\n%s\n' $(FIFOS) ;\
- ) | ../../scripts/make-erofs.sh $@
-
-
-build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
debug:
$(GDB) -q \
@@ -139,14 +111,5 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
$(KERNEL)
.PHONY: run-crosvm
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: run-$(VMM)
.PHONY: run
-
-clean:
- rm -rf build
-.PHONY: clean
diff --git a/img/app/default.nix b/img/app/default.nix
index 71a939c1c053ebd37fc02fa4eed49b883d50ef49..8c2a114e6b4db52afe9c92f9adb3d5ec52ea2260 100644
--- a/img/app/default.nix
+++ b/img/app/default.nix
@@ -105,6 +105,7 @@ stdenvNoCC.mkDerivation {
fileset = lib.fileset.intersection src (lib.fileset.unions [
./.
../../lib/common.mk
+ ../../lib/erofs.mk
../../scripts/make-erofs.sh
../../scripts/make-gpt.sh
../../scripts/sfdisk-field.awk
diff --git a/lib/erofs.mk b/lib/erofs.mk
new file mode 100644
index 0000000000000000000000000000000000000000..e78b1e92f8591cd4a7c0700a81959fbcbbbc2bec
--- /dev/null
+++ b/lib/erofs.mk
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022 Unikie
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+include $(basedir)/lib/common.mk
+include file-list.mk
+BUILD_FILES += build/etc/s6-rc
+dest = build/rootfs.erofs
+
+all:
+.PHONY: all
+$(dest): $(basedir)/scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
+ set -euo pipefail; ( \
+ cat $(PACKAGES_FILE);\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' "$$file" "$${file#image/}"; done;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' "$$file" "$${file#build/}"; done;\
+ for dir in $(DIRS); do printf 'build/empty\n%s\n' "$$dir"; done;\
+ for fifo in $(FIFOS); do printf 'build/fifo\n%s\n' "$$fifo"; done;\
+ ) | $(basedir)/scripts/make-erofs.sh $@
+
+clean:
+ -chmod -Rf +w build
+ rm -rf build
+.PHONY: clean
+ false
+
+build/fifo:
+ mkdir -p build
+ mkfifo -m 0600 $@
+
+build/empty:
+ mkdir -p $@
+
+# s6-rc-compile's input is a directory, but that doesn't play nice
+# with Make, because it won't know to update if some file in the
+# directory is changed, or a file is created or removed in a
+# subdirectory. Using the whole source directory could also end up
+# including files that aren't intended to be part of the input, like
+# temporary editor files or .license files. So for all these reasons,
+# only explicitly listed files are made available to s6-rc-compile.
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
+ mkdir -p build/etc
+ rm -rf $@
+ set -uo pipefail; \
+ dir=$$(mktemp -d) || exit; \
+ { tar -c $(S6_RC_FILES) | tar -C "$$dir" -x --strip-components 3;} && \
+ s6-rc-compile $@ $$dir; \
+ exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 23f3adcddd47a4453c4b8b7871af4516190b662d..217f95bfeabd80bc6fea1e3264296891ee495ee5 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -3,21 +3,22 @@
.POSIX:
-include ../../../lib/common.mk
-include file-list.mk
+basedir = ../../..
+include $(basedir)/lib/erofs.mk
prefix = build/host
libdir = $(prefix)/lib
vmdir = $(libdir)/spectrum/vm
VMM = cloud-hypervisor
+DIRS =
+FIFOS =
HOST_BUILD_FILES = \
$(vmdir)/netvm/blk/root.img \
$(vmdir)/netvm/vmlinux
all: $(HOST_BUILD_FILES)
-.PHONY: all
$(vmdir)/netvm/vmlinux: $(KERNEL)
mkdir -p $$(dirname $@)
@@ -29,29 +30,6 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-BUILD_FILES = build/etc/s6-rc
-
-build/empty:
- mkdir -p $@
-
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
- ( \
- cat $(PACKAGES_FILE) ;\
- for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(DIRS) ;\
- ) | ../../../scripts/make-erofs.sh $@
-
-
-build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
- mkdir -p $$(dirname $@)
- rm -rf $@
-
- set -uo pipefail; dir=$$(mktemp -d) || exit; \
- { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
- s6-rc-compile $@ $$dir; \
- exit=$$?; rm -r $$dir; exit $$exit
-
debug:
$(GDB) -q \
-ex 'set substitute-path .. $(LINUX_SRC)' \
@@ -103,14 +81,5 @@ run-crosvm: $(vmdir)/netvm/blk/root.img
$(KERNEL)
.PHONY: run-crosvm
-update-file-list:
- ../../scripts/genfiles.awk image > file-list.mk
-
-.PHONY: update-file-list
-
run: run-$(VMM)
.PHONY: run
-
-clean:
- rm -rf build
-.PHONY: clean
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index 7b2b8b1fbb9b9027781812307bed0551b80f5a78..c453f02cb204e97d0627b18c66c29a9767159d40 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -104,6 +104,7 @@ stdenvNoCC.mkDerivation {
fileset = lib.fileset.intersection src (lib.fileset.unions [
./.
../../../lib/common.mk
+ ../../../lib/erofs.mk
../../../scripts/make-erofs.sh
../../../scripts/make-gpt.sh
../../../scripts/sfdisk-field.awk
--
2.51.0
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v3 1/4] Do not ignore errors from tar
2025-09-11 12:47 ` [PATCH v3 1/4] Do not ignore errors from tar Demi Marie Obenour
@ 2025-09-17 11:48 ` Alyssa Ross
2025-09-18 2:45 ` Demi Marie Obenour
2025-09-19 7:55 ` Alyssa Ross
1 sibling, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-17 11:48 UTC (permalink / raw)
To: Demi Marie Obenour, Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 2581 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> These would be ignored due to a missing -o pipefail in the shell script.
> As a result, listing nonexistent s6-rc-compile inputs would cause a
> broken image to be successfully built.
>
> Reported-by: Alyssa Ross <hi@alyssa.is>
> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> host/rootfs/Makefile | 4 ++--
> img/app/Makefile | 4 ++--
> vm/sys/net/Makefile | 4 ++--
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
> --- a/host/rootfs/Makefile
> +++ b/host/rootfs/Makefile
> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
> mkdir -p $$(dirname $@)
> rm -rf $@
>
> - dir=$$(mktemp -d) && \
> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
> s6-rc-compile $@ $$dir; \
> exit=$$?; rm -r $$dir; exit $$exit
>
What do the additional { } do?
> diff --git a/img/app/Makefile b/img/app/Makefile
> index 9665a6b7158f2d8b183831202a4559ae06d53d16..73db07cc4c781d9c41cdf41a6214298aae8de58a 100644
> --- a/img/app/Makefile
> +++ b/img/app/Makefile
> @@ -117,8 +117,8 @@ build/etc/s6-rc: $(VM_S6_RC_FILES)
> mkdir -p $$(dirname $@)
> rm -rf $@
>
> - dir=$$(mktemp -d) && \
> - tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
> + { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
> s6-rc-compile $@ $$dir; \
> exit=$$?; rm -r $$dir; exit $$exit
>
> diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
> index 755b145175199aa97049dbd7feadc0e76230cf30..88ae20de79cd21b06263837f90310e8800b3d4e2 100644
> --- a/vm/sys/net/Makefile
> +++ b/vm/sys/net/Makefile
> @@ -82,8 +82,8 @@ build/etc/s6-rc: $(VM_S6_RC_FILES)
> mkdir -p $$(dirname $@)
> rm -rf $@
>
> - dir=$$(mktemp -d) && \
> - tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
> + { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
> s6-rc-compile $@ $$dir; \
> exit=$$?; rm -r $$dir; exit $$exit
>
>
> --
> 2.51.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 2/4] Move all files for the image into a subdirectory
2025-09-11 12:47 ` [PATCH v3 2/4] Move all files for the image into a subdirectory Demi Marie Obenour
@ 2025-09-17 12:30 ` Alyssa Ross
2025-09-17 12:39 ` Alyssa Ross
2025-09-17 13:03 ` Alyssa Ross
2 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-17 12:30 UTC (permalink / raw)
To: Demi Marie Obenour, Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 2772 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> diff --git a/img/app/Makefile b/img/app/Makefile
> index 73db07cc4c781d9c41cdf41a6214298aae8de58a..0099aa3b9626bfcc2079e5c67401db4e5316caeb 100644
> --- a/img/app/Makefile
> +++ b/img/app/Makefile
> @@ -30,32 +30,32 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
> mv $@.tmp $@
>
> VM_FILES = \
> - etc/dbus-1/session.conf \
> - etc/fonts/fonts.conf \
> - etc/fstab \
> - etc/init \
> - etc/mdev.conf \
> - etc/mdev/iface \
> - etc/mdev/listen \
> - etc/mdev/virtiofs \
> - etc/mdev/wait \
> - etc/passwd \
> - etc/pipewire/pipewire.conf \
> - etc/resolv.conf \
> - etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
> - etc/s6-linux-init/env/DISPLAY \
> - etc/s6-linux-init/env/GTK_USE_PORTAL \
> - etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
> - etc/s6-linux-init/env/WAYLAND_DISPLAY \
> - etc/s6-linux-init/env/XDG_RUNTIME_DIR \
> - etc/s6-linux-init/run-image/service/getty-hvc0/run \
> - etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
> - etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
> - etc/s6-linux-init/scripts/rc.init \
> - etc/s6-linux-init/scripts/rc.shutdown \
> - etc/s6-linux-init/scripts/rc.shutdown.final \
> - etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
> - etc/xdg/xdg-desktop-portal/portals.conf
> + image/etc/dbus-1/session.conf \
> + image/etc/fonts/fonts.conf \
> + image/etc/fstab \
> + image/etc/init \
> + image/etc/mdev.conf \
> + image/etc/mdev/iface \
> + image/etc/mdev/listen \
> + image/etc/mdev/virtiofs \
> + image/etc/mdev/wait \
> + image/etc/passwd \
> + image/etc/pipewire/pipewire.conf \
> + image/etc/resolv.conf \
> + image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
> + image/etc/s6-linux-init/env/DISPLAY \
> + image/etc/s6-linux-init/env/GTK_USE_PORTAL \
> + image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
> + image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
> + image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
> + image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
> + image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
> + image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
> + image/etc/s6-linux-init/scripts/rc.init \
> + image/etc/s6-linux-init/scripts/rc.shutdown \
> + image/etc/s6-linux-init/scripts/rc.shutdown.final \
> + image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
> + image/etc/xdg/xdg-desktop-portal/portals.conf
>
> VM_DIRS = dev run proc sys tmp \
> etc/s6-linux-init/run-image/service \
It's a bit of a shame that this makes VM_FILES and VM_DIRS asymmetric,
but I guess it's worth it…
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 2/4] Move all files for the image into a subdirectory
2025-09-11 12:47 ` [PATCH v3 2/4] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-17 12:30 ` Alyssa Ross
@ 2025-09-17 12:39 ` Alyssa Ross
2025-09-17 13:03 ` Alyssa Ross
2 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-17 12:39 UTC (permalink / raw)
To: Demi Marie Obenour, Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 14971 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> This avoids conflating files that will only be used during the build
> with files that will be included in the generated image. It also makes
> it vastly easier to generate the lists of files in the Makefile from a
> script.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> host/rootfs/Makefile | 182 ++++++++++-----------
> host/rootfs/{ => image}/bin | 0
> host/rootfs/{ => image}/etc/fonts/fonts.conf | 0
> host/rootfs/{ => image}/etc/fstab | 0
> host/rootfs/{ => image}/etc/group | 0
> host/rootfs/{ => image}/etc/group.license | 0
> host/rootfs/{ => image}/etc/init | 0
> host/rootfs/{ => image}/etc/login | 0
> host/rootfs/{ => image}/etc/mdev.conf | 0
> host/rootfs/{ => image}/etc/mdev/listen | 0
> host/rootfs/{ => image}/etc/mdev/net/add | 0
> host/rootfs/{ => image}/etc/mdev/wait | 0
> host/rootfs/{ => image}/etc/parse-devname | 0
> host/rootfs/{ => image}/etc/passwd | 0
> host/rootfs/{ => image}/etc/passwd.license | 0
> .../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
> .../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
> .../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
> .../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
> .../etc/s6-linux-init/run-image/opengl-driver | 0
> .../run-image/service/dbus/notification-fd | 0
> .../run-image/service/dbus/notification-fd.license | 0
> .../etc/s6-linux-init/run-image/service/dbus/run | 0
> .../service/dbus/template/notification-fd | 0
> .../service/dbus/template/notification-fd.license | 0
> .../run-image/service/dbus/template/run | 0
> .../s6-linux-init/run-image/service/getty-tty1/run | 0
> .../s6-linux-init/run-image/service/getty-tty2/run | 0
> .../s6-linux-init/run-image/service/getty-tty3/run | 0
> .../s6-linux-init/run-image/service/getty-tty4/run | 0
> .../service/s6-svscan-log/notification-fd | 0
> .../service/s6-svscan-log/notification-fd.license | 0
> .../run-image/service/s6-svscan-log/run | 0
> .../run-image/service/serial-getty-generator/run | 0
> .../run-image/service/serial-getty/notification-fd | 0
> .../service/serial-getty/notification-fd.license | 0
> .../run-image/service/serial-getty/run | 0
> .../run-image/service/serial-getty/template/run | 0
> .../service/vhost-user-fs/notification-fd | 0
> .../service/vhost-user-fs/notification-fd.license | 0
> .../run-image/service/vhost-user-fs/run | 0
> .../service/vhost-user-fs/template/notification-fd | 0
> .../vhost-user-fs/template/notification-fd.license | 0
> .../run-image/service/vhost-user-fs/template/run | 0
> .../service/vhost-user-gpu/notification-fd | 0
> .../service/vhost-user-gpu/notification-fd.license | 0
> .../run-image/service/vhost-user-gpu/run | 0
> .../service/vhost-user-gpu/template/data/check | 0
> .../vhost-user-gpu/template/notification-fd | 0
> .../template/notification-fd.license | 0
> .../run-image/service/vhost-user-gpu/template/run | 0
> .../run-image/service/vhost-user-gpu/template/type | 0
> .../service/vhost-user-gpu/template/type.license | 0
> .../run-image/service/vmm/notification-fd | 0
> .../run-image/service/vmm/notification-fd.license | 0
> .../etc/s6-linux-init/run-image/service/vmm/run | 0
> .../run-image/service/vmm/template/notification-fd | 0
> .../service/vmm/template/notification-fd.license | 0
> .../run-image/service/vmm/template/run | 0
> .../notification-fd | 0
> .../notification-fd.license | 0
> .../service/xdg-desktop-portal-spectrum-host/run | 0
> .../template/notification-fd | 0
> .../template/notification-fd.license | 0
> .../xdg-desktop-portal-spectrum-host/template/run | 0
> .../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
> host/rootfs/{ => image}/etc/s6-rc/card0/type | 0
> .../{ => image}/etc/s6-rc/card0/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/card0/up | 0
> host/rootfs/{ => image}/etc/s6-rc/core/type | 0
> .../rootfs/{ => image}/etc/s6-rc/core/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/core/up | 0
> host/rootfs/{ => image}/etc/s6-rc/kvm/timeout-up | 0
> .../{ => image}/etc/s6-rc/kvm/timeout-up.license | 0
> host/rootfs/{ => image}/etc/s6-rc/kvm/type | 0
> host/rootfs/{ => image}/etc/s6-rc/kvm/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/kvm/up | 0
> .../etc/s6-rc/mdevd-coldplug/dependencies | 0
> .../{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
> .../etc/s6-rc/mdevd-coldplug/type.license | 0
> .../rootfs/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
> .../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
> .../etc/s6-rc/mdevd/notification-fd.license | 0
> host/rootfs/{ => image}/etc/s6-rc/mdevd/run | 0
> host/rootfs/{ => image}/etc/s6-rc/mdevd/type | 0
> .../{ => image}/etc/s6-rc/mdevd/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/ok-all/contents | 0
> host/rootfs/{ => image}/etc/s6-rc/ok-all/type | 0
> .../{ => image}/etc/s6-rc/ok-all/type.license | 0
> .../rootfs/{ => image}/etc/s6-rc/static-nodes/type | 0
> .../etc/s6-rc/static-nodes/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/static-nodes/up | 0
> .../{ => image}/etc/s6-rc/sys-vmms/dependencies | 0
> host/rootfs/{ => image}/etc/s6-rc/sys-vmms/type | 0
> .../{ => image}/etc/s6-rc/sys-vmms/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/sys-vmms/up | 0
> host/rootfs/{ => image}/etc/s6-rc/vm-env/contents | 0
> host/rootfs/{ => image}/etc/s6-rc/vm-env/type | 0
> .../{ => image}/etc/s6-rc/vm-env/type.license | 0
> host/rootfs/{ => image}/etc/s6-rc/vmm-env/contents | 0
> host/rootfs/{ => image}/etc/s6-rc/vmm-env/type | 0
> .../{ => image}/etc/s6-rc/vmm-env/type.license | 0
> .../{ => image}/etc/s6-rc/weston/dependencies | 0
> .../{ => image}/etc/s6-rc/weston/notification-fd | 0
> .../etc/s6-rc/weston/notification-fd.license | 0
> host/rootfs/{ => image}/etc/s6-rc/weston/run | 0
> host/rootfs/{ => image}/etc/s6-rc/weston/type | 0
> .../{ => image}/etc/s6-rc/weston/type.license | 0
> host/rootfs/{ => image}/etc/xdg/weston/autolaunch | 0
> host/rootfs/{ => image}/etc/xdg/weston/weston.ini | 0
> host/rootfs/{ => image}/lib | 0
> host/rootfs/{ => image}/sbin | 0
> host/rootfs/{ => image}/usr/bin/assign-devices | 0
> .../{ => image}/usr/bin/create-vm-dependencies | 0
> host/rootfs/{ => image}/usr/bin/run-appimage | 0
> host/rootfs/{ => image}/usr/bin/run-vmm | 0
> host/rootfs/{ => image}/usr/bin/vm-console | 0
> host/rootfs/{ => image}/usr/bin/vm-import | 0
> host/rootfs/{ => image}/usr/bin/vm-start | 0
> host/rootfs/{ => image}/usr/bin/vm-stop | 0
> host/rootfs/{ => image}/usr/bin/xdg-open | 0
> .../org.freedesktop.portal.Documents.service | 0
> img/app/Makefile | 110 ++++++-------
> img/app/{ => image}/bin | 0
> img/app/{ => image}/etc/dbus-1/session.conf | 0
> img/app/{ => image}/etc/fonts/fonts.conf | 0
> img/app/{ => image}/etc/fstab | 0
> img/app/{ => image}/etc/init | 0
> img/app/{ => image}/etc/mdev.conf | 0
> img/app/{ => image}/etc/mdev/iface | 0
> img/app/{ => image}/etc/mdev/listen | 0
> img/app/{ => image}/etc/mdev/virtiofs | 0
> img/app/{ => image}/etc/mdev/wait | 0
> img/app/{ => image}/etc/passwd | 0
> img/app/{ => image}/etc/passwd.license | 0
> img/app/{ => image}/etc/pipewire/pipewire.conf | 0
> img/app/{ => image}/etc/resolv.conf | 0
> .../etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS | 0
> .../env/DBUS_SESSION_BUS_ADDRESS.license | 0
> img/app/{ => image}/etc/s6-linux-init/env/DISPLAY | 0
> .../etc/s6-linux-init/env/DISPLAY.license | 0
> .../etc/s6-linux-init/env/GTK_USE_PORTAL | 0
> .../etc/s6-linux-init/env/GTK_USE_PORTAL.license | 0
> .../s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR | 0
> .../env/NIX_XDG_DESKTOP_PORTAL_DIR.license | 0
> .../etc/s6-linux-init/env/WAYLAND_DISPLAY | 0
> .../etc/s6-linux-init/env/WAYLAND_DISPLAY.license | 0
> .../etc/s6-linux-init/env/XDG_RUNTIME_DIR | 0
> .../etc/s6-linux-init/env/XDG_RUNTIME_DIR.license | 0
> .../s6-linux-init/run-image/service/getty-hvc0/run | 0
> .../s6-linux-init-shutdownd/notification-fd | 0
> .../notification-fd.license | 0
> .../run-image/service/s6-linux-init-shutdownd/run | 0
> .../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
> .../etc/s6-linux-init/scripts/rc.shutdown | 0
> .../etc/s6-linux-init/scripts/rc.shutdown.final | 0
> .../{ => image}/etc/s6-rc/app/dependencies.d/dbus | 0
> .../etc/s6-rc/app/dependencies.d/pipewire | 0
> .../s6-rc/app/dependencies.d/wayland-proxy-virtwl | 0
> img/app/{ => image}/etc/s6-rc/app/run | 0
> img/app/{ => image}/etc/s6-rc/app/type | 0
> img/app/{ => image}/etc/s6-rc/app/type.license | 0
> img/app/{ => image}/etc/s6-rc/dbus/notification-fd | 0
> .../etc/s6-rc/dbus/notification-fd.license | 0
> img/app/{ => image}/etc/s6-rc/dbus/run | 0
> img/app/{ => image}/etc/s6-rc/dbus/type | 0
> img/app/{ => image}/etc/s6-rc/dbus/type.license | 0
> .../etc/s6-rc/mdevd-coldplug/dependencies | 0
> img/app/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
> .../etc/s6-rc/mdevd-coldplug/type.license | 0
> img/app/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
> .../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
> .../etc/s6-rc/mdevd/notification-fd.license | 0
> img/app/{ => image}/etc/s6-rc/mdevd/run | 0
> img/app/{ => image}/etc/s6-rc/mdevd/type | 0
> img/app/{ => image}/etc/s6-rc/mdevd/type.license | 0
> img/app/{ => image}/etc/s6-rc/ok-all/contents | 0
> img/app/{ => image}/etc/s6-rc/ok-all/type | 0
> img/app/{ => image}/etc/s6-rc/ok-all/type.license | 0
> .../{ => image}/etc/s6-rc/pipewire/notification-fd | 0
> .../etc/s6-rc/pipewire/notification-fd.license | 0
> img/app/{ => image}/etc/s6-rc/pipewire/run | 0
> img/app/{ => image}/etc/s6-rc/pipewire/type | 0
> .../{ => image}/etc/s6-rc/pipewire/type.license | 0
> .../etc/s6-rc/wayland-proxy-virtwl/notification-fd | 0
> .../wayland-proxy-virtwl/notification-fd.license | 0
> .../{ => image}/etc/s6-rc/wayland-proxy-virtwl/run | 0
> .../etc/s6-rc/wayland-proxy-virtwl/type | 0
> .../etc/s6-rc/wayland-proxy-virtwl/type.license | 0
> .../etc/s6-rc/wireplumber/dependencies.d/dbus | 0
> .../etc/s6-rc/wireplumber/dependencies.d/pipewire | 0
> img/app/{ => image}/etc/s6-rc/wireplumber/run | 0
> img/app/{ => image}/etc/s6-rc/wireplumber/type | 0
> .../{ => image}/etc/s6-rc/wireplumber/type.license | 0
> .../{ => image}/etc/ssl/certs/ca-certificates.crt | 0
> .../wireplumber.conf.d/99_spectrum.conf | 0
> .../etc/xdg/xdg-desktop-portal/portals.conf | 0
> img/app/{ => image}/sbin | 0
> vm/sys/net/Makefile | 64 ++++----
> vm/sys/net/{ => image}/bin | 0
> vm/sys/net/{ => image}/etc/dbus-1/system.conf | 0
> vm/sys/net/{ => image}/etc/fstab | 0
> vm/sys/net/{ => image}/etc/init | 0
> vm/sys/net/{ => image}/etc/mdev.conf | 0
> vm/sys/net/{ => image}/etc/mdev/iface | 0
> vm/sys/net/{ => image}/etc/nftables.conf | 0
> vm/sys/net/{ => image}/etc/passwd | 0
> vm/sys/net/{ => image}/etc/passwd.license | 0
> .../s6-linux-init/run-image/service/getty-hvc0/run | 0
> .../{ => image}/etc/s6-linux-init/scripts/rc.init | 0
> .../net/{ => image}/etc/s6-rc/connman/dependencies | 0
> vm/sys/net/{ => image}/etc/s6-rc/connman/run | 0
> vm/sys/net/{ => image}/etc/s6-rc/connman/type | 0
> .../net/{ => image}/etc/s6-rc/connman/type.license | 0
> .../net/{ => image}/etc/s6-rc/dbus/notification-fd | 0
> .../etc/s6-rc/dbus/notification-fd.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/dbus/run | 0
> vm/sys/net/{ => image}/etc/s6-rc/dbus/type | 0
> vm/sys/net/{ => image}/etc/s6-rc/dbus/type.license | 0
> .../etc/s6-rc/mdevd-coldplug/dependencies | 0
> .../net/{ => image}/etc/s6-rc/mdevd-coldplug/type | 0
> .../etc/s6-rc/mdevd-coldplug/type.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/mdevd-coldplug/up | 0
> .../{ => image}/etc/s6-rc/mdevd/notification-fd | 0
> .../etc/s6-rc/mdevd/notification-fd.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/mdevd/run | 0
> vm/sys/net/{ => image}/etc/s6-rc/mdevd/type | 0
> .../net/{ => image}/etc/s6-rc/mdevd/type.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/nftables/type | 0
> .../{ => image}/etc/s6-rc/nftables/type.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/nftables/up | 0
> vm/sys/net/{ => image}/etc/s6-rc/ok-all/contents | 0
> vm/sys/net/{ => image}/etc/s6-rc/ok-all/type | 0
> .../net/{ => image}/etc/s6-rc/ok-all/type.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/sysctl/type | 0
> .../net/{ => image}/etc/s6-rc/sysctl/type.license | 0
> vm/sys/net/{ => image}/etc/s6-rc/sysctl/up | 0
> vm/sys/net/{ => image}/etc/sysctl.conf | 0
> vm/sys/net/{ => image}/lib | 0
> vm/sys/net/{ => image}/sbin | 0
> vm/sys/net/{ => image}/var/run | 0
> 241 files changed, 178 insertions(+), 178 deletions(-)
This should also be done for initramfs, in the same patch.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 2/4] Move all files for the image into a subdirectory
2025-09-11 12:47 ` [PATCH v3 2/4] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-17 12:30 ` Alyssa Ross
2025-09-17 12:39 ` Alyssa Ross
@ 2025-09-17 13:03 ` Alyssa Ross
2 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-17 13:03 UTC (permalink / raw)
To: Demi Marie Obenour, Spectrum OS Development
Cc: Demi Marie Obenour, Alyssa Ross
This patch has been committed as edd53bb5dd9b682fec744d6df7921b64e0f56565,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=edd53bb5dd9b682fec744d6df7921b64e0f56565.
This is an automated message. Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 1/4] Do not ignore errors from tar
2025-09-17 11:48 ` Alyssa Ross
@ 2025-09-18 2:45 ` Demi Marie Obenour
2025-09-19 7:46 ` Alyssa Ross
0 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-18 2:45 UTC (permalink / raw)
To: Alyssa Ross, Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 1467 bytes --]
On 9/17/25 07:48, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> These would be ignored due to a missing -o pipefail in the shell script.
>> As a result, listing nonexistent s6-rc-compile inputs would cause a
>> broken image to be successfully built.
>>
>> Reported-by: Alyssa Ross <hi@alyssa.is>
>> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>> ---
>> host/rootfs/Makefile | 4 ++--
>> img/app/Makefile | 4 ++--
>> vm/sys/net/Makefile | 4 ++--
>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
>> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
>> --- a/host/rootfs/Makefile
>> +++ b/host/rootfs/Makefile
>> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
>> mkdir -p $$(dirname $@)
>> rm -rf $@
>>
>> - dir=$$(mktemp -d) && \
>> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
>> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
>> s6-rc-compile $@ $$dir; \
>> exit=$$?; rm -r $$dir; exit $$exit
>>
>
> What do the additional { } do?
Cause s6-rc-compile to be skipped if either tar command fails.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 1/4] Do not ignore errors from tar
2025-09-18 2:45 ` Demi Marie Obenour
@ 2025-09-19 7:46 ` Alyssa Ross
2025-09-30 12:59 ` Alyssa Ross
0 siblings, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-19 7:46 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> On 9/17/25 07:48, Alyssa Ross wrote:
>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>>
>>> These would be ignored due to a missing -o pipefail in the shell script.
>>> As a result, listing nonexistent s6-rc-compile inputs would cause a
>>> broken image to be successfully built.
>>>
>>> Reported-by: Alyssa Ross <hi@alyssa.is>
>>> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
>>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>>> ---
>>> host/rootfs/Makefile | 4 ++--
>>> img/app/Makefile | 4 ++--
>>> vm/sys/net/Makefile | 4 ++--
>>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
>>> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
>>> --- a/host/rootfs/Makefile
>>> +++ b/host/rootfs/Makefile
>>> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
>>> mkdir -p $$(dirname $@)
>>> rm -rf $@
>>>
>>> - dir=$$(mktemp -d) && \
>>> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>>> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
>>> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
>>> s6-rc-compile $@ $$dir; \
>>> exit=$$?; rm -r $$dir; exit $$exit
>>>
>>
>> What do the additional { } do?
> Cause s6-rc-compile to be skipped if either tar command fails.
Ah, like a subshell without creating a subshell! I haven't seen that
before. Probably there are lots of places where I'm needlessly using
subshells, then.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 1/4] Do not ignore errors from tar
2025-09-11 12:47 ` [PATCH v3 1/4] Do not ignore errors from tar Demi Marie Obenour
2025-09-17 11:48 ` Alyssa Ross
@ 2025-09-19 7:55 ` Alyssa Ross
2025-09-19 19:03 ` Demi Marie Obenour
1 sibling, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-19 7:55 UTC (permalink / raw)
To: Demi Marie Obenour, Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> These would be ignored due to a missing -o pipefail in the shell script.
> As a result, listing nonexistent s6-rc-compile inputs would cause a
> broken image to be successfully built.
>
> Reported-by: Alyssa Ross <hi@alyssa.is>
> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> host/rootfs/Makefile | 4 ++--
> img/app/Makefile | 4 ++--
> vm/sys/net/Makefile | 4 ++--
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
> --- a/host/rootfs/Makefile
> +++ b/host/rootfs/Makefile
> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
> mkdir -p $$(dirname $@)
> rm -rf $@
>
> - dir=$$(mktemp -d) && \
> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
Why do we need to change `dir=$(mktemp -d) &&` to `dir=$(mktemp -d) || exit;`?
In my testing we'll jump to the rm/exit with the former, which seems
like the right thing.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 1/4] Do not ignore errors from tar
2025-09-19 7:55 ` Alyssa Ross
@ 2025-09-19 19:03 ` Demi Marie Obenour
0 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-19 19:03 UTC (permalink / raw)
To: Alyssa Ross, Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 1561 bytes --]
On 9/19/25 03:55, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> These would be ignored due to a missing -o pipefail in the shell script.
>> As a result, listing nonexistent s6-rc-compile inputs would cause a
>> broken image to be successfully built.
>>
>> Reported-by: Alyssa Ross <hi@alyssa.is>
>> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>> ---
>> host/rootfs/Makefile | 4 ++--
>> img/app/Makefile | 4 ++--
>> vm/sys/net/Makefile | 4 ++--
>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
>> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
>> --- a/host/rootfs/Makefile
>> +++ b/host/rootfs/Makefile
>> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
>> mkdir -p $$(dirname $@)
>> rm -rf $@
>>
>> - dir=$$(mktemp -d) && \
>> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
>> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
>
> Why do we need to change `dir=$(mktemp -d) &&` to `dir=$(mktemp -d) || exit;`?
> In my testing we'll jump to the rm/exit with the former, which seems
> like the right thing.
We definitely do not need to make that change.
I have since reverted it in my local repository.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v3] Generate file lists from a script
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
` (3 preceding siblings ...)
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
@ 2025-09-21 2:23 ` Demi Marie Obenour
2025-09-21 8:47 ` Alyssa Ross
2025-09-21 17:24 ` [PATCH v4] " Demi Marie Obenour
4 siblings, 2 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-21 2:23 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://lore.kernel.org/r/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 17 ++++
host/rootfs/Makefile | 102 +----------------------
host/rootfs/file-list.mk | 99 +++++++++++++++++++++++
img/app/Makefile | 80 +++----------------
img/app/file-list.mk | 65 +++++++++++++++
lib/common.mk | 1 +
scripts/genfiles.awk | 120 ++++++++++++++++++++++++++++
scripts/genfiles.sh | 29 +++++++
scripts/git-rebase | 17 ++++
scripts/pre-commit.sh | 11 +++
vm/sys/net/Makefile | 50 ++----------
vm/sys/net/file-list.mk | 42 ++++++++++
12 files changed, 422 insertions(+), 211 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..0addc7d1a2fd322fa12918656baa3d169478504d 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -44,6 +44,23 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for the VM image is stored in a separate file,
+`file-lists.mk`. To update it, run `scripts/genfiles.sh`
+which will regenerate it from the output of `git ls-files`. Any
+changes you made will be lost. This script uses uses Git's index to
+generate the list, so you need to use `git add`, `git rm`, and `git mv`
+to ensure that Git knows about your changes. It is not necessary to
+commit the changes.
+
+It is recommended that you add a Git pre-commit hook that calls
+`scripts/pre-commit.sh`. This updates the `file-list.mk` files
+for you, so that each commit always includes the correct
+`file-list.mk`. Sadly, Git does not run the pre-commit hook
+during rebases, so if you rebase you should use the script
+`scripts/git-rebase` instead of `git rebase`. It tells
+Git to run `scripts/pre-commit.sh` after each commit and then
+calls `git commit --amend` to fixup the commit if needed.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index b11ba50f369c3440572e06a7eaca429fbe6746a1..875e511e6a5a83346fbf507d1104ce70599f0e21 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,36 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -165,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..f9946a6fa10e0cdf7d32975c3cc6d4b9e0d38991
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES ::= \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS ::= \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES ::= \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index c83b37364c16576e2609f5005b8a6092b644867b..61f783a1987791aef0bf062a78a44e1371fca80f 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,44 +45,17 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..049d597e22536d64d30d4af6e220d0a169b9b924
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES ::= \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS ::= \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES ::= \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/lib/common.mk b/lib/common.mk
index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
BACKGROUND = background
CPIO = cpio
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..6fe327fd0a314d226dbce23854aa8f119e9c8f34
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,120 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ file_count = 0;
+ symlink_count = 0;
+ rc_count = 0;
+ is_rc = 0;
+ exit_code = 0;
+ done = 0;
+ modes["120000"] = "symlink";
+ modes["040755"] = "directory";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg, status) {
+ if (status ~ /^([1-9][0-9]?|1[0-9]{2}|2[0-4][1-9]|25[1-5])$/) {
+ exit_code = status;
+ } else {
+ exit_code = 1;
+ status = 1;
+ }
+ print ("FATAL: " msg) > "/dev/stderr";
+ exit status;
+}
+done { fail("Junk after DONE", 1); }
+/^DONE$/ {
+ done = 1
+ next
+}
+
+# Make sure git produced valid output.
+!/^[0-7]{6}\t[ -~]+$/ {
+ fail("git ls-files produced invalid output", 1);
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+# Another check for a git bug.
+filename ~ /^\/|((^|\/)\.{0,2}($|\/))/ {
+ fail("git ls-files output non-canonical or absolute path '" filename "'", 1);
+}
+
+filename ~ /[^[:alnum:]_.+@/-]/ {
+ fail("filename '" filename "' has forbidden characters", 1);
+}
+
+/\.license$/ {
+ if (raw_mode != "100644") {
+ fail("License file '" filename "' is executable or not regular file", 1);
+ }
+ next;
+}
+
+mode == "directory" { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_count += 1;
+ rc_files[rc_count] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlink_count += 1;
+ symlinks[symlink_count] = filename;
+ next;
+}
+
+mode == "regular" {
+ file_count += 1;
+ files[file_count] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file, directory, or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ if (!done) {
+ fail("Did not receive DONE line", 1);
+ }
+ printf ("# SPDX-License-Identifier: CC0-1.0\n" \
+ "# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+ "# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
+ "FILES ::=") > out_file;
+ for (array_index = 1; array_index <= file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index] > out_file;
+ }
+ printf ("\n\n" \
+"# These are separate because they need to be included, but putting\n" \
+"# them as make dependencies would confuse make.\n" \
+"LINKS ::=") > out_file;
+ for (array_index = 1; array_index <= symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index] > out_file;
+ }
+ printf "\n\nS6_RC_FILES ::=" > out_file;
+ for (array_index = 1; array_index <= rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index] > out_file;
+ }
+ printf "\n" > out_file;
+ if (close(out_file)) {
+ print ("Cannot close output file: " ERRNO "\n") > "/dev/stderr";
+ exit 1;
+ }
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..77a8d95e88b6851be9447698556efe4f1eab174b
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env -S LC_ALL=C LANGUAGE=C bash --
+set -euo pipefail
+unset output_file astatus
+case $0 in
+(/*) cd "${0%/*}/..";;
+(*/*) cd "./${0%/*}/..";;
+(*) cd ..;;
+esac
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ echo DONE
+ } |
+ gawk -v "out_file=$output_file.tmp" -E scripts/genfiles.awk
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/scripts/git-rebase b/scripts/git-rebase
new file mode 100755
index 0000000000000000000000000000000000000000..593f9299ddfd2c553ceacc68e738629ca8dec019
--- /dev/null
+++ b/scripts/git-rebase
@@ -0,0 +1,17 @@
+#!/usr/bin/env -S bash --
+set -eu
+case $0 in
+(/*) dir=${0%/*}/..;;
+(*/*) dir=./${0%/*}/..;;
+(*) dir=..;;
+esac
+exec git rebase -x "set -eu; \
+cd '${dir//\'/\'\\\'\'}'; \
+scripts/pre-commit.sh; \
+set +e;\
+git diff --quiet HEAD -- host/rootfs/gen/file-list.mk img/app/file-list.mk vm/sys/net/file-list.mk;\
+case \$? in \
+(0) :;;\
+(1) git commit --amend -- host/rootfs/gen/file-list.mk img/app/file-list.mk vm/sys/net/file-list.mk;;\
+(*) exit \"\$?\";;\
+esac" "$@"
diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f0858da5395954e5af86a1fc4865c649381e5fdd
--- /dev/null
+++ b/scripts/pre-commit.sh
@@ -0,0 +1,11 @@
+#!/bin/sh --
+set -eu
+case $0 in
+(/*) cd ${0%/*}/..;;
+(*/*) cd ./${0%/*}/..;;
+(*) cd ..;;
+esac
+scripts/genfiles.sh
+for i in host/rootfs img/app vm/sys/net; do
+ git add -- "$i/file-list.mk"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 79be242ea26e37d6f02af8761320de27d69d5b69..e0a3c34b584569bc196937753c3d7669ca60ab3d 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,57 +29,20 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..de22e23c183f8d0a7df60a3c39395deae4f9a9bb
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES ::= \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS ::= \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES ::= \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
---
base-commit: 15ca6c4684313fcc9fcde3bda97d64698bb267ea
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v3] Generate file lists from a script
2025-09-21 2:23 ` [PATCH v3] Generate file lists from a script Demi Marie Obenour
@ 2025-09-21 8:47 ` Alyssa Ross
2025-09-21 16:51 ` Demi Marie Obenour
2025-09-21 17:24 ` [PATCH v4] " Demi Marie Obenour
1 sibling, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-21 8:47 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 11618 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
> manually-maintained lists of files and symlinks. These duplicate the
> information in the git repository and can easily get out of sync or
> cause unnecessary merge conflicts. Fix all of these issues by having
> the git repository be the source of truth, and using a script to
> generate the file lists. Developers can regenerate the lists before
> every commit, or even add a git hook to do that.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
I like where this is going. :)
> Changes in v3:
> - Only include the file list generator. Move the rest to separate patch
> series.
> - Remove the update-file-list make targets from img/app/Makefile and
> vm/sys/net/Makefile.
> - Link to v2: https://lore.kernel.org/r/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
>
> Changes in v2:
> - Drop the last patch (switching to /etc/s6-rc/compiled) as it is
> controversial and should be reviewed separately.
> - Add missing copyright notices.
> - Use a wrapper shell script to make the awk code easier to read.
> - Improve documentation.
> - Add helper scripts for use in git hooks and rebasing.
> - Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
> ---
> Documentation/development/built-in-vms.adoc | 17 ++++
> host/rootfs/Makefile | 102 +----------------------
> host/rootfs/file-list.mk | 99 +++++++++++++++++++++++
> img/app/Makefile | 80 +++----------------
> img/app/file-list.mk | 65 +++++++++++++++
> lib/common.mk | 1 +
> scripts/genfiles.awk | 120 ++++++++++++++++++++++++++++
> scripts/genfiles.sh | 29 +++++++
> scripts/git-rebase | 17 ++++
> scripts/pre-commit.sh | 11 +++
Let's take git-rebase and pre-commit.sh out of this patch, and focus on
the generated file lists first.
> vm/sys/net/Makefile | 50 ++----------
> vm/sys/net/file-list.mk | 42 ++++++++++
> 12 files changed, 422 insertions(+), 211 deletions(-)
>
> diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
> index e90009ee5a3c2c254a7ae11e36121576b819eee7..0addc7d1a2fd322fa12918656baa3d169478504d 100644
> --- a/Documentation/development/built-in-vms.adoc
> +++ b/Documentation/development/built-in-vms.adoc
Copyright header please!
> @@ -44,6 +44,23 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
> if the only change to the Nix files is modifying the packages
> installed in the VM.
>
> +The list of files used for the VM image is stored in a separate file,
> +`file-lists.mk`. To update it, run `scripts/genfiles.sh`
Typo: file-list*s*.mk. Also, so far we haven't used code syntax for
file names.
Maybe "used for images" would be better, since this also applies to
host/rootfs. (Obviously the ideal would be if this documentation wasn't
only written for VM images but that's out of scope. We'll get to it.)
> +which will regenerate it from the output of `git ls-files`. Any
> +changes you made will be lost. This script uses uses Git's index to
I think "Any changes you made will be lost." is a bit scary, because
it's not clear it only means changes to those files. The sentence could
probably just be dropped altogether — I think it's implied by "regenerate".
> +generate the list, so you need to use `git add`, `git rm`, and `git mv`
> +to ensure that Git knows about your changes. It is not necessary to
> +commit the changes.
"so only staged changes will be reflected"? All the extra stuff has
potential for confusion I think — for example "It is not necessary to
commit the changes." could be read as "when you make a commit, do not
include changes to file-list.mk".
> diff --git a/lib/common.mk b/lib/common.mk
> index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
> --- a/lib/common.mk
> +++ b/lib/common.mk
> @@ -1,5 +1,6 @@
> # SPDX-License-Identifier: EUPL-1.2+
> # SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>
> BACKGROUND = background
> CPIO = cpio
Accident?
> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
> new file mode 100644
> index 0000000000000000000000000000000000000000..6fe327fd0a314d226dbce23854aa8f119e9c8f34
> --- /dev/null
> +++ b/scripts/genfiles.awk
> @@ -0,0 +1,120 @@
> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +BEGIN {
> + RS = "\n";
> + FS = "\t";
> + file_count = 0;
> + symlink_count = 0;
> + rc_count = 0;
> + is_rc = 0;
> + exit_code = 0;
> + done = 0;
awk variables are implicitly initialized to 0 when you try to do
arithmetic on an undefined variable, so no need for these.
> + modes["120000"] = "symlink";
> + modes["040755"] = "directory";
> + modes["100644"] = "regular";
> + modes["100755"] = "regular";
> +}
> +
> +function fail(msg, status) {
> + if (status ~ /^([1-9][0-9]?|1[0-9]{2}|2[0-4][1-9]|25[1-5])$/) {
> + exit_code = status;
> + } else {
> + exit_code = 1;
> + status = 1;
> + }
> + print ("FATAL: " msg) > "/dev/stderr";
> + exit status;
Do we ever want to exit something other than 1 from this function?
> +}
> +done { fail("Junk after DONE", 1); }
> +/^DONE$/ {
> + done = 1
> + next
> +}
> +
> +# Make sure git produced valid output.
> +!/^[0-7]{6}\t[ -~]+$/ {
> + fail("git ls-files produced invalid output", 1);
> +}
> +
This is very unlikely to happen, and if it does, it will be obvious from
the diff.
> +# Extract data from built-in variables.
> +{
> + filename = $2;
> + raw_mode = $1;
> + # awk autocreates empty string entries if the key is invalid,
> + # but the code exits in this case so that is okay.
> + mode = modes[raw_mode];
> +}
> +
> +# Another check for a git bug.
> +filename ~ /^\/|((^|\/)\.{0,2}($|\/))/ {
> + fail("git ls-files output non-canonical or absolute path '" filename "'", 1);
> +}
> +
If there are git bugs, we will notice and report them. We do not need
to be the test suite for git here.
> +filename ~ /[^[:alnum:]_.+@/-]/ {
> + fail("filename '" filename "' has forbidden characters", 1);
> +}
> +
> +/\.license$/ {
> + if (raw_mode != "100644") {
> + fail("License file '" filename "' is executable or not regular file", 1);
> + }
> + next;
> +}
This is also not really in scope for a script that does not care about
license files.
> +
> +mode == "directory" { next }
Getting a directory from git ls-files would be sufficiently unexpected
that I don't think we should treat it any differently from an
unrecognized mode.
> +
> +filename ~ /^image\/etc\/s6-rc\// {
> + if (mode != "regular") {
> + fail("s6-rc-compile input '" filename "' isn't a regular file");
> + }
> + rc_count += 1;
> + rc_files[rc_count] = filename;
rc_files[rc_count++]
(will make it 0-indexed though so update the loops too)
> + next;
> +}
> +
> +mode == "symlink" {
> + symlink_count += 1;
> + symlinks[symlink_count] = filename;
> + next;
> +}
> +
> +mode == "regular" {
> + file_count += 1;
> + files[file_count] = filename;
> + next;
> +}
> +
> +{ fail("File '" filename "' is not regular file, directory, or symlink (mode " raw_mode ")"); }
> +
> +END {
> + if (exit_code) {
> + exit exit_code;
> + }
> + if (!done) {
> + fail("Did not receive DONE line", 1);
> + }
> + printf ("# SPDX-License-Identifier: CC0-1.0\n" \
> + "# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
Okay, so, it's silly that this needs to have a copyright header on it at
all, but since we have to have one to make reuse happy, I think it
should be mine from 2021, because the comment about links is the closest
thing to creative expression in here.
> + "# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
> + "FILES ::=") > out_file;
I note the change to ::=. Do you think we should do that across the
board in our Makefiles?
> + for (array_index = 1; array_index <= file_count; array_index += 1) {
> + printf " \\\n\t%s", files[array_index] > out_file;
> + }
> + printf ("\n\n" \
> +"# These are separate because they need to be included, but putting\n" \
> +"# them as make dependencies would confuse make.\n" \
> +"LINKS ::=") > out_file;
> + for (array_index = 1; array_index <= symlink_count; array_index += 1) {
> + printf " \\\n\t%s", symlinks[array_index] > out_file;
> + }
> + printf "\n\nS6_RC_FILES ::=" > out_file;
> + for (array_index = 1; array_index <= rc_count; array_index += 1) {
> + printf " \\\n\t%s", rc_files[array_index] > out_file;
> + }
> + printf "\n" > out_file;
> + if (close(out_file)) {
> + print ("Cannot close output file: " ERRNO "\n") > "/dev/stderr";
> + exit 1;
> + }
> +}
> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..77a8d95e88b6851be9447698556efe4f1eab174b
> --- /dev/null
> +++ b/scripts/genfiles.sh
> @@ -0,0 +1,29 @@
> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C bash --
env -S is not portable, and I don't think anything here needs bash
specifically. We can set the locale variables after the script starts,
because I don't think this wrapper script is going to do anything
locale-specific. (And shouldn't they be C.UTF-8?)
> +set -euo pipefail
> +unset output_file astatus
This is a bit overly defensive IMO. Both of these variables are
assigned before use, and if they weren't, the person making those
changes would be very unlikely to not notice because they had those
variables defined in their environment.
> +case $0 in
> +(/*) cd "${0%/*}/..";;
> +(*/*) cd "./${0%/*}/..";;
> +(*) cd ..;;
> +esac
Perhaps we could use git rev-parse --show-toplevel?
> +for i in host/rootfs img/app vm/sys/net; do
> + output_file=$i/file-list.mk
> + {
> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
> + sort -t $'\t' -k 2
TIL sort -t and -k! 🤯
> + echo DONE
Why do we need this?
> + } |
> + gawk -v "out_file=$output_file.tmp" -E scripts/genfiles.awk
Why not stdout? And why gawk? I didn't immediately notice anything
non-POSIX, and as usual would prefer to stick to it.
> + if [ -f "$output_file" ]; then
> + # Avoid changing output file if it is up to date, as that
> + # would cause unnecessary rebuilds.
> + if cmp -s -- "$output_file.tmp" "$output_file"; then
> + rm -- "$output_file.tmp"
> + continue
> + else
> + astatus=$?
> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
Could avoid the need for the variable and multiple ifs. Up to you
whether you prefer it:
set +e
cmp -s -- "$output_file.tmp" "$output_file"
set -e
case $? in
0)
rm -- "$output_file.tmp"
continue
;;
1)
;;
*)
exit $?
;;
esac
> + fi
> + fi
> + mv -- "$output_file.tmp" "$output_file"
> +done
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3] Generate file lists from a script
2025-09-21 8:47 ` Alyssa Ross
@ 2025-09-21 16:51 ` Demi Marie Obenour
2025-09-21 17:07 ` Alyssa Ross
0 siblings, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-21 16:51 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 13897 bytes --]
On 9/21/25 04:47, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
>> manually-maintained lists of files and symlinks. These duplicate the
>> information in the git repository and can easily get out of sync or
>> cause unnecessary merge conflicts. Fix all of these issues by having
>> the git repository be the source of truth, and using a script to
>> generate the file lists. Developers can regenerate the lists before
>> every commit, or even add a git hook to do that.
>>
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>> ---
>
> I like where this is going. :)
Yay!
>> Changes in v3:
>> - Only include the file list generator. Move the rest to separate patch
>> series.
>> - Remove the update-file-list make targets from img/app/Makefile and
>> vm/sys/net/Makefile.
>> - Link to v2: https://lore.kernel.org/r/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
>>
>> Changes in v2:
>> - Drop the last patch (switching to /etc/s6-rc/compiled) as it is
>> controversial and should be reviewed separately.
>> - Add missing copyright notices.
>> - Use a wrapper shell script to make the awk code easier to read.
>> - Improve documentation.
>> - Add helper scripts for use in git hooks and rebasing.
>> - Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
>> ---
>> Documentation/development/built-in-vms.adoc | 17 ++++
>> host/rootfs/Makefile | 102 +----------------------
>> host/rootfs/file-list.mk | 99 +++++++++++++++++++++++
>> img/app/Makefile | 80 +++----------------
>> img/app/file-list.mk | 65 +++++++++++++++
>> lib/common.mk | 1 +
>> scripts/genfiles.awk | 120 ++++++++++++++++++++++++++++
>> scripts/genfiles.sh | 29 +++++++
>> scripts/git-rebase | 17 ++++
>> scripts/pre-commit.sh | 11 +++
>
> Let's take git-rebase and pre-commit.sh out of this patch, and focus on
> the generated file lists first.
Will change.
>> vm/sys/net/Makefile | 50 ++----------
>> vm/sys/net/file-list.mk | 42 ++++++++++
>> 12 files changed, 422 insertions(+), 211 deletions(-)
>>
>> diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
>> index e90009ee5a3c2c254a7ae11e36121576b819eee7..0addc7d1a2fd322fa12918656baa3d169478504d 100644
>> --- a/Documentation/development/built-in-vms.adoc
>> +++ b/Documentation/development/built-in-vms.adoc
>
> Copyright header please!
Will fix. Also, in the future you have permission to fix missing copyright
headers when you commit. It's fine if you aren't comfortable doing that.
>> @@ -44,6 +44,23 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
>> if the only change to the Nix files is modifying the packages
>> installed in the VM.
>>
>> +The list of files used for the VM image is stored in a separate file,
>> +`file-lists.mk`. To update it, run `scripts/genfiles.sh`
>
> Typo: file-list*s*.mk. Also, so far we haven't used code syntax for
> file names.
>
> Maybe "used for images" would be better, since this also applies to
> host/rootfs. (Obviously the ideal would be if this documentation wasn't
> only written for VM images but that's out of scope. We'll get to it.)
Will fix.
>> +which will regenerate it from the output of `git ls-files`. Any
>> +changes you made will be lost. This script uses uses Git's index to
>
> I think "Any changes you made will be lost." is a bit scary, because
> it's not clear it only means changes to those files. The sentence could
> probably just be dropped altogether — I think it's implied by "regenerate".
Will fix.
>> +generate the list, so you need to use `git add`, `git rm`, and `git mv`
>> +to ensure that Git knows about your changes. It is not necessary to
>> +commit the changes.
>
> "so only staged changes will be reflected"? All the extra stuff has
> potential for confusion I think — for example "It is not necessary to
> commit the changes." could be read as "when you make a commit, do not
> include changes to file-list.mk".
Will fix.
>> diff --git a/lib/common.mk b/lib/common.mk
>> index 277c3544036d9a9057f8ba4ad37fe2207548cc59..0a03ff440cc671264d2b859a2ae048db9252d047 100644
>> --- a/lib/common.mk
>> +++ b/lib/common.mk
>> @@ -1,5 +1,6 @@
>> # SPDX-License-Identifier: EUPL-1.2+
>> # SPDX-FileCopyrightText: 2021, 2023, 2025 Alyssa Ross <hi@alyssa.is>
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>>
>> BACKGROUND = background
>> CPIO = cpio
>
> Accident?
Yes.
>> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..6fe327fd0a314d226dbce23854aa8f119e9c8f34
>> --- /dev/null
>> +++ b/scripts/genfiles.awk
>> @@ -0,0 +1,120 @@
>> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
>> +# SPDX-License-Identifier: EUPL-1.2+
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>> +BEGIN {
>> + RS = "\n";
>> + FS = "\t";
>> + file_count = 0;
>> + symlink_count = 0;
>> + rc_count = 0;
>> + is_rc = 0;
>> + exit_code = 0;
>> + done = 0;
>
> awk variables are implicitly initialized to 0 when you try to do
> arithmetic on an undefined variable, so no need for these.
GNU Awk can lint against that. I used its lint mode because it also
warns against non-portable constructs. Also, an undefined awk
variable used as an array subscript is treated as the empty string,
not 0, which could lead to confusion.
>> + modes["120000"] = "symlink";
>> + modes["040755"] = "directory";
>> + modes["100644"] = "regular";
>> + modes["100755"] = "regular";
>> +}
>> +
>> +function fail(msg, status) {
>> + if (status ~ /^([1-9][0-9]?|1[0-9]{2}|2[0-4][1-9]|25[1-5])$/) {
>> + exit_code = status;
>> + } else {
>> + exit_code = 1;
>> + status = 1;
>> + }
>> + print ("FATAL: " msg) > "/dev/stderr";
>> + exit status;
>
> Do we ever want to exit something other than 1 from this function?
Nope.
>> +}
>> +done { fail("Junk after DONE", 1); }
>> +/^DONE$/ {
>> + done = 1
>> + next
>> +}
>> +
>> +# Make sure git produced valid output.
>> +!/^[0-7]{6}\t[ -~]+$/ {
>> + fail("git ls-files produced invalid output", 1);
>> +}
>> +
>
> This is very unlikely to happen, and if it does, it will be obvious from
> the diff.
Will drop.
>> +# Extract data from built-in variables.
>> +{
>> + filename = $2;
>> + raw_mode = $1;
>> + # awk autocreates empty string entries if the key is invalid,
>> + # but the code exits in this case so that is okay.
>> + mode = modes[raw_mode];
>> +}
>> +
>> +# Another check for a git bug.
>> +filename ~ /^\/|((^|\/)\.{0,2}($|\/))/ {
>> + fail("git ls-files output non-canonical or absolute path '" filename "'", 1);
>> +}
>> +
>
> If there are git bugs, we will notice and report them. We do not need
> to be the test suite for git here.
Okay, fair!
>> +filename ~ /[^[:alnum:]_.+@/-]/ {
>> + fail("filename '" filename "' has forbidden characters", 1);
>> +}
>> +
>> +/\.license$/ {
>> + if (raw_mode != "100644") {
>> + fail("License file '" filename "' is executable or not regular file", 1);
>> + }
>> + next;
>> +}
>
> This is also not really in scope for a script that does not care about
> license files.
Fair. I will leave that to the reuse check.
>> +
>> +mode == "directory" { next }
>
> Getting a directory from git ls-files would be sufficiently unexpected
> that I don't think we should treat it any differently from an
> unrecognized mode.
Will fix.
>> +
>> +filename ~ /^image\/etc\/s6-rc\// {
>> + if (mode != "regular") {
>> + fail("s6-rc-compile input '" filename "' isn't a regular file");
>> + }
>> + rc_count += 1;
>> + rc_files[rc_count] = filename;
>
> rc_files[rc_count++]
>
> (will make it 0-indexed though so update the loops too)
I think this might break without explicit variable initialization.
>> + next;
>> +}
>> +
>> +mode == "symlink" {
>> + symlink_count += 1;
>> + symlinks[symlink_count] = filename;
>> + next;
>> +}
>> +
>> +mode == "regular" {
>> + file_count += 1;
>> + files[file_count] = filename;
>> + next;
>> +}
>> +
>> +{ fail("File '" filename "' is not regular file, directory, or symlink (mode " raw_mode ")"); }
>> +
>> +END {
>> + if (exit_code) {
>> + exit exit_code;
>> + }
>> + if (!done) {
>> + fail("Did not receive DONE line", 1);
>> + }
>> + printf ("# SPDX-License-Identifier: CC0-1.0\n" \
>> + "# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
>
> Okay, so, it's silly that this needs to have a copyright header on it at
> all, but since we have to have one to make reuse happy, I think it
> should be mine from 2021, because the comment about links is the closest
> thing to creative expression in here.
Will fix.
>> + "# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
>> + "FILES ::=") > out_file;
>
> I note the change to ::=. Do you think we should do that across the
> board in our Makefiles?
POSIX specifies ::= and it has better semantics in most cases, but I don't
know if the BSD makes implement it. ::= causes the RHS to be expanded immediately,
so subsequent changes in variables referenced by it do not affect the LHS.
>> + for (array_index = 1; array_index <= file_count; array_index += 1) {
>> + printf " \\\n\t%s", files[array_index] > out_file;
>> + }
>> + printf ("\n\n" \
>> +"# These are separate because they need to be included, but putting\n" \
>> +"# them as make dependencies would confuse make.\n" \
>> +"LINKS ::=") > out_file;
>> + for (array_index = 1; array_index <= symlink_count; array_index += 1) {
>> + printf " \\\n\t%s", symlinks[array_index] > out_file;
>> + }
>> + printf "\n\nS6_RC_FILES ::=" > out_file;
>> + for (array_index = 1; array_index <= rc_count; array_index += 1) {
>> + printf " \\\n\t%s", rc_files[array_index] > out_file;
>> + }
>> + printf "\n" > out_file;
>> + if (close(out_file)) {
>> + print ("Cannot close output file: " ERRNO "\n") > "/dev/stderr";
>> + exit 1;
>> + }
>> +}
>> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
>> new file mode 100755
>> index 0000000000000000000000000000000000000000..77a8d95e88b6851be9447698556efe4f1eab174b
>> --- /dev/null
>> +++ b/scripts/genfiles.sh
>> @@ -0,0 +1,29 @@
>> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C bash --
>
> env -S is not portable, and I don't think anything here needs bash
> specifically.
$'\t' doesn't work with all shells, though I believe it is either
part of the current POSIX standard or will be added. I'll use
/usr/bin/env bash, which breaks if the script is renamed to something
starting with '-'.
> We can set the locale variables after the script starts,
> because I don't think this wrapper script is going to do anything
> locale-specific. (And shouldn't they be C.UTF-8?)
The C locale is actually what I intended. The script does not rely
on support for non-ASCII characters, and it does use the fact that
negated character classes match all bytes. Admittedly, this will
only be needed if there is a git bug.
>> +set -euo pipefail
>> +unset output_file astatus
>
> This is a bit overly defensive IMO. Both of these variables are
> assigned before use, and if they weren't, the person making those
> changes would be very unlikely to not notice because they had those
> variables defined in their environment.
Fair!
>> +case $0 in
>> +(/*) cd "${0%/*}/..";;
>> +(*/*) cd "./${0%/*}/..";;
>> +(*) cd ..;;
>> +esac
>
> Perhaps we could use git rev-parse --show-toplevel?
git ls-files doesn't have that option.
>> +for i in host/rootfs img/app vm/sys/net; do
>> + output_file=$i/file-list.mk
>> + {
>> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
>> + sort -t $'\t' -k 2
>
> TIL sort -t and -k! 🤯
>
>> + echo DONE
>
> Why do we need this?
To avoid producing any output file if the input is truncated.
>> + } |
>> + gawk -v "out_file=$output_file.tmp" -E scripts/genfiles.awk
>
> Why not stdout?
The output file is created by awk so that it is only created if
nothing went wrong.
> And why gawk? I didn't immediately notice anything
> non-POSIX, and as usual would prefer to stick to it.
POSIX does not specify -E. I can use -f instead, though.
>> + if [ -f "$output_file" ]; then
>> + # Avoid changing output file if it is up to date, as that
>> + # would cause unnecessary rebuilds.
>> + if cmp -s -- "$output_file.tmp" "$output_file"; then
>> + rm -- "$output_file.tmp"
>> + continue
>> + else
>> + astatus=$?
>> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
>
> Could avoid the need for the variable and multiple ifs. Up to you
> whether you prefer it:
>
> set +e
> cmp -s -- "$output_file.tmp" "$output_file"
> set -e
> case $? in
> 0)
> rm -- "$output_file.tmp"
> continue
> ;;
> 1)
> ;;
> *)
> exit $?
> ;;
> esac
This might set $? to the return value of 'set -e' (0). Whether or
not it actually does is at least not obvious from reading the code.
>> + fi
>> + fi
>> + mv -- "$output_file.tmp" "$output_file"
>> +done
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3] Generate file lists from a script
2025-09-21 16:51 ` Demi Marie Obenour
@ 2025-09-21 17:07 ` Alyssa Ross
0 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-21 17:07 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 5633 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
>>> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
>>> new file mode 100644
>>> index 0000000000000000000000000000000000000000..6fe327fd0a314d226dbce23854aa8f119e9c8f34
>>> --- /dev/null
>>> +++ b/scripts/genfiles.awk
>>> @@ -0,0 +1,120 @@
>>> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C awk -E
>>> +# SPDX-License-Identifier: EUPL-1.2+
>>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>>> +BEGIN {
>>> + RS = "\n";
>>> + FS = "\t";
>>> + file_count = 0;
>>> + symlink_count = 0;
>>> + rc_count = 0;
>>> + is_rc = 0;
>>> + exit_code = 0;
>>> + done = 0;
>>
>> awk variables are implicitly initialized to 0 when you try to do
>> arithmetic on an undefined variable, so no need for these.
>
> GNU Awk can lint against that. I used its lint mode because it also
> warns against non-portable constructs. Also, an undefined awk
> variable used as an array subscript is treated as the empty string,
> not 0, which could lead to confusion.
Okay, happy to leave them if you want.
>>> +
>>> +filename ~ /^image\/etc\/s6-rc\// {
>>> + if (mode != "regular") {
>>> + fail("s6-rc-compile input '" filename "' isn't a regular file");
>>> + }
>>> + rc_count += 1;
>>> + rc_files[rc_count] = filename;
>>
>> rc_files[rc_count++]
>>
>> (will make it 0-indexed though so update the loops too)
>
> I think this might break without explicit variable initialization.
It does not.
>>> + "# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
>>> + "FILES ::=") > out_file;
>>
>> I note the change to ::=. Do you think we should do that across the
>> board in our Makefiles?
>
> POSIX specifies ::= and it has better semantics in most cases, but I don't
> know if the BSD makes implement it. ::= causes the RHS to be expanded immediately,
> so subsequent changes in variables referenced by it do not affect the LHS.
Happy to change, but would prefer we did it all at once.
>>> + for (array_index = 1; array_index <= file_count; array_index += 1) {
>>> + printf " \\\n\t%s", files[array_index] > out_file;
>>> + }
>>> + printf ("\n\n" \
>>> +"# These are separate because they need to be included, but putting\n" \
>>> +"# them as make dependencies would confuse make.\n" \
>>> +"LINKS ::=") > out_file;
>>> + for (array_index = 1; array_index <= symlink_count; array_index += 1) {
>>> + printf " \\\n\t%s", symlinks[array_index] > out_file;
>>> + }
>>> + printf "\n\nS6_RC_FILES ::=" > out_file;
>>> + for (array_index = 1; array_index <= rc_count; array_index += 1) {
>>> + printf " \\\n\t%s", rc_files[array_index] > out_file;
>>> + }
>>> + printf "\n" > out_file;
>>> + if (close(out_file)) {
>>> + print ("Cannot close output file: " ERRNO "\n") > "/dev/stderr";
>>> + exit 1;
>>> + }
>>> +}
>>> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
>>> new file mode 100755
>>> index 0000000000000000000000000000000000000000..77a8d95e88b6851be9447698556efe4f1eab174b
>>> --- /dev/null
>>> +++ b/scripts/genfiles.sh
>>> @@ -0,0 +1,29 @@
>>> +#!/usr/bin/env -S LC_ALL=C LANGUAGE=C bash --
>>
>> env -S is not portable, and I don't think anything here needs bash
>> specifically.
>
> $'\t' doesn't work with all shells, though I believe it is either
> part of the current POSIX standard or will be added. I'll use
> /usr/bin/env bash, which breaks if the script is renamed to something
> starting with '-'.
It's in 2024. I'd prefer this was /bin/sh like our other scripts — we
already have shellcheck checking for non-portable constructs.
>>> +case $0 in
>>> +(/*) cd "${0%/*}/..";;
>>> +(*/*) cd "./${0%/*}/..";;
>>> +(*) cd ..;;
>>> +esac
>>
>> Perhaps we could use git rev-parse --show-toplevel?
>
> git ls-files doesn't have that option.
I mean we could cd "$(git rev-parse --show-toplevel)", and then be in a
consistent starting place.
>>> +for i in host/rootfs img/app vm/sys/net; do
>>> + output_file=$i/file-list.mk
>>> + {
>>> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
>>> + sort -t $'\t' -k 2
>>
>> TIL sort -t and -k! 🤯
>>
>>> + echo DONE
>>
>> Why do we need this?
>
> To avoid producing any output file if the input is truncated.
>
>>> + } |
>>> + gawk -v "out_file=$output_file.tmp" -E scripts/genfiles.awk
>>
>> Why not stdout?
>
> The output file is created by awk so that it is only created if
> nothing went wrong.
For both of these, we already have exit status to communicate if
something goes wrong. When would output get truncated without that
being an unsuccessful exit?
>>> + if [ -f "$output_file" ]; then
>>> + # Avoid changing output file if it is up to date, as that
>>> + # would cause unnecessary rebuilds.
>>> + if cmp -s -- "$output_file.tmp" "$output_file"; then
>>> + rm -- "$output_file.tmp"
>>> + continue
>>> + else
>>> + astatus=$?
>>> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
>>
>> Could avoid the need for the variable and multiple ifs. Up to you
>> whether you prefer it:
>>
>> set +e
>> cmp -s -- "$output_file.tmp" "$output_file"
>> set -e
>> case $? in
>> 0)
>> rm -- "$output_file.tmp"
>> continue
>> ;;
>> 1)
>> ;;
>> *)
>> exit $?
>> ;;
>> esac
>
> This might set $? to the return value of 'set -e' (0). Whether or
> not it actually does is at least not obvious from reading the code.
Oh good point. Let's stick with your way then.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v4] Generate file lists from a script
2025-09-21 2:23 ` [PATCH v3] Generate file lists from a script Demi Marie Obenour
2025-09-21 8:47 ` Alyssa Ross
@ 2025-09-21 17:24 ` Demi Marie Obenour
2025-09-25 11:22 ` Alyssa Ross
2025-09-26 16:31 ` [PATCH v5] " Demi Marie Obenour
1 sibling, 2 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-21 17:24 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
This actually reduces the amount of code that has to be written by hand.
---
Changes in v4:
- Use /bin/sh instead of bash.
- Do not assume that negated awk character classes match all bytes.
- Do not check the mode of license files.
- Use implicit awk variable initialization.
- Use 'git rev-parse --show-toplevel' to find the repository root.
- Remove wrongly added copyright header.
- Improve documentation.
- Remove git hooks.
- Add missing copyright header.
- Avoid non-portable /usr/bin/env -S.
- Avoid assuming that awk is GNU awk.
- Avoid non-portable awk -E.
- Do not check for git bugs.
- Fix link in v3 changelog.
- Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 102 +---------------------------
host/rootfs/file-list.mk | 99 +++++++++++++++++++++++++++
img/app/Makefile | 80 +++-------------------
img/app/file-list.mk | 65 ++++++++++++++++++
scripts/genfiles.awk | 90 ++++++++++++++++++++++++
scripts/genfiles.sh | 28 ++++++++
vm/sys/net/Makefile | 50 ++------------
vm/sys/net/file-list.mk | 42 ++++++++++++
9 files changed, 352 insertions(+), 211 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..d044e7509a43df4b015f312dac61be6c74cc7feb 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 3
// SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
Spectrum comes with some built-in application VMs, to demonstrate
@@ -44,6 +45,12 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for images is stored in a separate file,
+file-list.mk. To update it, run scripts/genfiles.sh, which will
+regenerate it from the output of `git ls-files`. This script uses
+Git's index to generate the list, so only staged changes will be
+reflected in its output.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 322d75026dbcba4301f26abfbf74efa8cc68cdfd..da868557328fa84082e7b4cd968a1c2f7dd99af6 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,36 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -165,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..e800062de9fa2b057e0f3027e48b9ed3a65d3dc3
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES = \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS = \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/typeDONE
diff --git a/img/app/Makefile b/img/app/Makefile
index 8b9ecf990fe10adb7aa19b46935826d684f10686..50c6e126cef9fd4e7d1f3139a5bf00ef5f96fa8c 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,44 +45,17 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..cc94384585e4b61b090244e7dbb753b8f51b1bea
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES = \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS = \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/typeDONE
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..891ad162ea9748e275f7a048db3acbd9e7895a9b
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ modes["120000"] = "symlink";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg) {
+ exit_code = 1;
+ print msg > "/dev/stderr";
+ exit 1;
+}
+
+done { fail("Junk after DONE", 1); }
+
+$0 == "DONE" {
+ done = 1;
+ next;
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+filename !~ /^[[:alnum:]_.+@/-]+$/ {
+ fail("filename '" filename "' has forbidden characters");
+}
+
+# Skip license files
+/\.license$/ { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_files[rc_count++] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlinks[symlink_count++] = filename;
+ next;
+}
+
+mode == "regular" {
+ files[file_count++] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ if (!done) {
+ fail("Did not receive DONE line");
+ }
+ printf ("# SPDX-License-Identifier: EUPL-1.2+\n" \
+"# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>\n" \
+"# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
+"FILES =") > out_file;
+ for (array_index = 0; array_index < file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index] > out_file;
+ }
+ printf ("\n\n" \
+"# These are separate because they need to be included, but putting\n" \
+"# them as make dependencies would confuse make.\n" \
+"LINKS =") > out_file;
+ for (array_index = 0; array_index < symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index] > out_file;
+ }
+ printf "\n\nS6_RC_FILES =" > out_file;
+ for (array_index = 0; array_index < rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index] > out_file;
+ }
+ print > out_file;
+ if (close(out_file)) {
+ fail("Cannot close output file: " ERRNO);
+ }
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..65e8b56654448f4c9529e00807e68adb0bcfefbf
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,28 @@
+#!/bin/sh --
+set -euo pipefail
+export LC_ALL=C LANGUAGE=C
+# shell strips trailing newlines, so add something after the newline
+dir=$(git rev-parse --show-toplevel && echo a)
+cd "${dir%'
+a'}"
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ echo DONE
+ } |
+ awk -v "out_file=$output_file.tmp" -f scripts/genfiles.awk
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 0193cc8c09f895a6021de0d02fde20362818e185..989c5e79862f1918153776cadab3837e820ef9b8 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,57 +29,20 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..902ae9cb79a822c3e60ae48a71d0b0ed07ffe843
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES = \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS = \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES = \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/upDONE
---
base-commit: 2e9d63d3e213939615d3dcc44bcb3aa2e8dfa77f
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v4] Generate file lists from a script
2025-09-21 17:24 ` [PATCH v4] " Demi Marie Obenour
@ 2025-09-25 11:22 ` Alyssa Ross
2025-09-26 16:31 ` [PATCH v5] " Demi Marie Obenour
1 sibling, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-25 11:22 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 5074 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
> manually-maintained lists of files and symlinks. These duplicate the
> information in the git repository and can easily get out of sync or
> cause unnecessary merge conflicts. Fix all of these issues by having
> the git repository be the source of truth, and using a script to
> generate the file lists. Developers can regenerate the lists before
> every commit, or even add a git hook to do that.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
> new file mode 100644
> index 0000000000000000000000000000000000000000..891ad162ea9748e275f7a048db3acbd9e7895a9b
> --- /dev/null
> +++ b/scripts/genfiles.awk
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +BEGIN {
> + RS = "\n";
> + FS = "\t";
> + modes["120000"] = "symlink";
> + modes["100644"] = "regular";
> + modes["100755"] = "regular";
> +}
> +
> +function fail(msg) {
> + exit_code = 1;
This line doesn't do anything now, right?
> + print msg > "/dev/stderr";
> + exit 1;
> +}
> +
> +done { fail("Junk after DONE", 1); }
> +
> +$0 == "DONE" {
> + done = 1;
> + next;
> +}
> +
> +# Extract data from built-in variables.
> +{
> + filename = $2;
> + raw_mode = $1;
> + # awk autocreates empty string entries if the key is invalid,
> + # but the code exits in this case so that is okay.
> + mode = modes[raw_mode];
> +}
> +
> +filename !~ /^[[:alnum:]_.+@/-]+$/ {
> + fail("filename '" filename "' has forbidden characters");
> +}
> +
> +# Skip license files
> +/\.license$/ { next }
> +
> +filename ~ /^image\/etc\/s6-rc\// {
> + if (mode != "regular") {
> + fail("s6-rc-compile input '" filename "' isn't a regular file");
> + }
> + rc_files[rc_count++] = filename;
> + next;
> +}
> +
> +mode == "symlink" {
> + symlinks[symlink_count++] = filename;
> + next;
> +}
> +
> +mode == "regular" {
> + files[file_count++] = filename;
> + next;
> +}
> +
> +{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
> +
> +END {
> + if (exit_code) {
> + exit exit_code;
> + }
> + if (!done) {
> + fail("Did not receive DONE line");
> + }
> + printf ("# SPDX-License-Identifier: EUPL-1.2+\n" \
> +"# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>\n" \
> +"# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
> +"FILES =") > out_file;
> + for (array_index = 0; array_index < file_count; array_index += 1) {
> + printf " \\\n\t%s", files[array_index] > out_file;
> + }
> + printf ("\n\n" \
> +"# These are separate because they need to be included, but putting\n" \
> +"# them as make dependencies would confuse make.\n" \
> +"LINKS =") > out_file;
> + for (array_index = 0; array_index < symlink_count; array_index += 1) {
> + printf " \\\n\t%s", symlinks[array_index] > out_file;
> + }
> + printf "\n\nS6_RC_FILES =" > out_file;
> + for (array_index = 0; array_index < rc_count; array_index += 1) {
> + printf " \\\n\t%s", rc_files[array_index] > out_file;
> + }
> + print > out_file;
> + if (close(out_file)) {
> + fail("Cannot close output file: " ERRNO);
> + }
> +}
> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..65e8b56654448f4c9529e00807e68adb0bcfefbf
> --- /dev/null
> +++ b/scripts/genfiles.sh
> @@ -0,0 +1,28 @@
> +#!/bin/sh --
> +set -euo pipefail
> +export LC_ALL=C LANGUAGE=C
> +# shell strips trailing newlines, so add something after the newline
> +dir=$(git rev-parse --show-toplevel && echo a)
> +cd "${dir%'
> +a'}"
What's this for? In case the directory name ends with a newline? All
sorts of stuff is going to break if somebody decides to do this. We
don't need to go out of our way to accomodate it.
> +for i in host/rootfs img/app vm/sys/net; do
> + output_file=$i/file-list.mk
> + {
> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
> + sort -t $'\t' -k 2
> + echo DONE
I still don't understand what the DONE is for. Can you describe a
circumstance in which it would be necessary?
> + } |
> + awk -v "out_file=$output_file.tmp" -f scripts/genfiles.awk
This was unresolved from last time too. This could just be stdout and a
simpler awk script. If you really want to make sure a temporary file
isn't left around if something goes wrong, you could trap EXIT, but it's
also just really not a big deal.
> + if [ -f "$output_file" ]; then
> + # Avoid changing output file if it is up to date, as that
> + # would cause unnecessary rebuilds.
> + if cmp -s -- "$output_file.tmp" "$output_file"; then
> + rm -- "$output_file.tmp"
> + continue
> + else
> + astatus=$?
> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
> + fi
> + fi
> + mv -- "$output_file.tmp" "$output_file"
> +done
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v5] Generate file lists from a script
2025-09-21 17:24 ` [PATCH v4] " Demi Marie Obenour
2025-09-25 11:22 ` Alyssa Ross
@ 2025-09-26 16:31 ` Demi Marie Obenour
2025-09-27 8:19 ` Alyssa Ross
2025-09-27 16:22 ` [PATCH v6] " Demi Marie Obenour
1 sibling, 2 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-26 16:31 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
This actually reduces the amount of code that has to be written by hand.
---
Changes in v5:
- Use 'print ""' instead of 'print' in awk to print a newline. 'print'
with no arguments implicitly prints $0 instead. This caused the
generated makefiles to be incorrect.
- Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
img/app/Makefile. This prevented the image from being built.
- Do not check for git repository being in a directory with a name
ending in a newline.
- Use shell redirection instead of awk redirection.
- Do not include trailing DONE line in input to awk.
- Link to v4: https://lore.kernel.org/r/20250921-genfiles-v4-1-4375bda78707@gmail.com
Changes in v4:
- Use /bin/sh instead of bash.
- Do not assume that negated awk character classes match all bytes.
- Do not check the mode of license files.
- Use implicit awk variable initialization.
- Use 'git rev-parse --show-toplevel' to find the repository root.
- Remove wrongly added copyright header.
- Improve documentation.
- Remove git hooks.
- Add missing copyright header.
- Avoid non-portable /usr/bin/env -S.
- Avoid assuming that awk is GNU awk.
- Avoid non-portable awk -E.
- Do not check for git bugs.
- Fix link in v3 changelog.
- Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 102 +---------------------------
host/rootfs/file-list.mk | 99 +++++++++++++++++++++++++++
img/app/Makefile | 82 ++++------------------
img/app/file-list.mk | 65 ++++++++++++++++++
scripts/genfiles.awk | 77 +++++++++++++++++++++
scripts/genfiles.sh | 24 +++++++
vm/sys/net/Makefile | 52 +++-----------
vm/sys/net/file-list.mk | 42 ++++++++++++
9 files changed, 337 insertions(+), 213 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..d044e7509a43df4b015f312dac61be6c74cc7feb 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 3
// SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
Spectrum comes with some built-in application VMs, to demonstrate
@@ -44,6 +45,12 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for images is stored in a separate file,
+file-list.mk. To update it, run scripts/genfiles.sh, which will
+regenerate it from the output of `git ls-files`. This script uses
+Git's index to generate the list, so only staged changes will be
+reflected in its output.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 322d75026dbcba4301f26abfbf74efa8cc68cdfd..da868557328fa84082e7b4cd968a1c2f7dd99af6 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,36 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -165,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..58cda39f85f720ab46f025bc72f1a98f108f1c25
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES = \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS = \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index 8b9ecf990fe10adb7aa19b46935826d684f10686..df54cb52bbb21e2e0ad6d7933edf84f8448e1f04 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,48 +45,21 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..2afe652bbc87cacb7b823a5edf340d861e9bb9ba
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES = \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS = \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..935eebbdc7f0e2aa07b0b6439ab53d1f50940929
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ modes["120000"] = "symlink";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg) {
+ exit_code = 1;
+ print msg > "/dev/stderr";
+ exit 1;
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+filename !~ /^[[:alnum:]_./-]+$/ {
+ fail("filename '" filename "' has forbidden characters");
+}
+
+# Skip license files
+/\.license$/ { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_files[rc_count++] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlinks[symlink_count++] = filename;
+ next;
+}
+
+mode == "regular" {
+ files[file_count++] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ printf ("# SPDX-License-Identifier: EUPL-1.2+\n" \
+"# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>\n" \
+"# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
+"FILES =");
+ for (array_index = 0; array_index < file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index];
+ }
+ printf ("\n\n" \
+"# These are separate because they need to be included, but putting\n" \
+"# them as make dependencies would confuse make.\n" \
+"LINKS =");
+ for (array_index = 0; array_index < symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index];
+ }
+ printf "\n\nS6_RC_FILES =";
+ for (array_index = 0; array_index < rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index];
+ }
+ print "";
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a595d9effd64fe110ed0c2875bbd30f4428ee3f7
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,24 @@
+#!/bin/sh --
+set -euo pipefail
+export LC_ALL=C LANGUAGE=C
+dir=$(git rev-parse --show-toplevel)
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ } |
+ awk -f scripts/genfiles.awk > "$output_file.tmp"
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 0193cc8c09f895a6021de0d02fde20362818e185..6f8664aea3b2b9bfdf569c4b089695d2a575668a 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,61 +29,24 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env run proc sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..384b370fc84a279fff31162a571398cc0507b010
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
+# Generated by scripts/genfile.sh. Any changes will be overwritten.
+FILES = \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+# These are separate because they need to be included, but putting
+# them as make dependencies would confuse make.
+LINKS = \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES = \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
---
base-commit: 2e9d63d3e213939615d3dcc44bcb3aa2e8dfa77f
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v5] Generate file lists from a script
2025-09-26 16:31 ` [PATCH v5] " Demi Marie Obenour
@ 2025-09-27 8:19 ` Alyssa Ross
2025-09-27 8:42 ` Demi Marie Obenour
2025-09-27 16:22 ` [PATCH v6] " Demi Marie Obenour
1 sibling, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-27 8:19 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 6744 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
> manually-maintained lists of files and symlinks. These duplicate the
> information in the git repository and can easily get out of sync or
> cause unnecessary merge conflicts. Fix all of these issues by having
> the git repository be the source of truth, and using a script to
> generate the file lists. Developers can regenerate the lists before
> every commit, or even add a git hook to do that.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> This actually reduces the amount of code that has to be written by hand.
> ---
This is so close. Was almost at the point where I could have just fixed
it up myself and committed it, but there's one thing I want to check
with you.
> Changes in v5:
> - Use 'print ""' instead of 'print' in awk to print a newline. 'print'
> with no arguments implicitly prints $0 instead. This caused the
> generated makefiles to be incorrect.
> - Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
> img/app/Makefile. This prevented the image from being built.
> - Do not check for git repository being in a directory with a name
> ending in a newline.
> - Use shell redirection instead of awk redirection.
> - Do not include trailing DONE line in input to awk.
> - Link to v4: https://lore.kernel.org/r/20250921-genfiles-v4-1-4375bda78707@gmail.com
>
> Changes in v4:
> - Use /bin/sh instead of bash.
> - Do not assume that negated awk character classes match all bytes.
> - Do not check the mode of license files.
> - Use implicit awk variable initialization.
> - Use 'git rev-parse --show-toplevel' to find the repository root.
> - Remove wrongly added copyright header.
> - Improve documentation.
> - Remove git hooks.
> - Add missing copyright header.
> - Avoid non-portable /usr/bin/env -S.
> - Avoid assuming that awk is GNU awk.
> - Avoid non-portable awk -E.
> - Do not check for git bugs.
> - Fix link in v3 changelog.
> - Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
>
> Changes in v3:
> - Only include the file list generator. Move the rest to separate patch
> series.
> - Remove the update-file-list make targets from img/app/Makefile and
> vm/sys/net/Makefile.
> - Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
>
> Changes in v2:
> - Drop the last patch (switching to /etc/s6-rc/compiled) as it is
> controversial and should be reviewed separately.
> - Add missing copyright notices.
> - Use a wrapper shell script to make the awk code easier to read.
> - Improve documentation.
> - Add helper scripts for use in git hooks and rebasing.
> - Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
> ---
> Documentation/development/built-in-vms.adoc | 7 ++
> host/rootfs/Makefile | 102 +---------------------------
> host/rootfs/file-list.mk | 99 +++++++++++++++++++++++++++
> img/app/Makefile | 82 ++++------------------
> img/app/file-list.mk | 65 ++++++++++++++++++
> scripts/genfiles.awk | 77 +++++++++++++++++++++
> scripts/genfiles.sh | 24 +++++++
> vm/sys/net/Makefile | 52 +++-----------
> vm/sys/net/file-list.mk | 42 ++++++++++++
> 9 files changed, 337 insertions(+), 213 deletions(-)
>
> diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
> new file mode 100644
> index 0000000000000000000000000000000000000000..58cda39f85f720ab46f025bc72f1a98f108f1c25
> --- /dev/null
> +++ b/host/rootfs/file-list.mk
> @@ -0,0 +1,99 @@
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
Only 2021. The only thing I think is even arguably copyrightable is the
comment. And following that principle let's actually put your copyright
in here too.
> +# Generated by scripts/genfile.sh. Any changes will be overwritten.
Let's have a blank line before and after this comment, for readability.
> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
> new file mode 100644
> index 0000000000000000000000000000000000000000..935eebbdc7f0e2aa07b0b6439ab53d1f50940929
> --- /dev/null
> +++ b/scripts/genfiles.awk
> @@ -0,0 +1,77 @@
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
I wouldn't include this one.
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +BEGIN {
> + RS = "\n";
> + FS = "\t";
> + modes["120000"] = "symlink";
> + modes["100644"] = "regular";
> + modes["100755"] = "regular";
> +}
> +
> +function fail(msg) {
> + exit_code = 1;
> + print msg > "/dev/stderr";
> + exit 1;
> +}
> +
> +# Extract data from built-in variables.
> +{
> + filename = $2;
> + raw_mode = $1;
> + # awk autocreates empty string entries if the key is invalid,
> + # but the code exits in this case so that is okay.
> + mode = modes[raw_mode];
> +}
> +
> +filename !~ /^[[:alnum:]_./-]+$/ {
> + fail("filename '" filename "' has forbidden characters");
> +}
> +
> +# Skip license files
> +/\.license$/ { next }
> +
> +filename ~ /^image\/etc\/s6-rc\// {
> + if (mode != "regular") {
> + fail("s6-rc-compile input '" filename "' isn't a regular file");
> + }
> + rc_files[rc_count++] = filename;
> + next;
> +}
> +
> +mode == "symlink" {
> + symlinks[symlink_count++] = filename;
> + next;
> +}
> +
> +mode == "regular" {
> + files[file_count++] = filename;
> + next;
> +}
> +
> +{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
> +
> +END {
> + if (exit_code) {
> + exit exit_code;
> + }
I don't think this ever happens?
> + printf ("# SPDX-License-Identifier: EUPL-1.2+\n" \
> +"# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>\n" \
> +"# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
> +"FILES =");
> + for (array_index = 0; array_index < file_count; array_index += 1) {
> + printf " \\\n\t%s", files[array_index];
> + }
> + printf ("\n\n" \
> +"# These are separate because they need to be included, but putting\n" \
> +"# them as make dependencies would confuse make.\n" \
> +"LINKS =");
> + for (array_index = 0; array_index < symlink_count; array_index += 1) {
> + printf " \\\n\t%s", symlinks[array_index];
> + }
> + printf "\n\nS6_RC_FILES =";
> + for (array_index = 0; array_index < rc_count; array_index += 1) {
> + printf " \\\n\t%s", rc_files[array_index];
> + }
> + print "";
> +}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v5] Generate file lists from a script
2025-09-27 8:19 ` Alyssa Ross
@ 2025-09-27 8:42 ` Demi Marie Obenour
0 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-27 8:42 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 7397 bytes --]
On 9/27/25 04:19, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
>> manually-maintained lists of files and symlinks. These duplicate the
>> information in the git repository and can easily get out of sync or
>> cause unnecessary merge conflicts. Fix all of these issues by having
>> the git repository be the source of truth, and using a script to
>> generate the file lists. Developers can regenerate the lists before
>> every commit, or even add a git hook to do that.
>>
>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>> ---
>> This actually reduces the amount of code that has to be written by hand.
>> ---
>
> This is so close. Was almost at the point where I could have just fixed
> it up myself and committed it, but there's one thing I want to check
> with you.
Thank you for being careful!
>> Changes in v5:
>> - Use 'print ""' instead of 'print' in awk to print a newline. 'print'
>> with no arguments implicitly prints $0 instead. This caused the
>> generated makefiles to be incorrect.
>> - Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
>> img/app/Makefile. This prevented the image from being built.
>> - Do not check for git repository being in a directory with a name
>> ending in a newline.
>> - Use shell redirection instead of awk redirection.
>> - Do not include trailing DONE line in input to awk.
>> - Link to v4: https://lore.kernel.org/r/20250921-genfiles-v4-1-4375bda78707@gmail.com
>>
>> Changes in v4:
>> - Use /bin/sh instead of bash.
>> - Do not assume that negated awk character classes match all bytes.
>> - Do not check the mode of license files.
>> - Use implicit awk variable initialization.
>> - Use 'git rev-parse --show-toplevel' to find the repository root.
>> - Remove wrongly added copyright header.
>> - Improve documentation.
>> - Remove git hooks.
>> - Add missing copyright header.
>> - Avoid non-portable /usr/bin/env -S.
>> - Avoid assuming that awk is GNU awk.
>> - Avoid non-portable awk -E.
>> - Do not check for git bugs.
>> - Fix link in v3 changelog.
>> - Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
>>
>> Changes in v3:
>> - Only include the file list generator. Move the rest to separate patch
>> series.
>> - Remove the update-file-list make targets from img/app/Makefile and
>> vm/sys/net/Makefile.
>> - Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
>>
>> Changes in v2:
>> - Drop the last patch (switching to /etc/s6-rc/compiled) as it is
>> controversial and should be reviewed separately.
>> - Add missing copyright notices.
>> - Use a wrapper shell script to make the awk code easier to read.
>> - Improve documentation.
>> - Add helper scripts for use in git hooks and rebasing.
>> - Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
>> ---
>> Documentation/development/built-in-vms.adoc | 7 ++
>> host/rootfs/Makefile | 102 +---------------------------
>> host/rootfs/file-list.mk | 99 +++++++++++++++++++++++++++
>> img/app/Makefile | 82 ++++------------------
>> img/app/file-list.mk | 65 ++++++++++++++++++
>> scripts/genfiles.awk | 77 +++++++++++++++++++++
>> scripts/genfiles.sh | 24 +++++++
>> vm/sys/net/Makefile | 52 +++-----------
>> vm/sys/net/file-list.mk | 42 ++++++++++++
>> 9 files changed, 337 insertions(+), 213 deletions(-)
>>
>> diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..58cda39f85f720ab46f025bc72f1a98f108f1c25
>> --- /dev/null
>> +++ b/host/rootfs/file-list.mk
>> @@ -0,0 +1,99 @@
>> +# SPDX-License-Identifier: EUPL-1.2+
>> +# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
>
> Only 2021. The only thing I think is even arguably copyrightable is the
> comment. And following that principle let's actually put your copyright
> in here too.
I'd rather just drop the comment. It can be phrased better anyway,
and it is much cleaner for the generated file to only contain data.
>> +# Generated by scripts/genfile.sh. Any changes will be overwritten.
>
> Let's have a blank line before and after this comment, for readability.
>
>> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..935eebbdc7f0e2aa07b0b6439ab53d1f50940929
>> --- /dev/null
>> +++ b/scripts/genfiles.awk
>> @@ -0,0 +1,77 @@
>> +# SPDX-License-Identifier: EUPL-1.2+
>> +# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
>
> I wouldn't include this one.
See above.
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>> +BEGIN {
>> + RS = "\n";
>> + FS = "\t";
>> + modes["120000"] = "symlink";
>> + modes["100644"] = "regular";
>> + modes["100755"] = "regular";
>> +}
>> +
>> +function fail(msg) {
>> + exit_code = 1;
>> + print msg > "/dev/stderr";
>> + exit 1;
>> +}
>> +
>> +# Extract data from built-in variables.
>> +{
>> + filename = $2;
>> + raw_mode = $1;
>> + # awk autocreates empty string entries if the key is invalid,
>> + # but the code exits in this case so that is okay.
>> + mode = modes[raw_mode];
>> +}
>> +
>> +filename !~ /^[[:alnum:]_./-]+$/ {
>> + fail("filename '" filename "' has forbidden characters");
>> +}
>> +
>> +# Skip license files
>> +/\.license$/ { next }
>> +
>> +filename ~ /^image\/etc\/s6-rc\// {
>> + if (mode != "regular") {
>> + fail("s6-rc-compile input '" filename "' isn't a regular file");
>> + }
>> + rc_files[rc_count++] = filename;
>> + next;
>> +}
>> +
>> +mode == "symlink" {
>> + symlinks[symlink_count++] = filename;
>> + next;
>> +}
>> +
>> +mode == "regular" {
>> + files[file_count++] = filename;
>> + next;
>> +}
>> +
>> +{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
>> +
>> +END {
>> + if (exit_code) {
>> + exit exit_code;
>> + }
>
> I don't think this ever happens?
>
>> + printf ("# SPDX-License-Identifier: EUPL-1.2+\n" \
>> +"# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>\n" \
>> +"# Generated by scripts/genfile.sh. Any changes will be overwritten.\n" \
>> +"FILES =");
>> + for (array_index = 0; array_index < file_count; array_index += 1) {
>> + printf " \\\n\t%s", files[array_index];
>> + }
>> + printf ("\n\n" \
>> +"# These are separate because they need to be included, but putting\n" \
>> +"# them as make dependencies would confuse make.\n" \
>> +"LINKS =");
>> + for (array_index = 0; array_index < symlink_count; array_index += 1) {
>> + printf " \\\n\t%s", symlinks[array_index];
>> + }
>> + printf "\n\nS6_RC_FILES =";
>> + for (array_index = 0; array_index < rc_count; array_index += 1) {
>> + printf " \\\n\t%s", rc_files[array_index];
>> + }
>> + print "";
>> +}
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v6] Generate file lists from a script
2025-09-26 16:31 ` [PATCH v5] " Demi Marie Obenour
2025-09-27 8:19 ` Alyssa Ross
@ 2025-09-27 16:22 ` Demi Marie Obenour
2025-09-29 8:12 ` Alyssa Ross
2025-09-29 17:18 ` [PATCH v7] " Demi Marie Obenour
1 sibling, 2 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-27 16:22 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
This actually reduces the amount of code that has to be written by hand.
---
Changes in v6:
- Do not include comment in generated makefiles
- Change makefile license to CC0.
- Link to v5: https://spectrum-os.org/lists/archives/spectrum-devel/20250926-genfiles-v5-1-3394dfb3b330@gmail.com
Changes in v5:
- Use 'print ""' instead of 'print' in awk to print a newline. 'print'
with no arguments implicitly prints $0 instead. This caused the
generated makefiles to be incorrect.
- Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
img/app/Makefile. This prevented the image from being built.
- Do not check for git repository being in a directory with a name
ending in a newline.
- Use shell redirection instead of awk redirection.
- Do not include trailing DONE line in input to awk.
- Link to v4: https://spectrum-os.org/lists/archives/spectrum-devel/20250921-genfiles-v4-1-4375bda78707@gmail.com
Changes in v4:
- Use /bin/sh instead of bash.
- Do not assume that negated awk character classes match all bytes.
- Do not check the mode of license files.
- Use implicit awk variable initialization.
- Use 'git rev-parse --show-toplevel' to find the repository root.
- Remove wrongly added copyright header.
- Improve documentation.
- Remove git hooks.
- Add missing copyright header.
- Avoid non-portable /usr/bin/env -S.
- Avoid assuming that awk is GNU awk.
- Avoid non-portable awk -E.
- Do not check for git bugs.
- Fix link in v3 changelog.
- Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 109 +---------------------------
host/rootfs/file-list.mk | 101 ++++++++++++++++++++++++++
img/app/Makefile | 84 +++------------------
img/app/file-list.mk | 64 ++++++++++++++++
scripts/genfiles.awk | 79 ++++++++++++++++++++
scripts/genfiles.sh | 24 ++++++
vm/sys/net/Makefile | 53 ++------------
vm/sys/net/file-list.mk | 40 ++++++++++
9 files changed, 339 insertions(+), 222 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..d044e7509a43df4b015f312dac61be6c74cc7feb 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 3
// SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
Spectrum comes with some built-in application VMs, to demonstrate
@@ -44,6 +45,12 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for images is stored in a separate file,
+file-list.mk. To update it, run scripts/genfiles.sh, which will
+regenerate it from the output of `git ls-files`. This script uses
+Git's index to generate the list, so only staged changes will be
+reflected in its output.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 4b163de68c38943117eb54a9a954eb77f682c150..da868557328fa84082e7b4cd968a1c2f7dd99af6 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -95,24 +38,15 @@ DIRS = \
etc/s6-linux-init/run-image/vm/by-name \
etc/s6-linux-init/run-image/wait \
ext \
- proc \
run \
+ proc \
sys
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,41 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sys-vmms \
- image/etc/s6-rc/ok-all/contents.d/vm-env \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents.d/static-nodes \
- image/etc/s6-rc/vm-env/contents.d/weston \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents.d/core \
- image/etc/s6-rc/vmm-env/contents.d/kvm \
- image/etc/s6-rc/vmm-env/contents.d/static-nodes \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -170,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..d925edf28909f157fe017733ec16c8646f3cb3e1
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+FILES = \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+LINKS = \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sys-vmms \
+ image/etc/s6-rc/ok-all/contents.d/vm-env \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vm-env/contents.d/weston \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents.d/core \
+ image/etc/s6-rc/vmm-env/contents.d/kvm \
+ image/etc/s6-rc/vmm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index db9b53e434b2d018d76d92f7672bdd0718180fbd..df54cb52bbb21e2e0ad6d7933edf84f8448e1f04 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,50 +45,21 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/app \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/wireplumber \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..94512d3ebbe1bcfbf7d92ef7fc677ab821e1d340
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+FILES = \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+LINKS = \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/app \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/wireplumber \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..986d86ec7e3080ab7c9a73307d116d244ef542e0
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ modes["120000"] = "symlink";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg) {
+ exit_code = 1;
+ print msg > "/dev/stderr";
+ exit 1;
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+filename !~ /^[[:alnum:]_./-]+$/ {
+ fail("filename '" filename "' has forbidden characters");
+}
+
+# Skip license files
+/\.license$/ { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_files[rc_count++] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlinks[symlink_count++] = filename;
+ next;
+}
+
+mode == "regular" {
+ files[file_count++] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ printf ("# SPDX-License-Identifier: CC0-1.0\n" \
+"# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+"FILES =");
+ for (array_index = 0; array_index < file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index];
+ }
+ # GNU Make uses the modification time of the *target* of a symlink,
+ # rather than the modification time of the symlink itself. It can be told
+ # to *also* use the symlink's modification time, but not to *only* use
+ # the symlink's modification time. However, these symlinks will generally
+ # be broken, so make will not be able to dereference the symlink.
+ # Therefore, using these symlinks as make dependencies won't work.
+ printf ("\n\n" \
+"LINKS =");
+ for (array_index = 0; array_index < symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index];
+ }
+ printf "\n\nS6_RC_FILES =";
+ for (array_index = 0; array_index < rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index];
+ }
+ print "";
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a595d9effd64fe110ed0c2875bbd30f4428ee3f7
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,24 @@
+#!/bin/sh --
+set -euo pipefail
+export LC_ALL=C LANGUAGE=C
+dir=$(git rev-parse --show-toplevel)
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ } |
+ awk -f scripts/genfiles.awk > "$output_file.tmp"
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 38a9af765683f287d621d5a2107a78c84b9b166e..6f8664aea3b2b9bfdf569c4b089695d2a575668a 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,24 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sysctl \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..ab14acc87f3e3a298f0d326584a2889becc5881e
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+FILES = \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+LINKS = \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES = \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sysctl \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
---
base-commit: 2551f9eb1a6c9245699ff5cf77f9957d1e2d14be
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v6] Generate file lists from a script
2025-09-27 16:22 ` [PATCH v6] " Demi Marie Obenour
@ 2025-09-29 8:12 ` Alyssa Ross
2025-09-29 17:20 ` Demi Marie Obenour
2025-09-29 17:18 ` [PATCH v7] " Demi Marie Obenour
1 sibling, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-09-29 8:12 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 3291 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
> new file mode 100644
> index 0000000000000000000000000000000000000000..986d86ec7e3080ab7c9a73307d116d244ef542e0
> --- /dev/null
> +++ b/scripts/genfiles.awk
> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +BEGIN {
> + RS = "\n";
> + FS = "\t";
> + modes["120000"] = "symlink";
> + modes["100644"] = "regular";
> + modes["100755"] = "regular";
> +}
> +
> +function fail(msg) {
> + exit_code = 1;
I've been pointing out since v3 that this variable doesn't do anything.
It's still here!
> + print msg > "/dev/stderr";
> + exit 1;
> +}
> +
> +# Extract data from built-in variables.
> +{
> + filename = $2;
> + raw_mode = $1;
> + # awk autocreates empty string entries if the key is invalid,
> + # but the code exits in this case so that is okay.
> + mode = modes[raw_mode];
> +}
> +
> +filename !~ /^[[:alnum:]_./-]+$/ {
> + fail("filename '" filename "' has forbidden characters");
> +}
> +
> +# Skip license files
> +/\.license$/ { next }
> +
> +filename ~ /^image\/etc\/s6-rc\// {
> + if (mode != "regular") {
> + fail("s6-rc-compile input '" filename "' isn't a regular file");
> + }
> + rc_files[rc_count++] = filename;
> + next;
> +}
> +
> +mode == "symlink" {
> + symlinks[symlink_count++] = filename;
> + next;
> +}
> +
> +mode == "regular" {
> + files[file_count++] = filename;
> + next;
> +}
> +
> +{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
> +
> +END {
> + if (exit_code) {
> + exit exit_code;
> + }
> + printf ("# SPDX-License-Identifier: CC0-1.0\n" \
> +"# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
Does reuse pick these up? If so, might need to break them up into
multiple string literals.
Let's leave a blank line after the header too — I think that's more readable.
> +"FILES =");
> + for (array_index = 0; array_index < file_count; array_index += 1) {
> + printf " \\\n\t%s", files[array_index];
> + }
> + # GNU Make uses the modification time of the *target* of a symlink,
> + # rather than the modification time of the symlink itself. It can be told
> + # to *also* use the symlink's modification time, but not to *only* use
> + # the symlink's modification time. However, these symlinks will generally
> + # be broken, so make will not be able to dereference the symlink.
> + # Therefore, using these symlinks as make dependencies won't work.
> + printf ("\n\n" \
> +"LINKS =");
> + for (array_index = 0; array_index < symlink_count; array_index += 1) {
> + printf " \\\n\t%s", symlinks[array_index];
> + }
> + printf "\n\nS6_RC_FILES =";
> + for (array_index = 0; array_index < rc_count; array_index += 1) {
> + printf " \\\n\t%s", rc_files[array_index];
> + }
> + print "";
> +}
> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..a595d9effd64fe110ed0c2875bbd30f4428ee3f7
> --- /dev/null
> +++ b/scripts/genfiles.sh
> @@ -0,0 +1,24 @@
> +#!/bin/sh --
> +set -euo pipefail
Missing copyright.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v7] Generate file lists from a script
2025-09-27 16:22 ` [PATCH v6] " Demi Marie Obenour
2025-09-29 8:12 ` Alyssa Ross
@ 2025-09-29 17:18 ` Demi Marie Obenour
2025-10-01 9:20 ` Alyssa Ross
` (2 more replies)
1 sibling, 3 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-29 17:18 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
This actually reduces the amount of code that has to be written by hand.
---
Changes in v7:
- Do not break sorting of directories in host/rootfs/Makefile.
- Add newline after generated copyright headers.
- Add comment to scripts/genfiles.awk explaining use of exit_code variable.
- Check filename instead of $0 to see if a file is a license file.
This has no functional impact.
- Add missing copyright to scripts/genfiles.sh.
- Prevent reuse from tripping over scripts/genfiles.awk.
- Link to v6: https://spectrum-os.org/lists/archives/spectrum-devel/20250927-genfiles-v6-1-2111a981596d@gmail.com
Changes in v6:
- Do not include comment in generated makefiles
- Change makefile license to CC0.
- Link to v5: https://spectrum-os.org/lists/archives/spectrum-devel/20250926-genfiles-v5-1-3394dfb3b330@gmail.com
Changes in v5:
- Use 'print ""' instead of 'print' in awk to print a newline. 'print'
with no arguments implicitly prints $0 instead. This caused the
generated makefiles to be incorrect.
- Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
img/app/Makefile. This prevented the image from being built.
- Do not check for git repository being in a directory with a name
ending in a newline.
- Use shell redirection instead of awk redirection.
- Do not include trailing DONE line in input to awk.
- Link to v4: https://spectrum-os.org/lists/archives/spectrum-devel/20250921-genfiles-v4-1-4375bda78707@gmail.com
Changes in v4:
- Use /bin/sh instead of bash.
- Do not assume that negated awk character classes match all bytes.
- Do not check the mode of license files.
- Use implicit awk variable initialization.
- Use 'git rev-parse --show-toplevel' to find the repository root.
- Remove wrongly added copyright header.
- Improve documentation.
- Remove git hooks.
- Add missing copyright header.
- Avoid non-portable /usr/bin/env -S.
- Avoid assuming that awk is GNU awk.
- Avoid non-portable awk -E.
- Do not check for git bugs.
- Fix link in v3 changelog.
- Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 107 +---------------------------
host/rootfs/file-list.mk | 102 ++++++++++++++++++++++++++
img/app/Makefile | 84 ++++------------------
img/app/file-list.mk | 65 +++++++++++++++++
scripts/genfiles.awk | 85 ++++++++++++++++++++++
scripts/genfiles.sh | 26 +++++++
vm/sys/net/Makefile | 53 +++-----------
vm/sys/net/file-list.mk | 41 +++++++++++
9 files changed, 349 insertions(+), 221 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..d044e7509a43df4b015f312dac61be6c74cc7feb 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 3
// SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
Spectrum comes with some built-in application VMs, to demonstrate
@@ -44,6 +45,12 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for images is stored in a separate file,
+file-list.mk. To update it, run scripts/genfiles.sh, which will
+regenerate it from the output of `git ls-files`. This script uses
+Git's index to generate the list, so only staged changes will be
+reflected in its output.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 4b163de68c38943117eb54a9a954eb77f682c150..ad0409813ea462581c3c7de3c3c62476c4743aee 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,41 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sys-vmms \
- image/etc/s6-rc/ok-all/contents.d/vm-env \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents.d/static-nodes \
- image/etc/s6-rc/vm-env/contents.d/weston \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents.d/core \
- image/etc/s6-rc/vmm-env/contents.d/kvm \
- image/etc/s6-rc/vmm-env/contents.d/static-nodes \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -170,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..3694dc472a013fff931847171145465329fb800f
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+LINKS = \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sys-vmms \
+ image/etc/s6-rc/ok-all/contents.d/vm-env \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vm-env/contents.d/weston \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents.d/core \
+ image/etc/s6-rc/vmm-env/contents.d/kvm \
+ image/etc/s6-rc/vmm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index db9b53e434b2d018d76d92f7672bdd0718180fbd..df54cb52bbb21e2e0ad6d7933edf84f8448e1f04 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,50 +45,21 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file $${file#image/}; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
) | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/app \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/wireplumber \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..9967285ca9972b675713de36859850fed609f15f
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+LINKS = \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/app \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/wireplumber \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..2d32016b5e6d6773685b71cc04e49cf24e842ba9
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ modes["120000"] = "symlink";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg) {
+ # Awk will run END blocks even after exit.
+ # The END block checks this variable and
+ # immediately exits if it is nonzero.
+ exit_code = 1;
+ print msg > "/dev/stderr";
+ exit 1;
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # Awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+filename !~ /^[[:alnum:]_./-]+$/ {
+ fail("filename '" filename "' has forbidden characters");
+}
+
+# Skip license files
+filename ~ /\.license$/ { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_files[rc_count++] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlinks[symlink_count++] = filename;
+ next;
+}
+
+mode == "regular" {
+ files[file_count++] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ printf ("# SPDX-" \
+"License-Identifier: CC0-1.0\n" \
+"# SPDX-" \
+"FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+"\n" \
+"FILES =");
+ for (array_index = 0; array_index < file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index];
+ }
+ # GNU Make uses the modification time of the *target* of a symlink,
+ # rather than the modification time of the symlink itself. It can be told
+ # to *also* use the symlink's modification time, but not to *only* use
+ # the symlink's modification time. However, these symlinks will generally
+ # be broken, so make will not be able to dereference the symlink.
+ # Therefore, using these symlinks as make dependencies won't work.
+ printf ("\n\n" \
+"LINKS =");
+ for (array_index = 0; array_index < symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index];
+ }
+ printf "\n\nS6_RC_FILES =";
+ for (array_index = 0; array_index < rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index];
+ }
+ print "";
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..5bee72ec72bc3aeb5b2e1db26721664858661d35
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,26 @@
+#!/bin/sh --
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+set -euo pipefail
+export LC_ALL=C LANGUAGE=C
+dir=$(git rev-parse --show-toplevel)
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ } |
+ awk -f scripts/genfiles.awk > "$output_file.tmp"
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 38a9af765683f287d621d5a2107a78c84b9b166e..6f8664aea3b2b9bfdf569c4b089695d2a575668a 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,24 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
( \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
) | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sysctl \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..a6f1a41c9a30b769a508f6c486cced0c8daaa833
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+LINKS = \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES = \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sysctl \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
---
base-commit: 2551f9eb1a6c9245699ff5cf77f9957d1e2d14be
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v6] Generate file lists from a script
2025-09-29 8:12 ` Alyssa Ross
@ 2025-09-29 17:20 ` Demi Marie Obenour
0 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-09-29 17:20 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 3714 bytes --]
On 9/29/25 04:12, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..986d86ec7e3080ab7c9a73307d116d244ef542e0
>> --- /dev/null
>> +++ b/scripts/genfiles.awk
>> @@ -0,0 +1,79 @@
>> +# SPDX-License-Identifier: EUPL-1.2+
>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>> +BEGIN {
>> + RS = "\n";
>> + FS = "\t";
>> + modes["120000"] = "symlink";
>> + modes["100644"] = "regular";
>> + modes["100755"] = "regular";
>> +}
>> +
>> +function fail(msg) {
>> + exit_code = 1;
>
> I've been pointing out since v3 that this variable doesn't do anything.
> It's still here!
It actually does do something: the END block runs even after the exit
statement, unless the exit statement is itself in the END block.
I added a comment in v7 to explain this.
>> + print msg > "/dev/stderr";
>> + exit 1;
>> +}
>> +
>> +# Extract data from built-in variables.
>> +{
>> + filename = $2;
>> + raw_mode = $1;
>> + # awk autocreates empty string entries if the key is invalid,
>> + # but the code exits in this case so that is okay.
>> + mode = modes[raw_mode];
>> +}
>> +
>> +filename !~ /^[[:alnum:]_./-]+$/ {
>> + fail("filename '" filename "' has forbidden characters");
>> +}
>> +
>> +# Skip license files
>> +/\.license$/ { next }
>> +
>> +filename ~ /^image\/etc\/s6-rc\// {
>> + if (mode != "regular") {
>> + fail("s6-rc-compile input '" filename "' isn't a regular file");
>> + }
>> + rc_files[rc_count++] = filename;
>> + next;
>> +}
>> +
>> +mode == "symlink" {
>> + symlinks[symlink_count++] = filename;
>> + next;
>> +}
>> +
>> +mode == "regular" {
>> + files[file_count++] = filename;
>> + next;
>> +}
>> +
>> +{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
>> +
>> +END {
>> + if (exit_code) {
>> + exit exit_code;
>> + }
>> + printf ("# SPDX-License-Identifier: CC0-1.0\n" \
>> +"# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
>
> Does reuse pick these up? If so, might need to break them up into
> multiple string literals.
Yup, fixed in v7.
> Let's leave a blank line after the header too — I think that's more readable.
>
>> +"FILES =");
>> + for (array_index = 0; array_index < file_count; array_index += 1) {
>> + printf " \\\n\t%s", files[array_index];
>> + }
>> + # GNU Make uses the modification time of the *target* of a symlink,
>> + # rather than the modification time of the symlink itself. It can be told
>> + # to *also* use the symlink's modification time, but not to *only* use
>> + # the symlink's modification time. However, these symlinks will generally
>> + # be broken, so make will not be able to dereference the symlink.
>> + # Therefore, using these symlinks as make dependencies won't work.
>> + printf ("\n\n" \
>> +"LINKS =");
>> + for (array_index = 0; array_index < symlink_count; array_index += 1) {
>> + printf " \\\n\t%s", symlinks[array_index];
>> + }
>> + printf "\n\nS6_RC_FILES =";
>> + for (array_index = 0; array_index < rc_count; array_index += 1) {
>> + printf " \\\n\t%s", rc_files[array_index];
>> + }
>> + print "";
>> +}
>> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
>> new file mode 100755
>> index 0000000000000000000000000000000000000000..a595d9effd64fe110ed0c2875bbd30f4428ee3f7
>> --- /dev/null
>> +++ b/scripts/genfiles.sh
>> @@ -0,0 +1,24 @@
>> +#!/bin/sh --
>> +set -euo pipefail
>
> Missing copyright.
Fixed in v7.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v3 1/4] Do not ignore errors from tar
2025-09-19 7:46 ` Alyssa Ross
@ 2025-09-30 12:59 ` Alyssa Ross
0 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-09-30 12:59 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]
Alyssa Ross <hi@alyssa.is> writes:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> On 9/17/25 07:48, Alyssa Ross wrote:
>>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>>>
>>>> These would be ignored due to a missing -o pipefail in the shell script.
>>>> As a result, listing nonexistent s6-rc-compile inputs would cause a
>>>> broken image to be successfully built.
>>>>
>>>> Reported-by: Alyssa Ross <hi@alyssa.is>
>>>> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87segu879h.fsf@alyssa.is
>>>> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
>>>> ---
>>>> host/rootfs/Makefile | 4 ++--
>>>> img/app/Makefile | 4 ++--
>>>> vm/sys/net/Makefile | 4 ++--
>>>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
>>>> index e96458dba06ae31129b115b2b649962f8d88187a..2288ae4d22ca817ba9fe8ebfc42326fe38b27c27 100644
>>>> --- a/host/rootfs/Makefile
>>>> +++ b/host/rootfs/Makefile
>>>> @@ -169,8 +169,8 @@ build/etc/s6-rc: $(S6_RC_FILES)
>>>> mkdir -p $$(dirname $@)
>>>> rm -rf $@
>>>>
>>>> - dir=$$(mktemp -d) && \
>>>> - tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2 && \
>>>> + set -uo pipefail; dir=$$(mktemp -d) || exit; \
>>>> + { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 2; } && \
>>>> s6-rc-compile $@ $$dir; \
>>>> exit=$$?; rm -r $$dir; exit $$exit
>>>>
>>>
>>> What do the additional { } do?
>> Cause s6-rc-compile to be skipped if either tar command fails.
>
> Ah, like a subshell without creating a subshell! I haven't seen that
> before. Probably there are lots of places where I'm needlessly using
> subshells, then.
Fixed the ones I could find in
https://spectrum-os.org/git/spectrum/commit/?id=7ce3a09b48a53ec4c23edf713b9c3b1ee2de3339 :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v7] Generate file lists from a script
2025-09-29 17:18 ` [PATCH v7] " Demi Marie Obenour
@ 2025-10-01 9:20 ` Alyssa Ross
2025-10-01 9:24 ` Demi Marie Obenour
2025-10-01 9:35 ` Alyssa Ross
2025-10-01 18:30 ` [PATCH v8] " Demi Marie Obenour
2 siblings, 1 reply; 51+ messages in thread
From: Alyssa Ross @ 2025-10-01 9:20 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
> index 38a9af765683f287d621d5a2107a78c84b9b166e..6f8664aea3b2b9bfdf569c4b089695d2a575668a 100644
> --- a/vm/sys/net/Makefile
> +++ b/vm/sys/net/Makefile
> @@ -4,6 +4,7 @@
> .POSIX:
>
> include ../../../lib/common.mk
> +include file-list.mk
>
> prefix = build/host
> libdir = $(prefix)/lib
> @@ -28,62 +29,24 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
> build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
> mv $@.tmp $@
>
> -VM_FILES = \
> - image/etc/dbus-1/system.conf \
> - image/etc/fstab \
> - image/etc/init \
> - image/etc/mdev.conf \
> - image/etc/mdev/iface \
> - image/etc/nftables.conf \
> - image/etc/passwd \
> - image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
> - image/etc/s6-linux-init/scripts/rc.init \
> - image/etc/sysctl.conf
> -VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
VM_DIRS should have been renamed to DIRS here, not removed.
If there are no other issues I'll just fix that myself.
Happily the tests caught it.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v7] Generate file lists from a script
2025-10-01 9:20 ` Alyssa Ross
@ 2025-10-01 9:24 ` Demi Marie Obenour
0 siblings, 0 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-10-01 9:24 UTC (permalink / raw)
To: Alyssa Ross; +Cc: Spectrum OS Development
[-- Attachment #1.1.1: Type: text/plain, Size: 1509 bytes --]
On 10/1/25 05:20, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
>
>> diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
>> index 38a9af765683f287d621d5a2107a78c84b9b166e..6f8664aea3b2b9bfdf569c4b089695d2a575668a 100644
>> --- a/vm/sys/net/Makefile
>> +++ b/vm/sys/net/Makefile
>> @@ -4,6 +4,7 @@
>> .POSIX:
>>
>> include ../../../lib/common.mk
>> +include file-list.mk
>>
>> prefix = build/host
>> libdir = $(prefix)/lib
>> @@ -28,62 +29,24 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
>> build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
>> mv $@.tmp $@
>>
>> -VM_FILES = \
>> - image/etc/dbus-1/system.conf \
>> - image/etc/fstab \
>> - image/etc/init \
>> - image/etc/mdev.conf \
>> - image/etc/mdev/iface \
>> - image/etc/nftables.conf \
>> - image/etc/passwd \
>> - image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
>> - image/etc/s6-linux-init/scripts/rc.init \
>> - image/etc/sysctl.conf
>> -VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
>
> VM_DIRS should have been renamed to DIRS here, not removed.
> If there are no other issues I'll just fix that myself.
> Happily the tests caught it.
Whoops! That's what I get for accidentally trashing my NixOS
install and not reinstalling quickly enough. I should be able
to do better QA now that that machine is up and running again.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v7] Generate file lists from a script
2025-09-29 17:18 ` [PATCH v7] " Demi Marie Obenour
2025-10-01 9:20 ` Alyssa Ross
@ 2025-10-01 9:35 ` Alyssa Ross
2025-10-01 18:30 ` [PATCH v8] " Demi Marie Obenour
2 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-10-01 9:35 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..5bee72ec72bc3aeb5b2e1db26721664858661d35
> --- /dev/null
> +++ b/scripts/genfiles.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh --
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +set -euo pipefail
> +export LC_ALL=C LANGUAGE=C
> +dir=$(git rev-parse --show-toplevel)
shellcheck points out that this variable is never used. I'm not sure
whether you'd prefer to remove it, or re-add the cd, so please submit a
new version with your preferred behavior.
With that and DIRS reinstated in vm/sys/net:
Reviewed-by: Alyssa Ross <hi@alyssa.is>
> +for i in host/rootfs img/app vm/sys/net; do
> + output_file=$i/file-list.mk
> + {
> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
> + sort -t $'\t' -k 2
> + } |
> + awk -f scripts/genfiles.awk > "$output_file.tmp"
> + if [ -f "$output_file" ]; then
> + # Avoid changing output file if it is up to date, as that
> + # would cause unnecessary rebuilds.
> + if cmp -s -- "$output_file.tmp" "$output_file"; then
> + rm -- "$output_file.tmp"
> + continue
> + else
> + astatus=$?
> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
> + fi
> + fi
> + mv -- "$output_file.tmp" "$output_file"
> +done
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v8] Generate file lists from a script
2025-09-29 17:18 ` [PATCH v7] " Demi Marie Obenour
2025-10-01 9:20 ` Alyssa Ross
2025-10-01 9:35 ` Alyssa Ross
@ 2025-10-01 18:30 ` Demi Marie Obenour
2025-10-02 9:46 ` Alyssa Ross
2025-10-02 17:37 ` [PATCH v9] " Demi Marie Obenour
2 siblings, 2 replies; 51+ messages in thread
From: Demi Marie Obenour @ 2025-10-01 18:30 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
This actually reduces the amount of code that has to be written by hand.
---
Changes in v8:
- Re-add missing DIRS in vm/sys/net/Makefile.
- Re-add missing "$dir" in scripts/genfiles.sh.
- Link to v7: https://spectrum-os.org/lists/archives/spectrum-devel/20250929-genfiles-v7-1-5a702ee452b1@gmail.com
Changes in v7:
- Do not break sorting of directories in host/rootfs/Makefile.
- Add newline after generated copyright headers.
- Add comment to scripts/genfiles.awk explaining use of exit_code variable.
- Check filename instead of $0 to see if a file is a license file.
This has no functional impact.
- Add missing copyright to scripts/genfiles.sh.
- Prevent reuse from tripping over scripts/genfiles.awk.
- Link to v6: https://spectrum-os.org/lists/archives/spectrum-devel/20250927-genfiles-v6-1-2111a981596d@gmail.com
Changes in v6:
- Do not include comment in generated makefiles
- Change makefile license to CC0.
- Link to v5: https://spectrum-os.org/lists/archives/spectrum-devel/20250926-genfiles-v5-1-3394dfb3b330@gmail.com
Changes in v5:
- Use 'print ""' instead of 'print' in awk to print a newline. 'print'
with no arguments implicitly prints $0 instead. This caused the
generated makefiles to be incorrect.
- Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
img/app/Makefile. This prevented the image from being built.
- Do not check for git repository being in a directory with a name
ending in a newline.
- Use shell redirection instead of awk redirection.
- Do not include trailing DONE line in input to awk.
- Link to v4: https://spectrum-os.org/lists/archives/spectrum-devel/20250921-genfiles-v4-1-4375bda78707@gmail.com
Changes in v4:
- Use /bin/sh instead of bash.
- Do not assume that negated awk character classes match all bytes.
- Do not check the mode of license files.
- Use implicit awk variable initialization.
- Use 'git rev-parse --show-toplevel' to find the repository root.
- Remove wrongly added copyright header.
- Improve documentation.
- Remove git hooks.
- Add missing copyright header.
- Avoid non-portable /usr/bin/env -S.
- Avoid assuming that awk is GNU awk.
- Avoid non-portable awk -E.
- Do not check for git bugs.
- Fix link in v3 changelog.
- Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 107 +---------------------------
host/rootfs/file-list.mk | 102 ++++++++++++++++++++++++++
img/app/Makefile | 84 ++++------------------
img/app/file-list.mk | 65 +++++++++++++++++
scripts/genfiles.awk | 85 ++++++++++++++++++++++
scripts/genfiles.sh | 26 +++++++
vm/sys/net/Makefile | 55 +++-----------
vm/sys/net/file-list.mk | 41 +++++++++++
9 files changed, 351 insertions(+), 221 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..d044e7509a43df4b015f312dac61be6c74cc7feb 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 3
// SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
Spectrum comes with some built-in application VMs, to demonstrate
@@ -44,6 +45,12 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for images is stored in a separate file,
+file-list.mk. To update it, run scripts/genfiles.sh, which will
+regenerate it from the output of `git ls-files`. This script uses
+Git's index to generate the list, so only staged changes will be
+reflected in its output.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index a0b32dc6af554d4122974e214e5ba2b648608bae..aa45ca1d5c18d0dfb78d19267f263cc4222e8e84 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
{ \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,41 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sys-vmms \
- image/etc/s6-rc/ok-all/contents.d/vm-env \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents.d/static-nodes \
- image/etc/s6-rc/vm-env/contents.d/weston \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents.d/core \
- image/etc/s6-rc/vmm-env/contents.d/kvm \
- image/etc/s6-rc/vmm-env/contents.d/static-nodes \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -170,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..3694dc472a013fff931847171145465329fb800f
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+LINKS = \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sys-vmms \
+ image/etc/s6-rc/ok-all/contents.d/vm-env \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vm-env/contents.d/weston \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents.d/core \
+ image/etc/s6-rc/vmm-env/contents.d/kvm \
+ image/etc/s6-rc/vmm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index 93eeefb53e23f250812039a4d28a7ccd59e79446..981889ebe55d9ba03228977f3dc0ea3f26d5c4fb 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,50 +45,21 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
{ \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
} | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/app \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/wireplumber \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..9967285ca9972b675713de36859850fed609f15f
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+LINKS = \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/app \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/wireplumber \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..2d32016b5e6d6773685b71cc04e49cf24e842ba9
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ modes["120000"] = "symlink";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg) {
+ # Awk will run END blocks even after exit.
+ # The END block checks this variable and
+ # immediately exits if it is nonzero.
+ exit_code = 1;
+ print msg > "/dev/stderr";
+ exit 1;
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # Awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+filename !~ /^[[:alnum:]_./-]+$/ {
+ fail("filename '" filename "' has forbidden characters");
+}
+
+# Skip license files
+filename ~ /\.license$/ { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_files[rc_count++] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlinks[symlink_count++] = filename;
+ next;
+}
+
+mode == "regular" {
+ files[file_count++] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ printf ("# SPDX-" \
+"License-Identifier: CC0-1.0\n" \
+"# SPDX-" \
+"FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+"\n" \
+"FILES =");
+ for (array_index = 0; array_index < file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index];
+ }
+ # GNU Make uses the modification time of the *target* of a symlink,
+ # rather than the modification time of the symlink itself. It can be told
+ # to *also* use the symlink's modification time, but not to *only* use
+ # the symlink's modification time. However, these symlinks will generally
+ # be broken, so make will not be able to dereference the symlink.
+ # Therefore, using these symlinks as make dependencies won't work.
+ printf ("\n\n" \
+"LINKS =");
+ for (array_index = 0; array_index < symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index];
+ }
+ printf "\n\nS6_RC_FILES =";
+ for (array_index = 0; array_index < rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index];
+ }
+ print "";
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..5bee72ec72bc3aeb5b2e1db26721664858661d35
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,26 @@
+#!/bin/sh --
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+set -euo pipefail
+export LC_ALL=C LANGUAGE=C
+dir=$(git rev-parse --show-toplevel)
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ } |
+ awk -f scripts/genfiles.awk > "$output_file.tmp"
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 8a59faca2451ca3d404a62d76def15dec67add51..b377e12bba8f062026e997de18e19c9af8e07cb5 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,26 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
+
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
{ \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
} | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sysctl \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..a6f1a41c9a30b769a508f6c486cced0c8daaa833
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+LINKS = \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES = \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sysctl \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
---
base-commit: 6e0a84ec0380f9861bea12370160f0f20348c1dc
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v8] Generate file lists from a script
2025-10-01 18:30 ` [PATCH v8] " Demi Marie Obenour
@ 2025-10-02 9:46 ` Alyssa Ross
2025-10-02 17:37 ` [PATCH v9] " Demi Marie Obenour
1 sibling, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-10-02 9:46 UTC (permalink / raw)
To: Demi Marie Obenour; +Cc: Spectrum OS Development
[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..5bee72ec72bc3aeb5b2e1db26721664858661d35
> --- /dev/null
> +++ b/scripts/genfiles.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh --
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +set -euo pipefail
> +export LC_ALL=C LANGUAGE=C
> +dir=$(git rev-parse --show-toplevel)
This is still unused, just like it was in the previous version?
shellcheck still identifies this.
> +for i in host/rootfs img/app vm/sys/net; do
> + output_file=$i/file-list.mk
> + {
> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
> + sort -t $'\t' -k 2
> + } |
> + awk -f scripts/genfiles.awk > "$output_file.tmp"
> + if [ -f "$output_file" ]; then
> + # Avoid changing output file if it is up to date, as that
> + # would cause unnecessary rebuilds.
> + if cmp -s -- "$output_file.tmp" "$output_file"; then
> + rm -- "$output_file.tmp"
> + continue
> + else
> + astatus=$?
> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
> + fi
> + fi
> + mv -- "$output_file.tmp" "$output_file"
> +done
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v9] Generate file lists from a script
2025-10-01 18:30 ` [PATCH v8] " Demi Marie Obenour
2025-10-02 9:46 ` Alyssa Ross
@ 2025-10-02 17:37 ` Demi Marie Obenour
2025-10-03 9:04 ` Alyssa Ross
1 sibling, 1 reply; 51+ messages in thread
From: Demi Marie Obenour @ 2025-10-02 17:37 UTC (permalink / raw)
To: Spectrum OS Development; +Cc: Alyssa Ross, Demi Marie Obenour
Right now, the makefiles in host/rootfs, vm/sys/net, and img/app have
manually-maintained lists of files and symlinks. These duplicate the
information in the git repository and can easily get out of sync or
cause unnecessary merge conflicts. Fix all of these issues by having
the git repository be the source of truth, and using a script to
generate the file lists. Developers can regenerate the lists before
every commit, or even add a git hook to do that.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
This actually reduces the amount of code that has to be written by hand.
---
Changes in v9:
- Actually change to the toplevel directory of the git repository.
- Link to v8: https://spectrum-os.org/lists/archives/spectrum-devel/20251001-genfiles-v8-1-171a29081ab7@gmail.com
Changes in v8:
- Re-add missing DIRS in vm/sys/net/Makefile.
- Re-add missing "$dir" in scripts/genfiles.sh.
- Link to v7: https://spectrum-os.org/lists/archives/spectrum-devel/20250929-genfiles-v7-1-5a702ee452b1@gmail.com
Changes in v7:
- Do not break sorting of directories in host/rootfs/Makefile.
- Add newline after generated copyright headers.
- Add comment to scripts/genfiles.awk explaining use of exit_code variable.
- Check filename instead of $0 to see if a file is a license file.
This has no functional impact.
- Add missing copyright to scripts/genfiles.sh.
- Prevent reuse from tripping over scripts/genfiles.awk.
- Link to v6: https://spectrum-os.org/lists/archives/spectrum-devel/20250927-genfiles-v6-1-2111a981596d@gmail.com
Changes in v6:
- Do not include comment in generated makefiles
- Change makefile license to CC0.
- Link to v5: https://spectrum-os.org/lists/archives/spectrum-devel/20250926-genfiles-v5-1-3394dfb3b330@gmail.com
Changes in v5:
- Use 'print ""' instead of 'print' in awk to print a newline. 'print'
with no arguments implicitly prints $0 instead. This caused the
generated makefiles to be incorrect.
- Use S6_RC_FILES instead of VM_S6_RC_FILES in vm/sys/net/Makefile and
img/app/Makefile. This prevented the image from being built.
- Do not check for git repository being in a directory with a name
ending in a newline.
- Use shell redirection instead of awk redirection.
- Do not include trailing DONE line in input to awk.
- Link to v4: https://spectrum-os.org/lists/archives/spectrum-devel/20250921-genfiles-v4-1-4375bda78707@gmail.com
Changes in v4:
- Use /bin/sh instead of bash.
- Do not assume that negated awk character classes match all bytes.
- Do not check the mode of license files.
- Use implicit awk variable initialization.
- Use 'git rev-parse --show-toplevel' to find the repository root.
- Remove wrongly added copyright header.
- Improve documentation.
- Remove git hooks.
- Add missing copyright header.
- Avoid non-portable /usr/bin/env -S.
- Avoid assuming that awk is GNU awk.
- Avoid non-portable awk -E.
- Do not check for git bugs.
- Fix link in v3 changelog.
- Link to v3: https://spectrum-os.org/lists/archives/spectrum-devel/20250920-genfiles-v3-1-d6c2b6767b42@gmail.com
Changes in v3:
- Only include the file list generator. Move the rest to separate patch
series.
- Remove the update-file-list make targets from img/app/Makefile and
vm/sys/net/Makefile.
- Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20250910-genfiles-v2-0-37ebe07a3cdc@gmail.com
Changes in v2:
- Drop the last patch (switching to /etc/s6-rc/compiled) as it is
controversial and should be reviewed separately.
- Add missing copyright notices.
- Use a wrapper shell script to make the awk code easier to read.
- Improve documentation.
- Add helper scripts for use in git hooks and rebasing.
- Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20250903-genfiles-v1-0-cc993fcb1e4c@gmail.com/
---
Documentation/development/built-in-vms.adoc | 7 ++
host/rootfs/Makefile | 107 +---------------------------
host/rootfs/file-list.mk | 102 ++++++++++++++++++++++++++
img/app/Makefile | 84 ++++------------------
img/app/file-list.mk | 65 +++++++++++++++++
scripts/genfiles.awk | 85 ++++++++++++++++++++++
scripts/genfiles.sh | 27 +++++++
vm/sys/net/Makefile | 55 +++-----------
vm/sys/net/file-list.mk | 41 +++++++++++
9 files changed, 352 insertions(+), 221 deletions(-)
diff --git a/Documentation/development/built-in-vms.adoc b/Documentation/development/built-in-vms.adoc
index e90009ee5a3c2c254a7ae11e36121576b819eee7..d044e7509a43df4b015f312dac61be6c74cc7feb 100644
--- a/Documentation/development/built-in-vms.adoc
+++ b/Documentation/development/built-in-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 3
// SPDX-FileCopyrightText: 2023-2025 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
Spectrum comes with some built-in application VMs, to demonstrate
@@ -44,6 +45,12 @@ NOTE: As a special convenience, it's not necessary to run `make clean`
if the only change to the Nix files is modifying the packages
installed in the VM.
+The list of files used for images is stored in a separate file,
+file-list.mk. To update it, run scripts/genfiles.sh, which will
+regenerate it from the output of `git ls-files`. This script uses
+Git's index to generate the list, so only staged changes will be
+reflected in its output.
+
By default, `make run` runs the VM in Cloud Hypervisor, to match the
Spectrum environment. You can also add `VMM=crosvm` or `VMM=qemu` to
your command line to run the VM in a different VMM. One reason to do
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index a0b32dc6af554d4122974e214e5ba2b648608bae..aa45ca1d5c18d0dfb78d19267f263cc4222e8e84 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -4,67 +4,10 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
dest = build/rootfs.erofs
-FILES = \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/group \
- image/etc/init \
- image/etc/login \
- image/etc/mdev.conf \
- image/etc/mdev/listen \
- image/etc/mdev/net/add \
- image/etc/mdev/wait \
- image/etc/parse-devname \
- image/etc/passwd \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/run \
- image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/dbus/template/run \
- image/etc/s6-linux-init/run-image/service/getty-tty1/run \
- image/etc/s6-linux-init/run-image/service/getty-tty2/run \
- image/etc/s6-linux-init/run-image/service/getty-tty3/run \
- image/etc/s6-linux-init/run-image/service/getty-tty4/run \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
- image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
- image/etc/s6-linux-init/run-image/service/serial-getty/run \
- image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
- image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
- image/etc/s6-linux-init/run-image/service/vmm/run \
- image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
- image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/xdg/weston/autolaunch \
- image/etc/xdg/weston/weston.ini \
- image/usr/bin/assign-devices \
- image/usr/bin/create-vm-dependencies \
- image/usr/bin/run-appimage \
- image/usr/bin/run-vmm \
- image/usr/bin/vm-console \
- image/usr/bin/vm-import \
- image/usr/bin/vm-start \
- image/usr/bin/vm-stop \
- image/usr/bin/xdg-open \
- image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
-
DIRS = \
dev \
etc/s6-linux-init/env \
@@ -101,18 +44,9 @@ DIRS = \
FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-LINKS = \
- image/bin \
- image/etc/s6-linux-init/run-image/opengl-driver \
- image/etc/s6-linux-init/run-image/service/vmm/template/run \
- image/lib \
- image/sbin
-
BUILD_FILES = build/etc/s6-rc
-$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo
+$(dest): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
{ \
cat $(PACKAGES_FILE) ;\
for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
@@ -128,41 +62,6 @@ build/fifo:
build/empty:
mkdir -p $@
-S6_RC_FILES = \
- image/etc/s6-rc/card0/type \
- image/etc/s6-rc/card0/up \
- image/etc/s6-rc/core/type \
- image/etc/s6-rc/core/up \
- image/etc/s6-rc/kvm/timeout-up \
- image/etc/s6-rc/kvm/type \
- image/etc/s6-rc/kvm/up \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sys-vmms \
- image/etc/s6-rc/ok-all/contents.d/vm-env \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/static-nodes/type \
- image/etc/s6-rc/static-nodes/up \
- image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
- image/etc/s6-rc/sys-vmms/type \
- image/etc/s6-rc/sys-vmms/up \
- image/etc/s6-rc/vm-env/contents.d/static-nodes \
- image/etc/s6-rc/vm-env/contents.d/weston \
- image/etc/s6-rc/vm-env/type \
- image/etc/s6-rc/vmm-env/contents.d/core \
- image/etc/s6-rc/vmm-env/contents.d/kvm \
- image/etc/s6-rc/vmm-env/contents.d/static-nodes \
- image/etc/s6-rc/vmm-env/type \
- image/etc/s6-rc/weston/dependencies.d/card0 \
- image/etc/s6-rc/weston/notification-fd \
- image/etc/s6-rc/weston/run \
- image/etc/s6-rc/weston/type
-
# s6-rc-compile's input is a directory, but that doesn't play nice
# with Make, because it won't know to update if some file in the
# directory is changed, or a file is created or removed in a
@@ -170,7 +69,7 @@ S6_RC_FILES = \
# including files that aren't intended to be part of the input, like
# temporary editor files or .license files. So for all these reasons,
# only explicitly listed files are made available to s6-rc-compile.
-build/etc/s6-rc: $(S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..3694dc472a013fff931847171145465329fb800f
--- /dev/null
+++ b/host/rootfs/file-list.mk
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/group \
+ image/etc/init \
+ image/etc/login \
+ image/etc/mdev.conf \
+ image/etc/mdev/listen \
+ image/etc/mdev/net/add \
+ image/etc/mdev/wait \
+ image/etc/parse-devname \
+ image/etc/passwd \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/dbus/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/run \
+ image/etc/s6-linux-init/run-image/service/dbus/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/dbus/template/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty1/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty2/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty3/run \
+ image/etc/s6-linux-init/run-image/service/getty-tty4/run \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-svscan-log/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty-generator/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
+ image/etc/s6-linux-init/run-image/service/serial-getty/run \
+ image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-fs/template/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/run \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/data/check \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vhost-user-gpu/template/run \
+ image/etc/s6-linux-init/run-image/service/vmm/notification-fd \
+ image/etc/s6-linux-init/run-image/service/vmm/run \
+ image/etc/s6-linux-init/run-image/service/vmm/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/run \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/notification-fd \
+ image/etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/xdg/weston/autolaunch \
+ image/etc/xdg/weston/weston.ini \
+ image/usr/bin/assign-devices \
+ image/usr/bin/create-vm-dependencies \
+ image/usr/bin/run-appimage \
+ image/usr/bin/run-vmm \
+ image/usr/bin/vm-console \
+ image/usr/bin/vm-import \
+ image/usr/bin/vm-start \
+ image/usr/bin/vm-stop \
+ image/usr/bin/xdg-open \
+ image/usr/share/dbus-1/services/org.freedesktop.portal.Documents.service
+
+LINKS = \
+ image/bin \
+ image/etc/s6-linux-init/run-image/opengl-driver \
+ image/etc/s6-linux-init/run-image/service/vmm/template/run \
+ image/lib \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/card0/type \
+ image/etc/s6-rc/card0/up \
+ image/etc/s6-rc/core/type \
+ image/etc/s6-rc/core/up \
+ image/etc/s6-rc/kvm/timeout-up \
+ image/etc/s6-rc/kvm/type \
+ image/etc/s6-rc/kvm/up \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sys-vmms \
+ image/etc/s6-rc/ok-all/contents.d/vm-env \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/static-nodes/type \
+ image/etc/s6-rc/static-nodes/up \
+ image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+ image/etc/s6-rc/sys-vmms/type \
+ image/etc/s6-rc/sys-vmms/up \
+ image/etc/s6-rc/vm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vm-env/contents.d/weston \
+ image/etc/s6-rc/vm-env/type \
+ image/etc/s6-rc/vmm-env/contents.d/core \
+ image/etc/s6-rc/vmm-env/contents.d/kvm \
+ image/etc/s6-rc/vmm-env/contents.d/static-nodes \
+ image/etc/s6-rc/vmm-env/type \
+ image/etc/s6-rc/weston/dependencies.d/card0 \
+ image/etc/s6-rc/weston/notification-fd \
+ image/etc/s6-rc/weston/run \
+ image/etc/s6-rc/weston/type
diff --git a/img/app/Makefile b/img/app/Makefile
index 93eeefb53e23f250812039a4d28a7ccd59e79446..981889ebe55d9ba03228977f3dc0ea3f26d5c4fb 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -5,6 +5,7 @@
.POSIX:
include ../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -29,45 +30,13 @@ $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fie
build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/session.conf \
- image/etc/fonts/fonts.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/mdev/listen \
- image/etc/mdev/virtiofs \
- image/etc/mdev/wait \
- image/etc/passwd \
- image/etc/pipewire/pipewire.conf \
- image/etc/resolv.conf \
- image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
- image/etc/s6-linux-init/env/DISPLAY \
- image/etc/s6-linux-init/env/GTK_USE_PORTAL \
- image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
- image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
- image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
- image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/s6-linux-init/scripts/rc.shutdown \
- image/etc/s6-linux-init/scripts/rc.shutdown.final \
- image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
- image/etc/xdg/xdg-desktop-portal/portals.conf
-
-VM_DIRS = dev run proc sys tmp \
+DIRS = dev run proc sys tmp \
etc/s6-linux-init/run-image/service \
etc/s6-linux-init/run-image/user \
etc/s6-linux-init/run-image/wait
-VM_FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
+FIFOS = etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/fifo
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/etc/ssl/certs/ca-certificates.crt image/sbin
-
-VM_BUILD_FILES = build/etc/s6-rc
+BUILD_FILES = build/etc/s6-rc
build/fifo:
mkdir -p build
@@ -76,50 +45,21 @@ build/fifo:
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty build/fifo
+build/rootfs.erofs: ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
{ \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
- printf 'build/fifo\n%s\n' $(VM_FIFOS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
+ printf 'build/fifo\n%s\n' $(FIFOS) ;\
} | ../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/app/dependencies.d/dbus \
- image/etc/s6-rc/app/dependencies.d/pipewire \
- image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
- image/etc/s6-rc/app/run \
- image/etc/s6-rc/app/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/ok-all/contents.d/app \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/wireplumber \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/pipewire/notification-fd \
- image/etc/s6-rc/pipewire/run \
- image/etc/s6-rc/pipewire/type \
- image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
- image/etc/s6-rc/wayland-proxy-virtwl/run \
- image/etc/s6-rc/wayland-proxy-virtwl/type \
- image/etc/s6-rc/wireplumber/dependencies.d/dbus \
- image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
- image/etc/s6-rc/wireplumber/run \
- image/etc/s6-rc/wireplumber/type
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..9967285ca9972b675713de36859850fed609f15f
--- /dev/null
+++ b/img/app/file-list.mk
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/dbus-1/session.conf \
+ image/etc/fonts/fonts.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/mdev/listen \
+ image/etc/mdev/virtiofs \
+ image/etc/mdev/wait \
+ image/etc/passwd \
+ image/etc/pipewire/pipewire.conf \
+ image/etc/resolv.conf \
+ image/etc/s6-linux-init/env/DBUS_SESSION_BUS_ADDRESS \
+ image/etc/s6-linux-init/env/DISPLAY \
+ image/etc/s6-linux-init/env/GTK_USE_PORTAL \
+ image/etc/s6-linux-init/env/NIX_XDG_DESKTOP_PORTAL_DIR \
+ image/etc/s6-linux-init/env/WAYLAND_DISPLAY \
+ image/etc/s6-linux-init/env/XDG_RUNTIME_DIR \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/notification-fd \
+ image/etc/s6-linux-init/run-image/service/s6-linux-init-shutdownd/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/s6-linux-init/scripts/rc.shutdown \
+ image/etc/s6-linux-init/scripts/rc.shutdown.final \
+ image/etc/wireplumber/wireplumber.conf.d/99_spectrum.conf \
+ image/etc/xdg/xdg-desktop-portal/portals.conf
+
+LINKS = \
+ image/bin \
+ image/etc/ssl/certs/ca-certificates.crt \
+ image/sbin
+
+S6_RC_FILES = \
+ image/etc/s6-rc/app/dependencies.d/dbus \
+ image/etc/s6-rc/app/dependencies.d/pipewire \
+ image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
+ image/etc/s6-rc/app/run \
+ image/etc/s6-rc/app/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/ok-all/contents.d/app \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/wireplumber \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/pipewire/notification-fd \
+ image/etc/s6-rc/pipewire/run \
+ image/etc/s6-rc/pipewire/type \
+ image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
+ image/etc/s6-rc/wayland-proxy-virtwl/run \
+ image/etc/s6-rc/wayland-proxy-virtwl/type \
+ image/etc/s6-rc/wireplumber/dependencies.d/dbus \
+ image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
+ image/etc/s6-rc/wireplumber/run \
+ image/etc/s6-rc/wireplumber/type
diff --git a/scripts/genfiles.awk b/scripts/genfiles.awk
new file mode 100644
index 0000000000000000000000000000000000000000..2d32016b5e6d6773685b71cc04e49cf24e842ba9
--- /dev/null
+++ b/scripts/genfiles.awk
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+BEGIN {
+ RS = "\n";
+ FS = "\t";
+ modes["120000"] = "symlink";
+ modes["100644"] = "regular";
+ modes["100755"] = "regular";
+}
+
+function fail(msg) {
+ # Awk will run END blocks even after exit.
+ # The END block checks this variable and
+ # immediately exits if it is nonzero.
+ exit_code = 1;
+ print msg > "/dev/stderr";
+ exit 1;
+}
+
+# Extract data from built-in variables.
+{
+ filename = $2;
+ raw_mode = $1;
+ # Awk autocreates empty string entries if the key is invalid,
+ # but the code exits in this case so that is okay.
+ mode = modes[raw_mode];
+}
+
+filename !~ /^[[:alnum:]_./-]+$/ {
+ fail("filename '" filename "' has forbidden characters");
+}
+
+# Skip license files
+filename ~ /\.license$/ { next }
+
+filename ~ /^image\/etc\/s6-rc\// {
+ if (mode != "regular") {
+ fail("s6-rc-compile input '" filename "' isn't a regular file");
+ }
+ rc_files[rc_count++] = filename;
+ next;
+}
+
+mode == "symlink" {
+ symlinks[symlink_count++] = filename;
+ next;
+}
+
+mode == "regular" {
+ files[file_count++] = filename;
+ next;
+}
+
+{ fail("File '" filename "' is not regular file or symlink (mode " raw_mode ")"); }
+
+END {
+ if (exit_code) {
+ exit exit_code;
+ }
+ printf ("# SPDX-" \
+"License-Identifier: CC0-1.0\n" \
+"# SPDX-" \
+"FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>\n" \
+"\n" \
+"FILES =");
+ for (array_index = 0; array_index < file_count; array_index += 1) {
+ printf " \\\n\t%s", files[array_index];
+ }
+ # GNU Make uses the modification time of the *target* of a symlink,
+ # rather than the modification time of the symlink itself. It can be told
+ # to *also* use the symlink's modification time, but not to *only* use
+ # the symlink's modification time. However, these symlinks will generally
+ # be broken, so make will not be able to dereference the symlink.
+ # Therefore, using these symlinks as make dependencies won't work.
+ printf ("\n\n" \
+"LINKS =");
+ for (array_index = 0; array_index < symlink_count; array_index += 1) {
+ printf " \\\n\t%s", symlinks[array_index];
+ }
+ printf "\n\nS6_RC_FILES =";
+ for (array_index = 0; array_index < rc_count; array_index += 1) {
+ printf " \\\n\t%s", rc_files[array_index];
+ }
+ print "";
+}
diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..c93d2e7d5982adba9cd5e1d720d6d378174ef171
--- /dev/null
+++ b/scripts/genfiles.sh
@@ -0,0 +1,27 @@
+#!/bin/sh --
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+set -euo pipefail
+export LC_ALL=C LANGUAGE=C
+dir=$(git rev-parse --show-toplevel)
+cd -- "$dir"
+for i in host/rootfs img/app vm/sys/net; do
+ output_file=$i/file-list.mk
+ {
+ git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
+ sort -t $'\t' -k 2
+ } |
+ awk -f scripts/genfiles.awk > "$output_file.tmp"
+ if [ -f "$output_file" ]; then
+ # Avoid changing output file if it is up to date, as that
+ # would cause unnecessary rebuilds.
+ if cmp -s -- "$output_file.tmp" "$output_file"; then
+ rm -- "$output_file.tmp"
+ continue
+ else
+ astatus=$?
+ if [ "$astatus" != 1 ]; then exit "$astatus"; fi
+ fi
+ fi
+ mv -- "$output_file.tmp" "$output_file"
+done
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 8a59faca2451ca3d404a62d76def15dec67add51..b377e12bba8f062026e997de18e19c9af8e07cb5 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -4,6 +4,7 @@
.POSIX:
include ../../../lib/common.mk
+include file-list.mk
prefix = build/host
libdir = $(prefix)/lib
@@ -28,62 +29,26 @@ $(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdis
build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
mv $@.tmp $@
-VM_FILES = \
- image/etc/dbus-1/system.conf \
- image/etc/fstab \
- image/etc/init \
- image/etc/mdev.conf \
- image/etc/mdev/iface \
- image/etc/nftables.conf \
- image/etc/passwd \
- image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
- image/etc/s6-linux-init/scripts/rc.init \
- image/etc/sysctl.conf
-VM_DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
-
-# These are separate because they need to be included, but putting
-# them as make dependencies would confuse make.
-VM_LINKS = image/bin image/lib image/sbin image/var/run
-
-VM_BUILD_FILES = build/etc/s6-rc
+DIRS = dev etc/s6-linux-init/env proc run sys var/lib/connman
+
+BUILD_FILES = build/etc/s6-rc
build/empty:
mkdir -p $@
-build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(VM_FILES) $(VM_BUILD_FILES) build/empty
+build/rootfs.erofs: ../../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty file-list.mk
{ \
cat $(PACKAGES_FILE) ;\
- for file in $(VM_FILES) $(VM_LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
- for file in $(VM_BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
- printf 'build/empty\n%s\n' $(VM_DIRS) ;\
+ for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
+ for file in $(BUILD_FILES); do printf '%s\n%s\n' $$file $${file#build/}; done ;\
+ printf 'build/empty\n%s\n' $(DIRS) ;\
} | ../../../scripts/make-erofs.sh $@
-VM_S6_RC_FILES = \
- image/etc/s6-rc/connman/dependencies.d/dbus \
- image/etc/s6-rc/connman/run \
- image/etc/s6-rc/connman/type \
- image/etc/s6-rc/dbus/notification-fd \
- image/etc/s6-rc/dbus/run \
- image/etc/s6-rc/dbus/type \
- image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
- image/etc/s6-rc/mdevd-coldplug/type \
- image/etc/s6-rc/mdevd-coldplug/up \
- image/etc/s6-rc/mdevd/notification-fd \
- image/etc/s6-rc/mdevd/run \
- image/etc/s6-rc/mdevd/type \
- image/etc/s6-rc/nftables/type \
- image/etc/s6-rc/nftables/up \
- image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
- image/etc/s6-rc/ok-all/contents.d/sysctl \
- image/etc/s6-rc/ok-all/type \
- image/etc/s6-rc/sysctl/type \
- image/etc/s6-rc/sysctl/up
-
-build/etc/s6-rc: $(VM_S6_RC_FILES)
+build/etc/s6-rc: $(S6_RC_FILES) file-list.mk
mkdir -p $$(dirname $@)
rm -rf $@
set -uo pipefail && dir=$$(mktemp -d) && \
- { tar -c $(VM_S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
+ { tar -c $(S6_RC_FILES) | tar -C $$dir -x --strip-components 3; } && \
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
diff --git a/vm/sys/net/file-list.mk b/vm/sys/net/file-list.mk
new file mode 100644
index 0000000000000000000000000000000000000000..a6f1a41c9a30b769a508f6c486cced0c8daaa833
--- /dev/null
+++ b/vm/sys/net/file-list.mk
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+FILES = \
+ image/etc/dbus-1/system.conf \
+ image/etc/fstab \
+ image/etc/init \
+ image/etc/mdev.conf \
+ image/etc/mdev/iface \
+ image/etc/nftables.conf \
+ image/etc/passwd \
+ image/etc/s6-linux-init/run-image/service/getty-hvc0/run \
+ image/etc/s6-linux-init/scripts/rc.init \
+ image/etc/sysctl.conf
+
+LINKS = \
+ image/bin \
+ image/lib \
+ image/sbin \
+ image/var/run
+
+S6_RC_FILES = \
+ image/etc/s6-rc/connman/dependencies.d/dbus \
+ image/etc/s6-rc/connman/run \
+ image/etc/s6-rc/connman/type \
+ image/etc/s6-rc/dbus/notification-fd \
+ image/etc/s6-rc/dbus/run \
+ image/etc/s6-rc/dbus/type \
+ image/etc/s6-rc/mdevd-coldplug/dependencies.d/mdevd \
+ image/etc/s6-rc/mdevd-coldplug/type \
+ image/etc/s6-rc/mdevd-coldplug/up \
+ image/etc/s6-rc/mdevd/notification-fd \
+ image/etc/s6-rc/mdevd/run \
+ image/etc/s6-rc/mdevd/type \
+ image/etc/s6-rc/nftables/type \
+ image/etc/s6-rc/nftables/up \
+ image/etc/s6-rc/ok-all/contents.d/mdevd-coldplug \
+ image/etc/s6-rc/ok-all/contents.d/sysctl \
+ image/etc/s6-rc/ok-all/type \
+ image/etc/s6-rc/sysctl/type \
+ image/etc/s6-rc/sysctl/up
---
base-commit: cce9827490a788cd65273fde8cff5597fb200287
change-id: 20250831-genfiles-46787fc10869
--
Sincerely,
Demi Marie Obenour (she/her/hers)
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v9] Generate file lists from a script
2025-10-02 17:37 ` [PATCH v9] " Demi Marie Obenour
@ 2025-10-03 9:04 ` Alyssa Ross
0 siblings, 0 replies; 51+ messages in thread
From: Alyssa Ross @ 2025-10-03 9:04 UTC (permalink / raw)
To: Demi Marie Obenour, Spectrum OS Development
Cc: Alyssa Ross, Demi Marie Obenour
This patch has been committed as c5d5786d3dc938af0b279c542d1e43bce381b4b9,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=c5d5786d3dc938af0b279c542d1e43bce381b4b9.
This is an automated message. Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>
^ permalink raw reply [flat|nested] 51+ messages in thread
end of thread, other threads:[~2025-10-03 9:04 UTC | newest]
Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 1:56 [PATCH 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 1/4] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-04 1:56 ` [PATCH 2/4] Generate makefile file lists from a script Demi Marie Obenour
2025-09-08 9:59 ` Alyssa Ross
2025-09-08 18:45 ` Demi Marie Obenour
2025-09-09 14:51 ` Alyssa Ross
2025-09-04 1:56 ` [PATCH 3/4] Common make rules for building erofs images Demi Marie Obenour
2025-09-08 10:01 ` Alyssa Ross
2025-09-08 18:53 ` Demi Marie Obenour
2025-09-09 14:56 ` Alyssa Ross
2025-09-04 1:56 ` [PATCH 4/4] Use /etc/s6-rc/compiled for compiled s6-rc directory Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 0/3] Generate file lists from a script Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 1/3] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-10 18:58 ` Alyssa Ross
2025-09-11 12:21 ` Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 2/3] Generate makefile file lists from a script Demi Marie Obenour
2025-09-10 5:29 ` [PATCH v2 3/3] Common make rules for building erofs images Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 0/4] Generate file lists from a script Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 1/4] Do not ignore errors from tar Demi Marie Obenour
2025-09-17 11:48 ` Alyssa Ross
2025-09-18 2:45 ` Demi Marie Obenour
2025-09-19 7:46 ` Alyssa Ross
2025-09-30 12:59 ` Alyssa Ross
2025-09-19 7:55 ` Alyssa Ross
2025-09-19 19:03 ` Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 2/4] Move all files for the image into a subdirectory Demi Marie Obenour
2025-09-17 12:30 ` Alyssa Ross
2025-09-17 12:39 ` Alyssa Ross
2025-09-17 13:03 ` Alyssa Ross
2025-09-11 12:47 ` [PATCH v3 3/4] Generate makefile file lists from a script Demi Marie Obenour
2025-09-11 12:47 ` [PATCH v3 4/4] Common make rules for building erofs images Demi Marie Obenour
2025-09-21 2:23 ` [PATCH v3] Generate file lists from a script Demi Marie Obenour
2025-09-21 8:47 ` Alyssa Ross
2025-09-21 16:51 ` Demi Marie Obenour
2025-09-21 17:07 ` Alyssa Ross
2025-09-21 17:24 ` [PATCH v4] " Demi Marie Obenour
2025-09-25 11:22 ` Alyssa Ross
2025-09-26 16:31 ` [PATCH v5] " Demi Marie Obenour
2025-09-27 8:19 ` Alyssa Ross
2025-09-27 8:42 ` Demi Marie Obenour
2025-09-27 16:22 ` [PATCH v6] " Demi Marie Obenour
2025-09-29 8:12 ` Alyssa Ross
2025-09-29 17:20 ` Demi Marie Obenour
2025-09-29 17:18 ` [PATCH v7] " Demi Marie Obenour
2025-10-01 9:20 ` Alyssa Ross
2025-10-01 9:24 ` Demi Marie Obenour
2025-10-01 9:35 ` Alyssa Ross
2025-10-01 18:30 ` [PATCH v8] " Demi Marie Obenour
2025-10-02 9:46 ` Alyssa Ross
2025-10-02 17:37 ` [PATCH v9] " Demi Marie Obenour
2025-10-03 9:04 ` Alyssa Ross
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).