Support Orange Pi 3 Plus

This commit is contained in:
orangepi-xunlong
2024-04-01 09:19:48 +08:00
parent e9165fce27
commit 94d50c2386
27 changed files with 13743 additions and 1 deletions

View File

@@ -0,0 +1,127 @@
BOOTSCRIPT="boot-meson64.cmd:boot.cmd"
BOOTENV_FILE='meson.txt'
LINUXFAMILY=meson64
ARCH=arm64
#SERIALCON=ttyAML0
SERIALCON=ttyS0
SRC_LOADADDR='LOADADDR=0x1080000'
OVERLAY_PREFIX='meson'
# this family does not need it
ATF_COMPILE="no"
# Set CPUMIN et al if not already set in the board config.
CPUMIN=${CPUMIN:-500000}
CPUMAX=${CPUMAX:-1536000}
GOVERNOR=${GOVERNOR:-ondemand}
write_uboot_platform() {
dd if=$1/u-boot.bin of=$2 bs=1 count=442 conv=fsync >/dev/null 2>&1
dd if=$1/u-boot.bin of=$2 bs=512 skip=1 seek=1 conv=fsync >/dev/null 2>&1
}
family_tweaks_bsp() {
mkdir -p $destination/etc/udev/rules.d
mkdir -p $destination/usr/local/bin
mkdir -p "$destination"/etc/X11/xorg.conf.d
case "${BOARD}" in
"orangepi3plus")
cat <<- EOF > "$destination"/etc/X11/xorg.conf
Section "Device"
Identifier "DRM Graphics Acclerated"
## Use modesetting and glamor
Driver "modesetting"
Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable.
Option "DRI" "2"
Option "Dri2Vsync" "true"
Option "TripleBuffer" "True"
## End glamor configuration
EndSection
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
Depth 24
EndSubSection
EndSection
EOF
;;
esac
}
# this helper function includes postprocess for u200 and its variants.
# $1 PATH for uboot blob repo
# $2 family g12a or g12b
uboot_g12_postprocess() {
mv -v u-boot.bin bl33.bin
$1/blx_fix.sh $1/bl30.bin \
zero_tmp \
bl30_zero.bin \
$1/bl301.bin \
bl301_zero.bin \
bl30_new.bin bl30
$1/blx_fix.sh $1/bl2.bin \
zero_tmp \
bl2_zero.bin \
$1/acs.bin \
bl21_zero.bin \
bl2_new.bin bl2
$1/aml_encrypt_$2 --bl30sig \
--input bl30_new.bin \
--output bl30_new.bin.g12.enc \
--level v3
$1/aml_encrypt_$2 --bl3sig \
--input bl30_new.bin.g12.enc \
--output bl30_new.bin.enc \
--level v3 --type bl30
$1/aml_encrypt_$2 --bl3sig \
--input $1/bl31.img \
--output bl31.img.enc \
--level v3 --type bl31
$1/aml_encrypt_$2 --bl3sig \
--input bl33.bin \
--compress lz4 \
--output bl33.bin.enc \
--level v3 --type bl33
$1/aml_encrypt_$2 --bl2sig \
--input bl2_new.bin \
--output bl2.n.bin.sig
if [ -e $1/lpddr3_1d.fw ]; then
$1/aml_encrypt_$2 --bootmk --output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
--bl31 bl31.img.enc \
--bl33 bl33.bin.enc \
--ddrfw1 $1/ddr4_1d.fw \
--ddrfw2 $1/ddr4_2d.fw \
--ddrfw3 $1/ddr3_1d.fw \
--ddrfw4 $1/piei.fw \
--ddrfw5 $1/lpddr4_1d.fw \
--ddrfw6 $1/lpddr4_2d.fw \
--ddrfw7 $1/diag_lpddr4.fw \
--ddrfw8 $1/aml_ddr.fw \
--ddrfw9 $1/lpddr3_1d.fw \
--level v3
else
$1/aml_encrypt_$2 --bootmk --output u-boot.bin \
--bl2 bl2.n.bin.sig \
--bl30 bl30_new.bin.enc \
--bl31 bl31.img.enc \
--bl33 bl33.bin.enc \
--ddrfw1 $1/ddr4_1d.fw \
--ddrfw2 $1/ddr4_2d.fw \
--ddrfw3 $1/ddr3_1d.fw \
--ddrfw4 $1/piei.fw \
--ddrfw5 $1/lpddr4_1d.fw \
--ddrfw6 $1/lpddr4_2d.fw \
--ddrfw7 $1/diag_lpddr4.fw \
--ddrfw8 $1/aml_ddr.fw \
--level v3
fi
}

