2018-10-16 09:01:38 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-12-23 23:53:22 +00:00
|
|
|
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
|
|
|
cd "$script_path"
|
|
|
|
|
2019-12-22 14:55:52 +00:00
|
|
|
#SERENITY_PACKET_LOGGING_ARG="-object filter-dump,id=hue,netdev=breh,file=e1000.pcap"
|
2019-11-05 17:56:13 +00:00
|
|
|
|
2019-11-04 12:03:33 +00:00
|
|
|
[ -e /dev/kvm -a -r /dev/kvm -a -w /dev/kvm ] && SERENITY_KVM_ARG="-enable-kvm"
|
|
|
|
|
2019-12-23 21:07:29 +00:00
|
|
|
[ -z "$SERENITY_BOCHS_BIN" ] && SERENITY_BOCHS_BIN="bochs"
|
|
|
|
|
2019-05-04 00:51:50 +00:00
|
|
|
[ -z "$SERENITY_QEMU_BIN" ] && SERENITY_QEMU_BIN="qemu-system-i386"
|
|
|
|
|
2019-06-16 12:05:07 +00:00
|
|
|
[ -z "$SERENITY_KERNEL_CMDLINE" ] && SERENITY_KERNEL_CMDLINE="hello"
|
2019-06-02 07:50:18 +00:00
|
|
|
|
2019-11-01 22:46:39 +00:00
|
|
|
[ -z "$SERENITY_RAM_SIZE" ] && SERENITY_RAM_SIZE=128M
|
|
|
|
|
2019-11-01 23:01:45 +00:00
|
|
|
[ -z "$SERENITY_COMMON_QEMU_ARGS" ] && SERENITY_COMMON_QEMU_ARGS="
|
|
|
|
$SERENITY_EXTRA_QEMU_ARGS
|
|
|
|
-s -m $SERENITY_RAM_SIZE
|
2019-12-25 14:18:09 +00:00
|
|
|
-cpu max
|
2019-11-01 23:01:45 +00:00
|
|
|
-d cpu_reset,guest_errors
|
|
|
|
-device VGA,vgamem_mb=64
|
|
|
|
-hda _disk_image
|
|
|
|
-debugcon stdio
|
|
|
|
-soundhw pcspk
|
|
|
|
-soundhw sb16
|
|
|
|
"
|
|
|
|
|
2019-05-01 19:45:17 +00:00
|
|
|
export SDL_VIDEO_X11_DGAMOUSE=0
|
2019-03-27 12:02:29 +00:00
|
|
|
|
2019-03-11 11:43:45 +00:00
|
|
|
if [ "$1" = "b" ]; then
|
|
|
|
# ./run b: bochs
|
2019-12-23 21:07:29 +00:00
|
|
|
$SERENITY_BOCHS_BIN -q -f .bochsrc
|
2019-03-11 11:43:45 +00:00
|
|
|
elif [ "$1" = "qn" ]; then
|
|
|
|
# ./run qn: qemu without network
|
2019-11-01 23:01:45 +00:00
|
|
|
$SERENITY_QEMU_BIN \
|
|
|
|
$SERENITY_COMMON_QEMU_ARGS \
|
2019-04-24 19:06:16 +00:00
|
|
|
-device e1000 \
|
2019-06-04 12:16:30 +00:00
|
|
|
-kernel kernel \
|
2019-11-01 23:01:45 +00:00
|
|
|
-append "${SERENITY_KERNEL_CMDLINE}"
|
2019-03-13 02:26:01 +00:00
|
|
|
elif [ "$1" = "qtap" ]; then
|
|
|
|
# ./run qtap: qemu with tap
|
2019-11-01 23:01:45 +00:00
|
|
|
sudo $SERENITY_QEMU_BIN \
|
|
|
|
$SERENITY_COMMON_QEMU_ARGS \
|
2019-11-04 12:03:33 +00:00
|
|
|
$SERENITY_KVM_ARG \
|
2019-11-05 17:56:13 +00:00
|
|
|
$SERENITY_PACKET_LOGGING_ARG \
|
2019-04-24 19:06:16 +00:00
|
|
|
-netdev tap,ifname=tap0,id=br0 \
|
|
|
|
-device e1000,netdev=br0 \
|
2019-06-04 12:16:30 +00:00
|
|
|
-kernel kernel \
|
2019-11-01 23:01:45 +00:00
|
|
|
-append "${SERENITY_KERNEL_CMDLINE}"
|
2019-06-04 12:16:30 +00:00
|
|
|
elif [ "$1" = "qgrub" ]; then
|
|
|
|
# ./run qgrub: qemu with grub
|
2019-11-01 23:01:45 +00:00
|
|
|
$SERENITY_QEMU_BIN \
|
|
|
|
$SERENITY_COMMON_QEMU_ARGS \
|
2019-11-04 12:03:33 +00:00
|
|
|
$SERENITY_KVM_ARG \
|
2019-11-05 17:56:13 +00:00
|
|
|
$SERENITY_PACKET_LOGGING_ARG \
|
2019-09-09 07:19:43 +00:00
|
|
|
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
|
2019-11-01 23:01:45 +00:00
|
|
|
-device e1000,netdev=breh
|
2019-11-13 17:29:16 +00:00
|
|
|
elif [ "$1" = "qcmd" ]; then
|
|
|
|
SERENITY_KERNEL_CMDLINE=""
|
2019-11-13 20:57:51 +00:00
|
|
|
# FIXME: Someone who knows sh syntax better, please help:
|
|
|
|
for i in `seq 2 $#`; do
|
|
|
|
shift
|
|
|
|
SERENITY_KERNEL_CMDLINE="$SERENITY_KERNEL_CMDLINE $1"
|
2019-11-13 17:29:16 +00:00
|
|
|
done
|
|
|
|
echo "Starting SerenityOS, Commandline: ${SERENITY_KERNEL_CMDLINE}"
|
|
|
|
# ./run: qemu with serenity with custom commandline
|
2019-11-01 23:01:45 +00:00
|
|
|
$SERENITY_QEMU_BIN \
|
|
|
|
$SERENITY_COMMON_QEMU_ARGS \
|
2019-10-29 15:41:40 +00:00
|
|
|
-device e1000 \
|
|
|
|
-kernel kernel \
|
2019-11-13 17:29:16 +00:00
|
|
|
-append "${SERENITY_KERNEL_CMDLINE}"
|
2019-03-13 02:26:01 +00:00
|
|
|
else
|
|
|
|
# ./run: qemu with user networking
|
2019-11-01 23:01:45 +00:00
|
|
|
$SERENITY_QEMU_BIN \
|
|
|
|
$SERENITY_COMMON_QEMU_ARGS \
|
2019-11-04 12:03:33 +00:00
|
|
|
$SERENITY_KVM_ARG \
|
2019-11-05 17:56:13 +00:00
|
|
|
$SERENITY_PACKET_LOGGING_ARG \
|
2019-09-09 07:19:43 +00:00
|
|
|
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
|
2019-03-13 16:17:07 +00:00
|
|
|
-device e1000,netdev=breh \
|
2019-06-04 12:16:30 +00:00
|
|
|
-kernel kernel \
|
2019-11-01 23:01:45 +00:00
|
|
|
-append "${SERENITY_KERNEL_CMDLINE}"
|
2019-11-04 12:03:33 +00:00
|
|
|
fi
|