Meta: Commonize network device settings

This commit is contained in:
Tim Schumacher 2022-04-19 14:27:37 +02:00 committed by Andreas Kling
parent 44278fa5b4
commit 1878488c04
Notes: sideshowbarker 2024-07-17 11:40:10 +09:00

View file

@ -227,6 +227,17 @@ if [ -z "$SERENITY_ETHERNET_DEVICE_TYPE" ]; then
SERENITY_ETHERNET_DEVICE_TYPE="e1000"
fi
if [ "$SERENITY_ARCH" = "aarch64" ]; then
SERENITY_NETFLAGS=
SERENITY_NETFLAGS_WITH_DEFAULT_DEVICE=
else
SERENITY_NETFLAGS="-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,hostfwd=tcp:127.0.0.1:8000-10.0.2.15:8000,hostfwd=tcp:127.0.0.1:2222-10.0.2.15:22"
SERENITY_NETFLAGS_WITH_DEFAULT_DEVICE="
$SERENITY_NETFLAGS
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=breh
"
fi
# add -machine vmport=off below to run the machine with ps/2 mouse
if [ -z "$SERENITY_MACHINE" ]; then
if [ "$SERENITY_ARCH" = "aarch64" ]; then
@ -401,16 +412,14 @@ elif [ "$SERENITY_RUN" = "qgrub" ] || [ "$SERENITY_RUN" = "qextlinux" ]; then
$SERENITY_COMMON_QEMU_ARGS \
$SERENITY_VIRT_TECH_ARG \
$SERENITY_PACKET_LOGGING_ARG \
-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 \
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=breh
$SERENITY_NETFLAGS_WITH_DEFAULT_DEVICE
elif [ "$SERENITY_RUN" = "q35" ]; then
# Meta/run.sh q35: qemu (q35 chipset) with SerenityOS
echo "Starting SerenityOS with QEMU Q35 machine, Commandline: ${SERENITY_KERNEL_CMDLINE}"
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_Q35_ARGS \
$SERENITY_VIRT_TECH_ARG \
-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 \
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=breh \
$SERENITY_NETFLAGS_WITH_DEFAULT_DEVICE \
$SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
elif [ "$SERENITY_RUN" = "isapc" ]; then
@ -419,7 +428,7 @@ elif [ "$SERENITY_RUN" = "isapc" ]; then
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_ISA_PC_ARGS \
$SERENITY_VIRT_TECH_ARG \
-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 \
$SERENITY_NETFLAGS \
-device ne2k_isa,netdev=breh \
$SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
@ -429,7 +438,7 @@ elif [ "$SERENITY_RUN" = "microvm" ]; then
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_MICROVM_ARGS \
$SERENITY_VIRT_TECH_ARG \
-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 \
$SERENITY_NETFLAGS \
-device ne2k_isa,netdev=breh \
$SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
@ -438,8 +447,7 @@ elif [ "$SERENITY_RUN" = "q35grub" ]; then
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_Q35_ARGS \
$SERENITY_VIRT_TECH_ARG \
-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 \
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=breh
$SERENITY_NETFLAGS_WITH_DEFAULT_DEVICE
elif [ "$SERENITY_RUN" = "limine" ]; then
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_ARGS \
@ -464,19 +472,11 @@ elif [ "$SERENITY_RUN" = "ci" ]; then
-append "${SERENITY_KERNEL_CMDLINE}"
else
# Meta/run.sh: qemu with user networking
if [ "$SERENITY_ARCH" = "aarch64" ]; then
SERENITY_NETFLAGS=
else
SERENITY_NETFLAGS="
-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,hostfwd=tcp:127.0.0.1:8000-10.0.2.15:8000,hostfwd=tcp:127.0.0.1:2222-10.0.2.15:22 \
-device $SERENITY_ETHERNET_DEVICE_TYPE,netdev=breh \
"
fi
"$SERENITY_QEMU_BIN" \
$SERENITY_COMMON_QEMU_ARGS \
$SERENITY_VIRT_TECH_ARG \
$SERENITY_PACKET_LOGGING_ARG \
$SERENITY_NETFLAGS \
$SERENITY_NETFLAGS_WITH_DEFAULT_DEVICE \
$SERENITY_KERNEL_AND_INITRD \
-append "${SERENITY_KERNEL_CMDLINE}"
fi