View File

@@ -0,0 +1,179 @@
#
# 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/
#
source "${BASH_SOURCE%/*}/include/meson64_common.inc"
CPUMIN=667000
CPUMAX=1800000
GOVERNOR=ondemand
case $BRANCH in
#current)
# UBOOT_TARGET_MAP=";;build/u-boot.bin.sd.bin:u-boot.bin"
# BOOTPATCHDIR="v2015.01"
# BOOTBRANCH='branch:u-boot-2015.01'
# UBOOT_COMPILER="aarch64-linux-gnu-"
# UBOOT_USE_GCC='< 5.0'
# UBOOT_TOOLCHAIN2='arm-none-eabi-:5.0'
# KERNELBRANCH='branch:orange-pi-5.15-s905d3'
# KERNELPATCHDIR='rockchip-rk3588-legacy'
# LINUXCONFIG="linux-5.15-s905d3-current"
# KERNEL_USE_GCC='> 10.0'
# BOOT_FDT_FILE="meson-sm1-orangepi-3-plus.dtb"
# ;;
next)
UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin.sd.bin:u-boot.bin u-boot-dtb.img u-boot-spi.bin:u-boot-spi.bin"
BOOTPATCHDIR="v2023.07-meson64"
BOOTBRANCH='branch:v2023.07-meson64'
KERNELBRANCH='branch:orange-pi-6.1-meson64'
LINUXCONFIG="linux-6.1-meson64-next"
#KERNELBRANCH='branch:orange-pi-6.5-meson64'
#LINUXCONFIG="linux-6.5-meson64-next"
KERNELPATCHDIR='meson64-next'
KERNEL_USE_GCC='> 10.0'
ASOUND_STATE='asound.state.orangepi3plus-next'
;;
esac
write_uboot_platform_mtd() {
dd if=$1/u-boot-spi.bin of=/dev/mtdblock0
}
family_tweaks() {
#if [[ ${BRANCH} == current ]]; then
# sed -i 's/^debug_uart.*/debug_uart=ttyS0/' "${SDCARD}"/boot/orangepiEnv.txt
# SERIALCON="ttyS0"
#fi
install_wiringop
rsync -a --chown=root:root --exclude=etc/pulse "${EXTER}"/packages/bsp/overlays_s905d3/* ${SDCARD}/
chroot $SDCARD /bin/bash -c "apt-get -y -qq install usb-modeswitch tree dnsmasq v4l-utils swig python3-dev python3-setuptools bluez libncurses-dev" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1
#install_docker
#install_balenaEtcher
}
uboot_custom_postprocess() {
cd "${BOOTSOURCEDIR}"
if [[ ${BOARD} == orangepi3plus && ${BRANCH} == next ]]; then
# Preserve the u-boot produced (unsigned) u-boot.bin
cp -v u-boot.bin u-boot.bin.orig
# Sign using the old FIP blobs (amlogic-boot-fip-vim3-spi), for use exclusively with SPI booting.
display_alert "Signing u-boot for SPI booting with old blobs" "${BOARD}" "info"
uboot_g12_postprocess "${EXTER}"/cache/sources/amlogic-boot-fip-spi/${BOARD} g12a
# Once done, store the resulting u-boot.bin as u-boot-spi.bin referenced in the UBOOT_TARGET_MAP above.
cp -v u-boot.bin u-boot-spi.bin
# Restore the original, so we can do everything again.
cp -v u-boot.bin.orig u-boot.bin
# Do the normal signing, using the regular/updated FIP blobs. This is for eMMC booting.
display_alert "Signing u-boot for eMMC/SD booting with new blobs" "${BOARD}" "info"
uboot_g12_postprocess "${EXTER}"/cache/sources/amlogic-boot-fip/${BOARD} g12a
display_alert "Done postprocessing u-boot with new/old FIP blobs" "${BOARD}" "info"
fi
#if [[ ${BOARD} == orangepi3plus && ${BRANCH} == current ]]; then
# UBOOT_SRC_FOLDER="${BOOTSOURCEDIR}"
# source fip/variables.sh "${BOOTSOURCEDIR}"
# source fip/lib.sh
# source fip/build_bl2.sh
# source fip/build_bl30.sh
# source fip/build_bl31.sh
# source fip/build_bl32.sh
# source fip/build_bl33.sh
# source fip/build_bl40.sh
# # Cleanup old binaries
# rm -rf ${FIP_BUILD_FOLDER}
# # source uboot pre-build configs
# source ${SOURCE_FILE}
# CUR_SOC=${CONFIG_SYS_SOC}
# if [ "y" == "${CONFIG_NEED_BL32}" ]; then
# BLX_NEEDFUL[3]="true"
# fi
# export_variables
# source ${FIP_FOLDER}${CUR_SOC}/variable_soc.sh
# # compile fip tools for ddr_parse and map_tool
# prepare_tools > /dev/null 2>&1 || true
# # source soc package script
# source ${FIP_FOLDER}${CUR_SOC}/build.sh
# # source configs
# source ${CONFIG_FILE}
# if [ "y" == "${CONFIG_SUPPORT_CUSOTMER_BOARD}" ]; then
# BOARD_DIR="customer/board/${CONFIG_SYS_BOARD}"
# else
# BOARD_DIR="${CONFIG_BOARDDIR}"
# fi
# mkdir -p ${FIP_BUILD_FOLDER}
# cp ${FIP_FOLDER}${CUR_SOC}/bl2.bin $FIP_BUILD_FOLDER
# cp ${FIP_FOLDER}${CUR_SOC}/bl30.bin $FIP_BUILD_FOLDER
# cp ${FIP_FOLDER}${CUR_SOC}/bl31.bin $FIP_BUILD_FOLDER
# cp ${FIP_FOLDER}${CUR_SOC}/bl31.img $FIP_BUILD_FOLDER
# #cp ${FIP_FOLDER}${CUR_SOC}/bl32.bin $FIP_BUILD_FOLDER
# # cp bl33(uboot)
# copy_bl33
# # cp other firmwares(soc related)
# copy_other_soc
# # package final bootloader
# package
# if [ "y" != "${CONFIG_AML_SIGNED_UBOOT}" ]; then
# # copy bootloader to main folder
# mkdir -p ${BUILD_FOLDER}
# cp ${FIP_BUILD_FOLDER}u-boot.bin ${BUILD_FOLDER}u-boot.bin
# cp ${FIP_BUILD_FOLDER}u-boot.bin.encrypt ${BUILD_FOLDER}u-boot.bin.encrypt
# cp ${FIP_BUILD_FOLDER}u-boot.bin.encrypt.efuse ${BUILD_FOLDER}u-boot.bin.encrypt.efuse
# cp ${FIP_BUILD_FOLDER}u-boot.bin.encrypt.sd.bin ${BUILD_FOLDER}u-boot.bin.encrypt.sd.bin
# cp ${FIP_BUILD_FOLDER}u-boot.bin.encrypt.usb.bl2 ${BUILD_FOLDER}u-boot.bin.encrypt.usb.bl2
# cp ${FIP_BUILD_FOLDER}u-boot.bin.encrypt.usb.tpl ${BUILD_FOLDER}u-boot.bin.encrypt.usb.tpl
# cp ${FIP_BUILD_FOLDER}u-boot.bin.sd.bin ${BUILD_FOLDER}u-boot.bin.sd.bin
# cp ${FIP_BUILD_FOLDER}u-boot.bin.usb.bl2 ${BUILD_FOLDER}u-boot.bin.usb.bl2
# cp ${FIP_BUILD_FOLDER}u-boot.bin.usb.tpl ${BUILD_FOLDER}u-boot.bin.usb.tpl
# if [ "y" == "${CONFIG_AML_CRYPTO_IMG}" ]; then
# cp ${FIP_BUILD_FOLDER}boot.img.encrypt ${BUILD_FOLDER}boot.img.encrypt
# fi
# fi
#fi
}