Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

xtask API

English | 한국어

English

cargo xtask is the host-side control surface for RustOS. The command enum is defined in tools/xtask/src/cli.rs.

Commands

CommandPurposeMain output
cargo xtask checkValidate layering, package manifests, targets, and workspace checks.No image output.
cargo xtask buildFull OS build and stage.build/artifacts, build/image, registries.
cargo xtask stageCopy built artifacts and overlays into the boot image.build/image.
cargo xtask runRun current staged image in QEMU.QEMU session, logs/debugcon.log.
cargo xtask debugRun QEMU with GDB stub.logs/rustos-debug.gdb.
cargo xtask probe-displayHeadless display probe/stress path.Probe result and debug logs.
cargo xtask qemu-scenariosRun named QEMU regression scenarios.QEMU logs and scenario result.
cargo xtask selftestRun host selftests for contracts and hardening helpers.Cargo test output.
cargo xtask fuzz-hostRun deterministic host parser fuzz smoke tests.logs/fuzz-crash-*.bin on crash.
cargo xtask cleanRemove cargo/build outputs.Cleaned target/build dirs.
cargo xtask targetsInstall required Rust targets.Rust target availability.
cargo xtask build-efiBuild GRUB EFI boot manager only. Uses RUSTOS_GRUB_* when set, otherwise creates a local development key under build/dev-grub-gpg.build/artifacts/EFI/BOOT/BOOTX64.EFI, build/artifacts/nucleus.elf.sig.
cargo xtask build-kernelBuild Multiboot2 nucleus/kernel only.build/artifacts/nucleus.elf.
cargo xtask build-userBuild userspace packages.service/app artifacts.
cargo xtask build-console-demoBuild C demo/smoke programs.app artifacts.
cargo xtask build-driver-modulesBuild bridge driver modules..ko artifacts.

QEMU Options

cargo xtask run, debug, and probe-display accept shared options:

OptionMeaning
`--profile <defaultg14
--accel-profile kvmUse KVM acceleration and host CPU profile.
--usb-inputAttach qemu-xhci, usb-kbd, and usb-tablet.
--no-networkDisable default usernet and virtio-net-pci.
`--debugcon <filestdio
`--qemu-log <intnull>`
--timeout <seconds>Stop QEMU after a bounded run. No timeout is applied by default.
--expect <marker>Stop successfully once all repeated debugcon markers appear.
--fault <location=action>Add one validated fault-injection rule for this run.
--summarize-logPrint high-signal debugcon markers after QEMU stops.
--vfio-pci <BDF>Attach a host vfio-pci device.
--phoenix3-passthroughAuto-detect and attach Phoenix3 GPU functions.
--vfio-forceAllow devices driving active host display.

Raw QEMU args go after --:

cargo xtask run -- --no-reboot

Bounded KVM no-opt debugging uses NVMe storage by default while AHCI boundary issues are isolated separately:

cargo xtask run --profile nvme --accel-profile kvm --usb-input --debugcon file --timeout 35 --summarize-log -- --no-reboot

Fault injection rules can come from config/rustos.toml or repeated --fault arguments:

cargo xtask run --fault display.present=drop-every:10 --timeout 35 --summarize-log -- --no-reboot

Use cargo xtask qemu-scenarios --list to see the built-in scenario names.

When To Use Each Command

  • Use check before commits that change dependencies, manifests, or layer boundaries. It also validates an existing build/artifacts/nucleus.elf with grub-file --is-x86-multiboot2 when present.
  • Use build after changing code or staged image content. The default build requires GRUB public/signing key environment variables.
  • Use stage after changing only assets/image or package install metadata when artifacts are already built.
  • Use run for normal boot testing.
  • Use debug when attaching GDB.
  • Use probe-display for display, framebuffer, surface, or dirty-rect bugs.

한국어

cargo xtask는 RustOS의 host-side control surface입니다. command enum은 tools/xtask/src/cli.rs에 정의되어 있습니다.

Commands

