patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea 4830 bytes (raw)
name: img/app/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
 
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021-2024 Alyssa Ross <hi@alyssa.is>
# SPDX-FileCopyrightText: 2022 Unikie

.POSIX:

include ../../lib/common.mk
include file-list.mk

prefix = build/host
libdir = $(prefix)/lib
imgdir = $(libdir)/spectrum/img

VMM = cloud-hypervisor

HOST_BUILD_FILES = \
	$(imgdir)/appvm/blk/root.img \
	$(imgdir)/appvm/vmlinux

all: $(HOST_BUILD_FILES)
.PHONY: all

$(imgdir)/appvm/vmlinux: $(KERNEL)
	mkdir -p $$(dirname $@)
	cp $(KERNEL) $@

$(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/rootfs.erofs
	mkdir -p $$(dirname $@)
	bash ../../scripts/make-gpt.sh $@.tmp \
	    build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
	mv $@.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
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
	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 ;\
	    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) && \
	    { 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)' \
	    -ex 'target remote build/gdb.sock' \
	    $(VMLINUX)
.PHONY: debug

start-vhost-user-gpu:
	rm -f build/vhost-user-gpu.sock
	$(CROSVM_DEVICE_GPU) \
	    --socket build/vhost-user-gpu.sock \
	    --wayland-sock "$$XDG_RUNTIME_DIR/$$WAYLAND_DISPLAY" \
	    --params '{"context-types":"cross-domain"}' &
	while ! [ -S build/vhost-user-gpu.sock ] && sleep .1; do :; done
.PHONY: start-vhost-user-gpu

start-vhost-user-net:
	mkdir -p build
	../../scripts/start-passt.elb

start-virtiofsd: scripts/start-virtiofsd.elb
	mkdir -p build
	scripts/start-virtiofsd.elb
.PHONY: start-virtiofsd

run-qemu: $(imgdir)/appvm/blk/root.img start-vhost-user-net start-virtiofsd
	@../../scripts/run-qemu.sh -m 256 -cpu max -kernel $(KERNEL) -vga none \
	    -drive file=$(imgdir)/appvm/blk/root.img,if=virtio,format=raw,readonly=on \
	    -append "root=PARTLABEL=root nokaslr" \
	    -gdb unix:build/gdb.sock,server,nowait \
	    -chardev socket,id=vhost-user-net,path=build/vhost-user-net.sock \
	    -netdev vhost-user,id=net0,chardev=vhost-user-net \
	    -device virtio-net,netdev=net0,mac=02:00:00:00:00:01 \
	    -chardev socket,id=virtiofsd,path=build/virtiofsd.sock \
	    -device vhost-user-fs-pci,chardev=virtiofsd,tag=virtiofs0 \
	    -device virtio-gpu-rutabaga-pci,cross-domain=on,hostmem=8G \
	    -audio driver=pipewire,model=virtio \
	    -object memory-backend-memfd,id=mem,size=256M,share=on \
	    -numa node,memdev=mem \
	    -device vhost-vsock-pci,guest-cid=3 \
	    -parallel none \
	    -chardev vc,id=virtiocon0 \
	    -device virtio-serial-pci \
	    -device virtconsole,chardev=virtiocon0
.PHONY: run-qemu

run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-vhost-user-net start-virtiofsd
	rm -f build/vmm.sock build/vsock.sock
	@../../scripts/run-cloud-hypervisor.sh \
	    --api-socket path=build/vmm.sock \
	    --memory size=1G,shared=on \
	    --disk path=$(imgdir)/appvm/blk/root.img,readonly=on \
	    --fs tag=virtiofs0,socket=build/virtiofsd.sock \
	    --gpu socket=build/vhost-user-gpu.sock \
	    --vsock cid=3,socket=build/vsock.sock \
	    --net mac=02:00:00:00:00:01,vhost_user=on,socket=build/vhost-user-net.sock \
	    --kernel $(KERNEL) \
	    --cmdline "root=PARTLABEL=root" \
	    --console tty \
	    --serial file=build/serial.log
.PHONY: run-cloud-hypervisor

run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
	../../scripts/with-taps.elb $(CROSVM_RUN) \
	    --disk $(imgdir)/appvm/blk/root.img \
	    -p "console=ttyS0 root=PARTLABEL=root" \
	    --net tap-name=tap0,mac=02:00:00:00:00:01 \
	    --vhost-user fs,socket=build/virtiofsd.sock \
	    --vhost-user gpu,socket=build/vhost-user-gpu.sock \
	    --vsock cid=3 \
	    --serial type=file,hardware=serial,path=build/serial.log \
	    --serial type=stdout,hardware=virtio-console,stdin=true \
	    $(KERNEL)
.PHONY: run-crosvm

run: run-$(VMM)
.PHONY: run

clean:
	rm -rf build
.PHONY: clean

debug log:

solving f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea ...
found f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea in https://inbox.spectrum-os.org/spectrum-devel/20251121-updates-v4-4-d4561c42776e@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v4-2-40c438d2dcaf@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v5-2-fd746748febd@gmail.com/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-4-b88a99915509@gmail.com/
found 48eba871339d314479f730101246ace3fa39e2db in https://spectrum-os.org/git/spectrum
preparing index
index prepared:
100644 48eba871339d314479f730101246ace3fa39e2db	img/app/Makefile

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20251121-updates-v4-4-d4561c42776e@gmail.com/
diff --git a/img/app/Makefile b/img/app/Makefile
index 48eba871339d314479f730101246ace3fa39e2db..f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea 100644

Checking patch img/app/Makefile...
Applied patch img/app/Makefile cleanly.

skipping https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v4-2-40c438d2dcaf@gmail.com/ for f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea
skipping https://inbox.spectrum-os.org/spectrum-devel/20251126-updates-v5-2-fd746748febd@gmail.com/ for f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea
skipping https://inbox.spectrum-os.org/spectrum-devel/20251119-updates-v3-4-b88a99915509@gmail.com/ for f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea
index at:
100644 f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea	img/app/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).