Skip to content

Instantly share code, notes, and snippets.

@doevelopper
Created November 14, 2017 23:54
Show Gist options
  • Save doevelopper/d2dfc8fdd708d59bac5ea5f7ab6fe92c to your computer and use it in GitHub Desktop.
Save doevelopper/d2dfc8fdd708d59bac5ea5f7ab6fe92c to your computer and use it in GitHub Desktop.
#!/bin/bash
#./qemu-x86_64.sh ~/linux/arch/x86/boot/bzImage ~/buildroot/output/images/rootfs.cpio.
kernel=$1
initrd=$2
if [ -z $kernel ]; then
echo "pass the kernel argument"
exit 1
fi
if [ -z $initrd ]; then
echo "pass the initrd argument"
exit 1
fi
kvm=(
qemu-system-x86_64
-enable-kvm
-cpu kvm64,+rdtscp
-kernel $kernel
-m 300
-device e1000,netdev=net0
-netdev user,id=net0
-boot order=nc
-no-reboot
-watchdog i6300esb
-rtc base=localtime
-serial stdio
-vga qxl
-initrd $initrd
-spice port=5930,disable-ticketing
-s
)
append=(
hung_task_panic=1
earlyprintk=ttyS0,115200
systemd.log_level=err
debug
apic=debug
sysrq_always_enabled
rcupdate.rcu_cpu_stall_timeout=100
panic=-1
softlockup_panic=1
nmi_watchdog=panic
oops=panic
load_ramdisk=2
prompt_ramdisk=0
console=tty0
console=ttyS0,115200
vga=normal
root=/dev/ram0
rw
drbd.minor_count=8
)
# arm64 {
# qemu-system-aarch64 \
# -s \
# -machine virt \
# -cpu cortex-a57 \
# -smp 4 \
# -machine type=virt \
# -nographic \
# -m 2048 \
# -kernel ~/arm64_kernel/arch/arm64/boot/Image \
# --append "console=ttyAMA0" \
# -initrd ~/buildroot/output/images/rootfs.cpi
# }
# qemu-system-x86_64 \
# -enable-kvm \
# -bios OVMF.fd \
# -smp sockets=1,cpus=2,cores=1 -cpu host \
# -m 2048 \
# -usb -usbdevice tablet \
# -vga qxl -device virtio-serial-pci \
# -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
# -chardev spicevmc,id=spicechannel0,name=vdagent \
# -spice port=5930,disable-ticketing \
# -drive file="$IMAGE",if=virtio,aio=threads,format=raw \
# -netdev user,id=mynet0,hostfwd=tcp::${VMN}0022-:22,hostfwd=tcp::${VMN}2375-:2375 \
# -device virtio-net-pci,netdev=mynet0 \
# -debugcon file:debug.log -global isa-debugcon.iobase=0x402 $@
"${kvm[@]}" --append "${append[*]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment