environment/bin/vm-cmd

222 lines
8.8 KiB
Text
Raw Normal View History

2025-08-26 17:50:38 +02:00
#!/usr/bin/env bash
rm -rf /Volumes/Cache/vms/image/win11-arm64/win11/code.fd
rm -rf /Volumes/Cache/vms/image/win11-arm64/win11/vars.fd
cp /opt/homebrew/share/qemu/edk2-aarch64-code.fd /Volumes/Cache/vms/image/win11-arm64/win11/code.fd
cp /opt/homebrew/share/qemu/edk2-arm-vars.fd /Volumes/Cache/vms/image/win11-arm64/win11/vars.fd
2025-08-26 17:50:38 +02:00
# brew install qemu swtpm
# qemu-system-aarch64 -drive if=pflash,format=raw,unit=0,readonly=on,file=/Volumes/Cache/vms/image/win11-arm64/win11/code.fd -drive if=pflash,format=raw,unit=1,file=/Volumes/Cache/vms/image/win11-arm64/win11/vars.fd -display cocoa -device qemu-xhci,id=xhci -device usb-kbd -device usb-tablet -device virtio-keyboard-device -device virtio-mouse-device -device virtio-gpu -device virtio-net,netdev=n0 -netdev user,id=n0 -accel hvf -machine virt -cpu max -m 16384 -smp 6 -name FirstVM -boot order=d -drive file=/Volumes/Cache/vms/image/win11-arm64/win11/root.img,if=virtio,cache=writeback,format=raw,id=nvme0 -drive id=cd,format=raw,file=/Volumes/Cache/downloads/win11arm64.iso,media=cdrom -device usb-storage,drive=cd,bootindex=1 -device ramfb -chardev socket,id=chrtpm,path=/Users/agurgul/Downloads/tpm/tpm.sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0
# vm setup win11 --tpm --cdrom /Volumes/Cache/downloads/win11arm64.iso
# qemu-system-aarch64 -drive if=pflash,format=raw,unit=0,readonly=on,file=/Volumes/Cache/vms/image/win11-arm64/win11/code.fd -drive if=pflash,format=raw,unit=1,file=/Volumes/Cache/vms/image/win11-arm64/win11/vars.fd -display cocoa -device qemu-xhci,id=xhci -device usb-kbd -device usb-tablet -device virtio-keyboard-device -device virtio-mouse-device -device virtio-gpu -device virtio-net,netdev=n0 -netdev user,id=n0 -accel hvf -machine virt -cpu max -m 16384 -smp 6 -name FirstVM -boot order=d -drive file=/Volumes/Cache/vms/image/win11-arm64/win11/root.img,if=virtio,cache=writeback,format=raw,id=nvme0 -drive id=cd,format=raw,file=/Volumes/Cache/downloads/win11arm64.iso,media=cdrom -device usb-storage,drive=cd,bootindex=1 -device ramfb -chardev socket,id=chrtpm,path=/Users/agurgul/Downloads/tpm/tpm.sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0
# -netdev user,id=net0,hostfwd=tcp::33890-:3389,hostfwd=tcp::59850-:5985 \
# -machine virt,accel=hvf,highmem=off \
# -device virtio-keyboard-pci \
# -device virtio-tablet-pci \
# -device ich9-ahci,id=ahci0 \
# -device ide-hd,drive=drv0,bus=ahci0.0 \
2025-08-26 17:50:38 +02:00
# -device nvme,drive=drv0,serial=nvme0
# -boot order=d \
# -device usb-storage,drive=udisk,port=3\
# wget http://http.us.debian.org/debian/pool/main/e/edk2/qemu-efi-aarch64_2025.02-8_all.deb
# qemu-system-aarch64 \
# -machine virt,accel=hvf \
# -cpu host -smp 6 -m 8G \
# --boot order=d,menu=on \
# -bios /Users/artur/Downloads/tpm/QEMU_EFI.fd \
# -device qemu-xhci,id=xhci \
# \
# -drive file=/Volumes/Cache/vms/image/win11-arm64/win11/root.img,format=raw \
# \
# -device virtio-scsi-pci,id=scsi0 \
# -drive file=/Volumes/Cache/downloads/win11arm64.iso,if=none,media=cdrom,id=cd0 \
# -device scsi-cd,drive=cd0,bus=scsi0.0,bootindex=1 \
# -device ramfb \
# -device usb-kbd,bus=xhci.0,port=1 \
# -device usb-tablet,bus=xhci.0,port=2 \
# -netdev user,id=net0,hostfwd=tcp::35890-:3589 \
# -device virtio-net-pci,netdev=net0 \
# -chardev socket,id=chrtpm,path=/Users/artur/Downloads/tpm/tpm.sock \
# -tpmdev emulator,id=tpm0,chardev=chrtpm \
# -device tpm-tis-device,tpmdev=tpm0 \
# -monitor stdio
2025-08-26 17:50:38 +02:00
# in Shell
# FS0:
# cd EFI\BOOT
# BOOTAA64.EFI
# Disk driver: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/
# Used: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.271-1/
# Attempt 1
# qemu-system-aarch64 \
# -machine virt,accel=hvf \
# -cpu host -smp 6 -m 8G \
# --boot order=d,menu=on \
# -drive if=pflash,format=raw,file=/Volumes/Cache/vms/image/win11-arm64/win11/code.fd,readonly=on \
# -drive if=pflash,format=raw,file=/Volumes/Cache/vms/image/win11-arm64/win11/vars.fd \
# -drive file=/Volumes/Cache/vms/image/win11-arm64/win11/root.img,if=none,format=raw,id=drv0 \
# -device nvme,drive=drv0,serial=nvme0 \
# -device virtio-scsi-pci,id=scsi0 \
# -drive file=/Volumes/Cache/downloads/win11arm64.iso,if=none,media=cdrom,id=cd0 \
# -device scsi-cd,drive=cd0,bus=scsi0.0,bootindex=1 \
# -device ramfb \
# -device qemu-xhci,id=xhci \
# -device usb-kbd,bus=xhci.0,port=1 \
# -device usb-tablet,bus=xhci.0,port=2 \
# -netdev user,id=net0,hostfwd=tcp::33890-:3389 \
# -device virtio-net-pci,netdev=net0 \
# -chardev socket,id=chrtpm,path=/Users/artur/Downloads/tpm/tpm.sock \
# -tpmdev emulator,id=tpm0,chardev=chrtpm \
# -device tpm-tis-device,tpmdev=tpm0 \
# -monitor stdio
# Attempt 2
# qemu-system-aarch64 \
# -machine virt,accel=hvf \
# -cpu host -smp 6 -m 8G \
# --boot order=d,menu=on \
# -drive if=pflash,format=raw,file=/Volumes/Cache/vms/image/win11-arm64/win11/code.fd,readonly=on \
# -drive if=pflash,format=raw,file=/Volumes/Cache/vms/image/win11-arm64/win11/vars.fd \
# -drive file=/Volumes/Cache/vms/image/win11-arm64/win11/root.img,if=none,format=raw,id=drv0 \
# -device ich9-ahci,id=ahci0 \
# -device ide-hd,drive=drv0,bus=ahci0.0 \
# -device virtio-scsi-pci,id=scsi0 \
# -drive file=/Volumes/Cache/downloads/win11arm64.iso,if=none,media=cdrom,id=cd0 \
# -device scsi-cd,drive=cd0,bus=scsi0.0,bootindex=1 \
# -device ramfb \
# -device qemu-xhci,id=xhci \
# -device usb-kbd,bus=xhci.0,port=1 \
# -device usb-tablet,bus=xhci.0,port=2 \
# -netdev user,id=net0,hostfwd=tcp::33890-:3389 \
# -device virtio-net-pci,netdev=net0 \
# -chardev socket,id=chrtpm,path=/Users/artur/Downloads/tpm/tpm.sock \
# -tpmdev emulator,id=tpm0,chardev=chrtpm \
# -device tpm-tis-device,tpmdev=tpm0 \
# -monitor stdio
# Attempt 3
# qemu-system-aarch64 \
# -machine virt,accel=hvf \
# -cpu host -smp 6 -m 8G \
# --boot menu=on \
# \
# -drive if=pflash,format=raw,readonly=on,file=/Volumes/Cache/vms/image/win11-arm64/win11/code.fd \
# -drive if=pflash,format=raw,file=/Volumes/Cache/vms/image/win11-arm64/win11/vars.fd \
# \
# -drive if=none,file=/Volumes/Cache/vms/image/win11-arm64/win11/root.qcow2,format=qcow2,id=drv0 \
# -device nvme,drive=drv0,serial=nvme-1 \
# \
# -device qemu-xhci,id=xhci \
# -drive if=none,id=winiso,media=cdrom,readonly=on,file=/Volumes/Cache/downloads/win11arm64.iso \
# -device usb-storage,drive=winiso,bootindex=1 \
# \
# -device ramfb \
# -device usb-kbd \
# -device usb-tablet \
# -netdev user,id=net0,hostfwd=tcp::33890-:3389 \
# -device virtio-net-pci,netdev=net0 \
# \
# -chardev socket,id=chrtpm,path=/Users/artur/Downloads/tpm/tpm.sock \
# -tpmdev emulator,id=tpm0,chardev=chrtpm \
# -device tpm-tis-device,tpmdev=tpm0
# -serial mon:stdio
# File: bypass.reg
# Windows Registry Editor Version 5.00
# [HKEY_LOCAL_MACHINE\SYSTEM\Setup\LabConfig]
# "BypassTPMCheck"=dword:00000001
# "BypassSecureBootCheck"=dword:00000001
# "BypassCPUCheck"=dword:00000001
# "BypassRAMCheck"=dword:00000001
# hdiutil makehybrid -iso -joliet -o bypass.iso bypass.reg
# Shift+F10
# reg import D:\bypass.reg
## Build EDK2
# brew install nasm iasl python@3 openssl pkg-config
# brew install llvm acpica nasm
# git clone https://github.com/tianocore/edk2.git
# cd edk2
# git submodule update --init
# make -C BaseTools
# source ./edksetup.sh
# export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
# build -a X64 \
# -t XCODE5 \
# -p OvmfPkg/OvmfPkgX64.dsc \
# -D SECURE_BOOT_ENABLE=TRUE
# build -a AARCH64 \
# -t XCODE5 \
# -p ArmVirtPkg/ArmVirtQemu.dsc \
# -D SECURE_BOOT_ENABLE=TRUE
# build -a AARCH64 \
# -t CLANGDWARF \
# -p ArmVirtPkg/ArmVirtQemu.dsc \
# -D SECURE_BOOT_ENABLE=TRUE \
# -b DEBUG
# Steps moved to /bin/recipes/make-edk2
# Attempt 4
qemu-system-aarch64 \
-machine virt,accel=hvf \
-cpu host -smp 6 -m 8G \
--boot menu=on \
\
-drive if=pflash,format=raw,readonly=on,file=/Volumes/Cache/vms/image/win11-arm64/win11/QEMU_EFI-pflash.raw \
-drive if=pflash,format=raw,file=/Volumes/Cache/vms/image/win11-arm64/win11/QEMU_VARS-pflash.raw \
\
-drive if=none,file=/Volumes/Cache/vms/image/win11-arm64/win11/root.qcow2,format=qcow2,id=drv0 \
-device nvme,drive=drv0,serial=nvme-1 \
\
-device qemu-xhci,id=xhci \
-drive if=none,id=winiso,media=cdrom,readonly=on,file=/Volumes/Cache/downloads/win11arm64.iso \
-device usb-storage,drive=winiso,bootindex=1 \
\
-device ramfb \
-device usb-kbd \
-device usb-tablet \
-netdev user,id=net0,hostfwd=tcp::33890-:3389 \
-device virtio-net-pci,netdev=net0 \
\
-chardev socket,id=chrtpm,path=/Users/artur/Downloads/tpm/tpm.sock \
-tpmdev emulator,id=tpm0,chardev=chrtpm \
-device tpm-tis-device,tpmdev=tpm0