Skip to content

Commit e4f10ce

Browse files
author
zhengchenxiao
committed
Optimized sd.image packing scripts
1 parent 697fc9f commit e4f10ce

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
sudo add-apt-repository ppa:xmake-io/xmake -y
2020
sudo apt update
2121
sudo apt install -y nim
22-
sudo apt install -y xmake python3-pip
22+
sudo apt install -y xmake python3-pip qemu-system-aarch64
2323
pip install --upgrade pip
2424
pip install kconfiglib scons requests tqdm psutil
2525
@@ -33,11 +33,22 @@ jobs:
3333
'
3434
shell: bash
3535

36-
- name: Upload Build Artifacts
37-
uses: actions/upload-artifact@v3
36+
- name: Set file permissions
37+
run: |
38+
chmod +r ./models/rtthread.bin
39+
chmod +r ./models/build/ext4.img
40+
ls -lh ./models/build/
41+
42+
- name: Upload Build Artifacts
43+
uses: actions/upload-artifact@v4
3844
with:
3945
name: build-artifacts
4046
path: |
41-
models/rtthread.bin
42-
models/build/ext4.img
43-
retention-days: 7
47+
./models/rtthread.bin
48+
./models/build/ext4.img
49+
retention-days: 7
50+
51+
- name: Run QEMU and Execute /bin/hello
52+
run: |
53+
chmod +x ./.github/workflows/run_qemu.sh
54+
./.github/workflows/run_qemu.sh

.github/workflows/run_qemu.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# 启动 QEMU 并运行 rtthread.bin 和 ext4.img
4+
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -m 128M -smp 4 -kernel ./models/rtthread.bin -nographic \
5+
-drive if=none,file=./models/build/ext4.img,format=raw,id=blk0 \
6+
-device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
7+
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
8+
-device virtio-serial-device \
9+
-chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 \
10+
-device virtserialport,chardev=console0 \
11+
-nographic \
12+
-append "console=ttyAMA0" &
13+
14+
# 等待 10 秒钟,以便 QEMU 启动并执行 /bin/hello
15+
sleep 10
16+
17+
# 在 QEMU 虚拟机上执行 /bin/hello 任务
18+
echo "Running /bin/hello in QEMU..."
19+
telnet 127.0.0.1 4321 <<EOF
20+
/bin/hello
21+
EOF
22+
23+
# 等待 10 秒后杀死 QEMU 进程
24+
sleep 10
25+
echo "Terminating QEMU..."
26+
pkill -f "qemu-system-aarch64"

0 commit comments

Comments
 (0)