Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/qemu-x86_64.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
args = [
"-m",
"128M",
"-smp",
"1",
"-machine",
"q35",
"-device",
"virtio-blk-pci,drive=disk0",
"-drive",
"id=disk0,if=none,format=raw,file=${workspaceFolder}/tmp/rootfs.img",
"-nographic",
"-accel",
"kvm",
"-cpu",
"host",
]
fail_regex = ["System will reboot, press any key to continue ..."]
success_regex = ["usertests passed!"]
to_bin = false
uefi = false
69 changes: 35 additions & 34 deletions .github/workflows/test-qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ jobs:
- arch: aarch64
vmconfigs: configs/vms/arceos-aarch64-qemu-smp1.toml
vmconfigs_name: ArceOS
vmimage_name: qemu_arceos_aarch64
# vmrootfs_name: qemu_arceos_aarch64
vmimage_name: qemu_aarch64_arceos
# - arch: riscv64
# vmconfigs: configs/vms/arceos-riscv64-qemu-smp1.toml
# vmconfigs_name: ArceOS
# vmimage_name: qemu_arceos_riscv64
# - arch: x86_64
# vmconfigs: configs/vms/arceos-x86_64-qemu-smp1.toml
# vmconfigs_name: ArceOS
# vmimage_name: qemu_arceos_x86_64
- arch: x86_64
vmconfigs: configs/vms/nimbos-x86_64-qemu-smp1.toml
vmconfigs_name: NimbOS
vmimage_name: qemu_x86_64_nimbos
fail-fast: false
runs-on:
- self-hosted
Expand All @@ -45,35 +44,37 @@ jobs:
config=$(echo "$config" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
cargo xtask image download $img
img_name="qemu-${{ matrix.arch }}"
sed -i 's|^kernel_path[[:space:]]*=.*|kernel_path = "/tmp/axvisor/'"$img"'/'"$img_name"'"|' "$config"
echo "Updated kernel_path in $config"
done
image_location=$(sed -n 's/^image_location[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' "$config")

- name: Download rootfs
run: |
if [ -n "${{ matrix.vmrootfs_name }}" ]; then
ROOTFS_URL="https://github.com/arceos-hypervisor/axvisor-guest/releases/download/v0.0.19/${{ matrix.vmrootfs_name }}.tar.gz"
ROOTFS_DIR="/tmp/axvisor/rootfs/${{ matrix.vmrootfs_name }}"
ROOTFS_IMG_PATH="${ROOTFS_DIR}/rootfs.img"
mkdir -p "${ROOTFS_DIR}"

echo "Downloading rootfs from ${ROOTFS_URL}"
curl -L "${ROOTFS_URL}" -o "${ROOTFS_DIR}/${{ matrix.vmrootfs_name }}.tar.gz"

echo "Extracting rootfs to ${ROOTFS_DIR}"
tar -xzf "${ROOTFS_DIR}/${{ matrix.vmrootfs_name }}.tar.gz" -C "${ROOTFS_DIR}"

echo "Patching qemu-aarch64.toml file..."
sed -i 's|file=${workspaceFolder}/tmp/rootfs.img|file='"${ROOTFS_IMG_PATH}"'|' ".github/workflows/qemu-${{ matrix.arch }}.toml"

echo "Rootfs setup completed"
else
echo "Removing rootfs device configuration from qemu-${{ matrix.arch }}.toml..."
sed -i '/-device/,/virtio-blk-device,drive=disk0/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
sed -i '/-drive/,/id=disk0,if=none,format=raw,file=${workspaceFolder}\/tmp\/rootfs.img/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
sed -i 's/root=\/dev\/vda rw //' ".github/workflows/qemu-${{ matrix.arch }}.toml"
echo "Rootfs device configuration removed"
fi
case "$image_location" in
"fs")
echo "Filesystem storage mode - no config update needed"
;;
"memory")
sed -i 's|^kernel_path[[:space:]]*=.*|kernel_path = "/tmp/axvisor/'"$img"'/'"$img_name"'"|' "$config"
echo "Memory storage mode - updating kernel_path"
;;
*)
echo "Unknown image_location: $image_location"
exit 1
;;
esac

