Linux VMs on ARM64
mkdir vm && curl -L https://github.com/pluvial/vm/archive/main.tar.gz | tar xzf - --strip-components=1
mkdir vm && wget https://github.com/pluvial/vm/archive/main.tar.gz -O - | tar xzf - --strip-components=1
git clone --depth=1 https://github.com/pluvial/vm
./build.sh
# or
xcodebuild -arch arm64
$ tree build/Release
build/Release/
├── vm
├── vm.dSYM
│ └── Contents
│ ├── Info.plist
│ └── Resources
│ ├── DWARF
│ │ └── vm
│ └── Relocations
│ └── aarch64
│ └── vm.yml
└── vm.swiftmodule
├── Project
│ └── arm64-apple-macos.swiftsourceinfo
├── arm64-apple-macos.abi.json
├── arm64-apple-macos.swiftdoc
└── arm64-apple-macos.swiftmodule
9 directories, 8 files
ubuntu/setup.sh
tree ubuntu
ubuntu
├── cidata
│ ├── meta-data
│ └── user-data
├── initrd
├── noble-server-cloudimg-arm64.tar.gz
├── run.sh
├── setup.sh
├── vda.img
├── vdb.img
├── vdc.iso
├── vmlinuz
└── vmlinuz.gz
2 directories, 11 files
ubuntu/run.sh
Mount host shared directories:
sudo mkdir /mnt/host
sudo mount -t virtiofs host /mnt/host
# or add to /etc/fstab :
# host /mnt/host virtiofs defaults 0 0
In Ubuntu VM:
cd /mnt/host/cwd/alpine
sudo ./build.sh
Creates /mnt/host/cwd/vm-build
In host:
mv vm-build/* alpine
alpine/setup.sh
tree alpine
alpine
├── alpine-minirootfs.tar.gz
├── etc
│ ├── fstab
│ ├── group
│ ├── hosts
│ ├── init.d
│ │ ├── rcK
│ │ └── rcS
│ ├── inittab
│ └── passwd
├── image.sh
├── linux.config
├── linux.sh
├── linux.tar.xz
├── linux.version
├── mnt
├── root
│ ├── build.sh
│ ├── setup-podman.sh
│ └── setup-vdb.sh
├── run.sh
├── setup.sh
├── usr
│ └── share
│ └── udhcpc
│ └── default.script
├── vda.img
├── vdb.img
└── vmlinuz
8 directories, 22 files
alpine/run.sh
In VM:
apk add dropbear && reboot
In host:
alpine/ssh.sh
In VM:
./setup-vdb.sh
./setup-podman.sh
Test with:
podman run --rm -it alpine
./build.sh
Creates ~/build/vmlinuz
, can be copied to host with:
cp build/vmlinuz /mnt/host/cwd/
Clean disk images:
./clean.sh
Clean disk images, downloads, and build artifacts
./clean.sh --all
Apple sample code: