Skip to content

Commit ef9b629

Browse files
authored
feat(ci): add x86_64 NimbOS support and upgrade guest images to v0.0.20 (#310)
* feat(ci): add x86_64 NimbOS support and upgrade guest images to v0.0.20
1 parent b7a0dc8 commit ef9b629

File tree

6 files changed

+140
-170
lines changed

6 files changed

+140
-170
lines changed

.github/workflows/qemu-x86_64.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
args = [
2+
"-m",
3+
"128M",
4+
"-smp",
5+
"1",
6+
"-machine",
7+
"q35",
8+
"-device",
9+
"virtio-blk-pci,drive=disk0",
10+
"-drive",
11+
"id=disk0,if=none,format=raw,file=${workspaceFolder}/tmp/rootfs.img",
12+
"-nographic",
13+
"-accel",
14+
"kvm",
15+
"-cpu",
16+
"host",
17+
]
18+
fail_regex = ["System will reboot, press any key to continue ..."]
19+
success_regex = ["usertests passed!"]
20+
to_bin = false
21+
uefi = false

.github/workflows/test-qemu.yml

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ jobs:
1111
- arch: aarch64
1212
vmconfigs: configs/vms/arceos-aarch64-qemu-smp1.toml
1313
vmconfigs_name: ArceOS
14-
vmimage_name: qemu_arceos_aarch64
15-
# vmrootfs_name: qemu_arceos_aarch64
14+
vmimage_name: qemu_aarch64_arceos
1615
# - arch: riscv64
1716
# vmconfigs: configs/vms/arceos-riscv64-qemu-smp1.toml
1817
# vmconfigs_name: ArceOS
1918
# vmimage_name: qemu_arceos_riscv64
20-
# - arch: x86_64
21-
# vmconfigs: configs/vms/arceos-x86_64-qemu-smp1.toml
22-
# vmconfigs_name: ArceOS
23-
# vmimage_name: qemu_arceos_x86_64
19+
- arch: x86_64
20+
vmconfigs: configs/vms/nimbos-x86_64-qemu-smp1.toml
21+
vmconfigs_name: NimbOS
22+
vmimage_name: qemu_x86_64_nimbos
2423
fail-fast: false
2524
runs-on:
2625
- self-hosted
@@ -45,35 +44,37 @@ jobs:
4544
config=$(echo "$config" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
4645
cargo xtask image download $img
4746
img_name="qemu-${{ matrix.arch }}"
48-
sed -i 's|^kernel_path[[:space:]]*=.*|kernel_path = "/tmp/axvisor/'"$img"'/'"$img_name"'"|' "$config"
49-
echo "Updated kernel_path in $config"
50-
done
47+
image_location=$(sed -n 's/^image_location[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' "$config")
5148
52-
- name: Download rootfs
53-
run: |
54-
if [ -n "${{ matrix.vmrootfs_name }}" ]; then
55-
ROOTFS_URL="https://github.com/arceos-hypervisor/axvisor-guest/releases/download/v0.0.19/${{ matrix.vmrootfs_name }}.tar.gz"
56-
ROOTFS_DIR="/tmp/axvisor/rootfs/${{ matrix.vmrootfs_name }}"
57-
ROOTFS_IMG_PATH="${ROOTFS_DIR}/rootfs.img"
58-
mkdir -p "${ROOTFS_DIR}"
59-
60-
echo "Downloading rootfs from ${ROOTFS_URL}"
61-
curl -L "${ROOTFS_URL}" -o "${ROOTFS_DIR}/${{ matrix.vmrootfs_name }}.tar.gz"
62-
63-
echo "Extracting rootfs to ${ROOTFS_DIR}"
64-
tar -xzf "${ROOTFS_DIR}/${{ matrix.vmrootfs_name }}.tar.gz" -C "${ROOTFS_DIR}"
65-
66-
echo "Patching qemu-aarch64.toml file..."
67-
sed -i 's|file=${workspaceFolder}/tmp/rootfs.img|file='"${ROOTFS_IMG_PATH}"'|' ".github/workflows/qemu-${{ matrix.arch }}.toml"
68-
69-
echo "Rootfs setup completed"
70-
else
71-
echo "Removing rootfs device configuration from qemu-${{ matrix.arch }}.toml..."
72-
sed -i '/-device/,/virtio-blk-device,drive=disk0/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
73-
sed -i '/-drive/,/id=disk0,if=none,format=raw,file=${workspaceFolder}\/tmp\/rootfs.img/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
74-
sed -i 's/root=\/dev\/vda rw //' ".github/workflows/qemu-${{ matrix.arch }}.toml"
75-
echo "Rootfs device configuration removed"
76-
fi
49+
case "$image_location" in
50+
"fs")
51+
echo "Filesystem storage mode - no config update needed"
52+
;;
53+
"memory")
54+
sed -i 's|^kernel_path[[:space:]]*=.*|kernel_path = "/tmp/axvisor/'"$img"'/'"$img_name"'"|' "$config"
55+
echo "Memory storage mode - updating kernel_path"
56+
;;
57+
*)
58+
echo "Unknown image_location: $image_location"
59+
exit 1
60+
;;
61+
esac
62+
63+
ROOTFS_IMG_PATH="/tmp/axvisor/$img/rootfs.img"
64+
65+
# Check if rootfs.img exists after extraction
66+
if [ -f "${ROOTFS_IMG_PATH}" ]; then
67+
echo "Found rootfs.img, patching qemu-aarch64.toml file..."
68+
sed -i 's|file=${workspaceFolder}/tmp/rootfs.img|file='"${ROOTFS_IMG_PATH}"'|' ".github/workflows/qemu-${{ matrix.arch }}.toml"
69+
echo "Rootfs setup completed"
70+
else
71+
echo "No rootfs.img found, removing rootfs device configuration from qemu-${{ matrix.arch }}.toml..."
72+
sed -i '/-device/,/virtio-blk-device,drive=disk0/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
73+
sed -i '/-drive/,/id=disk0,if=none,format=raw,file=${workspaceFolder}\/tmp\/rootfs.img/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
74+
sed -i 's/root=\/dev\/vda rw //' ".github/workflows/qemu-${{ matrix.arch }}.toml"
75+
echo "Rootfs device configuration removed"
76+
fi
77+
done
7778
7879
- name: Run tests
7980
run: |

