Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-user:virtualization:qemu_host [2018/06/27 10:41] – [Init script] improved VM shutdown sebastian | docs:guide-user:virtualization:qemu_host [2022/05/30 09:04] (current) – [Download installer files] use https sebastian | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== OpenWrt |
| ===== Introduction ===== | ===== Introduction ===== | ||
| - | It's possible to use OpenWrt as a QEMU host and run guests on it. If you want to run OpenWrt as a QEMU guest, see [[docs: | + | It's possible to use OpenWrt as a QEMU host and run guests on it. If you want to run OpenWrt as a QEMU guest itself, see [[docs: |
| OpenWrt provides QEMU packages for ARM and x86 platforms. This article focuses on the x86 target, the networking is done via [[https:// | OpenWrt provides QEMU packages for ARM and x86 platforms. This article focuses on the x86 target, the networking is done via [[https:// | ||
| Line 42: | Line 42: | ||
| ==== Download installer files ==== | ==== Download installer files ==== | ||
| <code bash> | <code bash> | ||
| - | wget http:// | + | wget https:// |
| - | wget http:// | + | wget https:// |
| </ | </ | ||
| Both files can be savely removed after finishing the installation. | Both files can be savely removed after finishing the installation. | ||
| Line 95: | Line 95: | ||
| -daemonize &> / | -daemonize &> / | ||
| - | echo $! > $qemu_pidfile | + | / |
| - | echo "QEMU: Started VM with PID: $(cat $qemu_pidfile)" | + | echo "QEMU: Started VM with PID $(cat $qemu_pidfile)." |
| } | } | ||
| stop() { | stop() { | ||
| - | echo "QEMU: Sending ' | + | echo "QEMU: Sending ' |
| nc localhost 4444 << | nc localhost 4444 << | ||
| { " | { " | ||
| Line 106: | Line 106: | ||
| QMP | QMP | ||
| - | if [ -e /proc/$(cat $qemu_pidfile) ]; then | + | if [ -e $qemu_pidfile ]; then |
| - | echo " | + | if [ -e /proc/$(cat $qemu_pidfile) ]; then |
| - | while [ -e /proc/$(cat $qemu_pidfile) ]; do sleep 1s; done | + | echo "QEMU: Waiting for VM shutdown." |
| - | echo "VM Process $(cat $qemu_pidfile) finished" | + | while [ -e /proc/$(cat $qemu_pidfile) ]; do sleep 1s; done |
| + | echo "QEMU: VM Process $(cat $qemu_pidfile) finished." | ||
| + | else | ||
| + | echo "QEMU: Error: No VM with PID $(cat $qemu_pidfile) running." | ||
| + | fi | ||
| + | |||
| + | rm -f $qemu_pidfile | ||
| else | else | ||
| - | echo " | + | echo "QEMU: Error: $qemu_pidfile doesn' |
| fi | fi | ||
| - | |||
| - | rm $qemu_pidfile | ||
| } | } | ||
| </ | </ | ||
| Line 120: | Line 124: | ||
| Test the the script by running ''/ | Test the the script by running ''/ | ||
| If the script works as desired, enable it for every boot: ''/ | If the script works as desired, enable it for every boot: ''/ | ||
| + | |||
| + | FIXME This script needs to be ported to [[: | ||