适配了macOS下的加速器

This commit is contained in:
Liric Mechan 2022-08-17 23:24:32 -04:00
parent 161c81b6cc
commit c76ccf2907

20
run.sh Normal file → Executable file
View File

@ -9,24 +9,19 @@ IN_DOCKER=0
# 第一个参数如果是--notbuild 那就不构建,直接运行 # 第一个参数如果是--notbuild 那就不构建,直接运行
if [ ! "$1" == "--nobuild" ]; then if [ ! "$1" == "--nobuild" ]; then
if [ "$1" == "--nomake" ]; then
echo "将会跳过make过程直接构建镜像..."
echo "开始构建..." echo "开始构建..."
GENERATE_ISO=1 if [ "$1" == "--docker" ]; then
elif [ "$1" == "--docker" ]; then
echo "使用docker构建" echo "使用docker构建"
echo "开始构建..."
sudo bash tools/build_in_docker.sh sudo bash tools/build_in_docker.sh
GENERATE_ISO=0 GENERATE_ISO=0
elif [ "$1" == "--current_in_docker" ]; then elif [ "$1" == "--current_in_docker" ]; then
echo "运行在docker内" echo "运行在docker内"
echo "开始构建..."
IN_DOCKER=1 IN_DOCKER=1
make all -j 16 make all -j 16
make clean make clean
GENERATE_ISO=1 GENERATE_ISO=1
else else
echo "开始构建..."
make all -j 16 make all -j 16
make clean make clean
GENERATE_ISO=1 GENERATE_ISO=1
@ -136,6 +131,11 @@ allflags=$(qemu-system-x86_64 -cpu help | awk '/flags/ {y=1; getline}; y {print}
# 调试usb的trace # 调试usb的trace
qemu_trace_usb=trace:usb_xhci_reset,trace:usb_xhci_run,trace:usb_xhci_stop,trace:usb_xhci_irq_msi,trace:usb_xhci_irq_msix,trace:usb_xhci_port_reset qemu_trace_usb=trace:usb_xhci_reset,trace:usb_xhci_run,trace:usb_xhci_stop,trace:usb_xhci_irq_msi,trace:usb_xhci_irq_msix,trace:usb_xhci_port_reset
qemu_accel=kvm
if [ "${OS}" == "Darwin" ]; then
qemu_accel=hvf
fi
if [ $flag_can_run -eq 1 ]; then if [ $flag_can_run -eq 1 ]; then
if [ ${IA32_USE_QEMU} == 0 ]; then if [ ${IA32_USE_QEMU} == 0 ]; then
bochs -q -f ${bochsrc} -rc ./tools/bochsinit bochs -q -f ${bochsrc} -rc ./tools/bochsinit
@ -143,13 +143,13 @@ if [ $flag_can_run -eq 1 ]; then
qemu-system-x86_64 -d bin/disk.img -m 512M -smp 2,cores=2,threads=1,sockets=1 \ qemu-system-x86_64 -d bin/disk.img -m 512M -smp 2,cores=2,threads=1,sockets=1 \
-boot order=d \ -boot order=d \
-monitor stdio -d cpu_reset,guest_errors,trace:check_exception,exec,cpu,out_asm,in_asm,${qemu_trace_usb} \ -monitor stdio -d cpu_reset,guest_errors,trace:check_exception,exec,cpu,out_asm,in_asm,${qemu_trace_usb} \
-s -S -cpu "IvyBridge,+apic,+x2apic,+fpu,check,${allflags}" --enable-kvm -rtc clock=host,base=localtime -serial file:serial_opt.txt \ -s -S -cpu IvyBridge,apic,x2apic,+fpu,check,${allflags} -rtc clock=host,base=localtime -serial file:serial_opt.txt \
-drive id=disk,file=bin/disk.img,if=none \ -drive id=disk,file=bin/disk.img,if=none \
-device ahci,id=ahci \ -device ahci,id=ahci \
-device ide-hd,drive=disk,bus=ahci.0 \ -device ide-hd,drive=disk,bus=ahci.0 \
-usb \ -usb \
-device qemu-xhci,id=xhci,p2=8,p3=4 -device qemu-xhci,id=xhci,p2=8,p3=4 \
-machine accel=${qemu_accel}
fi fi
else else
echo "不满足运行条件" echo "不满足运行条件"