build/config/sources/families/rockchip.conf

110 lines
3.9 KiB
Plaintext
Raw Normal View History

#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
#
enable_extension "rkbin-tools"
ARCH=armhf
BOOTSCRIPT="boot-rockchip.cmd:boot.cmd"
BOOTENV_FILE='rockchip.txt'
OVERLAY_PREFIX='rockchip'
UBOOT_TARGET_MAP=";;$SRC/packages/blobs/rockchip/rk3288_boot.bin u-boot-rockchip-with-spl.bin"
BOOTDELAY=1
if [[ $BOARD == miqi ]]; then
BOOTBRANCH='tag:v2017.11'
BOOTPATCHDIR='legacy'
else
BOOTBRANCH='tag:v2022.04'
BOOTPATCHDIR='v2022.04'
fi
SERIALCON=ttyS2
case $BRANCH in
current)
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-6.1.y'
;;
edge)
declare -g KERNEL_MAJOR_MINOR="6.4" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-6.4.y'
;;
esac
CPUMIN="600000"
CPUMAX="1900000"
GOVERNOR="ondemand"
write_uboot_platform() {
dd if=/dev/zero of=$2 bs=1k count=1023 seek=1 status=noxfer > /dev/null 2>&1
dd if=$1/u-boot-rockchip-with-spl.bin of=$2 seek=64 conv=notrunc > /dev/null 2>&1
}
uboot_custom_postprocess() {
# xt-q8l-v10 requires the original DDR init blob because u-boot does not support LPDDR2 initialization
# for rk3288 SoC (binary is in sources/rkbin-tools/rk32 path). U-boot is configured to produce a TPL
# which is thrown away. SPL does some more initial configurations, expecially pinmux for power hold,
# so reset works more reliably. U-boot image is set to be at sector 0x200 on the eMMC/SD,
# so we burn it 0x200-0x40 because of the rockchip 0x40 sectors offset.
if [[ $BOARD == xt-q8l-v10 ]]; then
tools/mkimage -n rk3288 -T rksd -d $SRC/cache/sources/rkbin-tools/rk32/rk3288_ddr_400MHz_v1.08.bin u-boot-rockchip-with-spl.bin
cat spl/u-boot-spl-dtb.bin >> u-boot-rockchip-with-spl.bin
dd if=u-boot-dtb.img of=u-boot-rockchip-with-spl.bin seek=$((0x200 - 0x40)) conv=notrunc
else
tools/mkimage -n rk3288 -T rksd -d tpl/u-boot-tpl.bin u-boot-rockchip-with-spl.bin
cat spl/u-boot-spl-dtb.bin >> u-boot-rockchip-with-spl.bin
dd if=u-boot-dtb.img of=u-boot-rockchip-with-spl.bin seek=$((0x200 - 0x40)) conv=notrunc
fi
}
family_tweaks() {
if [[ $BOARD == tinkerboard ]]; then
chroot_sdcard_apt_get_install rfkill bluetooth bluez bluez-tools
if [[ -f "$SDCARD/etc/pulse/default.pa" ]]; then
sed -i -e "/#load-module module-alsa-sink/r $SRC/packages/bsp/rockchip/pulseaudio.txt" "$SDCARD/etc/pulse/default.pa" 2>&1
else
display_alert "Can't find pulseaudio config" "${BOARD} - family_tweaks" "warn"
fi
fi
return 0
}
family_tweaks_bsp() {
#Graphics and media
mkdir -p $destination/etc/udev/rules.d
mkdir -p $destination/usr/local/bin
cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rockchip/50-hevc.rules $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rockchip/50-mali.rules $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rockchip/50-vpu.rules $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rockchip/60-media.rules $destination/etc/udev/rules.d
install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin
# Peripheral access for specific groups
addgroup --system --quiet --gid 997 gpio || display_alert "Failed to create 997 group gid" "gpio" "warn"
addgroup --system --quiet --gid 998 i2c || display_alert "Failed to create 997 group gid" "gpio" "warn"
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/
cp $SRC/packages/bsp/rockchip/89-pulseaudio-usb.rules $destination/etc/udev/rules.d
# AP6330 (BCM4330) firmware initramfs hook for in-kernel btbcm driver
mkdir -p $destination/etc/initramfs-tools/hooks
install -m 550 $SRC/packages/bsp/rockchip/ap6330-initramfs-firmware $destination/etc/initramfs-tools/hooks
return 0 # exit with success
}