liminix/scripts/run-qemu.sh

26 lines
1 KiB
Bash
Raw Normal View History

2022-09-24 22:03:26 +02:00
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p qemu
if test "$1" = "--background" ; then
socket=$2
2022-09-26 11:47:29 +02:00
pid="`dirname $socket`/`basename $socket .sock`.pid"
echo "running in background, socket is $socket, pid $pid"
flags="--daemonize --pidfile $pid -chardev socket,id=sock,path=$2,server=on,wait=off,mux=on -mon chardev=sock,mode=readline -serial chardev:sock "
2022-09-24 22:03:26 +02:00
shift;shift
else
flags="-serial mon:stdio"
fi
2022-09-27 15:06:39 +02:00
INIT=${INIT-/bin/init}
2022-10-02 11:05:28 +02:00
echo $QEMU_OPTIONS
2022-09-24 22:03:26 +02:00
qemu-system-mips \
-M malta -m 256 \
-echr 16 \
2022-09-27 15:06:39 +02:00
-append "default console=ttyS0,38400n8 panic=10 oops=panic init=$INIT loglevel=8 root=/dev/vda" \
2022-09-24 22:03:26 +02:00
-drive file=$2,format=raw,readonly=on,if=virtio \
-netdev socket,id=access,mcast=230.0.0.1:1234 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=access,mac=ba:ad:1d:ea:21:02 \
-netdev socket,id=lan,mcast=230.0.0.1:1235 \
-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=lan,mac=ba:ad:1d:ea:21:01 \
2022-10-02 11:05:28 +02:00
-kernel $1 -display none $flags ${QEMU_OPTIONS}