Skip to content

Commit 3638617

Browse files
authored
Merge pull request #1 from anyvm-org/dev
sync
2 parents ffe08e7 + e26ee0a commit 3638617

File tree

4 files changed

+88
-22
lines changed

4 files changed

+88
-22
lines changed

.github/workflows/freebsd.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ jobs:
2626
matrix:
2727
release: ["13.2", "13.3", "13.4", "13.5", "14.0", "14.1", "14.2", "14.3", "15.0"]
2828
arch: ["aarch64", ""]
29-
runs: ["ubuntu-24.04"]
29+
runs: ["ubuntu-24.04", "ubuntu-24.04-arm"]
3030
exclude:
3131
- release: 12.4
3232
arch: aarch64
3333
- release: 13.2
3434
arch: aarch64
3535
- release: 14.0
3636
arch: aarch64
37+
- runs: ubuntu-24.04-arm
38+
arch: ""
3739

3840

3941
uses: ./.github/workflows/testrun.yml
@@ -70,3 +72,20 @@ jobs:
7072
arch: ${{ matrix.arch }}
7173
sync: nfs
7274

75+
testscp-riscv64:
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
release: ["13.5", "14.2", "14.3", "15.0"]
80+
arch: ["riscv64"]
81+
runs: ["ubuntu-24.04"]
82+
83+
84+
uses: ./.github/workflows/testrun.yml
85+
secrets: inherit
86+
with:
87+
runs: ${{ matrix.runs }}
88+
os: freebsd
89+
release: ${{ matrix.release }}
90+
arch: ${{ matrix.arch }}
91+
sync: scp

.github/workflows/openbsd.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ jobs:
6868
matrix:
6969
release: ["7.7", "7.8"]
7070
arch: ["aarch64", ""]
71-
runs: ["ubuntu-24.04"]
71+
runs: ["ubuntu-24.04", "ubuntu-24.04-arm"]
72+
exclude:
73+
- runs: ubuntu-24.04-arm
74+
arch: ""
7275

7376
uses: ./.github/workflows/testrun.yml
7477
secrets: inherit
@@ -85,7 +88,10 @@ jobs:
8588
matrix:
8689
release: ["7.7", "7.8"]
8790
arch: ["aarch64", ""]
88-
runs: ["ubuntu-24.04"]
91+
runs: ["ubuntu-24.04", "ubuntu-24.04-arm"]
92+
exclude:
93+
- runs: ubuntu-24.04-arm
94+
arch: ""
8995

9096
uses: ./.github/workflows/testrun.yml
9197
secrets: inherit
@@ -95,4 +101,21 @@ jobs:
95101
release: ${{ matrix.release }}
96102
arch: ${{ matrix.arch }}
97103
sync: "nfs"
98-
104+
105+
106+
testscp-riscv64:
107+
strategy:
108+
fail-fast: false
109+
matrix:
110+
release: ["7.7", "7.8"]
111+
arch: ["riscv64"]
112+
runs: ["ubuntu-24.04"]
113+
114+
uses: ./.github/workflows/testrun.yml
115+
secrets: inherit
116+
with:
117+
runs: ${{ matrix.runs }}
118+
os: openbsd
119+
release: ${{ matrix.release }}
120+
arch: ${{ matrix.arch }}
121+
sync: "scp"

.github/workflows/testrun.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ jobs:
5959
qemu-utils \
6060
ca-certificates \
6161
qemu-system-x86 \
62-
qemu-system-arm qemu-efi-aarch64 qemu-system-misc nfs-kernel-server rsync
62+
qemu-system-arm qemu-efi-aarch64 \
63+
qemu-system-misc u-boot-qemu ipxe-qemu \
64+
nfs-kernel-server rsync
6365
sudo chmod 666 /dev/kvm || true
6466
6567
- name: Install dependencies (macOS)

anyvm.py

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def urlretrieve(url, filename, reporthook=None):
8080
"solaris": "2.0.0",
8181
"omnios": "2.0.3",
8282
"haiku": "0.0.2",
83-
"openindiana": "2.0.0"
83+
"openindiana": "2.0.1"
8484
}
8585

8686
VERSION_TOKEN_RE = re.compile(r"[0-9]+|[A-Za-z]+")
@@ -2275,7 +2275,7 @@ def sync_scp(ssh_cmd, vhost, vguest, sshport, hostid_file, ssh_user):
22752275
"-o", "StrictHostKeyChecking=no",
22762276
"-o", "UserKnownHostsFile={}".format(SSH_KNOWN_HOSTS_NULL),
22772277
"-o", "LogLevel=ERROR",
2278-
] + sources + ["{}@localhost:".format(ssh_user) + vguest + "/"])
2278+
] + sources + ["{}@127.0.0.1:".format(ssh_user) + vguest + "/"])
22792279

