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

cargo osdk build

概覽

The cargo osdk build command is used to compile the project and its dependencies. The usage is as follows:

cargo osdk build [OPTIONS]

選項

The options can be divided into two types: Cargo options that can be accepted by Cargo, and Manifest options that can also be defined in the manifest named OSDK.toml.

Cargo 選項

  • --profile <PROFILE>: Build artifacts with the specified Cargo profile (built-in candidates are ‘dev’, ‘release’, ‘test’, and ‘bench’) [default: dev]

  • --release: Build artifacts in release mode, with optimizations

  • --features <FEATURES>: Space or comma separated list of features to activate

  • --no-default-features: Do not activate the default features

  • --config <KEY=VALUE>: Override a configuration value

More Cargo options will be supported in future versions of OSDK.

清單選項

這些選項也可以在名為 OSDK.toml 的專案清單中定義。命令行選項用於覆蓋或追加 OSDK.toml 中的數值。每個選項允許的值可在清單文件中找到。

  • --kcmd-args <ARGS>: Command line arguments for the guest kernel
  • --init-args <ARGS>: Command line arguments for the init process
  • --initramfs <PATH>: Path of the initramfs
  • --boot-method <METHOD>: The method to boot the kernel
  • --grub-mkrescue <PATH>: Path of grub-mkrescue
  • --grub-boot-protocol <PROTOCOL>: The boot protocol for booting the kernel
  • --display-grub-menu: To display the GRUB menu if booting with GRUB
  • --qemu-exe <FILE>: The QEMU executable file
  • --qemu-args <ARGS>: Extra arguments for running QEMU
  • --strip-elf: Whether to strip the built kernel ELF using rust-strip
  • --scheme <SCHEME>: Select the specific configuration scheme provided in the OSDK manifest
  • --encoding <FORMAT>: Denote the encoding format for kernel self-decompression

範例

  • Build a project with ./initramfs.cpio.gz as the initramfs and multiboot2 as the boot protocol used by GRUB:
cargo osdk build --initramfs="./initramfs.cpio.gz" --grub-boot-protocol="multiboot2"
  • Build a project and append sh, -l to init process arguments:
cargo osdk build --init_args="sh" --init_args="-l"