Skip to content

Commit 74770e4

Browse files
committed
fix(sh): fix run-qemu.sh
Signed-off-by: aLinChe <1129332011@qq.com>
1 parent fd2646c commit 74770e4

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

rootfs/init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ init_network() {
173173
echo "Hello! Here is Linux-minimal." > /var/www/index.html
174174
fi
175175
# httpd -p 80 -h /var/www
176-
sh -c "nc -lvp 2233 -e /bin/mysh &"
176+
sh -c "while true; do nc -lvp 2233 -e /bin/mysh; done &"
177177
else
178178
echo "Warning: No physical network interface found!"
179179
sleep 1

tools/BUILD_CONTAINER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1
1+
v0.11

tools/run-qemu.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/bin/bash
2+
# bash run-qemu.sh --arch x86_64 --display nographic --bios legacy --ext4 --user --prebuilt # 使用CNB预构建镜像时使用的命令
23
ARCH=""
34
# 需要根据架构调整的参数
45
APPEND_PARAMS=""
56
CMDLINE=""
67

78
QEMU_DEVICES=""
89
QEMU_DISK_IMAGE="build/disk.img"
9-
QEMU_SMP="2,cores=2,threads=1,sockets=1"
10+
QEMU_SMP="2,sockets=2,cores=1,threads=1"
1011
QEMU_MEMORY="256M"
1112
QEMU_ARGUMENT=" -smp ${QEMU_SMP} -m ${QEMU_MEMORY} "
1213

@@ -16,6 +17,7 @@ BIOS_TYPE=""
1617
TAP_DEV="tap0"
1718

1819
ONLYMAKEIMAGE=false
20+
PREBUILT=false
1921

2022
while true; do
2123
case "$1" in
@@ -95,11 +97,14 @@ while true; do
9597
ONLYMAKEIMAGE=true
9698
shift 1
9799
break;;
100+
--prebuilt)
101+
PREBUILT=true
102+
shift 1;;
98103
*) break
99104
esac
100105
done
101106

102-
if [ -z ${ARCH}]; then
107+
if [ -z ${ARCH} ]; then
103108
echo "[Error] Not Found ARCH. please add --arch [option]"
104109
exit 1
105110
fi
@@ -303,4 +308,10 @@ if [ ${ONLYMAKEIMAGE} == true ]; then
303308
exit 0
304309
fi
305310

311+
if [ ${PREBUILT} == true ]; then
312+
echo "使用预构建磁盘镜像,跳过挂载步骤"
313+
run_qemu
314+
exit 0
315+
fi
316+
306317
main

0 commit comments

Comments
 (0)