Skip to content

x86_64/qemu: boot Asterinas as the root zone#353

Closed
shanynarrid wants to merge 5 commits into
syswonder:devfrom
shanynarrid:feature/asterinas-x86_64-io
Closed

x86_64/qemu: boot Asterinas as the root zone#353
shanynarrid wants to merge 5 commits into
syswonder:devfrom
shanynarrid:feature/asterinas-x86_64-io

Conversation

@shanynarrid

Copy link
Copy Markdown

Opt-in asterinas_root toggle. Boots Asterinas via the Linux/x86 boot
protocol as the qemu board's root zone instead of Linux.

  • Cargo.toml / board.rs: toggle selects Asterinas cmdline, multiboot2
    initramfs, PCI ECAM base.
  • build.rs: validates the staged boot artifacts when the toggle is on —
    setup/vmlinux/initramfs all present, initramfs is an uncompressed newc
    cpio (checks magic 070701/070702), size fits the 32-bit
    ramdisk_size boot-protocol field. Computes the real initramfs byte
    length at build time and writes it as ASTERINAS_ROOT_INITRD_SIZE so
    board.rs doesn't need a hand-maintained constant.
  • Kconfig registration for asterinas_root.

Depends on two PRs opened separately: the CPUID/boot/IOAPIC hardening pass
and the VT-d/VirtIO/mapper fixes above — nothing in this PR itself, but
they land on files this one also touches.

Verified: make ARCH=x86_64 BOARD=qemu MODE=release all toggle off and on;
cargo fmt --all -- --check clean. With the toggle on,
ASTERINAS_ROOT_INITRD_SIZE matches the staged file's real size on disk
exactly. Booted under QEMU/KVM with keystroke injection to prove it's
actually interactive — ran echo and uname -a in the guest shell, output
matched.

Add x86_64 support needed to boot Asterinas as a root zone and keep CPUID, HPET, trap, and IOAPIC state scoped by zone.
Add build-time selection for the Asterinas root zone and map the q35 ECAM window used for PCI config space enumeration.
…ebase

build.rs detected asterinas_root via the Cargo-injected
CARGO_FEATURE_ASTERINAS_ROOT env var, which stops existing once the feature
moves out of Cargo.toml. Switched the check to the already-parsed .config
enabled-set (same one gen_cargo_config/build.rs now use for everything
else) and added ASTERINAS_ROOT to kconfig/Kconfig + cfg_map.toml so the
board.rs cfg gates keep resolving. Re-tested with the staged Asterinas
image; initrd size still comes out to the correct byte count.
@github-actions github-actions Bot added the x86_64 label Jul 2, 2026
@shanynarrid shanynarrid force-pushed the feature/asterinas-x86_64-io branch from 804ab42 to 86b4216 Compare July 2, 2026 15:43
@shanynarrid shanynarrid force-pushed the feature/asterinas-x86_64-io branch from 86b4216 to c28ebf0 Compare July 2, 2026 16:44
@Solicey Solicey closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants