x86_64/qemu: boot Asterinas as the root zone#353
Closed
shanynarrid wants to merge 5 commits into
Closed
Conversation
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.
804ab42 to
86b4216
Compare
86b4216 to
c28ebf0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opt-in
asterinas_roottoggle. Boots Asterinas via the Linux/x86 bootprotocol as the qemu board's root zone instead of Linux.
Cargo.toml/board.rs: toggle selects Asterinas cmdline, multiboot2initramfs, 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-bitramdisk_sizeboot-protocol field. Computes the real initramfs bytelength at build time and writes it as
ASTERINAS_ROOT_INITRD_SIZEsoboard.rsdoesn't need a hand-maintained constant.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 alltoggle off and on;cargo fmt --all -- --checkclean. With the toggle on,ASTERINAS_ROOT_INITRD_SIZEmatches the staged file's real size on diskexactly. Booted under QEMU/KVM with keystroke injection to prove it's
actually interactive — ran
echoanduname -ain the guest shell, outputmatched.