diff --git a/projects/Rockchip/README.md b/projects/Rockchip/README.md new file mode 100644 index 0000000000..e39aefc74c --- /dev/null +++ b/projects/Rockchip/README.md @@ -0,0 +1,16 @@ +# Rockchip + +This project is for Rockchip SoC devices + +## Devices + +**My single-board computer is not listed, will it be added in the future?**
+If your single-board computer uses a current generation SoC listed on http://opensource.rock-chips.com/wiki_Main_Page the odds are in your favor. + +**My Android device is not listed, will it be added in the future?**
+You may have luck if your device vendor is open source friendly, otherwise keep using Android for best support. + +## Links + +* https://github.com/rockchip-linux +* http://opensource.rock-chips.com diff --git a/projects/Rockchip/bootloader/canupdate.sh b/projects/Rockchip/bootloader/canupdate.sh new file mode 100644 index 0000000000..dc1f71f97b --- /dev/null +++ b/projects/Rockchip/bootloader/canupdate.sh @@ -0,0 +1,24 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +# Allow upgrades between arm and aarch64 +if [ "$1" = "@PROJECT@.arm" -o "$1" = "@PROJECT@.aarch64" ]; then + exit 0 +else + exit 1 +fi diff --git a/projects/Rockchip/bootloader/install b/projects/Rockchip/bootloader/install new file mode 100644 index 0000000000..c83c030495 --- /dev/null +++ b/projects/Rockchip/bootloader/install @@ -0,0 +1,68 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_RKBIN="$(get_build_dir rkbin)" + +case "$UBOOT_SYSTEM" in + rk3036) + PKG_DATAFILE="spl/u-boot-spl-nodtb.bin" + PKG_LOADER="u-boot-dtb.bin" + ;; + rk3328) + PKG_DATAFILE="$PKG_RKBIN/rk33/rk3328_ddr_786MHz_v1.08.bin" + PKG_LOADER="$PKG_RKBIN/rk33/rk3328_miniloader_v2.44.bin" + PKG_BL31="$PKG_RKBIN/rk33/rk3328_bl31_v1.34.bin" + ;; + rk3399) + PKG_DATAFILE="$PKG_RKBIN/rk33/rk3399_ddr_800MHz_v1.08.bin" + PKG_LOADER="$PKG_RKBIN/rk33/rk3399_miniloader_v1.06.bin" + PKG_BL31="$PKG_RKBIN/rk33/rk3399_bl31_v1.00.elf" + ;; + *) + PKG_DATAFILE="spl/u-boot-spl-dtb.bin" + PKG_LOADER="u-boot-dtb.bin" + ;; +esac + +if [ -n "$PKG_DATAFILE" -a -n "$PKG_LOADER" ]; then + tools/mkimage -n $UBOOT_SYSTEM -T rksd -d "$PKG_DATAFILE" idbloader.img + cat "$PKG_LOADER" >> idbloader.img + cp -av idbloader.img $INSTALL/usr/share/bootloader +fi + +if [ -n "$PKG_BL31" ]; then + $PKG_RKBIN/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img 0x200000 + cp -av uboot.img $INSTALL/usr/share/bootloader + + cat >trust.ini <. +################################################################################ + +if [ -f "$RELEASE_DIR/3rdparty/bootloader/idbloader.img" ]; then + echo "image: burn idbloader.img to image..." + dd if="$RELEASE_DIR/3rdparty/bootloader/idbloader.img" of="$DISK" bs=32k seek=1 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error +fi +if [ -f "$RELEASE_DIR/3rdparty/bootloader/uboot.img" ]; then + echo "image: burn uboot.img to image..." + dd if="$RELEASE_DIR/3rdparty/bootloader/uboot.img" of="$DISK" bs=64k seek=128 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error +fi +if [ -f "$RELEASE_DIR/3rdparty/bootloader/trust.img" ]; then + echo "image: burn trust.img to image..." + dd if="$RELEASE_DIR/3rdparty/bootloader/trust.img" of="$DISK" bs=64k seek=192 conv=fsync,notrunc >"$SAVE_ERROR" 2>&1 || show_error +fi diff --git a/projects/Rockchip/bootloader/release b/projects/Rockchip/bootloader/release new file mode 100644 index 0000000000..2efcf2f75c --- /dev/null +++ b/projects/Rockchip/bootloader/release @@ -0,0 +1,38 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +mkdir -p $RELEASE_DIR/3rdparty/bootloader + if [ -n "$UBOOT_SYSTEM" ]; then + BOOTLOADER_DIR=$(get_build_dir $BOOTLOADER) + if [ -f $BOOTLOADER_DIR/idbloader.img ]; then + cp -a $BOOTLOADER_DIR/idbloader.img $RELEASE_DIR/3rdparty/bootloader + fi + if [ -f $BOOTLOADER_DIR/uboot.img ]; then + cp -a $BOOTLOADER_DIR/uboot.img $RELEASE_DIR/3rdparty/bootloader + fi + if [ -f $BOOTLOADER_DIR/trust.img ]; then + cp -a $BOOTLOADER_DIR/trust.img $RELEASE_DIR/3rdparty/bootloader + fi + fi + + LINUX_DTS_DIR=$(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts + for dtb in $LINUX_DTS_DIR/*.dtb $LINUX_DTS_DIR/*/*.dtb; do + if [ -f $dtb ]; then + cp -a $dtb $RELEASE_DIR/3rdparty/bootloader + fi + done diff --git a/projects/Rockchip/bootloader/update.sh b/projects/Rockchip/bootloader/update.sh new file mode 100644 index 0000000000..aca46993a5 --- /dev/null +++ b/projects/Rockchip/bootloader/update.sh @@ -0,0 +1,65 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT="" +[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash" +[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) +if [ -z "$BOOT_DISK" ]; then + case $BOOT_PART in + /dev/sd[a-z][0-9]*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") + ;; + /dev/mmcblk*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") + ;; + esac +fi + +# mount $BOOT_ROOT r/w + mount -o remount,rw $BOOT_ROOT + +# update device tree + for all_dtb in $BOOT_ROOT/*.dtb; do + dtb=$(basename $all_dtb) + if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then + echo -n "Updating $dtb... " + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT + echo "done" + fi + done + +# update bootloader + if [ -f $SYSTEM_ROOT/usr/share/bootloader/idbloader.img ]; then + echo -n "Updating idbloader.img... " + dd if=$SYSTEM_ROOT/usr/share/bootloader/idbloader.img of=$BOOT_DISK bs=32k seek=1 conv=fsync &>/dev/null + echo "done" + fi + if [ -f $SYSTEM_ROOT/usr/share/bootloader/uboot.img ]; then + echo -n "Updating uboot.img... " + dd if=$SYSTEM_ROOT/usr/share/bootloader/uboot.img of=$BOOT_DISK bs=64k seek=128 conv=fsync &>/dev/null + echo "done" + fi + if [ -f $SYSTEM_ROOT/usr/share/bootloader/trust.img ]; then + echo -n "Updating trust.img... " + dd if=$SYSTEM_ROOT/usr/share/bootloader/trust.img of=$BOOT_DISK bs=64k seek=192 conv=fsync &>/dev/null + echo "done" + fi + +# mount $BOOT_ROOT r/o + sync + mount -o remount,ro $BOOT_ROOT diff --git a/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service new file mode 100644 index 0000000000..80d27f78c0 --- /dev/null +++ b/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service @@ -0,0 +1,24 @@ +[Unit] +Description=Debug Shell on /dev/ttyS2 +DefaultDependencies=no +ConditionKernelCommandLine=|console=ttyS2 +ConditionKernelCommandLine=|console=uart8250,mmio32,0xff130000 +ConditionKernelCommandLine=|console=uart8250,mmio32,0xff1a0000 +ConditionKernelCommandLine=|console=uart8250,mmio32,0xff690000 + +[Service] +WorkingDirectory=/storage +Environment="ENV=/etc/profile" +ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' +ExecStart=/bin/sh +Restart=always +RestartSec=0 +StandardInput=tty +TTYPath=/dev/ttyS2 +KillMode=process +IgnoreSIGPIPE=no +# bash ignores SIGTERM +KillSignal=SIGHUP + +[Install] +WantedBy=sysinit.target diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf new file mode 100644 index 0000000000..a79abf8d3e --- /dev/null +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf @@ -0,0 +1,34 @@ +# +# Configuration for HDMI +# + + + +HDMI.pcm.hdmi.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf new file mode 100644 index 0000000000..0a21710eaa --- /dev/null +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf @@ -0,0 +1,12 @@ +# +# Configuration for I2S +# + + + +I2S.pcm.front.0 { + @args [ CARD ] + @args.CARD { type string } + type hw + card $CARD +} diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf new file mode 100644 index 0000000000..1618b55161 --- /dev/null +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf @@ -0,0 +1,34 @@ +# +# Configuration for SPDIF +# + + + +SPDIF.pcm.iec958.0 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + type hooks + slave.pcm { + type hw + card $CARD + device 0 + } + hooks.0 { + type ctl_elems + hook_args [ + { + interface MIXER + name "IEC958 Playback Default" + lock true + preserve true + optional true + value [ $AES0 $AES1 $AES2 $AES3 ] + } + ] + } + hint.device 0 +} diff --git a/projects/Rockchip/kodi/appliance.xml b/projects/Rockchip/kodi/appliance.xml new file mode 100644 index 0000000000..5600a892b1 --- /dev/null +++ b/projects/Rockchip/kodi/appliance.xml @@ -0,0 +1,37 @@ + + +
+ + + + false + + + false + + + + + 2 + false + + + + + + + false + + + +
+
+ + + + 2 + + + +
+
diff --git a/projects/Rockchip/options b/projects/Rockchip/options new file mode 100644 index 0000000000..8e5e05c3fd --- /dev/null +++ b/projects/Rockchip/options @@ -0,0 +1,76 @@ +################################################################################ +# setup system defaults +################################################################################ + + # Bootloader to use (syslinux / u-boot / bcm2835-bootloader) + BOOTLOADER="u-boot" + + # Kernel extra targets to build + KERNEL_UBOOT_EXTRA_TARGET="" + + # Kernel to use. values can be: + # default: default mainline kernel + LINUX="${LINUX:-rockchip-4.4}" + +################################################################################ +# setup build defaults +################################################################################ + + # Project CFLAGS + PROJECT_CFLAGS="" + + # SquashFS compression method (gzip / lzo / xz) + SQUASHFS_COMPRESSION="lzo" + +################################################################################ +# setup project defaults +################################################################################ + + # build and install ALSA Audio support (yes / no) + ALSA_SUPPORT="yes" + + # OpenGL(X) implementation to use (no / mesa) + OPENGL="no" + + # OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q) + OPENGLES="mali-rockchip" + + # include uvesafb support (yes / no) + UVESAFB_SUPPORT="no" + + # Displayserver to use (weston / no) + DISPLAYSERVER="no" + + # Windowmanager to use (ratpoison / fluxbox / none) + WINDOWMANAGER="none" + + # Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia) + # Space separated list is supported, + # e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia" + GRAPHIC_DRIVERS="" + + # KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap) + KODIPLAYER_DRIVER="rkmpp" + + # Modules to install in initramfs for early boot + INITRAMFS_MODULES="" + + # additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware) + # Space separated list is supported, + # e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware" + FIRMWARE="misc-firmware wlan-firmware dvb-firmware" + + # additional packages to install + ADDITIONAL_PACKAGES="dtc" + + # build and install ATV IR remote support (yes / no) + ATVCLIENT_SUPPORT="no" + + # build and install CEC framework support (yes / no) + CEC_FRAMEWORK_SUPPORT="yes" + + # build with installer (yes / no) + INSTALLER_SUPPORT="no" + + # Start boot partition at 16MiB, same as https://github.com/rockchip-linux/build images + SYSTEM_PART_START=32768 diff --git a/projects/Rockchip/patches/linux/rockchip-4.4/linux-0000-Revert-rk-add-gcc-wrapper.patch b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0000-Revert-rk-add-gcc-wrapper.patch new file mode 100644 index 0000000000..b5d30ff740 --- /dev/null +++ b/projects/Rockchip/patches/linux/rockchip-4.4/linux-0000-Revert-rk-add-gcc-wrapper.patch @@ -0,0 +1,27 @@ +From a968000cae7b5d0c3c10b4e5a94fd187c891ee08 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Wed, 27 Dec 2017 22:01:06 +0100 +Subject: [PATCH] Revert "rk: add gcc-wrapper" + +This reverts part of commit 7a51384d24fe4da183fc15b2d17aa3c153b822e7. +--- + Makefile | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/Makefile b/Makefile +index a785aeed4674..d34c20a89fb7 100644 +--- a/Makefile ++++ b/Makefile +@@ -372,12 +372,6 @@ PERL = perl + PYTHON = python + CHECK = sparse + +-# Use the wrapper for the compiler. This wrapper scans for new +-# warnings and causes the build to stop upon encountering them. +-ifneq ($(wildcard $(srctree)/scripts/gcc-wrapper.py),) +-CC = $(srctree)/scripts/gcc-wrapper.py $(CROSS_COMPILE)gcc +-endif +- + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ + -Wbitwise -Wno-return-void $(CF) + CFLAGS_MODULE = diff --git a/scripts/uboot_helper b/scripts/uboot_helper index 84c5bcf051..ace24186ad 100755 --- a/scripts/uboot_helper +++ b/scripts/uboot_helper @@ -8,6 +8,9 @@ devices = { 'board_name' : { 'dtb' : 'board_name.dtb', 'config' : 'board_name_defconfig' }, }, }, + + 'Rockchip' : { + }, } def usage():