22802280
if subprocess.call(cmd) != 0:
22812281
log("Warning: SCP sync failed.")
@@ -3023,7 +3023,10 @@ def find_image_link(releases, target_zst, target_xz):
30233023
if config['nc']:
30243024
net_card = config['nc']
30253025
else:
3026-
net_card = "e1000"
3026+
if config['arch'] == "aarch64":
3027+
net_card = "virtio-net-pci"
3028+
else:
3029+
net_card = "e1000"
30273030
if config['os'] == "openbsd" and config['release']:
30283031
release_base = config['release'].split('-')[0]
30293032
if release_base in OPENBSD_E1000_RELEASES:
@@ -3075,20 +3078,28 @@ def find_image_link(releases, target_zst, target_xz):
30753078
accel = "kvm"
30763079
else:
30773080
log("Warning: /dev/kvm exists but is not writable. Falling back to TCG.")
3078-
elif platform.system() == "Darwin" and hvf_supported():
3079-
accel = "hvf"
3081+
elif platform.system() == "Darwin":
3082+
# On Apple Silicon, HVF is available if we're on aarch64 host AND the system supports it
3083+
if host_arch == "aarch64" and hvf_supported():
3084+
accel = "hvf"
3085+
else:
3086+
# Intel Mac trying to run aarch64 -> TCG, or HVF not supported
3087+
accel = "tcg"
30803088

30813089
if config['cputype']:
30823090
cpu = config['cputype']
30833091
else:
3084-
cpu = "cortex-a72"
3085-
3086-
if accel == "kvm":
3087-
cpu = "host"
3092+
if accel in ["kvm", "hvf"]:
3093+
cpu = "host"
3094+
elif config['os'] == "openbsd":
3095+
# OpenBSD fails with "FP exception in kernel" on cpu=max
3096+
cpu = "neoverse-n1"
3097+
else:
3098+
cpu = "max"
30883099

3089-
vga_type = config['vga'] if config['vga'] else "virtio-gpu"
3090-
if vga_type == "virtio":
3091-
vga_type = "virtio-gpu"
3100+
vga_type = config['vga'] if config['vga'] else "virtio-gpu-pci"
3101+
if vga_type in ["virtio", "virtio-gpu"]:
3102+
vga_type = "virtio-gpu-pci"
30923103

30933104
args_qemu.extend([
30943105
"-machine", "virt,accel={},gic-version=3,usb=on".format(accel),
@@ -3114,8 +3125,15 @@ def find_image_link(releases, target_zst, target_xz):
31143125
"-machine", machine_opts,
31153126
"-cpu", cpu_opts,
31163127
"-device", "qemu-xhci",
3117-
"-device", "{},netdev=net0".format(net_card),
3118-
"-kernel", "/usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin",
3128+
"-device", "{},netdev=net0".format(net_card)
3129+
])
3130+
3131+
uboot_bin = "/usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin"
3132+
if not os.path.exists(uboot_bin):
3133+
fatal("RISC-V u-boot binary not found at {}.\nPlease install it: sudo apt-get install u-boot-qemu".format(uboot_bin))
3134+
3135+
args_qemu.extend([
3136+
"-kernel", uboot_bin,
31193137
"-device", "virtio-balloon-pci"
31203138
])
31213139
else:
@@ -3229,7 +3247,11 @@ def find_image_link(releases, target_zst, target_xz):
32293247
disp = port - 5900
32303248
# Add audio support if the vnc driver is available
32313249
if check_qemu_audio_backend(qemu_bin, "vnc"):
3232-
args_qemu.extend(["-device", "intel-hda", "-device", "hda-duplex"])
3250+
if config['arch'] == "aarch64":
3251+
# Use usb-audio on aarch64 to avoid intel-hda driver issues
3252+
args_qemu.extend(["-device", "usb-audio,audiodev=vnc_audio"])
3253+
else:
3254+
args_qemu.extend(["-device", "intel-hda", "-device", "hda-duplex"])
32333255
args_qemu.extend(["-audiodev", "vnc,id=vnc_audio"])
32343256
args_qemu.append("-display")
32353257
args_qemu.append("vnc={}:{},audiodev=vnc_audio".format(addr, disp))
@@ -3358,7 +3380,7 @@ def fail_with_output(reason):
33583380

33593381
def build_ssh_host_config(host_aliases):
33603382
host_spec = " ".join(str(x) for x in host_aliases if x)
3361-
host_block = "Host {}\n StrictHostKeyChecking no\n UserKnownHostsFile {}\n ConnectTimeout 10\n ConnectionAttempts 3\n User {}\n HostName localhost\n Port {}\n".format(
3383+
host_block = "Host {}\n StrictHostKeyChecking no\n UserKnownHostsFile {}\n ConnectTimeout 10\n ConnectionAttempts 3\n User {}\n HostName 127.0.0.1\n Port {}\n".format(
33623384
host_spec,
33633385
SSH_KNOWN_HOSTS_NULL,
33643386
vm_user,
@@ -3649,7 +3671,7 @@ def supports_ansi_color(stream):
36493671

36503672
ssh_base_cmd.extend([
36513673
"-p", str(config['sshport']),
3652-
"{}@localhost".format(vm_user)
3674+
"{}@127.0.0.1".format(vm_user)
36533675
])
36543676

36553677
boot_timeout_seconds = 600 # 10 minutes

0 commit comments

Comments
 (0)