Cargo.lock

Lines changed: 9 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configs/board/qemu-x86_64.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cargo_args = []
22
features = [
3+
"axstd/myplat",
34
"ept-level-4",
5+
"fs",
46
]
57
log = "Info"
68
target = "x86_64-unknown-none"

modules/axconfig/src/lib.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,21 @@ pub const TICKS_PER_SEC: usize = 100;
2424
#[doc = ""]
2525
pub mod devices {
2626
#[doc = " MMIO regions with format (`base_paddr`, `size`)."]
27-
pub const MMIO_REGIONS: &[(usize, usize)] = &[];
27+
pub const MMIO_REGIONS: &[(usize, usize)] = &[
28+
(0xb000_0000, 0x1000_0000), // PCI config space
29+
(0xfe00_0000, 0xc0_0000), // PCI devices
30+
(0xfec0_0000, 0x1000), // IO APIC
31+
(0xfed0_0000, 0x1000), // HPET
32+
(0xfee0_0000, 0x1000), // Local APIC
33+
];
2834
#[doc = " End PCI bus number."]
29-
pub const PCI_BUS_END: usize = 0;
35+
pub const PCI_BUS_END: usize = 0xff;
3036
#[doc = " Base physical address of the PCIe ECAM space."]
31-
pub const PCI_ECAM_BASE: usize = 0;
37+
pub const PCI_ECAM_BASE: usize = 0xb000_0000 ;
3238
#[doc = " PCI device memory ranges."]
3339
pub const PCI_RANGES: &[(usize, usize)] = &[];
3440
#[doc = " Timer interrupt num (PPI, physical timer)."]
35-
pub const TIMER_IRQ: usize = 26;
41+
pub const TIMER_IRQ: usize = 0xf0;
3642
#[doc = " VirtIO MMIO regions with format (`base_paddr`, `size`)."]
3743
pub const VIRTIO_MMIO_REGIONS: &[(usize, usize)] = &[];
3844
}
@@ -45,13 +51,13 @@ pub mod plat {
4551
#[doc = " Platform family (deprecated)."]
4652
pub const FAMILY: &str = "";
4753
#[doc = " Kernel address space base."]
48-
pub const KERNEL_ASPACE_BASE: usize = 0x0000_0000_0000;
54+
pub const KERNEL_ASPACE_BASE: usize = 0xffff_8000_0000_0000;
4955
#[doc = " Kernel address space size."]
50-
pub const KERNEL_ASPACE_SIZE: usize = 0xffff_ffff_f000;
56+
pub const KERNEL_ASPACE_SIZE: usize = 0x0000_7fff_ffff_f000;
5157
#[doc = " No need."]
52-
pub const KERNEL_BASE_PADDR: usize = 0x0;
58+
pub const KERNEL_BASE_PADDR: usize = 0x20_0000 ;
5359
#[doc = " Base virtual address of the kernel image."]
54-
pub const KERNEL_BASE_VADDR: usize = 0x8000_0000_0000;
60+
pub const KERNEL_BASE_VADDR: usize = 0xffff_8000_0020_0000;
5561
#[doc = " Offset of bus address and phys address. some boards, the bus address is"]
5662
#[doc = " different from the physical address."]
5763
pub const PHYS_BUS_OFFSET: usize = 0;

0 commit comments

Comments
 (0)