mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-28 03:43:23 +00:00
Remove the vars mechanism in OSDK and polish documents
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
56175f63df
commit
cc4111cab2
@ -2,15 +2,19 @@
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
# This script is used to generate QEMU arguments for OSDK.
|
||||
# The positional argument $1 is the scheme.
|
||||
# A switch "-ovmf" can be passed as an argument to enable OVMF.
|
||||
|
||||
RAND_PORT_NUM1=$(shuf -i 1024-65535 -n 1)
|
||||
RAND_PORT_NUM2=$(shuf -i 1024-65535 -n 1)
|
||||
|
||||
echo "Forwarded QEMU guest port: $RAND_PORT_NUM1->22; $RAND_PORT_NUM2->8080" 1>&2
|
||||
echo "[$1] Forwarded QEMU guest port: $RAND_PORT_NUM1->22; $RAND_PORT_NUM2->8080" 1>&2
|
||||
|
||||
COMMON_QEMU_ARGS="\
|
||||
-cpu Icelake-Server,+x2apic \
|
||||
-smp $SMP \
|
||||
-m $MEM \
|
||||
-smp ${SMP:-1} \
|
||||
-m ${MEM:-2G} \
|
||||
--no-reboot \
|
||||
-nographic \
|
||||
-display none \
|
||||
@ -20,10 +24,18 @@ COMMON_QEMU_ARGS="\
|
||||
-netdev user,id=net01,hostfwd=tcp::$RAND_PORT_NUM1-:22,hostfwd=tcp::$RAND_PORT_NUM2-:8080 \
|
||||
-object filter-dump,id=filter0,netdev=net01,file=virtio-net.pcap \
|
||||
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \
|
||||
-drive if=none,format=raw,id=x0,file=$EXT2_IMG \
|
||||
-drive if=none,format=raw,id=x1,file=$EXFAT_IMG \
|
||||
-drive if=none,format=raw,id=x0,file=./regression/build/ext2.img \
|
||||
-drive if=none,format=raw,id=x1,file=./regression/build/exfat.img \
|
||||
"
|
||||
|
||||
if [ "$1" = "iommu" ]; then
|
||||
IOMMU_DEV_EXTRA=",iommu_platform=on,ats=on"
|
||||
IOMMU_EXTRA_ARGS="\
|
||||
-device intel-iommu,intremap=on,device-iotlb=on \
|
||||
-device ioh3420,id=pcie.0,chassis=1\
|
||||
"
|
||||
fi
|
||||
|
||||
QEMU_ARGS="\
|
||||
$COMMON_QEMU_ARGS \
|
||||
-machine q35,kernel-irqchip=split \
|
||||
@ -49,13 +61,14 @@ MICROVM_QEMU_ARGS="\
|
||||
-device virtconsole,chardev=mux \
|
||||
"
|
||||
|
||||
if [ "$MICROVM" ]; then
|
||||
if [ "$1" = "microvm" ]; then
|
||||
QEMU_ARGS=$MICROVM_QEMU_ARGS
|
||||
echo $QEMU_ARGS
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$OVMF_PATH" ]; then
|
||||
if [ "$1" = "-ovmf" ] || [ "$2" = "-ovmf" ]; then
|
||||
OVMF_PATH="/usr/share/OVMF"
|
||||
QEMU_ARGS="${QEMU_ARGS}\
|
||||
-drive if=pflash,format=raw,unit=0,readonly=on,file=$OVMF_PATH/OVMF_CODE.fd \
|
||||
-drive if=pflash,format=raw,unit=1,file=$OVMF_PATH/OVMF_VARS.fd \
|
||||
|
Reference in New Issue
Block a user