# # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2013-2025 Igor Pecovnik, igor@armbian.com # # This file is a part of the Armbian Build Framework # https://github.com/armbian/build/ # # # RV1106 family: includes Rockchip RV1103 and RV1106 SoCs. # This family is optimized for low-memory (64-256MB). # enable_extension "rkbin-tools" # BOOT_SOC has to be set in the board configuration file; if not set # we resort to rv1106 BOOT_SOC=${BOOT_SOC:="rv1106"} ARCH=armhf BOOTDELAY=1 SERIALCON="ttyFIQ0" RKBIN_DIR="$SRC/cache/sources/rkbin-tools" SRC_EXTLINUX="yes" # Bootargs: # cma=0 -- disable CMA allocations (used by video / ipc) to save memory # video=off -- disable video subsystem to save memory # udev.children-max=1 -- limit number of udev child processes to save memory early in boot # console=ttyFIQ0,115200n8 -- set console to FIQ0 serial port at 115200 baud SRC_CMDLINE="cma=0 video=off udev.children-max=1 console=ttyFIQ0,115200n8" OVERLAY_PREFIX="rv1106" OFFSET=16 SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_optee.sh" UBOOT_TARGET_MAP="spl/u-boot-spl.bin u-boot.dtb u-boot-nodtb.bin;;download.bin idblock.img u-boot.itb" BOOTSOURCE="https://github.com/radxa/u-boot.git" BOOTBRANCH="branch:next-dev-buildroot" BOOTPATCHDIR="legacy/u-boot-rockchip-buildroot" BOOTDIR="u-boot-rockchip" # Set defaults based on BOOT_SOC (overridable in board config) if [[ "$BOOT_SOC" == "rv1103" ]]; then DDR_BLOB="${DDR_BLOB:-"rv11/rv1103b_ddr_924MHz_v1.05.bin"}" TEE_BLOB="${TEE_BLOB:-"rv11/rv1103b_tee_ta_v1.03.bin"}" USBPLUG_BLOB="${USBPLUG_BLOB:-"rv11/rv1103b_usbplug_v1.00.bin"}" elif [[ "$BOOT_SOC" == "rv1106" ]]; then DDR_BLOB="${DDR_BLOB:-"rv11/rv1106_ddr_924MHz_v1.15.bin"}" TEE_BLOB="${TEE_BLOB:-"rv11/rv1106_tee_ta_v1.13.bin"}" USBPLUG_BLOB="${USBPLUG_BLOB:-"rv11/rv1106_usbplug_v1.09.bin"}" else display_alert "$BOARD" "Unknown BOOT_SOC: ${BOOT_SOC} in rockchip-rv1106 family" "error" exit 1 fi case $BRANCH in vendor) declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. KERNELSOURCE='https://github.com/armbian/linux-rockchip.git' KERNELBRANCH='branch:rk-6.1-rkr5.1' KERNELPATCHDIR='rv1106-vendor-6.1' KERNEL_BTF="no" ;; esac function post_config_uboot_target__downgrade_gcc_errors_to_warnings() { declare -i gcc_major_version=0 gcc_major_version=$(gcc -dumpversion | cut -d. -f1) display_alert "$BOARD" "GCC major version: ${gcc_major_version}" "debug" # Rockchip/Radxa U-Boot won't build with GCC 13 due to enum-int-mismatch if [[ ${gcc_major_version} -ge 13 ]]; then display_alert "$BOARD" "Adding extra CFLAGS to fix vendor U-Boot building with GCC 13+" "info" uboot_cflags_array+=("-Wno-error=enum-int-mismatch") fi return 0 } function pre_config_uboot_target__copy_tee() { # Makefiles expect 'tee.bin' in the uboot build directory display_alert "Copy TEE blob" "info" run_host_command_logged cp ${RKBIN_DIR}/${TEE_BLOB} tee.bin return 0 } uboot_custom_postprocess() { display_alert "Generate u-boot.its" "info" run_host_command_logged $SPL_FIT_GENERATOR -t 0x03d00000 -c lzma > u-boot.its display_alert "Generate u-boot.itb" "info" # Remove uboot-generated itb if exists rm -f u-boot.itb run_host_command_logged tools/mkimage -f u-boot.its -E u-boot.itb display_alert "Generate idblock.img with u-boot SPL" "debug" RKBOOT_INI_FILE=rv1106.ini cp $RKBIN_DIR/rv11/RV1106MINIALL.ini $RKBOOT_INI_FILE sed -i "s|Path1=.*rv1106_ddr.*$|Path1=${RKBIN_DIR}/${DDR_BLOB}|g" $RKBOOT_INI_FILE sed -i "s|Path1=.*rv1106_usbplug.*$|Path1=${RKBIN_DIR}/${USBPLUG_BLOB}|g" $RKBOOT_INI_FILE sed -i "s|FlashData=.*$|FlashData=${RKBIN_DIR}/${DDR_BLOB}|g" $RKBOOT_INI_FILE sed -i "s|FlashBoot=.*$|FlashBoot=./spl/u-boot-spl.bin|g" $RKBOOT_INI_FILE sed -i "s|PATH=.*$|PATH=download.bin|g" $RKBOOT_INI_FILE sed -i "s|IDB_PATH=.*$|IDB_PATH=idblock.img|g" $RKBOOT_INI_FILE run_host_x86_binary_logged $RKBIN_DIR/tools/boot_merger $RKBOOT_INI_FILE rm -f $RKBOOT_INI_FILE } # Note that write_uboot_platform() is also used to install # the bootloader in the proper place during live systems upgrade. write_uboot_platform() { # This is run board-side too, so account for the non-existance of run_host_command_logged local logging_prelude="" [[ $(type -t run_host_command_logged) == function ]] && logging_prelude="run_host_command_logged" ${logging_prelude} dd if=$1/idblock.img of=$2 bs=512 seek=$((0x40)) conv=notrunc status=none ${logging_prelude} dd if=$1/u-boot.itb of=$2 bs=512 seek=$((0x440)) conv=notrunc status=none } family_tweaks() { # Create gpio and i2c groups on the build rootfs; they are matched against # udev rules to allow non-root user access to these resources chroot_sdcard addgroup --system --quiet --gid 900 gpio chroot_sdcard addgroup --system --quiet --gid 901 i2c return 0 } family_tweaks_bsp() { mkdir -p $destination/etc/udev/rules.d mkdir -p $destination/usr/local/bin # Peripheral access for specific groups cp $SRC/packages/bsp/rockchip/70-gpio.rules $destination/etc/udev/rules.d cp $SRC/packages/bsp/rockchip/71-i2c.rules $destination/etc/udev/rules.d # Sound cp $SRC/packages/bsp/rockchip/asound.conf $destination/etc/ # AP6330 (BCM4330) firmware initramfs hook for in-kernel btbcm driver if [[ "$INSTALL_ARMBIAN_FIRMWARE" == "yes" ]]; then mkdir -p $destination/etc/initramfs-tools/hooks install -m 550 $SRC/packages/bsp/rockchip/ap6330-initramfs-firmware $destination/etc/initramfs-tools/hooks fi return 0 # exit with success }