Skip to content

Commit 12e3aba

Browse files
authored
feat: Add aarch64 Linux guest CI and optimize shell commands (#315)
1 parent 90b1e19 commit 12e3aba

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

.github/workflows/qemu-aarch64.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ args = [
1616
"8g",
1717
]
1818
fail_regex = []
19-
success_regex = ["Hello, world!"]
19+
success_regex = [
20+
"Hello, world!",
21+
"test pass!",
22+
]
2023
to_bin = true
2124
uefi = false

.github/workflows/test-qemu.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
vmconfigs: configs/vms/arceos-aarch64-qemu-smp1.toml
1313
vmconfigs_name: ArceOS
1414
vmimage_name: qemu_aarch64_arceos
15+
- arch: aarch64
16+
vmconfigs: configs/vms/linux-aarch64-qemu-smp1.toml
17+
vmconfigs_name: Linux
18+
vmimage_name: qemu_aarch64_linux
1519
# - arch: riscv64
1620
# vmconfigs: configs/vms/arceos-riscv64-qemu-smp1.toml
1721
# vmconfigs_name: ArceOS

configs/vms/linux-aarch64-qemu-smp1.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dtb_load_addr = 0x8000_0000
3434
# Memory regions with format (`base_paddr`, `size`, `flags`, `map_type`).
3535
# For `map_type`, 0 means `MAP_ALLOC`, 1 means `MAP_IDENTICAL`.
3636
memory_regions = [
37-
[0x8000_0000, 0x1000_0000, 0x7, 0], # System RAM 1G MAP_IDENTICAL
37+
[0x8000_0000, 0x1000_0000, 0x7, 1], # System RAM 1G MAP_IDENTICAL
3838
]
3939

4040
#

kernel/src/shell/command/base.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ macro_rules! print_err {
1919
}
2020

2121
// Helper function: split whitespace
22+
#[cfg(feature = "fs")]
2223
fn split_whitespace(s: &str) -> (&str, &str) {
2324
let s = s.trim();
2425
if let Some(pos) = s.find(char::is_whitespace) {
@@ -587,6 +588,7 @@ fn file_type_to_char(ty: FileType) -> char {
587588
}
588589

589590
#[rustfmt::skip]
591+
#[cfg(feature = "fs")]
590592
const fn file_perm_to_rwx(mode: u32) -> [u8; 9] {
591593
let mut perm = [b'-'; 9];
592594
macro_rules! set {

kernel/src/shell/command/vm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fs::read_to_string;
1111

1212
use crate::{
1313
shell::command::{CommandNode, FlagDef, OptionDef, ParsedCommand},
14-
vmm::{add_running_vm_count, config::init_guest_vm, vcpus, vm_list, with_vm},
14+
vmm::{add_running_vm_count, vcpus, vm_list, with_vm},
1515
};
1616

1717
/// Check if a VM can transition to Running state.
@@ -124,6 +124,7 @@ fn vm_create(cmd: &ParsedCommand) {
124124
for config_path in args.iter() {
125125
println!("Creating VM from config: {}", config_path);
126126

127+
use crate::vmm::config::init_guest_vm;
127128
match read_to_string(config_path) {
128129
Ok(raw_cfg) => match init_guest_vm(&raw_cfg) {
129130
Ok(vm_id) => {
@@ -767,6 +768,7 @@ fn delete_vm_by_id(vm_id: usize, keep_data: bool) {
767768
println!("✓ VM[{}] deletion completed", vm_id);
768769
}
769770

771+
#[cfg(feature = "fs")]
770772
fn vm_list_simple() {
771773
let vms = vm_list::get_vm_list();
772774
println!("ID NAME STATE VCPU MEMORY");

kernel/src/vmm/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ pub fn with_vm_and_vcpu_on_pcpu(
129129
// }))
130130
}
131131

132-
pub fn get_running_vm_count() -> usize {
133-
RUNNING_VM_COUNT.load(Ordering::Acquire)
134-
}
135-
136132
pub fn add_running_vm_count(count: usize) {
137133
RUNNING_VM_COUNT.fetch_add(count, Ordering::Release);
138134
}

0 commit comments

Comments
 (0)