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

.POSIX:

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

prefix = build/host
libdir = $(prefix)/lib
vmdir = $(libdir)/spectrum/vm

VMM = cloud-hypervisor

HOST_BUILD_FILES = \
	$(vmdir)/netvm/blk/root.img \
	$(vmdir)/netvm/vmlinux

all: $(HOST_BUILD_FILES)
.PHONY: all

$(vmdir)/netvm/vmlinux: $(KERNEL)
	mkdir -p $$(dirname $@)
	cp $(KERNEL) $@

$(vmdir)/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../scripts/sfdisk-field.awk build/rootfs.erofs
	mkdir -p $$(dirname $@)
	../../../scripts/make-gpt.sh $@.tmp \
	    build/rootfs.erofs:root:ea21da27-0391-48da-9235-9d2ab2ca7844:root
	mv $@.tmp $@

DIRS = dev etc/s6-linux-init/env proc run sys

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
	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) ;\
	} | ../../../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-net:
	mkdir -p build
	../../../scripts/start-passt.elb
.PHONY: start-vhost-user-net

run-qemu: $(vmdir)/netvm/blk/root.img
	@../../../scripts/run-qemu.sh -m 256 -cpu max -kernel $(KERNEL) -vga none \
	    -drive file=$(vmdir)/netvm/blk/root.img,if=virtio,format=raw,readonly=on \
	    -append "root=PARTLABEL=root nokaslr" \
	    -gdb unix:build/gdb.sock,server,nowait \
	    -netdev user,id=net0 \
	    -device e1000e,netdev=net0 \
	    -netdev user,id=net1 \
	    -device virtio-net,netdev=net1,mac=02:01:00:00:00:01 \
	    -parallel none \
	    -chardev vc,id=virtiocon0 \
	    -device virtio-serial-pci \
	    -device virtconsole,chardev=virtiocon0
.PHONY: run-qemu

run-cloud-hypervisor: $(vmdir)/netvm/blk/root.img start-vhost-user-net
	rm -f build/vmm.sock
	@../../../scripts/with-taps.elb \
	    ../../../scripts/run-cloud-hypervisor.sh \
	    --api-socket path=build/vmm.sock \
	    --memory size=256M,shared=on \
	    --disk path=$(vmdir)/netvm/blk/root.img,readonly=on \
	    --net vhost_user=on,socket=build/vhost-user-net.sock tap=tap1,mac=02:01:00:00:00:01 \
	    --kernel $(KERNEL) \
	    --cmdline "root=PARTLABEL=root" \
	    --console tty \
	    --serial file=build/serial.log
.PHONY: run-cloud-hypervisor

run-crosvm: $(vmdir)/netvm/blk/root.img start-vhost-user-net
	../../../scripts/with-taps.elb $(CROSVM_RUN) \
	    -b path=$(vmdir)/netvm/blk/root.img,ro=true \
	    -p "console=ttyS0 root=PARTLABEL=root" \
	    --vhost-user net,socket=build/vhost-user-net.sock \
	    --net tap-name=tap1,mac=02:01:00:00:00:01 \
	    --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 e37fe8ca161106f9c6492b2f8b5d68d48ae945de ...
found e37fe8ca161106f9c6492b2f8b5d68d48ae945de in https://spectrum-os.org/git/spectrum

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