Add Orange Pi R1 Plus support

This commit is contained in:
leeboby 2020-12-15 10:08:21 +08:00
parent 2262000207
commit 2a7bfed3c3
9 changed files with 830 additions and 412 deletions

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ external/cache/hash
external/cache/rootfs external/cache/rootfs
external/cache/sources/extra external/cache/sources/extra
external/cache/sources/sunxi-tools external/cache/sources/sunxi-tools
external/cache/sources/rkbin-tools
external/cache/sources/orangepi-firmware external/cache/sources/orangepi-firmware
external/cache/sources/orangepi-firmware-git external/cache/sources/orangepi-firmware-git
external/cache/sources/arm-trusted-firmware-sunxi-mainline external/cache/sources/arm-trusted-firmware-sunxi-mainline

View File

@ -0,0 +1,11 @@
# Rockchip RK3328 quad core 1GB 2xGBE USB2
BOARD_NAME="Orange Pi R1 Plus"
BOARDFAMILY="rockchip64"
BOOTCONFIG="orangepi_r1_plus_rk3328_defconfig"
KERNEL_TARGET="current"
DEFAULT_CONSOLE="serial"
MODULES="g_serial"
MODULES_BLACKLIST="rockchipdrm analogix_dp dw_mipi_dsi dw_hdmi gpu_sched lima hantro_vpu"
SERIALCON="ttyS2:1500000,ttyGS0"
BUILD_DESKTOP="no"
BOOT_FDT_FILE="rockchip/rk3328-orangepi-r1plus.dtb"

View File

@ -1,6 +1,6 @@
# DO NOT EDIT THIS FILE # DO NOT EDIT THIS FILE
# #
# Please edit /boot/armbianEnv.txt to set supported parameters # Please edit /boot/orangepiEnv.txt to set supported parameters
# #
setenv ramdisk_addr_r "0x21000000" setenv ramdisk_addr_r "0x21000000"
@ -17,8 +17,8 @@ setenv earlycon "off"
echo "Boot script loaded from ${devtype} ${devnum}" echo "Boot script loaded from ${devtype} ${devnum}"
if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then if test -e ${devtype} ${devnum} ${prefix}orangepiEnv.txt; then
load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt load ${devtype} ${devnum} ${load_addr} ${prefix}orangepiEnv.txt
env import -t ${load_addr} ${filesize} env import -t ${load_addr} ${filesize}
fi fi
@ -29,7 +29,7 @@ if test "${console}" = "ttyS2,115200n8"; then setenv console "both"; fi
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,115200n8 ${consoleargs}"; fi if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,115200n8 ${consoleargs}"; fi
if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi
if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.armbian ${consoleargs}"; fi if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.orangepi ${consoleargs}"; fi
# get PARTUUID of first partition on SD/eMMC the boot script was loaded from # get PARTUUID of first partition on SD/eMMC the boot script was loaded from
if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi

View File

