添加构建Allwinner H616四核2GB RAM SoC WiFi(蓝莓)
This commit is contained in:
23
config/sources/families/include/crust_firmware.inc
Normal file
23
config/sources/families/include/crust_firmware.inc
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
declare -g CRUST_TARGET_MAP="scp;;build/scp/scp.bin"
|
||||
|
||||
if [[ -n "${CRUSTCONFIG}" ]]; then
|
||||
[[ -z $CRUSTSOURCE ]] && CRUSTSOURCE='https://github.com/crust-firmware/crust'
|
||||
[[ -z $CRUSTDIR ]] && CRUSTDIR='crust-sunxi-mainline'
|
||||
[[ -z $CRUSTBRANCH ]] && CRUSTBRANCH='tag:v0.6'
|
||||
[[ -z $CRUST_USE_GCC ]] && CRUST_USE_GCC='> 9.1.0'
|
||||
[[ -z $CRUST_COMPILER ]] && CRUST_COMPILER='or1k-elf-'
|
||||
|
||||
# Apply crust patches if crust is enabled
|
||||
BOOTPATCHDIR="${BOOTPATCHDIR} u-boot-sunxi-crust"
|
||||
|
||||
# Use a different BOOTDIR so that we don't leave scp.bin behind for non crust builds
|
||||
BOOTDIR="u-boot-crust"
|
||||
fi
|
||||
305
config/sources/families/include/meson64_common.inc
Normal file
305
config/sources/families/include/meson64_common.inc
Normal file
@@ -0,0 +1,305 @@
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP:-u-boot-dtb.img;;u-boot.bin.sd.bin:u-boot.bin u-boot-dtb.img}"
|
||||
BOOTSCRIPT="boot-meson64.cmd:boot.cmd"
|
||||
BOOTENV_FILE='meson.txt'
|
||||
LINUXFAMILY=meson64
|
||||
ARCH=arm64
|
||||
SERIALCON=ttyAML0
|
||||
SRC_LOADADDR='LOADADDR=0x1080000'
|
||||
BOOTBRANCH="${BOOTBRANCH_BOARD:-"tag:v2022.07"}"
|
||||
BOOTPATCHDIR="${BOOTPATCHDIR:-"v2022.07"}"
|
||||
OVERLAY_PREFIX='meson'
|
||||
|
||||
# This is an extension method, put directly in meson64_common. A "built-in" extension if you will.
|
||||
# Bring in LibreELEC's amlogic-boot-fip repo, which is the authoritative source for FIP blobs.
|
||||
# To add FIP blobs for a new board, send a PR there, they're awesome.
|
||||
function fetch_sources_tools__libreelec_amlogic_fip() {
|
||||
fetch_from_repo "https://github.com/LibreELEC/amlogic-boot-fip" "amlogic-boot-fip" "branch:master"
|
||||
}
|
||||
|
||||
# this family does not need it
|
||||
ATF_COMPILE="no"
|
||||
|
||||
if [[ $BOARD == lafrite ]]; then
|
||||
UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin:u-boot.bin u-boot-dtb.img"
|
||||
fi
|
||||
|
||||
# Set CPUMIN et al if not already set in the board config.
|
||||
CPUMIN=${CPUMIN:-500000}
|
||||
CPUMAX=${CPUMAX:-1536000}
|
||||
GOVERNOR=${GOVERNOR:-ondemand}
|
||||
|
||||
case $BRANCH in
|
||||
|
||||
current)
|
||||
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. For mainline caching.
|
||||
KERNELBRANCH='branch:linux-6.1.y'
|
||||
KERNELPATCHDIR='meson64-current'
|
||||
;;
|
||||
|
||||
edge)
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel. For mainline caching.
|
||||
KERNELBRANCH='branch:linux-6.5.y'
|
||||
KERNELPATCHDIR='meson64-edge'
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# this helper function includes postprocess for p212 and its variants.
|
||||
# $1 PATH for uboot blob repo
|
||||
# $2 dir name in uboot blob repo
|
||||
uboot_gxl_postprocess() {
|
||||
run_host_command_logged mv -v u-boot.bin bl33.bin
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/$2/bl30.bin \
|
||||
$1/$2/zero_tmp \
|
||||
$1/$2/bl30_zero.bin \
|
||||
$1/$2/bl301.bin \
|
||||
$1/$2/bl301_zero.bin \
|
||||
$1/$2/bl30_new.bin bl30
|
||||
|
||||
run_host_command_logged python2 $1/acs_tool.pyc $1/$2/bl2.bin \
|
||||
$1/$2/bl2_acs.bin \
|
||||
$1/$2/acs.bin 0
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/$2/bl2_acs.bin \
|
||||
$1/$2/zero_tmp \
|
||||
$1/$2/bl2_zero.bin \
|
||||
$1/$2/bl21.bin \
|
||||
$1/$2/bl21_zero.bin \
|
||||
$1/$2/bl2_new.bin bl2
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl3enc --input $1/$2/bl30_new.bin
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl3enc --input $1/$2/bl31.img
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl3enc --input bl33.bin
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bl2sig --input $1/$2/bl2_new.bin \
|
||||
--output bl2.n.bin.sig
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_gxl --bootmk \
|
||||
--output u-boot.bin \
|
||||
--bl2 bl2.n.bin.sig \
|
||||
--bl30 $1/$2/bl30_new.bin.enc \
|
||||
--bl31 $1/$2/bl31.img.enc \
|
||||
--bl33 bl33.bin.enc
|
||||
}
|
||||
|
||||
# this helper function includes postprocess for s400 and its variants.
|
||||
# $1 PATH for uboot blob repo
|
||||
# $2 dir name in uboot blob repo
|
||||
uboot_axg_postprocess_ng() {
|
||||
run_host_command_logged mv -v u-boot.bin bl33.bin
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/$2/bl30.bin \
|
||||
$1/$2/zero_tmp \
|
||||
$1/$2/bl30_zero.bin \
|
||||
$1/$2/bl301.bin \
|
||||
$1/$2/bl301_zero.bin \
|
||||
$1/$2/bl30_new.bin bl30
|
||||
|
||||
run_host_command_logged python3 $1/acs_tool.py $1/$2/bl2.bin \
|
||||
$1/$2/bl2_acs.bin \
|
||||
$1/$2/acs.bin 0
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/$2/bl2_acs.bin \
|
||||
$1/$2/zero_tmp \
|
||||
$1/$2/bl2_zero.bin \
|
||||
$1/$2/bl21.bin \
|
||||
$1/$2/bl21_zero.bin \
|
||||
$1/$2/bl2_new.bin bl2
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl3sig --input $1/$2/bl30_new.bin \
|
||||
--output bl30_new.bin.enc \
|
||||
--level v3 --type bl30
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl3sig --input $1/$2/bl31.img \
|
||||
--output bl31.img.enc \
|
||||
--level v3 --type bl31
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl3sig --input bl33.bin --compress lz4 \
|
||||
--output bl33.bin.enc \
|
||||
--level v3 --type bl33
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bl2sig --input $1/$2/bl2_new.bin \
|
||||
--output bl2.n.bin.sig
|
||||
|
||||
run_host_x86_binary_logged $1/$2/aml_encrypt_axg --bootmk \
|
||||
--output u-boot.bin \
|
||||
--bl2 bl2.n.bin.sig \
|
||||
--bl30 bl30_new.bin.enc \
|
||||
--bl31 bl31.img.enc \
|
||||
--bl33 bl33.bin.enc --level v3
|
||||
}
|
||||
|
||||
# this helper function includes postprocess for u200 and its variants.
|
||||
# $1 PATH for uboot blob repo
|
||||
# $2 family g12a or g12b
|
||||
uboot_g12_postprocess() {
|
||||
run_host_command_logged mv -v u-boot.bin bl33.bin
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/bl30.bin \
|
||||
zero_tmp \
|
||||
bl30_zero.bin \
|
||||
$1/bl301.bin \
|
||||
bl301_zero.bin \
|
||||
bl30_new.bin bl30
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/bl2.bin \
|
||||
zero_tmp \
|
||||
bl2_zero.bin \
|
||||
$1/acs.bin \
|
||||
bl21_zero.bin \
|
||||
bl2_new.bin bl2
|
||||
|
||||
run_host_x86_binary_logged $1/aml_encrypt_$2 --bl30sig \
|
||||
--input bl30_new.bin \
|
||||
--output bl30_new.bin.g12.enc \
|
||||
--level v3
|
||||
run_host_x86_binary_logged $1/aml_encrypt_$2 --bl3sig \
|
||||
--input bl30_new.bin.g12.enc \
|
||||
--output bl30_new.bin.enc \
|
||||
--level v3 --type bl30
|
||||
run_host_x86_binary_logged $1/aml_encrypt_$2 --bl3sig \
|
||||
--input $1/bl31.img \
|
||||
--output bl31.img.enc \
|
||||
--level v3 --type bl31
|
||||
run_host_x86_binary_logged $1/aml_encrypt_$2 --bl3sig \
|
||||
--input bl33.bin \
|
||||
--compress lz4 \
|
||||
--output bl33.bin.enc \
|
||||
--level v3 --type bl33
|
||||
run_host_x86_binary_logged $1/aml_encrypt_$2 --bl2sig \
|
||||
--input bl2_new.bin \
|
||||
--output bl2.n.bin.sig
|
||||
if [ -e $1/lpddr3_1d.fw ]; then
|
||||
run_host_x86_binary_logged $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
|
||||
run_host_x86_binary_logged $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
|
||||
|
||||
}
|
||||
|
||||
# this helper function includes postprocess for meson gxl and gxm.
|
||||
# $1 PATH for uboot blob repo
|
||||
uboot_gxl_postprocess_ng() {
|
||||
run_host_command_logged mv -v u-boot.bin bl33.bin
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/bl30.bin \
|
||||
$1/zero_tmp \
|
||||
$1/bl30_zero.bin \
|
||||
$1/bl301.bin \
|
||||
$1/bl301_zero.bin \
|
||||
$1/bl30_new.bin bl30
|
||||
|
||||
run_host_command_logged python3 $1/acs_tool.py $1/bl2.bin $1/bl2_acs.bin $1/acs.bin 0
|
||||
|
||||
run_host_command_logged $1/blx_fix.sh $1/bl2_acs.bin \
|
||||
$1/zero_tmp \
|
||||
$1/bl2_zero.bin \
|
||||
$1/bl21.bin \
|
||||
$1/bl21_zero.bin \
|
||||
$1/bl2_new.bin bl2
|
||||
|
||||
run_host_command_logged $1/aml_encrypt_gxl --bl3enc --input $1/bl30_new.bin
|
||||
run_host_command_logged $1/aml_encrypt_gxl --bl3enc --input $1/bl31.img
|
||||
run_host_command_logged $1/aml_encrypt_gxl --bl3enc --input bl33.bin
|
||||
run_host_command_logged $1/aml_encrypt_gxl --bl2sig --input $1/bl2_new.bin \
|
||||
--output bl2.n.bin.sig
|
||||
|
||||
run_host_command_logged $1/aml_encrypt_gxl --bootmk --output u-boot.bin \
|
||||
--bl2 bl2.n.bin.sig \
|
||||
--bl30 $1/bl30_new.bin.enc \
|
||||
--bl31 $1/bl31.img.enc \
|
||||
--bl33 bl33.bin.enc
|
||||
}
|
||||
|
||||
write_uboot_platform() {
|
||||
dd if=$1/u-boot.bin of=$2 bs=1 count=442 conv=fsync 2>&1
|
||||
dd if=$1/u-boot.bin of=$2 bs=512 skip=1 seek=1 conv=fsync 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
|
||||
"odroidc2" | "nanopik2-s905" | "lepotato" | "lafrite" | "khadas-vim1" | "khadas-vim2" | "aml-s9xx-box")
|
||||
cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/02-driver.conf
|
||||
Section "OutputClass"
|
||||
Identifier "Amlogic"
|
||||
MatchDriver "meson"
|
||||
Driver "modesetting"
|
||||
Option "PrimaryGPU" "true"
|
||||
EndSection
|
||||
Section "Screen"
|
||||
Identifier "Default Screen"
|
||||
Device "Meson"
|
||||
Monitor "foo"
|
||||
DefaultDepth 24
|
||||
SubSection "Display"
|
||||
Depth 24
|
||||
Modes "1920x1080" "1440x900" "1280x720" "1280x1024" "1280x960" "1024x768" "800x600" "640x480" "720x400"
|
||||
EndSubSection
|
||||
EndSection
|
||||
EOF
|
||||
;;
|
||||
"odroidn2" | "odroidc4" | "khadas-vim2" | "odroidhc4" | "khadas-vim3" | "khadas-vim3l" | "radxa-zero" | "radxa-zero2" | "bananapi-m2s")
|
||||
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
|
||||
}
|
||||
82
config/sources/families/include/meson_common.inc
Normal file
82
config/sources/families/include/meson_common.inc
Normal file
@@ -0,0 +1,82 @@
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
ARCH=armhf
|
||||
LINUXFAMILY=meson
|
||||
KERNEL_IMAGE_TYPE='uImage'
|
||||
KERNEL_INSTALL_TYPE='uinstall'
|
||||
SRC_LOADADDR='LOADADDR=0x00208000'
|
||||
NAME_KERNEL=uImage
|
||||
|
||||
SERIALCON="ttyAML0"
|
||||
|
||||
CPUMIN=504000
|
||||
CPUMAX=1632000
|
||||
GOVERNOR=ondemand
|
||||
|
||||
SKIP_BOOTSPLASH="yes"
|
||||
|
||||
case $BOARD in
|
||||
odroidc1)
|
||||
|
||||
BOOTDIR='u-boot-odroidc1'
|
||||
BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
|
||||
BOOTBRANCH='branch:odroidc-v2011.03'
|
||||
BOOTPATCHDIR="legacy"
|
||||
UBOOT_COMPILER="arm-linux-gnueabihf-"
|
||||
UBOOT_USE_GCC='< 4.9'
|
||||
|
||||
UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin'
|
||||
|
||||
write_uboot_platform() {
|
||||
dd if=$1/bl1.bin.hardkernel of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1
|
||||
dd if=$1/bl1.bin.hardkernel of=$2 bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1
|
||||
dd if=$1/u-boot.bin of=$2 bs=512 seek=64 conv=fsync > /dev/null 2>&1
|
||||
dd if=/dev/zero of=$2 seek=1024 count=32 bs=512 conv=fsync > /dev/null 2>&1
|
||||
}
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
case $BRANCH in
|
||||
current)
|
||||
|
||||
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH="branch:linux-6.1.y"
|
||||
KERNELPATCHDIR='meson-'$BRANCH
|
||||
|
||||
;;
|
||||
|
||||
edge)
|
||||
|
||||
declare -g KERNEL_MAJOR_MINOR="6.4" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH="branch:linux-6.4.y"
|
||||
KERNELPATCHDIR='meson-'$BRANCH
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
family_tweaks() {
|
||||
case $BOARD in
|
||||
onecloud)
|
||||
cp $SRC/packages/blobs/splash/armbian-u-boot-24.bmp $SDCARD/boot/boot.bmp
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
family_tweaks_bsp() {
|
||||
mkdir -p "$destination/etc/X11/xorg.conf.d"
|
||||
cat <<- EOF > "$destination/etc/X11/xorg.conf.d/02-driver.conf"
|
||||
Section "OutputClass"
|
||||
Identifier "Amlogic"
|
||||
MatchDriver "meson"
|
||||
Driver "modesetting"
|
||||
Option "PrimaryGPU" "true"
|
||||
EndSection
|
||||
EOF
|
||||
}
|
||||
47
config/sources/families/include/mvebu-clearfog.inc
Normal file
47
config/sources/families/include/mvebu-clearfog.inc
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
case $BRANCH in
|
||||
|
||||
legacy | current)
|
||||
|
||||
# Check https://developer.solid-run.com/knowledge-base/a388-u-boot
|
||||
# for advanced config options
|
||||
BOOTSOURCE='https://github.com/SolidRun/u-boot'
|
||||
BOOTBRANCH='branch:v2018.01-solidrun-a38x'
|
||||
BOOTDIR='u-boot-armada'
|
||||
BOOTPATCHDIR='legacy/u-boot-clearfog'
|
||||
BOOTSCRIPT='boot-mvebu.cmd:boot.cmd'
|
||||
UBOOT_TARGET_MAP=";sdhc;u-boot-spl-sdhc.kwb:u-boot.mmc
|
||||
;mmc;u-boot-spl-mmc.kwb:u-boot.emmc
|
||||
;spi;u-boot-spl-spi.kwb:u-boot.flash
|
||||
;sata;u-boot-spl-sata.kwb:u-boot.sata
|
||||
;uart;u-boot-spl-uart.kwb:u-boot.uart"
|
||||
|
||||
;;
|
||||
edge)
|
||||
# Check https://developer.solid-run.com/knowledge-base/a388-u-boot
|
||||
# for advanced config options
|
||||
BOOTSOURCE='https://github.com/SolidRun/u-boot'
|
||||
BOOTBRANCH='branch:v2018.01-solidrun-a38x'
|
||||
BOOTDIR='u-boot-armada'
|
||||
BOOTPATCHDIR='legacy/u-boot-clearfog'
|
||||
BOOTSCRIPT='boot-mvebu.cmd:boot.cmd'
|
||||
UBOOT_TARGET_MAP=";sdhc;u-boot-spl-sdhc.kwb:u-boot.mmc
|
||||
;mmc;u-boot-spl-mmc.kwb:u-boot.emmc
|
||||
;spi;u-boot-spl-spi.kwb:u-boot.flash
|
||||
;sata;u-boot-spl-sata.kwb:u-boot.sata
|
||||
;uart;u-boot-spl-uart.kwb:u-boot.uart"
|
||||
|
||||
if [[ $BOARD == clearfogbase ]]; then
|
||||
OVERLAY_PREFIX='armada-388-clearfog-base'
|
||||
else
|
||||
OVERLAY_PREFIX='armada-388-clearfog'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
103
config/sources/families/include/mvebu-helios4.inc
Normal file
103
config/sources/families/include/mvebu-helios4.inc
Normal file
@@ -0,0 +1,103 @@
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
case $BRANCH in
|
||||
|
||||
legacy | current | edge)
|
||||
|
||||
BOOTSOURCE=$MAINLINE_UBOOT_SOURCE
|
||||
BOOTBRANCH='tag:v2019.04'
|
||||
BOOTDIR=$MAINLINE_UBOOT_DIR
|
||||
BOOTPATCHDIR='legacy/u-boot-helios4'
|
||||
BOOTSCRIPT='boot-mvebu.cmd:boot.cmd'
|
||||
|
||||
UBOOT_TARGET_MAP=";sdhc;u-boot-spl.kwb:u-boot.mmc
|
||||
;spi;u-boot-spl.kwb:u-boot.flash
|
||||
;uart;u-boot-spl.kwb:u-boot.uart"
|
||||
|
||||
UBOOT_USE_GCC='> 7.0'
|
||||
|
||||
OVERLAY_PREFIX='armada-388-helios4'
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Helios4 tweak
|
||||
family_tweaks_bsp() {
|
||||
## Add dependency list
|
||||
local DEPENDENCIES="fancontrol, mdadm"
|
||||
sed -i "/^Depends:/ s/$/, $DEPENDENCIES/" "${destination}"/DEBIAN/control
|
||||
|
||||
## Pack additional files
|
||||
|
||||
mkdir -p $destination/etc/systemd/system/
|
||||
mkdir -p $destination/etc/udev/rules.d/
|
||||
mkdir -p $destination/etc/default/
|
||||
mkdir -p $destination/lib/systemd/system/
|
||||
mkdir -p $destination/usr/sbin
|
||||
|
||||
### Fancontrol tweaks
|
||||
# copy hwmon rules to fix device mapping
|
||||
install -m 644 $SRC/packages/bsp/mvebu/helios4/90-helios4-hwmon.rules $destination/etc/udev/rules.d/
|
||||
|
||||
# copy fancontrol config
|
||||
install -m 644 $SRC/packages/bsp/mvebu/helios4/fancontrol_pwm-fan.conf $destination/etc/fancontrol
|
||||
install -m 644 $SRC/packages/bsp/mvebu/helios4/fancontrol.service $destination/etc/systemd/system/
|
||||
|
||||
### Mdadm tweaks
|
||||
|
||||
# copy mdadm-fault-led script and set right permission
|
||||
install -m 755 $SRC/packages/bsp/mvebu/helios4/mdadm-fault-led.sh $destination/usr/sbin
|
||||
|
||||
### Ethernet tweaks
|
||||
|
||||
# copy and enable helios4-wol.service
|
||||
install -m 644 $SRC/packages/bsp/mvebu/helios4/helios4-wol.service $destination/lib/systemd/system/
|
||||
|
||||
### Other tweaks
|
||||
|
||||
# add custom motd default conf file
|
||||
install -m 644 $SRC/packages/bsp/mvebu/helios4/armbian-motd $destination/etc/default/
|
||||
|
||||
# create modules file
|
||||
if [[ $BRANCH == dev && -n $MODULES_EDGE ]]; then
|
||||
tr ' ' '\n' <<< "$MODULES_DEV" > "${destination}"/etc/modules
|
||||
elif [[ $BRANCH == current || $BRANCH == dev ]]; then
|
||||
tr ' ' '\n' <<< "$MODULES_CURRENT" > "${destination}"/etc/modules
|
||||
else
|
||||
tr ' ' '\n' <<< "$MODULES_LEGACY" > "${destination}"/etc/modules
|
||||
fi
|
||||
|
||||
display_alert "Adding to bsp-cli" "${BOARD}: postinst for bluetooth service" "info"
|
||||
# Define a function to be run board-side during postinst of the BSP
|
||||
postinst_functions+=("board_side_helios4_bsp_cli_postinst_mdadm") # add to the postinst function list
|
||||
function board_side_helios4_bsp_cli_postinst_mdadm() {
|
||||
### Mdadm tweaks
|
||||
MDADM_CONF=/etc/mdadm/mdadm.conf
|
||||
MDADM_HOOK=/usr/share/initramfs-tools/hooks/mdadm
|
||||
grep -q "PROGRAM" $MDADM_CONF
|
||||
if [ "$?" -ne 0 ]; then
|
||||
cat <<- EOS >> $MDADM_CONF
|
||||
# Trigger Fault Led script when an event is detected
|
||||
PROGRAM /usr/sbin/mdadm-fault-led.sh
|
||||
EOS
|
||||
fi
|
||||
|
||||
# Fix for "mdadm: initramfs boot message: /scripts/local-bottom/mdadm: rm: not found"
|
||||
# Refer to https://wiki.kobol.io/helios4/mdadm/#fix-mdadm
|
||||
grep -q "^[[:blank:]]*copy_exec /bin/rm /bin" $MDADM_HOOK
|
||||
if [ "$?" -ne 0 ]; then
|
||||
sed -i '/copy_exec \/sbin\/mdmon \/sbin/ a\copy_exec /bin/rm /bin' $MDADM_HOOK
|
||||
update-initramfs -u
|
||||
fi
|
||||
|
||||
# enable helios4-wol.service
|
||||
systemctl --no-reload enable helios4-wol.service
|
||||
}
|
||||
|
||||
}
|
||||
334
config/sources/families/include/rockchip64_common.inc
Normal file
334
config/sources/families/include/rockchip64_common.inc
Normal file
@@ -0,0 +1,334 @@
|
||||
#
|
||||
# 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=arm64
|
||||
OFFSET=16
|
||||
BOOTSCRIPT='boot-rockchip64.cmd:boot.cmd'
|
||||
BOOTENV_FILE='rockchip64.txt'
|
||||
UBOOT_TARGET_MAP=";;idbloader.bin uboot.img trust.bin"
|
||||
BOOTDELAY=0
|
||||
OVERLAY_PREFIX='rockchip'
|
||||
SERIALCON=${SERIALCON:=$([ "${BRANCH}" == "legacy" ] && echo "ttyFIQ0:1500000" || echo "ttyS2:1500000")}
|
||||
GOVERNOR="ondemand"
|
||||
ATFPATCHDIR='atf-rockchip64'
|
||||
BOOTPATCHDIR="${BOOTPATCHDIR:-"u-boot-rockchip64"}"
|
||||
PACKAGE_LIST_FAMILY="ethtool"
|
||||
|
||||
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
|
||||
|
||||
# Common variables:
|
||||
# BOOT_SCENARIO - determines which tpl (ddrbin), spl and ATF combination to use
|
||||
#
|
||||
# Different boot scenario can arrange:
|
||||
# * Phase 1: DDR initialization (proprietary rockchip ddrbin or u-boot TPL)
|
||||
# * Phase 2: Initial system and clock initialization (proprietary rockchip miniload or u-boot SPL)
|
||||
# * Phase 3: Arm Trusted Firmware (proprietary rockchip or mainline opensource)
|
||||
# * Phase 4: u-boot proper is always the mainline one
|
||||
#
|
||||
# Available options for BOOT_SCENARIO are:
|
||||
# - only-blobs: proprietary rockchip ddrbin, miniloader and ATF
|
||||
# - spl-blobs: proprietary rockchip ddrin and ATF, but uses mainline u-boot SPL in place of rockchip miniloader
|
||||
# - tpl-spl-blob: uses mainline u-boot TPL and SPL with proprietary rockchip ATF blob
|
||||
# - tpl-blob-atf-mainline: proprietary rockchip ddrbin + mainline u-boot SPL + mainline ATF
|
||||
# - blobless: mainline u-boot TPL + mainline u-boot SPL + mainline ATF
|
||||
|
||||
#BOOT_SOC=`expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*'`
|
||||
BOOT_SOC=${BOOT_SOC:=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*' || true)}
|
||||
|
||||
if [[ "a${BOOT_SOC}a" == "aa" ]]; then
|
||||
if [[ "${BOOTCONFIG}" != "" && "${BOOTCONFIG}" != " none" ]]; then # only warn if BOOTCONFIG set and not 'none'
|
||||
display_alert "Could not determine BOOT_SOC from BOOTCONFIG" "BOOTCONFIG: '${BOOTCONFIG}'" "warning"
|
||||
fi
|
||||
else
|
||||
display_alert "Determined BOOT_SOC from BOOTCONFIG" "BOOT_SOC: '${BOOT_SOC}'; BOOTCONFIG: '${BOOTCONFIG}'" "info"
|
||||
fi
|
||||
|
||||
CPUMIN=${CPUMIN:="408000"}
|
||||
|
||||
if [[ $BOOT_SOC == rk3399 ]]; then
|
||||
|
||||
CPUMAX=${CPUMAX:="2016000"}
|
||||
|
||||
elif [[ $BOOT_SOC == rk3328 || $BOOT_SOC == rk3308 ]]; then
|
||||
|
||||
CPUMAX=${CPUMAX:="1296000"}
|
||||
|
||||
elif [[ "${BOOT_SOC}" == rk3566 ]]; then
|
||||
|
||||
CPUMAX=${CPUMAX:="1800000"}
|
||||
|
||||
elif [[ "${BOOT_SOC}" == rk3568 ]]; then
|
||||
|
||||
CPUMAX=${CPUMAX:="1992000"}
|
||||
|
||||
fi
|
||||
|
||||
# BOOT_SOC_MKIMAGE defaults to BOOT_SOC, but can be overriden. See rk3566
|
||||
declare -g BOOT_SOC_MKIMAGE="${BOOT_SOC}"
|
||||
|
||||
if [[ $BOOT_SOC == rk3328 ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
||||
DDR_BLOB="${DDR_BLOB:-"rk33/rk3328_ddr_333MHz_v1.16.bin"}"
|
||||
MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk322xh_miniloader_v2.50.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk33/rk322xh_bl31_v1.44.elf"}"
|
||||
|
||||
elif [[ $BOOT_SOC == rk3399 ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
||||
DDR_BLOB="${DDR_BLOB:-"rk33/rk3399_ddr_933MHz_v1.25.bin"}"
|
||||
MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk3399_miniloader_v1.26.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk33/rk3399_bl31_v1.35.elf"}"
|
||||
|
||||
elif [[ $BOOT_SOC == rk3399pro ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
||||
DDR_BLOB="${DDR_BLOB:-"rk33/rk3399pro_npu_ddr_933MHz_v1.02.bin"}"
|
||||
MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk3399pro_miniloader_v1.26.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk33/rk3399pro_bl31_v1.35.elf"}"
|
||||
|
||||
elif [[ $BOOT_SOC == rk3566 ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
|
||||
DDR_BLOB="${DDR_BLOB:-"rk35/rk3566_ddr_1056MHz_v1.10.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk35/rk3568_bl31_v1.29.elf"}"
|
||||
BOOT_SOC_MKIMAGE="rk3568" # mkimage does not know about rk3566, and rk3568 works.
|
||||
|
||||
elif [[ $BOOT_SOC == rk3568 ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
|
||||
DDR_BLOB="${DDR_BLOB:-"rk35/rk3568_ddr_1560MHz_v1.13.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk35/rk3568_bl31_v1.32.elf"}"
|
||||
|
||||
elif [[ $BOOT_SOC == rk3588 ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
|
||||
DDR_BLOB="${DDR_BLOB:-"rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk35/rk3588_bl31_v1.28.elf"}"
|
||||
|
||||
elif [[ $BOARD == rockpi-s ]]; then
|
||||
|
||||
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
||||
BOOT_SOC=rk3308
|
||||
DDR_BLOB="${DDR_BLOB:-"rk33/rk3308_ddr_589MHz_uart2_m1_v1.30.bin"}"
|
||||
MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk3308_miniloader_v1.22.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk33/rk3308_bl31_v2.22.elf"}"
|
||||
|
||||
if [[ ${BRANCH} == legacy ]]; then
|
||||
DDR_BLOB="${DDR_BLOB:-"rk33/rk3308_ddr_589MHz_uart2_m0_v1.26.bin"}"
|
||||
MINILOADER_BLOB="${MINILOADER_BLOB:-"rk33/rk3308_miniloader_sd_nand_v1.13.bin"}"
|
||||
BL31_BLOB="${BL31_BLOB:-"rk33/rk3308_bl31_v2.10.elf"}"
|
||||
fi
|
||||
fi
|
||||
|
||||
case $BRANCH in
|
||||
|
||||
current)
|
||||
|
||||
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH="branch:linux-6.1.y"
|
||||
KERNELPATCHDIR='rockchip64-'$BRANCH
|
||||
LINUXFAMILY=rockchip64
|
||||
LINUXCONFIG='linux-rockchip64-'$BRANCH
|
||||
;;
|
||||
|
||||
edge)
|
||||
|
||||
KERNELPATCHDIR='rockchip64-'$BRANCH
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
|
||||
KERNELBRANCH="branch:linux-6.5.y"
|
||||
LINUXFAMILY=rockchip64
|
||||
LINUXCONFIG='linux-rockchip64-'$BRANCH
|
||||
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
prepare_boot_configuration() {
|
||||
if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]]; then
|
||||
|
||||
UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
||||
ATFSOURCE='https://github.com/ARM-software/arm-trusted-firmware'
|
||||
ATF_COMPILER='aarch64-linux-gnu-'
|
||||
ATFDIR='arm-trusted-firmware'
|
||||
ATFBRANCH='tag:lts-v2.8.8'
|
||||
ATF_USE_GCC='> 6.3'
|
||||
ATF_TARGET_MAP="M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=$BOOT_SOC bl31;;build/$BOOT_SOC/release/bl31/bl31.elf:bl31.elf"
|
||||
ATF_TOOLCHAIN2="arm-linux-gnueabi-:< 10.0"
|
||||
|
||||
[[ $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]] && UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
||||
|
||||
elif [[ $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
|
||||
|
||||
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
||||
ATFSOURCE=''
|
||||
ATF_COMPILE='no'
|
||||
|
||||
elif [[ $BOOT_SCENARIO == "spl-blobs" ]]; then
|
||||
|
||||
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB spl/u-boot-spl.bin u-boot.dtb u-boot.itb;;idbloader.img u-boot.itb"
|
||||
ATFSOURCE=''
|
||||
ATF_COMPILE='no'
|
||||
|
||||
elif [[ $BOOT_SCENARIO == "only-blobs" ]]; then
|
||||
|
||||
UBOOT_TARGET_MAP="u-boot-dtb.bin;;idbloader.bin uboot.img trust.bin"
|
||||
ATFSOURCE=''
|
||||
ATF_COMPILE='no'
|
||||
|
||||
fi
|
||||
|
||||
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
|
||||
|
||||
if [[ "${BOOT_SPI_RKSPI_LOADER:-"no"}" != "yes" ]]; then
|
||||
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP} tpl/u-boot-tpl.bin spl/u-boot-spl.bin u-boot.itb rkspi_loader.img"
|
||||
else
|
||||
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP} rkspi_loader.img"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
uboot_custom_postprocess() {
|
||||
[[ -z ${BOOT_SOC} ]] && exit_with_error "BOOT_SOC not defined for scenario '${BOOT_SCENARIO}' for BOARD'=${BOARD}' and BOOTCONFIG='${BOOTCONFIG}'"
|
||||
|
||||
if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
|
||||
:
|
||||
elif [[ $BOOT_SCENARIO == "spl-blobs" || $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]]; then
|
||||
# Bomb if DDR_BLOB not defined or does not exist
|
||||
declare SPL_BIN_PATH="${RKBIN_DIR}/${DDR_BLOB}"
|
||||
[[ -z ${SPL_BIN_PATH} ]] && exit_with_error "DDR_BLOB not defined for scenario ${BOOT_SCENARIO}"
|
||||
[[ ! -f "${SPL_BIN_PATH}" ]] && exit_with_error "DDR_BLOB ${SPL_BIN_PATH} does not exist for scenario ${BOOT_SCENARIO}"
|
||||
|
||||
display_alert "mkimage for '${BOOT_SOC}' for scenario ${BOOT_SCENARIO}" "SPL_BIN_PATH: ${SPL_BIN_PATH}" "debug"
|
||||
run_host_command_logged tools/mkimage -n "${BOOT_SOC_MKIMAGE}" -T rksd -d "${SPL_BIN_PATH}:spl/u-boot-spl.bin" idbloader.img
|
||||
|
||||
elif [[ $BOOT_SCENARIO == "only-blobs" ]]; then
|
||||
|
||||
local tempfile
|
||||
tempfile=$(mktemp)
|
||||
run_host_command_logged tools/mkimage -n "${BOOT_SOC_MKIMAGE}" -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
|
||||
cat $RKBIN_DIR/$MINILOADER_BLOB >> idbloader.bin
|
||||
run_host_x86_binary_logged $RKBIN_DIR/tools/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000
|
||||
run_host_x86_binary_logged $RKBIN_DIR/tools/trust_merger --replace bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
|
||||
|
||||
else
|
||||
exit_with_error "Unsupported u-boot processing configuration!"
|
||||
fi
|
||||
|
||||
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
|
||||
if [[ "${BOOT_SPI_RKSPI_LOADER:-"no"}" == "yes" ]]; then
|
||||
dd if=/dev/zero of=rkspi_loader.img bs=1M count=0 seek=16
|
||||
/sbin/parted -s rkspi_loader.img mklabel gpt
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart idbloader 64 7167
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart vnvm 7168 7679
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart reserved_space 7680 8063
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart reserved1 8064 8127
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart uboot_env 8128 8191
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart reserved2 8192 16383
|
||||
/sbin/parted -s rkspi_loader.img unit s mkpart uboot 16384 32734
|
||||
dd if=idbloader.img of=rkspi_loader.img seek=64 conv=notrunc
|
||||
dd if=u-boot.itb of=rkspi_loader.img seek=16384 conv=notrunc
|
||||
else
|
||||
tools/mkimage -n "${BOOT_SOC_MKIMAGE}" -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
|
||||
fi
|
||||
}
|
||||
|
||||
write_uboot_platform() {
|
||||
# This is run board-side too, so account for the non-existance of run_host_command_logged
|
||||
local logging_prelude=""
|
||||
[[ $(type -t run_host_command_logged) == function ]] && logging_prelude="run_host_command_logged"
|
||||
|
||||
if [[ -f $1/rksd_loader.img ]]; then # legacy rk3399 loader
|
||||
${logging_prelude} dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none
|
||||
elif [[ -f $1/u-boot.itb ]]; then # $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob"
|
||||
${logging_prelude} dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none
|
||||
${logging_prelude} dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none
|
||||
elif [[ -f $1/uboot.img ]]; then # $BOOT_SCENARIO == "only-blobs"
|
||||
${logging_prelude} dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none
|
||||
${logging_prelude} dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none
|
||||
${logging_prelude} dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none
|
||||
else
|
||||
echo "Unsupported u-boot processing configuration!"
|
||||
exit 1
|
||||
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() {
|
||||
|
||||
if grep -q "ubootpart" /proc/cmdline; then
|
||||
|
||||
local tmp=$(cat /proc/cmdline)
|
||||
tmp="${tmp##*ubootpart=}"
|
||||
tmp="${tmp%% *}"
|
||||
[[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2> /dev/null)
|
||||
[[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null)
|
||||
[[ -n $dev ]] && DEVICE="/dev/$dev"
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
family_tweaks() {
|
||||
|
||||
if [[ -f $SDCARD/lib/systemd/system/rk3399-bluetooth.service ]]; then
|
||||
|
||||
# install and enable Bluetooth
|
||||
chroot_sdcard_apt_get_install rfkill bluetooth bluez bluez-tools
|
||||
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable rk3399-bluetooth.service >/dev/null 2>&1"
|
||||
|
||||
elif [[ -f $SDCARD/lib/systemd/system/sprd-bluetooth.service ]]; then
|
||||
|
||||
# install and enable Bluetooth
|
||||
chroot_sdcard_apt_get_install rfkill bluetooth bluez bluez-tools
|
||||
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable sprd-bluetooth.service >/dev/null 2>&1"
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
family_tweaks_bsp() {
|
||||
|
||||
if [[ $BOOTCONFIG == *3328* ]] && [[ $BRANCH != legacy ]]; then
|
||||
mkdir -p "$destination"/etc/X11/xorg.conf.d
|
||||
cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/02-driver.conf
|
||||
# set fbdev as default driver.
|
||||
Section "Device"
|
||||
Identifier "NOGPU"
|
||||
Driver "fbdev"
|
||||
EndSection
|
||||
EOF
|
||||
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/
|
||||
|
||||
}
|
||||
73
config/sources/families/include/sunxi64_common.inc
Normal file
73
config/sources/families/include/sunxi64_common.inc
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# 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 "sunxi-tools"
|
||||
declare -g ARCH=arm64
|
||||
declare -g ATF_TARGET_MAP="PLAT=$ATF_PLAT DEBUG=1 bl31;;build/$ATF_PLAT/debug/bl31.bin"
|
||||
declare -g ATFBRANCH="tag:v2.9.0"
|
||||
declare -g BOOTDELAY=1
|
||||
declare -g BOOTPATCHDIR="${BOOTPATCHDIR:-"u-boot-sunxi"}"
|
||||
declare -g BOOTBRANCH="${BOOTBRANCH:-"tag:v2023.07.02"}"
|
||||
declare -g BOOTENV_FILE='sunxi.txt'
|
||||
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP:-BINMAN_ALLOW_MISSING=1;;u-boot-sunxi-with-spl.bin}"
|
||||
declare -g BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd'
|
||||
declare -g LINUXFAMILY=sunxi64
|
||||
|
||||
source "${BASH_SOURCE%/*}/crust_firmware.inc"
|
||||
|
||||
case $BRANCH in
|
||||
|
||||
legacy)
|
||||
declare -g KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH="tag:v5.15.131"
|
||||
;;
|
||||
|
||||
current)
|
||||
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH="tag:v6.1.53"
|
||||
;;
|
||||
|
||||
edge)
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH="tag:v6.5.3"
|
||||
;;
|
||||
esac
|
||||
|
||||
KERNELPATCHDIR="archive/sunxi-${KERNEL_MAJOR_MINOR}"
|
||||
|
||||
family_tweaks() {
|
||||
# execute specific tweaks function if present
|
||||
[[ $(type -t family_tweaks_s) == function ]] && family_tweaks_s
|
||||
cp $SRC/packages/blobs/splash/armbian-u-boot-24.bmp $SDCARD/boot/boot.bmp
|
||||
}
|
||||
|
||||
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-sunxi-with-spl.bin of=$2 bs=1024 seek=8 status=noxfer > /dev/null 2>&1
|
||||
}
|
||||
|
||||
setup_write_uboot_platform() {
|
||||
if grep -q "ubootpart" /proc/cmdline; then
|
||||
# mainline with new boot script
|
||||
local tmp=$(cat /proc/cmdline)
|
||||
tmp="${tmp##*ubootpart=}"
|
||||
tmp="${tmp%% *}"
|
||||
[[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2> /dev/null)
|
||||
[[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null)
|
||||
[[ -n $dev ]] && DEVICE="/dev/$dev"
|
||||
else
|
||||
# legacy or old boot script
|
||||
local tmp=$(cat /proc/cmdline)
|
||||
tmp="${tmp##*root=}"
|
||||
tmp="${tmp%% *}"
|
||||
[[ -n $tmp ]] && local part=$(findfs $tmp 2> /dev/null)
|
||||
[[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null)
|
||||
# do not try to write u-boot to USB devices
|
||||
[[ -n $dev && $dev == mmcblk* ]] && DEVICE="/dev/$dev"
|
||||
fi
|
||||
}
|
||||
83
config/sources/families/include/sunxi_common.inc
Normal file
83
config/sources/families/include/sunxi_common.inc
Normal file
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# 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 "sunxi-tools"
|
||||
declare -g ARCH=armhf
|
||||
declare -g BOOTDELAY=1
|
||||
declare -g BOOTPATCHDIR="${BOOTPATCHDIR:-"u-boot-sunxi"}"
|
||||
declare -g BOOTBRANCH="${BOOTBRANCH:-"tag:v2023.07.02"}"
|
||||
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP:-;;u-boot-sunxi-with-spl.bin}"
|
||||
declare -g BOOTSCRIPT="boot-sunxi.cmd:boot.cmd"
|
||||
declare -g BOOTENV_FILE='sunxi.txt'
|
||||
declare -g LINUXFAMILY=sunxi
|
||||
declare -g UBOOT_FW_ENV='0x88000,0x20000' # /etc/fw_env.config offset and env size
|
||||
declare -g ASOUND_STATE='asound.state.sunxi-next'
|
||||
declare -g GOVERNOR=ondemand
|
||||
|
||||
source "${BASH_SOURCE%/*}/crust_firmware.inc"
|
||||
|
||||
case $BRANCH in
|
||||
|
||||
legacy)
|
||||
declare -g KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH="tag:v5.15.131"
|
||||
;;
|
||||
|
||||
current)
|
||||
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH="tag:v6.1.53"
|
||||
;;
|
||||
|
||||
edge)
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH="tag:v6.5.3"
|
||||
;;
|
||||
esac
|
||||
|
||||
KERNELPATCHDIR="archive/sunxi-${KERNEL_MAJOR_MINOR}"
|
||||
|
||||
family_tweaks() {
|
||||
# execute specific tweaks function if present
|
||||
[[ $(type -t family_tweaks_s) == function ]] && family_tweaks_s
|
||||
|
||||
cp $SRC/packages/blobs/splash/armbian-u-boot-24.bmp $SDCARD/boot/boot.bmp
|
||||
}
|
||||
|
||||
family_tweaks_bsp() {
|
||||
# execute specific tweaks function if present
|
||||
[[ $(type -t family_tweaks_bsp_s) == function ]] && family_tweaks_bsp_s
|
||||
|
||||
return 0 # short-circuit above, avoid errors on exit.
|
||||
}
|
||||
|
||||
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-sunxi-with-spl.bin of=$2 bs=1024 seek=8 status=noxfer > /dev/null 2>&1
|
||||
}
|
||||
|
||||
setup_write_uboot_platform() {
|
||||
if grep -q "ubootpart" /proc/cmdline; then
|
||||
local tmp=$(cat /proc/cmdline)
|
||||
tmp="${tmp##*ubootpart=}"
|
||||
tmp="${tmp%% *}"
|
||||
[[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2> /dev/null)
|
||||
[[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null)
|
||||
[[ -n $dev ]] && DEVICE="/dev/$dev"
|
||||
elif [[ -f /var/lib/armbian/force_search_uboot ]]; then
|
||||
# This may cause overwriting u-boot for android or other non-Armbian OS installed on eMMC
|
||||
# so don't run this function by default
|
||||
for dev in $(lsblk -d -n -p -o NAME); do
|
||||
if grep -q 'eGON.BT0' <(dd if=$dev bs=32 skip=256 count=1 status=none); then
|
||||
# Assuming that only one device with SPL signature is present
|
||||
echo "SPL signature found on $dev" >&2
|
||||
DEVICE=$dev
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
76
config/sources/families/include/uefi_common.inc
Normal file
76
config/sources/families/include/uefi_common.inc
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
declare -g SERIALCON="tty1" # Cant reasonably expect UEFI stuff to have a serial console. Customize if otherwise.
|
||||
declare -g SKIP_BOOTSPLASH="yes" # No splash.
|
||||
declare -g UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for GRUB menu.
|
||||
declare -g BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards
|
||||
case "${BRANCH}" in
|
||||
|
||||
ddk)
|
||||
# This will force `unset KERNELSOURCE` later; no kernel will be built.
|
||||
# Instead, the distro's default linux-generic kernel will be installed.
|
||||
declare -g DISTRO_GENERIC_KERNEL=yes
|
||||
;;
|
||||
|
||||
legacy)
|
||||
|
||||
declare -g DISTRO_GENERIC_KERNEL=no
|
||||
declare -g LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
|
||||
declare -g KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
|
||||
declare -g KERNELBRANCH="branch:linux-5.15.y" # Branch or tag to build from. It should match MAJOR_MINOR
|
||||
declare -g KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
|
||||
;;
|
||||
|
||||
current)
|
||||
|
||||
declare -g DISTRO_GENERIC_KERNEL=no
|
||||
declare -g LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
|
||||
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. For mainline caching.
|
||||
declare -g KERNELBRANCH="branch:linux-6.1.y" # Branch or tag to build from. It should match MAJOR_MINOR
|
||||
declare -g KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
|
||||
;;
|
||||
|
||||
edge)
|
||||
|
||||
declare -g DISTRO_GENERIC_KERNEL=no
|
||||
declare -g LINUXCONFIG="linux-uefi-${LINUXFAMILY}-${BRANCH}"
|
||||
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel.
|
||||
declare -g KERNELBRANCH='branch:linux-6.5.y'
|
||||
declare -g KERNELPATCHDIR="uefi-${LINUXFAMILY}-${BRANCH}" # Might be empty.
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${QEMU_UBOOT_BOOTCONFIG}" != "" ]]; then
|
||||
# Allowance for using the UEFI kernels, but not an UEFI bootloader, instead, use qemu with uboot.
|
||||
# Used in the qemu-uboot-x86 and qemu-uboot-arm64 "boards".
|
||||
display_alert "Using UEFI as base for qemu-uboot-${LINUXFAMILY}" "Using BOOTCONFIG: ${QEMU_UBOOT_BOOTCONFIG}" "debug"
|
||||
declare -g ATF_COMPILE="no"
|
||||
|
||||
declare -g BOOTDIR="qemu-uboot-${LINUXFAMILY}"
|
||||
declare -g BOOTBRANCH='tag:v2023.04'
|
||||
declare -g BOOTSOURCE='https://github.com/u-boot/u-boot' # Gotta set this again, it is unset by grub extension
|
||||
|
||||
declare -g BOOTCONFIG="${QEMU_UBOOT_BOOTCONFIG}"
|
||||
add_packages_to_image spice-vdagent qemu-guest-agent # Nice-to-have packages for running under qemu
|
||||
|
||||
# A patch to convert to `q35` machine type DTS (x86 only)
|
||||
declare -g BOOTPATCHDIR="u-boot-qemu-${LINUXFAMILY}"
|
||||
|
||||
# Config for the qcow2 image
|
||||
declare -g QCOW2_RESIZE_AMOUNT="+50G" # resize the qcow2 image to be 50G bigger
|
||||
declare -g QCOW2_KEEP_IMG="no" # produce only the .qcow2 image, not raw .img
|
||||
|
||||
# Enable the qcow2 output extension.
|
||||
enable_extension "image-output-qcow2"
|
||||
|
||||
write_uboot_platform() {
|
||||
echo "Not writing uboot for qemu-uboot-xxxx platform"
|
||||
}
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user