Skip to main content

Build the Complete Firmware

The Three-Step Workflow​

cd recamera-pro-sdk-v1.0.10
./build.sh lunch # 1. Select a board configuration
./build.sh all # 2. Build and package the images
ls output/image/ # 3. Inspect the outputs

./build.sh all runs these stages in order: sysdrv (U-Boot + kernel + rootfs) → media → app → recovery → firmware (image packaging).

Running ./build.sh with no arguments executes allsave by default (all + save). This also archives images, patches, and build information under IMAGE/. In CI, run ./build.sh all explicitly if you do not want the archive.

Select a Board Configuration​

./build.sh lunch

The script lists and numbers all 50 BoardConfig-*.mk files under project/cfg/. Their names follow this pattern:

BoardConfig-"boot-medium"-"power-scheme"-"hardware-version"-"application-scenario".mk

For reCamera Pro, choose one of the two configurations under BoardConfig_Recamera2/:

Configuration fileDescription
BoardConfig_Recamera2/BoardConfig-EMMC-RK801-RV1126B_V1-IPC_64BIT.mk64-bit, recommended; uses aarch64-rockchip1240-linux-gnu
BoardConfig_Recamera2/BoardConfig-EMMC-RK801-RV1126B_V1-IPC.mk32-bit version

The menu number can change between SDK versions because entries are sorted by filename. Do not hard-code the number in documentation, scripts, or CI configuration; use the full filename instead.

lunch accepts a configuration filename directly, avoiding the interactive menu:

./build.sh lunch BoardConfig-EMMC-RK801-RV1126B_V1-IPC_64BIT.mk

After selection, the SDK root contains a symbolic link named .BoardConfig.mk pointing to the selected file:

ls -l .BoardConfig.mk
./build.sh info # Check the current configuration, defconfig, DTS, partition table, and all RK_* variables

Complete build.sh Command Reference​

Component Builds​

CommandDescription
envGenerate the env partition image (partition table and boot arguments)
metaBuild/export multimedia meta headers; optional, handled automatically when building apps
ubootBuild U-Boot
kernelBuild the kernel
rootfsBuild the root filesystem with Buildroot
driverBuild kernel driver modules (.ko)
sysdrvBuild U-Boot + kernel + rootfs
mediaBuild multimedia libraries such as mpp / rockit / rkaiq / rga / iva
appBuild reference applications (depends on media; media must be built first)
recoveryBuild the recovery system
toolBuild host-PC tools
mcuBuild MCU-side RT-Thread firmware. This command is handled before normal argument parsing; use ./build.sh mcu [configuration]

Packaging and Complete-System Commands​

CommandDescription
allBuild and package all images required to boot the system
allsaveRun all + save; the default when no argument is provided
firmwarePackage all images required to boot the system
updateimgPackage all partition images into update.img
unpackimgExtract an update.img package
otaPackage the OTA update archive update_ota.tar
factoryCreate a factory flashing image using tools/linux/SocToolKit
sdcard_upgradeCreate an SD-card upgrade image
saveArchive images, patches, and debug information to IMAGE/; save xml also saves the repo manifest

Clean​

CommandDescription
cleanClean all build outputs
clean uboot / clean kernel / clean driver / clean rootfs / clean sysdrvClean the selected component
clean media / clean app / clean recoveryClean media, applications, or recovery

Configuration Menus​

CommandDescription
kernelconfigOpen kernel menuconfig; on exit, automatically save the configuration back to defconfig with savedefconfig
buildrootconfigOpen Buildroot menuconfig and save the defconfig on exit

kernelconfig first saves a defconfig.before snapshot. If the configuration has not changed, it skips savedefconfig.

Secure Boot and Advanced Commands​

CommandDescription
dmCreate device-mapper images for encrypted or verity partitions
dm-key-genGenerate a device-mapper key
secure-boot-key-genGenerate secure-boot keys

Get Help (Watch Out for This)​

./build.sh help          # Print usage
./build.sh help media # Show the actual make command used for media
./build.sh help kernel # Likewise for kernel; also works with uboot/rootfs/sysdrv