@ -1,6 +1,6 @@
# DO NOT EDIT THIS FILE # DO NOT EDIT THIS FILE
# #
# Please edit /boot/armbianEnv.txt to set supported parameters # Please edit /boot/orangepiEnv.txt to set supported parameters
# #
setenv load_addr "0x9000000" setenv load_addr "0x9000000"
@ -16,8 +16,8 @@ setenv earlycon "off"
echo "Boot script loaded from ${devtype} ${devnum}" echo "Boot script loaded from ${devtype} ${devnum}"
if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then if test -e ${devtype} ${devnum} ${prefix}orangepiEnv.txt; then
load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt load ${devtype} ${devnum} ${load_addr} ${prefix}orangepiEnv.txt
env import -t ${load_addr} ${filesize} env import -t ${load_addr} ${filesize}
fi fi
@ -26,7 +26,7 @@ if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,1500000 ${consoleargs}"; fi if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,1500000 ${consoleargs}"; fi
if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi
if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.armbian ${consoleargs}"; fi if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.orangepi ${consoleargs}"; fi
# get PARTUUID of first partition on SD/eMMC the boot script was loaded from # get PARTUUID of first partition on SD/eMMC the boot script was loaded from
if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
ARCH=arm64 ARCH=arm64
KERNEL_IMAGE_TYPE=Image KERNEL_IMAGE_TYPE=Image
OFFSET=16 OFFSET=30
BOOTSCRIPT='boot-rockchip64.cmd:boot.cmd' BOOTSCRIPT='boot-rockchip64.cmd:boot.cmd'
BOOTENV_FILE='rockchip.txt' BOOTENV_FILE='rockchip.txt'
UBOOT_TARGET_MAP=";;idbloader.bin uboot.img trust.bin" UBOOT_TARGET_MAP=";;idbloader.bin uboot.img trust.bin"
@ -8,46 +8,34 @@ BOOTDELAY=0
OVERLAY_PREFIX='rockchip' OVERLAY_PREFIX='rockchip'
SERIALCON=${SERIALCON:=$([ $BRANCH == "legacy" ] && echo "ttyFIQ0:1500000" || echo "ttyS2:1500000")} SERIALCON=${SERIALCON:=$([ $BRANCH == "legacy" ] && echo "ttyFIQ0:1500000" || echo "ttyS2:1500000")}
GOVERNOR="ondemand" GOVERNOR="ondemand"
CPUMAX="2016000" BOOTBRANCH="tag:v2020.07-rockchip64"
CPUMIN="408000" PACKAGE_LIST_FAMILY="ethtool"
BOOTBRANCH="tag:v2020.07"
RKBIN_DIR="$SRC/cache/sources/rkbin-tools" RKBIN_DIR="$EXTER/cache/sources/rkbin-tools"
if [[ $BOARD == nanopi-r2s || $BOARD == rockpi-e || $BOARD == nanopineo3 ]]; then if [[ $BOOTCONFIG == *3399* ]]; then
CPUMIN=${CPUMIN:="408000"}
CPUMAX=${CPUMAX:="2016000"}
else # rk3328
CPUMIN=${CPUMIN:="408000"}
CPUMAX=${CPUMAX:="1296000"}
fi
if [[ $BOARD == orangepir1plus ]]; then
BOOT_USE_BLOBS=yes BOOT_USE_BLOBS=yes
BOOT_SOC=rk3328 BOOT_SOC=rk3328
DDR_BLOB='rk33/rk3328_ddr_333MHz_v1.16.bin' DDR_BLOB='rk33/rk3328_ddr_333MHz_v1.16.bin'
MINILOADER_BLOB='rk33/rk322xh_miniloader_v2.50.bin' MINILOADER_BLOB='rk33/rk322xh_miniloader_v2.50.bin'
BL31_BLOB='rk33/rk322xh_bl31_v1.42.elf' BL31_BLOB='rk33/rk322xh_bl31_v1.44.elf'
elif [[ $BOOTCONFIG == *3328* ]]; then elif [[ $BOOTCONFIG == *3328* ]]; then
BOOT_RK3328_USE_AYUFAN_ATF=yes BOOT_RK3328_USE_AYUFAN_ATF=yes
CPUMAX="1390000"
elif [[ $BOARD == rockpi-4* ]]; then
BOOT_USE_BLOBS=yes
BOOT_SOC=rk3399
DDR_BLOB='rk33/rk3399_ddr_933MHz_v1.20.bin' # 1GB model does not boot with later versions
MINILOADER_BLOB='rk33/rk3399_miniloader_v1.19.bin'
BL31_BLOB='rk33/rk3399_bl31_v1.30.elf'
elif [[ $BOARD == rockpro64 ]] || [[ $BOARD == pinebook-pro ]]; then
BOOT_RK3399_LEGACY_HYBRID=yes
BL31_BLOB='rk33/rk3399_bl31_v1.17.elf'
elif [[ $BOARD == rockpi-s ]]; then
BOOT_USE_BLOBS=yes
BOOT_SOC=rk3308
DDR_BLOB='rk33/rk3308_ddr_589MHz_uart0_m0_v1.26.bin'
MINILOADER_BLOB='rk33/rk3308_miniloader_sd_nand_v1.13.bin'
BL31_BLOB='rk33/rk3308_bl31_v2.10.elf'
CPUMAX="1296000"
else else
@ -60,25 +48,16 @@ case $BRANCH in
current) current)
KERNELPATCHDIR='rockchip64-'$BRANCH KERNELPATCHDIR='rockchip64-'$BRANCH
KERNELBRANCH="branch:linux-5.7.y" KERNELBRANCH="branch:orange-pi-5.8-rockchip64"
LINUXFAMILY=rockchip64 LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH LINUXCONFIG='linux-rockchip64-'$BRANCH
;; ;;
dev)
KERNELPATCHDIR='rockchip64-'$BRANCH
KERNELBRANCH="branch:linux-5.7.y"
LINUXFAMILY=rockchip64
LINUXCONFIG='linux-rockchip64-'$BRANCH
;;
esac esac
prepare_boot_configuration() prepare_boot_configuration()
{ {
if [[ $BOOT_USE_MAINLINE_ATF == yes ]]; then if [[ $BOOT_USE_MAINLINE_ATF == yes ]]; then
UBOOT_TARGET_MAP="BL31=bl31.bin idbloader.img u-boot.itb;;idbloader.img u-boot.itb" UBOOT_TARGET_MAP="BL31=bl31.bin idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
@ -87,7 +66,7 @@ prepare_boot_configuration()
ATFDIR='arm-trusted-firmware' ATFDIR='arm-trusted-firmware'
ATFBRANCH='tag:v2.2' ATFBRANCH='tag:v2.2'
ATF_USE_GCC='> 6.3' ATF_USE_GCC='> 6.3'
ATF_TARGET_MAP='M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=rk3399 bl31;;build/rk3399/release/bl31/bl31.elf:bl31.bin' ATF_TARGET_MAP="M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=$BOOT_SOC bl31;;build/$BOOT_SOC/release/bl31/bl31.elf:bl31.bin"
ATF_TOOLCHAIN2="arm-linux-gnueabi-:> 5.0" ATF_TOOLCHAIN2="arm-linux-gnueabi-:> 5.0"
elif [[ $BOOT_USE_TPL_SPL_BLOB == yes ]]; then elif [[ $BOOT_USE_TPL_SPL_BLOB == yes ]]; then
@ -124,10 +103,17 @@ prepare_boot_configuration()
legacy_uboot_locations legacy_uboot_locations
fi fi
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
UBOOT_TARGET_MAP+=" rkspi_loader.img"
fi
} }
legacy_uboot_locations() legacy_uboot_locations()
{ {
BOOTSOURCE='https://github.com/ayufan-rock64/linux-u-boot' BOOTSOURCE='https://github.com/ayufan-rock64/linux-u-boot'
BOOTDIR='u-boot-rockchip64' BOOTDIR='u-boot-rockchip64'
BOOTBRANCH='branch:rockchip-master' BOOTBRANCH='branch:rockchip-master'
@ -143,9 +129,15 @@ legacy_uboot_locations()
uboot_custom_postprocess() uboot_custom_postprocess()
{ {
if [[ $BOOT_USE_MAINLINE_ATF == yes || $BOOT_USE_TPL_SPL_BLOB == yes ]]; then if [[ $BOOT_USE_MAINLINE_ATF == yes || $BOOT_USE_TPL_SPL_BLOB == yes ]]; then
: if [[ $BOOT_SUPPORT_SPI == yes ]]; then
tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin rkspi_tpl_spl.img
dd if=/dev/zero of=rkspi_loader.img count=8128 status=none
dd if=rkspi_tpl_spl.img of=rkspi_loader.img conv=notrunc status=none
dd if=u-boot.itb of=rkspi_loader.img seek=768 conv=notrunc status=none
fi
elif [[ $BOOT_USE_BLOBS == yes ]]; then elif [[ $BOOT_USE_BLOBS == yes ]]; then
@ -184,6 +176,7 @@ uboot_custom_postprocess()
write_uboot_platform() write_uboot_platform()
{ {
if [[ -f $1/rksd_loader.img ]]; then # legacy rk3399 loader if [[ -f $1/rksd_loader.img ]]; then # legacy rk3399 loader
dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none >/dev/null 2>&1 dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none >/dev/null 2>&1
@ -206,6 +199,20 @@ write_uboot_platform()
fi fi
} }
write_uboot_platform_mtd()
{
if [[ -f $1/rkspi_loader.img ]]; then
dd if=$1/rkspi_loader.img of=$2 conv=notrunc status=none >/dev/null 2>&1
else
echo "SPI u-boot image not found!"
exit 1
fi
}
setup_write_uboot_platform() setup_write_uboot_platform()
{ {
@ -220,7 +227,6 @@ setup_write_uboot_platform()
[[ -n $dev ]] && DEVICE="/dev/$dev" [[ -n $dev ]] && DEVICE="/dev/$dev"
fi fi
} }
@ -231,18 +237,13 @@ atf_custom_postprocess()
rm -f build/rk322xh/debug/bl31.bin rm -f build/rk322xh/debug/bl31.bin
# ATF # ATF
trust_merger trust.ini trust_merger trust.ini
} }
family_tweaks() family_tweaks()
{ {
if [[ $BOARD == z28pro ]]; then if [[ $BOARD == orangepir1plus ]]; then
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable z28pro-bluetooth.service >/dev/null 2>&1"
elif [[ $BOARD == nanopi-r2s ]]; then
# rename USB based network to lan0 # rename USB based network to lan0
mkdir -p $SDCARD/etc/udev/rules.d/ mkdir -p $SDCARD/etc/udev/rules.d/
@ -261,40 +262,20 @@ family_tweaks()
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable rk3399-bluetooth.service >/dev/null 2>&1" chroot $SDCARD /bin/bash -c "systemctl --no-reload enable rk3399-bluetooth.service >/dev/null 2>&1"
fi fi
} }
family_tweaks_bsp() family_tweaks_bsp()
{ {
if [[ $BOARD == z28pro ]]; then if [[ $BOOTCONFIG == *3328* ]] && [[ $BRANCH != legacy ]]; then
mkdir -p "$destination"/etc/X11/xorg.conf.d
mkdir -p $destination/usr/local/bin cat <<-EOF > "$destination"/etc/X11/xorg.conf.d/02-driver.conf
# set fbdev as default driver.
# Bluetooth for Z28 PRO Section "Device"
install -m 755 $SRC/packages/bsp/rk3328/z28pro/8822b_hciattach $destination/usr/bin Identifier "NOGPU"
install -m 755 $SRC/packages/bsp/rk3328/z28pro/start_bt.sh $destination/usr/local/bin Driver "fbdev"
cp $SRC/packages/bsp/rk3328/z28pro/z28pro-bluetooth.service $destination/lib/systemd/system/ EndSection
EOF
elif [[ $BOARD == rockpi-4b || $BOARD == nanop* || $BOARD == orangepi* || $BOARD == firefly* || $BOARD == roc-rk3399-pc ]]; then
# Bluetooth for most of others
install -m 755 $SRC/packages/bsp/rk3399/brcm_patchram_plus_rk3399 $destination/usr/bin
cp $SRC/packages/bsp/rk3399/rk3399-bluetooth.service $destination/lib/systemd/system/
fi fi
if [[ $BOARD == pinebook-pro ]]; then
cp $SRC/packages/bsp/pinebook-pro/xorg.conf $destination/etc/X11/
fi
# Graphics and media
mkdir -p $destination/etc/udev/rules.d
cp $SRC/packages/bsp/rk3399/50-mali.rules $destination/etc/udev/rules.d/
cp $SRC/packages/bsp/rk3399/50-rk3399-vpu.rules $destination/etc/udev/rules.d/
mkdir -p $destination/etc/sysfs.d
cp $SRC/packages/bsp/rk3399/20-gpu-governor.conf $destination/etc/sysfs.d/
} }

View File

@ -14,4 +14,13 @@ case $BRANCH in
esac esac
family_tweaks_bsp()
{
if [[ $BOARD == orangepir1plus ]]; then
:
fi
}
prepare_boot_configuration prepare_boot_configuration

View File

@ -439,3 +439,13 @@ orangepizero2 legacy buster minimal stable yes
orangepizero2 legacy xenial minimal stable no orangepizero2 legacy xenial minimal stable no
orangepizero2 legacy bionic minimal stable yes orangepizero2 legacy bionic minimal stable yes
orangepizero2 legacy focal minimal stable yes orangepizero2 legacy focal minimal stable yes
# orangepir1plus
orangepir1plus current buster cli stable yes
orangepir1plus current bionic cli stable yes
orangepir1plus current focal cli stable yes
orangepir1plus current buster minimal stable yes
orangepir1plus current bionic minimal stable yes
orangepir1plus current focal minimal stable yes

View File

@ -153,6 +153,7 @@ if [[ -z $BOARD ]]; then
options+=("orangepilite2" "Allwinner H6 quad core 1GB RAM WiFi/BT USB3") options+=("orangepilite2" "Allwinner H6 quad core 1GB RAM WiFi/BT USB3")
options+=("orangepioneplus" "Allwinner H6 quad core 1GB RAM GBE") options+=("orangepioneplus" "Allwinner H6 quad core 1GB RAM GBE")
options+=("orangepizero2" "Allwinner H616 quad core 512MB/1GB RAM WiFi/BT GBE SPI") options+=("orangepizero2" "Allwinner H616 quad core 512MB/1GB RAM WiFi/BT GBE SPI")
options+=("orangepir1plus" "Rockchip RK3328 quad core 1GB RAM 2xGBE USB2 SPI")
menustr="Please choose a Board." menustr="Please choose a Board."
BOARD=$(whiptail --title "${titlestr}" --backtitle "${backtitle}" \ BOARD=$(whiptail --title "${titlestr}" --backtitle "${backtitle}" \
@ -378,11 +379,11 @@ display_alert "Downloading sources" "" "info"
fi fi
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "${EXTER}/cache/sources/sunxi-tools" "branch:master" fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "${EXTER}/cache/sources/sunxi-tools" "branch:master"
#fetch_from_repo "https://github.com/armbian/rkbin" "${EXTER}/cache/sources/rkbin-tools" "branch:master" fetch_from_repo "https://github.com/armbian/rkbin" "${EXTER}/cache/sources/rkbin-tools" "branch:master"
fi fi
compile_sunxi_tools compile_sunxi_tools
#install_rkbin_tools install_rkbin_tools
for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do
[[ $option != sources ]] && cleaning "$option" [[ $option != sources ]] && cleaning "$option"