CommandPurposeMain output
cargo xtask checklayering, package manifest, target, workspace check를 검증합니다.image output 없음
cargo xtask build전체 OS build와 stage를 수행합니다.build/artifacts, build/image, registries
cargo xtask stagebuilt artifact와 overlay를 boot image에 복사합니다.build/image
cargo xtask run현재 staged image를 QEMU에서 실행합니다.QEMU session, logs/debugcon.log
cargo xtask debugGDB stub과 함께 QEMU를 실행합니다.logs/rustos-debug.gdb
cargo xtask probe-displayheadless display probe/stress path를 실행합니다.probe result와 debug logs
cargo xtask qemu-scenarios이름이 있는 QEMU regression scenario를 실행합니다.QEMU log와 scenario result
cargo xtask selftestcontract와 hardening helper host selftest를 실행합니다.Cargo test output
cargo xtask fuzz-hostdeterministic host parser fuzz smoke test를 실행합니다.crash 시 logs/fuzz-crash-*.bin
cargo xtask cleancargo/build output을 지웁니다.정리된 target/build dirs
cargo xtask targets필요한 Rust target을 설치합니다.Rust target availability
cargo xtask build-efiGRUB EFI boot manager만 빌드합니다. RUSTOS_GRUB_* 값이 없으면 build/dev-grub-gpg 아래에 로컬 개발 키를 생성합니다.build/artifacts/EFI/BOOT/BOOTX64.EFI, build/artifacts/nucleus.elf.sig
cargo xtask build-kernelMultiboot2 nucleus/kernel만 빌드합니다.build/artifacts/nucleus.elf
cargo xtask build-useruserspace package를 빌드합니다.service/app artifacts
cargo xtask build-console-demoC demo/smoke program을 빌드합니다.app artifacts
cargo xtask build-driver-modulesbridge driver module을 빌드합니다..ko artifacts

QEMU Options

cargo xtask run, debug, probe-display는 같은 option을 받습니다.

OptionMeaning
`--profile <defaultg14
--accel-profile kvmKVM acceleration과 host CPU profile 사용
--usb-inputqemu-xhci, usb-kbd, usb-tablet attach
--no-networkdefault usernet과 virtio-net-pci 비활성화
`--debugcon <filestdio
`--qemu-log <intnull>`
--timeout <seconds>제한 시간 후 QEMU를 종료. 기본값은 timeout 없음
--expect <marker>반복 지정한 debugcon marker가 모두 나오면 성공으로 종료
--fault <location=action>이번 실행에만 validated fault-injection rule 추가
--summarize-logQEMU 종료 후 high-signal debugcon marker 요약 출력
--vfio-pci <BDF>host vfio-pci device attach
--phoenix3-passthroughPhoenix3 GPU function 자동 탐지/attach
--vfio-forceactive host display를 구동 중인 device도 허용

Raw QEMU arg는 -- 뒤에 둡니다.

cargo xtask run -- --no-reboot

KVM no-opt bounded debugging은 AHCI boundary issue를 별도로 격리하기 위해 우선 NVMe storage profile을 사용합니다.

cargo xtask run --profile nvme --accel-profile kvm --usb-input --debugcon file --timeout 35 --summarize-log -- --no-reboot

Fault injection rule은 config/rustos.toml에서 오거나 반복 지정한 --fault argument에서 옵니다.

cargo xtask run --fault display.present=drop-every:10 --timeout 35 --summarize-log -- --no-reboot

내장 scenario 이름은 cargo xtask qemu-scenarios --list로 확인합니다.

언제 어떤 명령을 쓰는가

  • dependency, manifest, layer boundary를 바꿨다면 check를 사용합니다. 기존 build/artifacts/nucleus.elf가 있으면 grub-file --is-x86-multiboot2도 검증합니다.
  • code 또는 staged image content를 바꿨다면 build를 사용합니다. 기본 build는 GRUB public/signing key 환경 변수가 필요합니다.
  • artifact가 이미 있고 assets/image 또는 install metadata만 바꿨다면 stage를 사용합니다.
  • 일반 boot test에는 run을 사용합니다.
  • GDB를 붙일 때는 debug를 사용합니다.
  • display, framebuffer, surface, dirty-rect bug에는 probe-display를 사용합니다.