### Manual Environment Setup (Ubuntu/Debian) Source: https://context7.com/rcore-os/tgoskits/llms.txt Instructions for manual installation of the Rust toolchain and build tools on Ubuntu/Debian. Includes installing QEMU and cargo-binutils. ```bash # Rust toolchain (auto-switched by rust-toolchain.toml) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Build tools and QEMU sudo apt update sudo apt install -y cmake make ninja-build pkg-config \ qemu-system-arm qemu-system-riscv64 qemu-system-x86 # Rust cargo tools cargo install cargo-binutils # Verify QEMU availability qemu-system-aarch64 --version qemu-system-riscv64 --version qemu-system-x86_64 --version ``` -------------------------------- ### Example Configuration: Using Predefined Device Tree Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/FDT_Configuration_Guide.md A complete TOML configuration example demonstrating the setup when using a predefined device tree file. Note that device-specific configurations like `passthrough_devices` are ignored in this mode. ```toml [base] id = 1 name = "linux-qemu" vm_type = 1 cpu_num = 2 phys_cpu_ids = [0, 1] # phys_cpu_sets 不再需要手动配置,会自动根据 phys_cpu_ids 生成 [kernel] entry_point = 0x8020_0000 image_location = "memory" kernel_path = "tmp/Image" kernel_load_addr = 0x8020_0000 dtబ_path = "/home/user/device-tree.dtb" # 使用预定义设备树文件 dtబ_load_addr = 0x8000_0000 memory_regions = [ [0x8000_0000, 0x1000_0000, 0x7, 1], # System RAM 1G MAP_IDENTICAL ] [devices] # 注意:以下配置在使用预定义设备树时将被忽略 passthrough_devices = [ ["/intc"], ] # 直通地址配置 passthrough_addresses = [ [0x28041000, 0x100_0000], ] excluded_devices = [ ["/timer"], ] ``` -------------------------------- ### Prepare NimbOS image and run Axvisor with automatic VM startup Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/shell.md This example demonstrates preparing a NimbOS client image and then launching Axvisor, which automatically starts the NimbOS VM. It's suitable for scenarios where a specific VM needs to be running upon system initialization. ```bash # 1. 准备NimbOS镜像 ./scripts/nimbos.sh --arch aarch64 # 2. 启动AxVisor(VM会自动启动) ./axvisor.sh run \ --plat aarch64-generic \ --features fs,ept-level-4 \ --vmconfigs configs/vms/nimbos-aarch64-qemu-smp1.toml \ --arceos-args "BUS=mmio,BLK=y,DISK_IMG=tmp/nimbos-aarch64.img,LOG=info" # 3. 在Shell中操作(VM已运行) # 查看VM状态 axvisor:/$ vm list ID NAME STATE VCPU MEMORY ---- ----------- ------- ---- ------ 0 nimbos-vm 🟢 running 1 512MB axvisor:/$ vm status 0 # 查看详细状态 axvisor:/$ log debug # 调整日志级别 ``` -------------------------------- ### StarryOS Quick Start Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/build/commands.md Provides a convenient entry point for common StarryOS platform setups. ```bash cargo xtask starry quick-start ``` -------------------------------- ### Boot Flowchart for ax-plat-aarch64-qemu-virt Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/ax-plat-aarch64-qemu-virt.md Illustrates the boot sequence for the primary core, starting from the image header and progressing through early page table setup, MMU enabling, and finally calling the kernel's main entry point. ```mermaid flowchart TD A[_start 带 Linux-style 镜像头] --> B[_start_primary] B --> C[读取 MPIDR 得到 CPU ID] C --> D[保存 DTB 地址与引导参数] D --> E[切换到 EL1] E --> F[构造早期页表] F --> G[打开 MMU] G --> H[把 SP 调整到高半区线性映射] H --> I[ax_plat::call_main cpu_id dtb] I --> J[内核 #[ax_plat::main] 入口] ``` -------------------------------- ### VM Start Command Options Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/shell.md Details the options available for the 'vm start' command, including starting all VMs, a specific VM, and background execution. ```text # vm start - 不带参数:启动所有虚拟机 - 指定VM ID:启动特定虚拟机 - 支持 `--detach` 后台模式运行 - 支持 `--console` 连接到控制台(计划实现) ``` -------------------------------- ### Basic Integration Example Source: https://github.com/rcore-os/tgoskits/blob/dev/components/handler_table/README.md A minimal `main` function demonstrating how to integrate the `ax-handler-table` crate into a project. This serves as a starting point for using the library. ```rust use ax_handler_table as _; fn main() { // Integrate `ax-handler-table` into your project here. } ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-readlinkat-zero-size/c/CMakeLists.txt Installs the built executable to the user's binary directory. ```cmake install(TARGETS bug-readlinkat-zero-size RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Configuration Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/riscv64-regression/test-unix-stream-eof/c/CMakeLists.txt Installs the built executable to the '/usr/bin' directory on the target system. ```cmake install(TARGETS test-unix-stream-eof RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Configuration Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-mmap-fd-zero-anon/c/CMakeLists.txt Installs the built executable to the '/usr/bin' directory. This ensures the program is accessible in the system's PATH after installation. ```cmake install(TARGETS bug-mmap-fd-zero-anon RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-mknodat-mode-type/c/CMakeLists.txt Configures the installation of the built executable to the '/usr/bin' directory on the target system. ```cmake install(TARGETS bug-mknodat-mode-type RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/syscall/test_ioctl_fionbio_int/c/CMakeLists.txt Specifies that the built executable should be installed to the /usr/bin directory at runtime. ```cmake install(TARGETS test_ioctl_fionbio_int RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Basic Integration Example Source: https://github.com/rcore-os/tgoskits/blob/dev/components/crate_interface/crate_interface_lite/README.md A minimal example demonstrating how to integrate the ax-crate-interface-lite crate into your project. ```rust use ax_crate_interface_lite as _; fn main() { // Integrate `ax-crate-interface-lite` into your project here. } ``` -------------------------------- ### Install System Dependencies Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/qemu-quickstart.md Installs essential build tools, libraries, and QEMU system emulators required for development. ```bash sudo apt update && sudo apt install -y \ build-essential gcc libssl-dev libudev-dev pkg-config \ qemu-system-x86 qemu-system-arm qemu-system-misc \ git curl wget ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-signal-to-child/c/CMakeLists.txt Specifies that the built executable should be installed to the user's binary directory. ```cmake install(TARGETS bug-signal-to-child RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/riscv64-regression/test-prlimit64/c/CMakeLists.txt Installs the 'test-prlimit64' executable to '/usr/bin' on the target system. This defines how the built artifact is deployed. ```cmake install(TARGETS test-prlimit64 RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Install Helper Binary Source: https://github.com/rcore-os/tgoskits/blob/dev/examples/starry/orangepi-5-plus-uvc/README.md Install the compiled uvc-fps binary to /usr/bin on the board and display its help message. ```bash ssh orangepi@${BOARD_IP} \ 'sudo install -m 0755 \ ~/tgoskits-uvc-fps/target/release/uvc-fps \ /usr/bin/uvc-fps && \ /usr/bin/uvc-fps --help | head' ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-pwritev2-read-at/c/CMakeLists.txt Specifies that the built executable should be installed to '/usr/bin' on the target system. ```cmake install(TARGETS bug-pwritev2-read-at RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/grep/c/CMakeLists.txt Specifies that the compiled executable should be installed to the /usr/bin directory at runtime. ```cmake install(TARGETS grep-sed-awk-test RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Basic Integration Example Source: https://github.com/rcore-os/tgoskits/blob/dev/components/axdriver_crates/axdriver_virtio/README.md A minimal example demonstrating how to integrate the ax-driver-virtio crate into a Rust project. ```rust use ax_driver_virtio as _; fn main() { // Integrate `ax-driver-virtio` into your project here. } ``` -------------------------------- ### Basic Integration Example Source: https://github.com/rcore-os/tgoskits/blob/dev/components/axvisor_api/axvisor_api_proc/README.md A minimal example demonstrating how to use the axvisor_api_proc crate in your Rust project. ```rust use axvisor_api_proc as _; fn main() { // Integrate `axvisor_api_proc` into your project here. } ``` -------------------------------- ### Automate QEMU Setup with setup_qemu.sh Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/qemu-quickstart.md Use this script to automate the download of guest images, generation of temporary VM configurations, and preparation of the root filesystem for QEMU. This script eliminates manual steps and ensures correct paths are set. ```bash ./scripts/setup_qemu.sh ``` -------------------------------- ### Run Axvisor QEMU Example Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/development/components.md Set up and run an Axvisor QEMU instance with specific configurations. This is used for testing Axvisor functionality with a guest system. ```bash ./scripts/setup_qemu.sh arceos && cargo xtask qemu --build-config ... --qemu-config ... --vmconfigs ... ``` -------------------------------- ### Prepare Root Filesystem for Architectures Source: https://github.com/rcore-os/tgoskits/blob/dev/os/StarryOS/README.md Download and set up the root filesystem image for QEMU execution. Run this command for each target architecture. ```bash cargo xtask starry rootfs --arch riscv64 cargo xtask starry rootfs --arch loongarch64 ``` -------------------------------- ### Yarn Commands for Docusaurus Local Development Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/contributing/docs.md Installs dependencies and starts the Docusaurus development server with hot module replacement. ```bash cd docs corepack enable # 启用 Corepack(管理 Yarn 版本) yarn install # 安装依赖 ``` ```bash yarn start # 或指定监听地址 yarn start --host 0.0.0.0 ``` -------------------------------- ### Setup and Run Linux (AArch64) Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/qemu-quickstart.md Sets up the Linux guest image and runs it on QEMU using the cargo xtask command with specified configurations. ```bash ./scripts/setup_qemu.sh linux ``` ```bash cargo xtask qemu \ --config configs/board/qemu-aarch64.toml \ --qemu-config .github/workflows/qemu-aarch64.toml \ --vmconfigs tmp/vmconfigs/linux-aarch64-qemu-smp1.generated.toml ``` -------------------------------- ### Integrate x86_vlapic into a Rust Project Source: https://github.com/rcore-os/tgoskits/blob/dev/components/x86_vlapic/README.md Basic example demonstrating how to integrate the `x86_vlapic` crate into your Rust project. This snippet shows the minimal setup required. ```rust use x86_vlapic as _; fn main() { // Integrate `x86_vlapic` into your project here. } ``` -------------------------------- ### Core API Usage Example Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/axdevice.md A minimal example demonstrating how to initialize AxVmDeviceConfig and AxVmDevices, and how to potentially add custom MMIO devices and handle MMIO reads during VM exits. ```APIDOC ## Core API Usage Example ### Description This snippet shows the basic instantiation of device configuration and the device manager, along with how to manually add an MMIO device and handle MMIO read operations, which are crucial for VM exit processing. ### Usage ```rust use axdevice::{AxVmDeviceConfig, AxVmDevices}; // Initialize device configuration with an empty vector of emulated devices. let config = AxVmDeviceConfig::new(vec![]); // Create a new AxVmDevices instance, which manages the VM's device collection. let mut devices = AxVmDevices::new(config); // Optionally, manually add an MMIO device to the collection. // devices.add_mmio_dev(my_dev); // In a VM exit handler, you would use this to process MMIO reads: // let value = devices.handle_mmio_read(addr, width)?; ``` ### Key Functions - `AxVmDeviceConfig::new()`: Creates a new device configuration. - `AxVmDevices::new()`: Initializes the device manager for a VM. - `add_mmio_dev()`: Manually adds an MMIO device. - `handle_mmio_read()`: Dispatches MMIO read requests to the appropriate device. ``` -------------------------------- ### Integrate ax-driver-block in Rust Project Source: https://github.com/rcore-os/tgoskits/blob/dev/components/axdriver_crates/axdriver_block/README.md A basic example demonstrating how to integrate the `ax-driver-block` crate into a Rust project. This snippet shows the minimal setup required. ```rust use ax_driver_block as _; fn main() { // Integrate `ax-driver-block` into your project here. } ``` -------------------------------- ### Running `ax-helloworld-myplat` Example Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/ax-helloworld-myplat.md This command demonstrates how to execute the `ax-helloworld-myplat` example crate using Cargo. It specifies the manifest path for direct execution. ```bash cargo run --manifest-path "os/arceos/examples/helloworld-myplat/Cargo.toml" ``` -------------------------------- ### Running `ax-helloworld` Example Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/ax-helloworld.md This command demonstrates how to execute the `ax-helloworld` example crate using Cargo. Ensure you provide the correct path to the `Cargo.toml` file. ```bash cargo run --manifest-path "os/arceos/examples/helloworld/Cargo.toml" ``` -------------------------------- ### Clone and Run Axvisor Source: https://github.com/rcore-os/tgoskits/blob/dev/README.md Clones the repository and runs the Axvisor example on aarch64. It's recommended to use the official setup script for guest images and configuration. ```bash # Axvisor: recommended to use the official setup script for guest and rootfs cargo xtask axvisor qemu --arch aarch64 # Equivalent alias cargo axvisor qemu --arch aarch64 ``` -------------------------------- ### Run Axvisor Hello World Example Source: https://github.com/rcore-os/tgoskits/blob/dev/README.md Use this command to quickly run the 'ax-helloworld' example on Axvisor for the AArch64 architecture. ```bash cargo xtask axvisor qemu --arch aarch64 ``` -------------------------------- ### Axvisor Shell Welcome Message Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/shell.md This is the initial welcome message displayed when the Axvisor shell starts, providing basic instructions on how to get help and navigate command history. ```text Welcome to Axvisor Shell! Type 'help' to see available commands Use UP/DOWN arrows to navigate command history axvisor:/$ ``` -------------------------------- ### Axvisor Board Configuration Example Source: https://context7.com/rcore-os/tgoskits/llms.txt Defines compilation settings and active features for the Axvisor hypervisor binary. The `vm_configs` field is populated by setup scripts or runtime configurations. ```toml # os/axvisor/configs/board/qemu-aarch64.toml env = { AX_IP = "10.0.2.15", AX_GW = "10.0.2.2" } features = ["ept-level-4", "ax-std/bus-mmio", "fs"] log = "Info" plat_dyn = true vm_configs = [] # populated by setup_qemu.sh or specified at runtime ``` -------------------------------- ### Passthrough Device Configuration Example Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/FDT_Configuration_Guide.md Specifies which device nodes should be passed through to the guest VM. The format uses global paths starting from the root node. This configuration is only active during dynamic device tree generation. ```toml passthrough_devices = [ ["/"], # 直通根节点及其所有子节点 ["/intc"], # 直通 /intc 节点及其子节点 ] ``` -------------------------------- ### Command-line execution examples for `arceos-net-udpserver` Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/arceos-net-udpserver.md Examples demonstrate how to run the `arceos-net-udpserver` crate for testing and execution on a specified architecture. ```bash cargo arceos test qemu --target riscv64gc-unknown-none-elf ``` ```bash cargo xtask arceos run --package arceos-net-udpserver --arch riscv64 ``` -------------------------------- ### Secondary Hart Entry Point Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/ax-plat-riscv64-qemu-virt.md The entry point for secondary CPU cores after being started by the SBI HSM extension. It mirrors the primary hart's entry but assumes some initial setup is already done. ```rust pub extern "C" fn _start_secondary(hartid: usize, dtb: usize) -> ! { // ... } ``` -------------------------------- ### Build and Run Hello Kernel Example Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/hello-kernel.md Command to build and run the hello-kernel example for a specified architecture. The Makefile handles cross-compilation and execution, typically using QEMU. ```bash cd components/axplat_crates/examples/hello-kernel make ARCH= run ``` -------------------------------- ### Architecture-Specific `current_ptr` Generation (x86_64 Example) Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/ax-percpu-macros.md This snippet shows the x86_64 implementation for `current_ptr()`, which retrieves the per-CPU base address using `gs:[__PERCPU_SELF_PTR]` and adds the symbol offset to get the pointer for the current CPU. ```rust #[cfg(target_arch = "x86_64")] #[inline(always)] unsafe fn current_ptr(sym: *const T) -> *mut T { let offset = symbol_vma(sym); let base = core::arch::x86_64::gs::read_percpu_base(); (base as *mut u8).add(offset) as *mut T } ``` -------------------------------- ### Axvisor: Setup QEMU Environment Source: https://context7.com/rcore-os/tgoskits/llms.txt Prepare the QEMU environment for Axvisor. This involves generating the board configuration and downloading guest images. ```bash cargo xtask axvisor defconfig qemu-aarch64 ``` ```bash (cd os/axvisor && ./scripts/setup_qemu.sh arceos) ``` -------------------------------- ### Setup QEMU for Axvisor Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/axvisor.md Navigate to the axvisor directory and set up QEMU for the arceos target. ```bash cd os/axvisor ./scripts/setup_qemu.sh arceos ``` -------------------------------- ### Rust API Usage Example for CRU Operations Source: https://github.com/rcore-os/tgoskits/blob/dev/drivers/soc/rockchip/rockchip-soc/CLAUDE.md Demonstrates how to instantiate the CRU (Clock Reset Unit) for a specific SoC type and perform common operations like enabling clocks, getting clock rates, setting clock rates, and controlling resets. Assumes necessary imports and base addresses are available. ```rust use rockchip_soc::{Cru, CruOp, SocType}; // 创建 CRU 实例 (自动初始化) let cru = Cru::new(SocType::Rk3588, base_addr, sys_grf_addr); // 时钟操作 cru.clk_enable(CLK_I2C1)?; let rate = cru.clk_get_rate(CLK_I2C1)?; cru.clk_set_rate(CLK_I2C1, 100_000_000)?; // 复位控制 cru.reset_assert(RstId::new(100)); cru.reset_deassert(RstId::new(100)); ``` -------------------------------- ### Install Executable Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-open-dir-wronly/c/CMakeLists.txt Installs the built executable to the user's binary directory upon installation. ```cmake install(TARGETS bug-open-dir-wronly RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Build and Deploy Hello World Example with Chainboot Source: https://github.com/rcore-os/tgoskits/blob/dev/os/arceos/doc/jtag_debug_in_raspi4.md Build the 'helloworld' example using the chainboot mechanism for the aarch64-raspi4 platform. This command initiates the build and deployment process. ```bash make A=examples/helloworld MYPLAT=axplat-aarch64-raspi chainboot ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/test-aarch64-cpu-feat/c/CMakeLists.txt Specifies the installation rule for the built executable. The 'test-aarch64-cpu-feat' target will be installed to '/usr/bin' on the target system. ```cmake install(TARGETS test-aarch64-cpu-feat RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Installation Rule Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/bug-lseek-negative-einval/c/CMakeLists.txt Installs the built executable to '/usr/bin' on the target system. This specifies where the compiled program will be placed after installation. ```cmake install(TARGETS bug-lseek-negative-einval RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Building and Running `bwbench-client` Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/bwbench-client.md Build the release binary and run the client with root privileges. Specify 'sender' or 'receiver' mode and the network interface to use. ```bash cargo build --release --manifest-path os/arceos/tools/bwbench_client/Cargo.toml sudo ./target/release/bwbench_client [sender|receiver] ``` -------------------------------- ### Install QEMU on Debian/Ubuntu Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/qemu-quickstart.md If 'qemu-system-aarch64: command not found' error occurs, QEMU is not installed. Use this command to install it. ```bash sudo apt install qemu-system-aarch64 ``` -------------------------------- ### Run StarryOS Example Source: https://github.com/rcore-os/tgoskits/blob/dev/examples/starry/README.md Executes a StarryOS example scenario on a board. Replace `` with the desired example name. ```bash cargo starry example board -t orangepi-5-plus-uvc ``` -------------------------------- ### Minimal Kernel Initialization and Shutdown Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/docs/components/crates/hello-kernel.md This is the main function of the hello-kernel example. It initializes the platform, prints startup messages, waits for 5 seconds using busy-wait, and then shuts down the system. It's designed to be the shortest possible example demonstrating a successful boot. ```rust #[ax_plat::main] fn main(cpu_id: usize, arg: usize) -> ! { // Initialize per-CPU and platform components. init_kernel(cpu_id, arg); // Print startup information. console_println!("Hello, ArceOS!"); console_println!("cpu_id = {cpu_id}, arg = {arg}"); // Busy-wait for 5 seconds, printing elapsed time. let mut elapsed = 0; while elapsed < 5 { // Busy-wait for approximately 1 second. busy_wait(Duration::from_secs(1)); elapsed += 1; console_println!("elapsed = {elapsed}s"); } // Shut down the system. console_println!("All done, shutting down!"); system_off(); } ``` -------------------------------- ### Runtime Installation Configuration Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bugfix/clone3-badsize/c/CMakeLists.txt Specifies that the built executable should be installed to the user's bin directory. This makes the program accessible after installation. ```cmake install(TARGETS clone3-badsize RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Using Different Configuration Files Source: https://github.com/rcore-os/tgoskits/blob/dev/os/axvisor/doc/task.py-usage.md Shows how to use different configuration files for development and production scenarios by copying and modifying .hvconfig.toml. ```bash # 开发配置 cp .hvconfig.toml .hvconfig.dev.toml # 编辑 .hvconfig.dev.toml 添加调试参数 # 生产配置 cp .hvconfig.toml .hvconfig.prod.toml # 编辑 .hvconfig.prod.toml 优化性能参数 # 使用不同配置 cp .hvconfig.dev.toml .hvconfig.toml && ./task.py build cp .hvconfig.prod.toml .hvconfig.toml && ./task.py run ``` -------------------------------- ### Install Executable Target Source: https://github.com/rcore-os/tgoskits/blob/dev/test-suit/starryos/normal/qemu-smp1/bug-raw-terminal-polling/c/CMakeLists.txt This snippet defines the installation rule for the built executable. It specifies that the 'bug-raw-terminal-polling' executable should be installed in '/usr/bin' at runtime. ```cmake install(TARGETS bug-raw-terminal-polling RUNTIME DESTINATION usr/bin) ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/rcore-os/tgoskits/blob/dev/docs/README.md Run these commands in the `docs/` directory to install project dependencies using Yarn. Ensure Node.js 18+ and Yarn are installed. ```bash corepack enable yarn install --frozen-lockfile ```