Skip to content

Commit 299d972

Browse files
committed
feat: Add interactive shell support and improve VM management
1 parent a01561e commit 299d972

File tree

14 files changed

+2521
-53
lines changed

14 files changed

+2521
-53
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
cargo version
4242
export DISK_IMG="${{ github.workspace }}/disk-aarch64.img"
4343
export VM_CONFIGS="$(pwd)/configs/vms/nimbos-aarch64-qemu-smp1.toml"
44-
./axvisor.sh run --plat ${{ matrix.plat }} --vmconfigs $VM_CONFIGS --features fs,ept-level-4 --arceos-args DISK_IMG=$DISK_IMG,BUS=mmio,BLK=y,MEM=8g
44+
./auto_interrupt.sh ./axvisor.sh run --plat ${{ matrix.plat }} --vmconfigs $VM_CONFIGS --features fs,ept-level-4 --arceos-args DISK_IMG=$DISK_IMG,BUS=mmio,BLK=y,MEM=8g
4545
4646
aarch64-generic-phytiumpi:
4747
runs-on: [self-hosted, linux, phytiumpi]
@@ -135,4 +135,4 @@ jobs:
135135
cargo version
136136
export DISK_IMG="${{ github.workspace }}/disk-x86_64.img"
137137
export VM_CONFIGS="$(pwd)/configs/vms/nimbos-x86_64-qemu-smp1.toml"
138-
./axvisor.sh run --plat ${{ matrix.plat }} --vmconfigs $VM_CONFIGS --features fs --arceos-args DISK_IMG=$DISK_IMG,BLK=y
138+
./auto_interrupt.sh ./axvisor.sh run --plat ${{ matrix.plat }} --vmconfigs $VM_CONFIGS --features fs --arceos-args DISK_IMG=$DISK_IMG,BLK=y

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ lazyinit = "0.2"
2828
log = "=0.4.21"
2929
spin = "0.9"
3030
timer_list = "0.1.0"
31+
lazy_static = { version = "1.5", default-features = false, features = ["spin_no_std"] }
3132

3233
# System dependent modules provided by ArceOS.
3334
axstd = {git = "https://github.com/arceos-hypervisor/arceos.git", tag = "hv-0.3.1", features = [

auto_interrupt.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
if [ $# -eq 0 ]; then
4+
echo "用法: $0 <命令> [参数...]"
5+
echo "示例: $0 ostool run uboot"
6+
exit 1
7+
fi
8+
9+
COMMAND=("$@")
10+
echo "执行命令: ${COMMAND[*]}"
11+
12+
"${COMMAND[@]}" 2>&1 | while IFS= read -r line; do
13+
echo "输出: $line"
14+
15+
if [[ "$line" == *"[OK] Default guest initialized"* ]]; then
16+
echo "检测到Shell就绪信号!发送中断信号..."
17+
18+
PROCESS_NAME=$(basename "${COMMAND[0]}")
19+
PIDS=$(pgrep -f "${COMMAND[0]}")
20+
21+
for PID in $PIDS; do
22+
echo "发送 SIGINT 到进程 $PID"
23+
kill -INT "$PID" 2>/dev/null
24+
done
25+
26+
break
27+
fi
28+
done
29+
30+
echo "完成"

configs/vms/arceos-aarch64-e2000-smp2.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ image_location = "memory"
2323
# The load address of the kernel image.
2424
kernel_load_addr = 0x20_2008_0000
2525
## The file path of the kernel image.
26-
kernel_path = "/path/to/arceos_aarch64-dyn_smp1.bin"
26+
kernel_path = "/guest/arceos/arceos_aarch64-dyn_smp2.bin"
2727
## The file path of the device tree blob (DTB).
2828
dtb_load_addr = 0x20_2000_0000
2929
#dtb_path = "/path/to/axvisor/configs/vms/arceos-aarch64-e2000_smp2.dtb"

configs/vms_bkp/arceos-aarch64.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ phys_cpu_sets = [2]
2020
entry_point = 0x4020_0000
2121
# The location of image: "memory" | "fs".
2222
# Load from file system.
23-
image_location = "memory"
23+
image_location = "fs"
2424
# The file path of the kernel image.
25-
kernel_path = "path/to/kernel"
25+
kernel_path = "helloworld_aarch64-qemu-virt.bin"
2626
# The load address of the kernel image.
2727
kernel_load_addr = 0x4020_0000
2828
## Load from memory

src/main.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#![no_std]
22
#![no_main]
33

4+
use std::println;
5+
46
#[macro_use]
57
extern crate log;
8+
69
#[macro_use]
710
extern crate alloc;
811

@@ -17,6 +20,9 @@ extern crate axplat_aarch64_roc_rk3568_pc;
1720
#[cfg(feature = "plat-x86-qemu-q35")]
1821
extern crate axplat_x86_qemu_q35;
1922

23+
#[cfg(feature = "fs")]
24+
mod shell;
25+
2026
mod hal;
2127
mod logo;
2228
mod task;
@@ -33,5 +39,8 @@ fn main() {
3339
vmm::init();
3440
vmm::start();
3541

36-
info!("VMM shutdown");
42+
println!("[OK] Default guest initialized");
43+
44+
#[cfg(feature = "fs")]
45+
shell::console_init();
3746
}

0 commit comments

Comments
 (0)