Created
May 8, 2020 01:40
-
-
Save codehz/980c417f26e28cce027d77dbd14edadb to your computer and use it in GitHub Desktop.
Run qemu with 9p rootfs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
kernel="${kernel:-kernel}" | |
initrd="${initrd:-initramfs.cpio.gz}" | |
target="$1" | |
shift | |
nsroot -xpf -- qemu-system-x86_64 \ | |
-enable-kvm \ | |
-m 1G \ | |
-smp 2 \ | |
-cpu host \ | |
-kernel $kernel \ | |
-initrd $initrd \ | |
-fsdev local,id=fsdev0,path=$target,security_model=passthrough \ | |
-device virtio-9p-pci,fsdev=fsdev0,mount_tag=root \ | |
-device virtio-rng-pci \ | |
-net nic,model=virtio-net-pci -net user \ | |
-append "quiet" \ | |
"$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment