Build RadxaOS
Installing rsdk
rsdk is the current build environment for RadxaOS, which has the following features:
- Containerized build environment, no need to configure build dependencies additionally.
- Modularized build scripts that are easy to modify.
- Support for x86 and ARM64 platforms.
Here is a brief introduction to how to install rsdk
Method 1: Install via DevContainer (recommended for development environment)
- First, please install the required dependencies:
sudo apt-get update
sudo apt-get install git qemu-user-static binfmt-support
sudo apt-get install npm docker.io
sudo usermod -a -G docker $USER
- Use the following commands to clone the project and install DevContainer:
git clone --recurse-submodules https://github.com/RadxaOS-SDK/rsdk.git
cd rsdk
npm install @devcontainers/cli
export PATH="$PWD/src/bin:$PWD/node_modules/.bin:$PATH"
rsdk devcon up
rsdk devcon
When the terminal appears as follows, you are now inside the rsdk's dev container shell.
██████╗ ███████╗██████╗ ██╗ ██╗
██╔══██╗██╔════╝██╔══██╗██║ ██╔╝
██████╔╝███████╗██║ ██║█████╔╝
██╔══██╗╚════██║██║ ██║██╔═██╗
██║ ██║███████║██████╔╝██║ ██╗
╚═╝ ╚═╝╚══════╝╚═════╝ ╚═╝ ╚═╝
RadxaOS Software Development Kit
Please run `rsdk shell` to enter the full development shell.
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +DEVENV_DOTFILE +DEVENV_PROFILE +DEVENV_ROOT +DEVENV_RUNTIME
+DEVENV_STATE +DEVENV_TASKS +HOST_PATH +IN_NIX_SHELL +LD +LOCALE_ARCHIVE +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu
+NIX_BUILD_CORES +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_LDFLAGS
+NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_STORE +NM +NODE_PATH +OBJCOPY +OBJDUMP +PKG_CONFIG +PKG_CONFIG_PATH +PYTHONHASHSEED +PYTHONNOUSERSITE
+PYTHONPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STARSHIP_SESSION_KEY +STRINGS +STRIP +\_PYTHON_HOST_PLATFORM +\_PYTHON_SYSCONFIGDATA_NAME +\_\_structuredAttrs +buildInputs
+buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated
+depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +hardeningDisable +mesonFlags +name +nativeBuildInputs +out +outputs +patches
+phases +preferLocalBuild +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS
vscode ➜ /workspaces/rsdk (main) $
For detailed usage of the repository, please refer to the rsdk page.
If you need to conduct secondary development based on rsdk, please continue reading the documentation Build customization.
Method 2: Build rsdk deb package from source (recommended for Debian 12)
For Debian 12 systems, you can build the rsdk deb package from source without using DevContainer. After building and installing, you can use the rsdk command locally.
- Clone the source repository:
git clone --recurse-submodules https://github.com/RadxaOS-SDK/rsdk.git
cd rsdk
If your system is not based on RadxaOS (or has not configured Radxa software sources), please first add the Radxa signature keyring and add the software source to meet build dependencies:
# Install signature keyring
keyring="$(mktemp)"
version="$(curl -L https://github.com/radxa-pkg/radxa-archive-keyring/releases/latest/download/VERSION)"
curl -L --output "$keyring" "https://github.com/radxa-pkg/radxa-archive-keyring/releases/latest/download/radxa-archive-keyring_${version}\_all.deb"
sudo dpkg -i "$keyring"
rm -f "$keyring"
# Add Radxa APT software source and update package index
sudo tee /etc/apt/sources.list.d/70-radxa.list <<< "deb [signed-by=/usr/share/keyrings/radxa-archive-keyring.gpg] https://radxa-repo.github.io/bookworm/ bookworm main"
sudo apt-get update
(Note: If you are already using RadxaOS or have configured the corresponding software sources, you can skip the above steps.)
If you have difficulty accessing GitHub, you can use domestic mirror git and software source sites:
git clone https://gitcode.com/radxaos-sdk/rsdk.git
sudo tee /etc/apt/sources.list.d/70-radxa.list <<< "deb [trusted=yes] https://mirrors.sdu.edu.cn/radxa-repo/bookworm/ bookworm main"
- Install build-related dependencies and prepare the build environment:
sudo apt-get update
sudo apt-get install devscripts dpkg-dev build-essential
sudo apt build-dep .
- Build the deb package:
dpkg-buildpackage -us -uc -b
- After successful build, the generated deb package is located in the parent directory (..), and can be installed with the following command:
sudo apt install ../rsdk\_\*.deb
- After installation, use the
rsdkcommand to start the TUI wizard (same steps as Method 1).
Using rsdk
The rsdk command is the universal CLI entry point; when run without any parameters, it defaults to launching the rsdk-tui wizard.
Start the TUI wizard: Run rsdk in the terminal.
-
In the wizard, select the task to run, use the arrow keys to navigate, press Enter to confirm the operation in the current window, press Esc to exit the current window.
-
In the example below, we select Build system image:
┌─────────────────┤ RSDK ├──────────────────┐
│ Please select a task: │
│ │
│ Build system image │
│ ========= │
│ About │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────┘
Select the product to build. Note: Use the space key to select the product, the selected item will display * in parentheses (pressing Enter alone will not select the product):
If you cannot find your product model, select the option corresponding to your product's SoC model.
Example: Radxa CM4 / NX4 and ROCK 4D use the Rockchip RK3576 SoC, so you should select radxa-rk3576.
┌─────────────────┤ RSDK ├──────────────────┐
│ Please select a product: │
│ │
│ ( ) radxa-e25 │
│ (*) rock-5b-6_1 │
│ ( ) rock-5b │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────┘
Select Yes to start building, rsdk-tui will run the associated CLI commands to complete the task.
Before starting the actual build, the wizard will ask if you want to configure optional package mirrors (Radxa's radxa-deb mirror and optional Debian/Ubuntu mirror). If you select No, it will use the default mirror and proceed directly to confirmation; if you select Yes, the wizard will guide you to select mirrors (you can choose the default). If you cancel during mirror selection, it will return to the question of whether to configure mirrors.
It is recommended for users in China to choose to use mirror sources to improve package download speed.
Example: Select Radxa APT mirror:
┌─────────────────┤ RSDK ├──────────────────┐
│ Select Radxa APT mirror (radxa-deb): │
│ │
│ (*) Use official Radxa repository │
│ ( ) mirrors.aghost.cn │
│ ( ) mirrors.cqu.edu.cn │
│ ( ) mirrors.lzu.edu.cn │
│ ( ) mirrors.hust.edu.cn │
│ ( ) mirrors.sdu.edu.cn │
│ ( ) mirror.nju.edu.cn │
│ ( ) mirror.nyist.edu.cn │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────┘
Then you can select an optional Debian/Ubuntu mirror (or keep the default):
┌─────────────────┤ RSDK ├──────────────────┐
│ Select Debian/Ubuntu mirror (optional): │
│ │
│ (*) Use default Debian/Ubuntu mirror │
│ ( ) mirrors.ustc.edu.cn │
│ ( ) mirrors.tuna.tsinghua.edu.cn │
│ ( ) mirrors.cqu.edu.cn │
│ ( ) mirrors.lzu.edu.cn │
│ ( ) mirrors.hust.edu.cn │
│ ( ) mirrors.sdu.edu.cn │
│ ( ) mirror.nju.edu.cn │
│ ( ) mirror.nyist.edu.cn │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────────┘
Confirm and start building: After mirror configuration (if any), the wizard will display a summary of the selected product and mirrors (corresponding to the final CLI command to be executed), please carefully check the summary and select Yes to start building, or select No to return and modify:
┌─────────────────┤ RSDK ├──────────────────┐
│ │
│ Are you sure to build with: │
│ │
│ Product: rock-5b-6_1 │
│ Radxa mirror: https://mirrors.example/ │
│ Debian/Ubuntu mirror: https://mirrors/ │
│ Are you sure to build for 'rock-5b-6_1'? │
│ │
│ │
│ <Yes> <No> │
│ │
└───────────────────────────────────────────┘
- For advanced building, please use the
rsdk-buildcommand.
After compilation, an out directory will be generated, and output.img is the final generated image:
vscode ➜ /workspaces/rsdk (main) $ ls out/rock-5b_bookworm_kde/
build-image config.yaml debs manifest output.img rootfs.tar seed.tar.xz
For detailed usage of the repository, please refer to the rsdk page.
If you need to conduct secondary development based on rsdk, please continue reading the documentation Build customization.
Common Issues
- Devcontainer setup paused with the message: You might be rate limited by GitHub. You might be rate limited by GitHub. Please follow the instructions listed in the output.
- Failed to launch devcontainer. Please edit .devcontainer/devcontainer.json, and adjust the runArgs property.