File tree Expand file tree Collapse file tree 2 files changed +47
-12
lines changed Expand file tree Collapse file tree 2 files changed +47
-12
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,16 @@ write_diskimage-uefi:
79
79
bash -c " cd tools && bash grub_auto_install.sh && sudo bash $( ROOT_PATH) /tools/write_disk_image.sh --bios=uefi && cd .."
80
80
# 不编译,直接启动QEMU
81
81
qemu :
82
- sh -c " cd tools && bash run-qemu.sh --bios=legacy && cd .."
82
+ sh -c " cd tools && bash run-qemu.sh --bios=legacy --display=window && cd .."
83
83
# 不编译,直接启动QEMU(UEFI)
84
84
qemu-uefi :
85
- sh -c " cd tools && bash run-qemu.sh --bios=uefi && cd .."
85
+ sh -c " cd tools && bash run-qemu.sh --bios=uefi --display=window && cd .."
86
+ # 不编译,直接启动QEMU,使用VNC Display作为图像输出
87
+ qemu-vnc :
88
+ sh -c " cd tools && bash run-qemu.sh --bios=legacy --display=vnc && cd .."
89
+ # 不编译,直接启动QEMU(UEFI),使用VNC Display作为图像输出
90
+ qemu-uefi-vnc :
91
+ sh -c " cd tools && bash run-qemu.sh --bios=uefi --display=vnc && cd .."
86
92
87
93
# 编译并写入磁盘镜像
88
94
build :
@@ -107,6 +113,18 @@ run:
107
113
$(MAKE ) write_diskimage || exit 1
108
114
$(MAKE ) qemu
109
115
116
+ # uefi方式启动,使用VNC Display作为图像输出
117
+ run-uefi-vnc :
118
+ $(MAKE ) all -j $(NPROCS )
119
+ $(MAKE ) write_diskimage-uefi || exit 1
120
+ $(MAKE ) qemu-uefi-vnc
121
+
122
+ # 编译并启动QEMU,使用VNC Display作为图像输出
123
+ run-vnc :
124
+ $(MAKE ) all -j $(NPROCS )
125
+ $(MAKE ) write_diskimage || exit 1
126
+ $(MAKE ) qemu-vnc
127
+
110
128
# 在docker中编译,并启动QEMU
111
129
run-docker :
112
130
@echo " 使用docker构建并运行"
Original file line number Diff line number Diff line change 1
1
# 进行启动前检查
2
2
flag_can_run=1
3
- ARGS=` getopt -o p -l bios: -- " $@ " `
3
+ ARGS=` getopt -o p -l bios:,display: -- " $@ " `
4
4
eval set -- " ${ARGS} "
5
5
echo " $@ "
6
6
allflags=$( qemu-system-x86_64 -cpu help | awk ' /flags/ {y=1; getline}; y {print}' | tr ' ' ' \n' | grep -Ev " ^$" | sed -r ' s|^|+|' | tr ' \n' ' ,' | sed -r " s|,$||" )
@@ -36,22 +36,39 @@ QEMU_ARGUMENT="-d ${QEMU_DISK_IMAGE} -m ${QEMU_MEMORY} -smp ${QEMU_SMP} -boot or
36
36
QEMU_ARGUMENT+=" -s -S -cpu ${QEMU_CPU_FEATURES} -rtc ${QEMU_RTC_CLOCK} -serial ${QEMU_SERIAL} -drive ${QEMU_DRIVE} ${QEMU_DEVICES} "
37
37
38
38
if [ $flag_can_run -eq 1 ]; then
39
+ while true ; do
39
40
case " $1 " in
40
41
--bios)
41
- case " $2 " in
42
+ case " $2 " in
42
43
uefi) # uefi启动新增ovmf.fd固件
43
- if [ ${ARCH} == x86_64 ] ; then
44
- sudo ${QEMU} -bios arch/x86_64/efi/OVMF-pure-efi.fd ${QEMU_ARGUMENT}
45
- elif [ ${ARCH} == i386 ] ; then
46
- sudo ${QEMU} -bios arch/i386/efi/OVMF-pure-efi.fd ${QEMU_ARGUMENT}
47
- fi
44
+ BIOS_TYPE=uefi
48
45
;;
49
46
legacy)
50
- sudo ${QEMU} ${QEMU_ARGUMENT}
47
+ BIOS_TYPE=lagacy
51
48
;;
52
- esac
49
+ esac ; shift 2;;
50
+ --display)
51
+ case " $2 " in
52
+ vnc)
53
+ QEMU_ARGUMENT+=" -display vnc=:5900"
54
+ ;;
55
+ window)
56
+ ;;
57
+ esac ; shift 2;;
58
+ * ) break
59
+ esac
60
+ done
61
+
62
+ if [ ${BIOS_TYPE} == uefi ] ; then
63
+ if [ ${ARCH} == x86_64 ] ; then
64
+ sudo ${QEMU} -bios arch/x86_64/efi/OVMF-pure-efi.fd ${QEMU_ARGUMENT}
65
+ elif [ ${ARCH} == i386 ] ; then
66
+ sudo ${QEMU} -bios arch/i386/efi/OVMF-pure-efi.fd ${QEMU_ARGUMENT}
67
+ fi
68
+ else
69
+ sudo ${QEMU} ${QEMU_ARGUMENT}
70
+ fi
53
71
54
- esac
55
72
else
56
73
echo " 不满足运行条件"
57
74
fi
You can’t perform that action at this time.
0 commit comments