Pitfall: before lunch, ./build.sh --help may first open the board-selection menu instead of showing help. The script checks for .BoardConfig.mk before parsing arguments and forces board selection if the link is missing. Run ./build.sh lunch first; after selecting a board, --help / help can show the usage information.

help <component> is especially useful because it reveals the underlying make command and arguments used by build.sh, making it easier to reproduce a build manually or diagnose a problem.

Build Mode Modifiers​

Prefix a command with DEBUG or ASAN to change the build mode:

./build.sh DEBUG app     # -O0 -g -ggdb -pg
./build.sh ASAN app # -O0 -g -ggdb -fsanitize=address -fno-stack-protector -fno-omit-frame-pointer -fsanitize-recover=all
./build.sh app # Default RELEASE: -Os; strip binaries during packaging

In RELEASE mode, packaging runs strip, except on libpthread*.so* and ld-*.so* (gdb's pthread debugging and valgrind require unstripped symbols). Kernel modules (.ko) receive only --strip-debug. DEBUG mode skips stripping and also installs libc debug symbols (runtime_lib/libc, lib.tar.bz2).

Incremental Builds​

./build.sh app                             # Rebuild applications only; fastest when changing application code
./build.sh app && ./build.sh firmware # Rebuild applications and repackage the images
./build.sh kernel # Rebuild the kernel only
./build.sh clean app && ./build.sh app # Clean and rebuild applications when needed

Build one application directly (run lunch first):

make -C project/app/recamera_notify        # Build one application
make -C project/app/recamera_notify distclean

Build media separately (run lunch first; media can be built independently of the rest of the SDK):

make -C media

Build Outputs​

output/image/ — Flashable Images​

FileDescription
download.binDevice-side program used for flashing communication; loaded into board memory only
idblock.imgLoader, including DDR initialization
uboot.imgU-Boot
env.imgPartition table and boot arguments
boot.imgKernel image including the DTB
rootfs.imgRoot filesystem (ext4)
recovery.imgRecovery system (RK_ENABLE_RECOVERY=y in this board configuration)
misc.imgmisc partition used for the recovery boot flag; this board configuration uses recovery-misc.img
userdata.imguserdata partition (ext4, mounted at /userdata)
update.imgComplete package for all partitions; can be used for an update
parameter.txtPartition table text used by rkflash.sh

output/out/ — Intermediate Outputs​

DirectoryDescription
media_out/media include/ and lib/, used as application dependencies
app_out/Application outputs merged into the rootfs under bin/lib/share/etc/root during packaging
rootfs_glibc_rv1126b/Rootfs packaging directory
sysdrv_out/sysdrv outputs
oem/, userdata/, ramdisk/OEM partition, userdata, and recovery ramdisk contents
S20linkmount, S21appinitGenerated partition-mount and OEM application-startup scripts

Expected First-Build Time​

A full ./build.sh all includes a complete Buildroot build and can take tens of minutes to several hours, depending on CPU cores and storage. On the first run, Buildroot extracts sysdrv/tools/board/buildroot/buildroot-2023.02.6.tar.gz and downloads/builds many packages, so an internet connection is required. Incremental builds are much faster because they rebuild only changed components.

For the first build, consider using screen or tmux and saving the log:

./build.sh all 2>&1 | tee build_$(date +%Y%m%d_%H%M).log

Pre-Build Checklist​

  • ./setup_build_env.sh has completed, and the version summary shows no required tool as NOT INSTALLED.
  • ./build.sh lunch selected BoardConfig_Recamera2/...IPC_64BIT.mk, and the .BoardConfig.mk symbolic link exists.
  • ./build.sh info reports rv1126b-recamera2-v1.dts for RK_KERNEL_DTS.
  • At least 20 GB of free disk space remains on the SDK partition (100 GB or more recommended).
  • If you changed the board configuration, run ./build.sh clean first.

Next, flash the images to the board: Flashing and Boot.

Tech Support & Product Discussion​

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...