Files
build/config/sources/families/realtek-rtd1619b.conf
Wei e696c2eb3b Add support for XpressReal T3
XpressReal(https://xpressreal.io/) is a family of Single Board Computers
developed in collaboration between Fyde Innovations, Radxa and Realtek.

XpressReal T3 is the first product in the family - a small form factor
high performance single board computer powered by the Realtek RTD1619B,
which runs FydeOS/openFyde and Linux!

Now we are adding the awesome Armbian Linux support for XpressReal T3!

This commit introduces some binary files that XpressReal T3 needed:

- firmware/realtek/rtd1619b
	These binaries are the firmware for rtd1619b peripherals
	(including the audio decoder, video decoder, etc.).
- u-boot-fw.tar.gz
	This contains some co-processor firmware,
	which needs to be loaded by u-boot in the early stage of boot.
- u-boot-prebuilt.tar.gz
	These are hwsettings related files, used for tasks such as DDR initialization.

These files come from the rtd1619b SDK, which has already been open-sourced on our github:

- [firmware](https://github.com/XpressReal/linux-sdk/tree/main/meta-xpressreal/recipes-kernel/linux-firmware/files/rtd1619b)
- [u-boot prebuilts](https://github.com/XpressReal/linux-sdk/tree/main/meta-xpressreal/recipes-bsp/u-boot/files/prebuilt/rtd1619b)
2025-09-04 20:32:34 +08:00

131 lines
4.8 KiB
Plaintext

#
# SPDX-License-Identifier: GPL-2.0
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
#
ARCH=arm64
ATF_COMPILE="no"
SERIALCON='ttyS0'
BOOTSOURCE='https://github.com/XpressReal/u-boot.git'
BOOTBRANCH='branch:v2024.01-xpressreal'
BOOTCONFIG="rtd1619b_bleedingedge_defconfig"
BOOTPATCHDIR="u-boot-xpressreal"
BOOTSCRIPT='boot-xpressreal-t3.cmd:boot.cmd'
BOOTENV_FILE='xpressreal-t3.txt'
UBOOT_TARGET_MAP=";;u-boot.bin-rtd1619b_emmc rtd1619b_emmc_bind_4gb.bin"
case $BRANCH in
vendor)
KERNELSOURCE='https://github.com/XpressReal/linux.git'
KERNEL_MAJOR_MINOR="6.6"
KERNELBRANCH='branch:v6.6.54-xpressreal-t3'
LINUXCONFIG="linux-xpressreal-t3-6.6"
KERNEL_BTF="no"
;;
esac
function add_host_dependencies__xpressreal_t3() {
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} xxd python3-setuptools device-tree-compiler lzop u-boot-tools openssl binutils"
}
function pre_config_uboot_target__xpressreal_prepare() {
display_alert "Run pre_config_uboot_target"
local PREBUILT_FILE="${SRC}/packages/bsp/xpressreal-t3/u-boot/u-boot-prebuilt.tar.gz"
local FW_FILE="${SRC}/packages/bsp/xpressreal-t3/u-boot/u-boot-fw.tar.gz"
if [ -f "${FW_FILE}" ]; then
display_alert "Extract FW files..."
run_host_command_logged tar xvf "${FW_FILE}"
fi
if [ -f "${PREBUILT_FILE}" ]; then
display_alert "Extract prebuilt files..."
run_host_command_logged tar xvf "${PREBUILT_FILE}"
fi
if [ -d "./prebuilt/keys" ]; then
display_alert "Copy keys..."
run_host_command_logged cp -r "./prebuilt/keys" "./keys"
else
display_alert "No signing keys found"
fi
}
function post_uboot_custom_postprocess__xpressreal_generate_image() {
display_alert "Run post_uboot_custom_postprocess"
local KEY_DIR="./keys"
local PREBUILT="./prebuilt"
if [ -d "./keys" ]; then
display_alert "Signing SPL..."
run_host_command_logged openssl dgst -sha256 -binary "./spl/u-boot-spl.bin_pad" > "${PREBUILT}/u-boot-spl.sha"
run_host_command_logged openssl pkeyutl -inkey "${KEY_DIR}/dev.key" -sign -in "${PREBUILT}/u-boot-spl.sha" -out "${PREBUILT}/u-boot-spl.sig"
run_host_command_logged objcopy -I binary -O binary --reverse-bytes=256 "${PREBUILT}/u-boot-spl.sig" "${PREBUILT}/u-boot-spl.sig"
fi
display_alert "Generate u-boot images..."
run_host_command_logged cp -v "./spl/u-boot-spl.bin_pad" "${PREBUILT}/"
run_host_command_logged cp -v "./u-boot.img" "${PREBUILT}/"
run_host_command_logged cpp -P -nostdinc -undef -D__DTS__ -x assembler-with-cpp \
-o "${PREBUILT}/rtd1619b_emmc_4gb.pp" "${PREBUILT}/rtd1619b_emmc_lpddr4_4gb.dts"
run_host_command_logged dtc -I dts -O dtb -o "${PREBUILT}/rtd1619b_emmc_4gb.dtb" "${PREBUILT}/rtd1619b_emmc_4gb.pp"
run_host_command_logged tools/binman/binman build --update-fdt -I "${PREBUILT}" --dt "${PREBUILT}/rtd1619b_emmc_4gb.dtb" -O ./
run_host_command_logged cp -vf "./u-boot.itb" "./u-boot.bin-rtd1619b_emmc"
run_host_command_logged cp -vf "./bind_4gb.bin" "./rtd1619b_emmc_bind_4gb.bin"
}
function pre_package_uboot_image__xpressreal_install_image() {
if [ -f "./u-boot.bin-rtd1619b_emmc" ]; then
display_alert "Found ./u-boot.bin-rtd1619b_emmc, preparing to install to /boot." "info"
run_host_command_logged mkdir -p "${destination}/boot"
run_host_command_logged cp -v "./u-boot.bin-rtd1619b_emmc" "${destination}/boot/u-boot.bin-rtd1619b_emmc"
else
display_alert "No u-boot.bin-rtd1619b_emmc found, skipping installation to /boot." "info"
fi
}
function write_uboot_platform() {
local DIR=$1
local DEVICE=$2
display_alert "XpressReal T3" "Writing u-boot to ${DEVICE}..." "info"
if [[ ! -b "${DEVICE}" ]]; then
display_alert "XpressReal T3" "Device ${DEVICE} is not a block device" "err"
return 1
fi
if [[ "${DEVICE}" == "/dev/mmcblk0" ]]; then
# disable boot0/boot1 write protection
echo 0 > /sys/block/mmcblk0boot0/force_ro
echo 0 > /sys/block/mmcblk0boot1/force_ro
dd if="${DIR}/rtd1619b_emmc_bind_4gb.bin" of="/dev/mmcblk0boot0" bs=4096 status=none conv=fsync
dd if="${DIR}/rtd1619b_emmc_bind_4gb.bin" of="/dev/mmcblk0boot1" bs=4096 status=none conv=fsync
# clear saved u-boot environment variables
dd if=/dev/zero of=/dev/mmcblk0boot0 bs=4096 seek=256 count=32 status=none conv=fsync
dd if=/dev/zero of=/dev/mmcblk0boot1 bs=4096 seek=256 count=32 status=none conv=fsync
sync
fi
}
function pre_customize_image__xpressreal_install_firmware() {
local firmware_source_dir="${SRC}/packages/bsp/xpressreal-t3/firmware"
local firmware_dest_dir="${SDCARD}/lib/firmware"
if [ -d "${firmware_source_dir}" ]; then
display_alert "Copy firmware: ${firmware_source_dir} -> ${firmware_dest_dir}" "info"
run_host_command_logged mkdir -p "${firmware_dest_dir}"
run_host_command_logged cp -r "${firmware_source_dir}"/* "${firmware_dest_dir}/"
else
display_alert "Custom firmware directory not found, skipping"
fi
}