-
Notifications
You must be signed in to change notification settings - Fork 2
/
lkd_run_qemu.sh
executable file
·26 lines (20 loc) · 996 Bytes
/
lkd_run_qemu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#/usr/bin/env bash
if [[ $# -eq 1 && $1 == "debug" ]]
then
DEBUG="-s -S"
else
DEBUG=""
fi
if [[ -n "$(ss -ln | grep '^tcp.*:2222')" ]]
then
echo "port 2222 is already in use! change the port or stop the corresponding process"
exit 1
fi
# w/ KVM support
# does not quite work: https://lkml.iu.edu/hypermail/linux/kernel/2103.2/00282.html
# single-stepping gets interrupted by e.g. timers
# qemu-system-x86_64 -kernel arch/x86_64/boot/bzImage -append "root=/dev/sda rw console=ttyS0 nokaslr" -drive file=./lkd_qemu_image.qcow2,format=raw --enable-kvm -cpu host --nographic -m 4096 -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:2222-:22 -smp 1 $DEBUG |& tee lkd_vm.log
# w/o KVM support
qemu-system-x86_64 -kernel arch/x86_64/boot/bzImage -append "root=/dev/sda rw console=ttyS0 nokaslr" -drive file=./lkd_qemu_image.qcow2,format=raw --nographic -m 4096 -net nic,model=e1000 -net user,hostfwd=tcp:127.0.0.1:2222-:22 -smp 1 $DEBUG |& tee lkd_vm.log
# reset the terminal
reset