patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob fe728b6b385862487dab06d832e79b29d57697a8 5883 bytes (raw)
name: host/rootfs/Makefile 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
 
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>

.POSIX:

include ../../lib/common.mk
include file-list.mk
ROOT_FS_DIR = build

DIRS = \
	boot \
	dev \
	etc/s6-linux-init/env \
	etc/s6-linux-init/run-image/configs \
	etc/s6-linux-init/run-image/sd-notify-wrapper \
	etc/s6-linux-init/run-image/service/dbus/instance \
	etc/s6-linux-init/run-image/service/dbus/instances \
	etc/s6-linux-init/run-image/service/dbus/template/data \
	etc/s6-linux-init/run-image/service/dbus/template/env \
	etc/s6-linux-init/run-image/service/serial-getty/instance \
	etc/s6-linux-init/run-image/service/serial-getty/instances \
	etc/s6-linux-init/run-image/service/vhost-user-fs/instance \
	etc/s6-linux-init/run-image/service/vhost-user-fs/instances \
	etc/s6-linux-init/run-image/service/vhost-user-fs/template/data \
	etc/s6-linux-init/run-image/service/vhost-user-fs/template/env \
	etc/s6-linux-init/run-image/service/vhost-user-gpu/instance \
	etc/s6-linux-init/run-image/service/vhost-user-gpu/instances \
	etc/s6-linux-init/run-image/service/vhost-user-gpu/template/env \
	etc/s6-linux-init/run-image/service/vmm/instance \
	etc/s6-linux-init/run-image/service/vmm/instances \
	etc/s6-linux-init/run-image/service/vmm/template/data \
	etc/s6-linux-init/run-image/service/vmm/template/env \
	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/instance \
	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/instances \
	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/data \
	etc/s6-linux-init/run-image/service/xdg-desktop-portal-spectrum-host/template/env \
	etc/s6-linux-init/run-image/user \
	etc/s6-linux-init/run-image/vm/by-id \
	etc/s6-linux-init/run-image/vm/by-name \
	ext \
	home \
	proc \
	run \
	sys \
	tmp

FIFOS = etc/s6-linux-init/run-image/service/s6-svscan-log/fifo

BUILD_FILES = build/etc/s6-rc build/etc/os-release build/etc/update-url

# This rule produces three files but Make only (portably)
# supports one output per rule.  Instead of resorting to temporary
# files, a timestamp file is created as the last step.  The actual
# outputs are produced as side-effects.
build/verity-timestamp: $(ROOT_FS)
	$(VERITYSETUP) format \
		--root-hash-file $(ROOT_FS_VERITY_ROOTHASH) \
		-- $(ROOT_FS) $(ROOT_FS_VERITY)
	# Add trailing newline
	echo >> $(ROOT_FS_VERITY_ROOTHASH)
	touch -- $(ROOT_FS_DIR)/verity-timestamp

$(ROOT_FS): ../../scripts/make-erofs.sh $(PACKAGES_FILE) $(FILES) $(BUILD_FILES) build/empty build/fifo file-list.mk
	mkdir -p $(ROOT_FS_DIR) && \
	{ \
	    cat $(PACKAGES_FILE) ;\
	    printf '%s\n%s\n' "$$UPDATE_SIGNING_KEY" /etc/systemd/import-pubring.gpg; \
	    for file in $(FILES) $(LINKS); do printf '%s\n%s\n' $$file "$${file#image/}"; done ;\
	    for file in $(BUILD_FILES) $(BUILD_NON_TARGET_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 $(ROOT_FS)

build/etc/update-url:
	mkdir -p build/etc
	# might have metacharacters, so avoid interpolation
	printf %s\\n "$${UPDATE_URL:?'update URL empty or missing'}" > build/etc/update-url

build/etc/os-release:
	mkdir -p build/etc
	sed 's/@VERSION@/$(VERSION)/g' < os-release.in > build/etc/os-release

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) && \
	    { 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

build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk $(ROOT_FS_DIR)/verity-timestamp $(ROOT_FS)
	uuids=$$(awk -f ../../scripts/format-uuid.awk < $(ROOT_FS_VERITY_ROOTHASH)) && \
	set -euo pipefail -- $$uuids && \
	bash ../../scripts/make-gpt.sh $@.tmp \
	    $(ROOT_FS_VERITY):verity:$$3:Spectrum_'$(VERSION).verity' \
	    $(ROOT_FS):root:$$1:Spectrum_'$(VERSION)'
	mv $@.tmp $@

debug:
	$(GDB) -q \
	    -ex 'set substitute-path .. $(LINUX_SRC)' \
	    -ex 'target remote build/gdb.sock' \
	    $(VMLINUX)
.PHONY: debug

run: build/live.img
	@set -x && \
	ext="$$(mktemp build/spectrum-rootfs-extfs.XXXXXXXXXX.img)" && \
	truncate -s 10G "$$ext" && \
	mkfs.btrfs "$$ext" && \
	exec 3<>"$$ext" && \
	rm -f "$$ext" && \
	set +x && \
	exec ../../scripts/run-qemu.sh -cpu max -m 4G \
	    -machine virtualization=on \
	    -kernel $(KERNEL) \
	    -initrd $(INITRAMFS) \
	    -gdb unix:build/gdb.sock,server,nowait \
	    -qmp unix:build/vmm.sock,server,nowait \
	    -monitor vc \
	    -parallel none \
	    -chardev vc,id=virtiocon0 \
	    -device virtio-serial \
	    -device virtconsole,chardev=virtiocon0 \
	    -drive file=build/live.img,if=virtio,format=raw,readonly=on \
	    -drive file=/proc/self/fd/3,if=virtio,format=raw \
	    -append "earlycon console=hvc0 roothash=$$(< $(ROOT_FS_VERITY_ROOTHASH)) intel_iommu=on nokaslr" \
	    -device virtio-keyboard \
	    -device virtio-mouse \
	    -device virtio-gpu \
	    -netdev user,id=net0 \
	    -device e1000e,netdev=net0 \
	    -vga none \
	    -device vhost-vsock-pci,guest-cid=3
.PHONY: run

debug log:

solving fe728b6b385862487dab06d832e79b29d57697a8 ...
found fe728b6b385862487dab06d832e79b29d57697a8 in https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-12-b88a99915509@gmail.com/
found 0d71dd1441077c9f30945e5063aacbfc240a9006 in https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-8-b88a99915509@gmail.com/
found 1945afde0c1d804f9d14e9177aa812cbdc71234c in https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-6-b88a99915509@gmail.com/
found 533471c58591d305f386157e04e9e48da7259fd5 in https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-4-b88a99915509@gmail.com/
found 4c14d3acfa8f7ffd276fdfb684d08bf58fd80a15 in https://inbox.spectrum-os.org/spectrum-devel/20251119-refactor-verity-v4-2-9bc56d5216c0@gmail.com/
found 055185064d84d9450c2076fdeb410b21d00f1d40 in https://inbox.spectrum-os.org/spectrum-devel/20251119-refactor-verity-v4-1-9bc56d5216c0@gmail.com/
found 27a7c689c39bf9bc93b5ba33ce661be7e47b67f1 in https://spectrum-os.org/git/spectrum
preparing index
index prepared:
100644 27a7c689c39bf9bc93b5ba33ce661be7e47b67f1	host/rootfs/Makefile

applying [1/6] https://inbox.spectrum-os.org/spectrum-devel/20251119-refactor-verity-v4-1-9bc56d5216c0@gmail.com/
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 27a7c689c39bf9bc93b5ba33ce661be7e47b67f1..055185064d84d9450c2076fdeb410b21d00f1d40 100644


applying [2/6] https://inbox.spectrum-os.org/spectrum-devel/20251119-refactor-verity-v4-2-9bc56d5216c0@gmail.com/
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 055185064d84d9450c2076fdeb410b21d00f1d40..4c14d3acfa8f7ffd276fdfb684d08bf58fd80a15 100644


applying [3/6] https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-4-b88a99915509@gmail.com/
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 4c14d3acfa8f7ffd276fdfb684d08bf58fd80a15..533471c58591d305f386157e04e9e48da7259fd5 100644


applying [4/6] https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-6-b88a99915509@gmail.com/
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 533471c58591d305f386157e04e9e48da7259fd5..1945afde0c1d804f9d14e9177aa812cbdc71234c 100644


applying [5/6] https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-8-b88a99915509@gmail.com/
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 1945afde0c1d804f9d14e9177aa812cbdc71234c..0d71dd1441077c9f30945e5063aacbfc240a9006 100644


applying [6/6] https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-12-b88a99915509@gmail.com/
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 0d71dd1441077c9f30945e5063aacbfc240a9006..fe728b6b385862487dab06d832e79b29d57697a8 100644

Checking patch host/rootfs/Makefile...
Applied patch host/rootfs/Makefile cleanly.
Checking patch host/rootfs/Makefile...
Applied patch host/rootfs/Makefile cleanly.
Checking patch host/rootfs/Makefile...
Applied patch host/rootfs/Makefile cleanly.
Checking patch host/rootfs/Makefile...
Applied patch host/rootfs/Makefile cleanly.
Checking patch host/rootfs/Makefile...
Applied patch host/rootfs/Makefile cleanly.
Checking patch host/rootfs/Makefile...
Applied patch host/rootfs/Makefile cleanly.

index at:
100644 fe728b6b385862487dab06d832e79b29d57697a8	host/rootfs/Makefile

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock

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).