ROOTFS_IMG_PATH="/tmp/axvisor/$img/rootfs.img"

# Check if rootfs.img exists after extraction
if [ -f "${ROOTFS_IMG_PATH}" ]; then
echo "Found rootfs.img, patching qemu-aarch64.toml file..."
sed -i 's|file=${workspaceFolder}/tmp/rootfs.img|file='"${ROOTFS_IMG_PATH}"'|' ".github/workflows/qemu-${{ matrix.arch }}.toml"
echo "Rootfs setup completed"
else
echo "No rootfs.img found, removing rootfs device configuration from qemu-${{ matrix.arch }}.toml..."
sed -i '/-device/,/virtio-blk-device,drive=disk0/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
sed -i '/-drive/,/id=disk0,if=none,format=raw,file=${workspaceFolder}\/tmp\/rootfs.img/d' ".github/workflows/qemu-${{ matrix.arch }}.toml"
sed -i 's/root=\/dev\/vda rw //' ".github/workflows/qemu-${{ matrix.arch }}.toml"
echo "Rootfs device configuration removed"
fi
done

- name: Run tests
run: |
Expand Down
102 changes: 9 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions configs/board/qemu-x86_64.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cargo_args = []
features = [
"axstd/myplat",
"ept-level-4",
"fs",
]
log = "Info"
target = "x86_64-unknown-none"
Expand Down
22 changes: 14 additions & 8 deletions modules/axconfig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ pub const TICKS_PER_SEC: usize = 100;
#[doc = ""]
pub mod devices {
#[doc = " MMIO regions with format (`base_paddr`, `size`)."]
pub const MMIO_REGIONS: &[(usize, usize)] = &[];
pub const MMIO_REGIONS: &[(usize, usize)] = &[
(0xb000_0000, 0x1000_0000), // PCI config space
(0xfe00_0000, 0xc0_0000), // PCI devices
(0xfec0_0000, 0x1000), // IO APIC
(0xfed0_0000, 0x1000), // HPET
(0xfee0_0000, 0x1000), // Local APIC
];
#[doc = " End PCI bus number."]
pub const PCI_BUS_END: usize = 0;
pub const PCI_BUS_END: usize = 0xff;
#[doc = " Base physical address of the PCIe ECAM space."]
pub const PCI_ECAM_BASE: usize = 0;
pub const PCI_ECAM_BASE: usize = 0xb000_0000 ;
#[doc = " PCI device memory ranges."]
pub const PCI_RANGES: &[(usize, usize)] = &[];
#[doc = " Timer interrupt num (PPI, physical timer)."]
pub const TIMER_IRQ: usize = 26;
pub const TIMER_IRQ: usize = 0xf0;
#[doc = " VirtIO MMIO regions with format (`base_paddr`, `size`)."]
pub const VIRTIO_MMIO_REGIONS: &[(usize, usize)] = &[];
}
Expand All @@ -45,13 +51,13 @@ pub mod plat {
#[doc = " Platform family (deprecated)."]
pub const FAMILY: &str = "";
#[doc = " Kernel address space base."]
pub const KERNEL_ASPACE_BASE: usize = 0x0000_0000_0000;
pub const KERNEL_ASPACE_BASE: usize = 0xffff_8000_0000_0000;
#[doc = " Kernel address space size."]
pub const KERNEL_ASPACE_SIZE: usize = 0xffff_ffff_f000;
pub const KERNEL_ASPACE_SIZE: usize = 0x0000_7fff_ffff_f000;
#[doc = " No need."]
pub const KERNEL_BASE_PADDR: usize = 0x0;
pub const KERNEL_BASE_PADDR: usize = 0x20_0000 ;
#[doc = " Base virtual address of the kernel image."]
pub const KERNEL_BASE_VADDR: usize = 0x8000_0000_0000;
pub const KERNEL_BASE_VADDR: usize = 0xffff_8000_0020_0000;
#[doc = " Offset of bus address and phys address. some boards, the bus address is"]
#[doc = " different from the physical address."]
pub const PHYS_BUS_OFFSET: usize = 0;
Expand Down
Loading