forked from armbian/build
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmvebu64.conf
More file actions
166 lines (139 loc) · 6.83 KB
/
Copy pathmvebu64.conf
File metadata and controls
166 lines (139 loc) · 6.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#
# 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 "marvell-tools"
# The C++ compiler is no longer included by default in the Armbian build system (but required for mox related stuff)
# Enable the extension that brings includes it. It could've been an inline extension (eg: the function right here),
# but having a core extension allows it to be pre-included in the Dockerfile generation and thus in the Docker images.
enable_extension "c-plus-plus-compiler"
# The BLx stuff requires 32-bit compiler, add it using an inline hook.
# This is only used for non-Docker, since the Docker image already has it, since it includes compilers for all architectures.
function add_host_dependencies__mvebu64_add_32_bit_c_compiler() {
display_alert "Adding armhf C compiler to host dependencies" "for mvebu64 BLx compile" "debug"
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} gcc-arm-linux-gnueabi" # @TODO: convert to array later
}
declare -g ARCH=arm64
declare -g BOOTBRANCH='tag:v2025.10'
declare -g BOOTPATCHDIR='v2025.10'
declare -g BOOTENV_FILE='mvebu64.txt'
declare -g BOOTSCRIPT_OUTPUT='boot.scr'
declare -g OVERLAY_DIR="/boot/dtb/marvell/overlay"
declare -g ATFSOURCE='https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git'
declare -g ATFDIR='arm-trusted-firmware-espressobin'
declare -g ATFBRANCH='tag:lts-v2.12.8'
ATF_COMPILER='aarch64-linux-gnu-'
if [[ $BOARD = macchiatobin-doubleshot ]]; then
export SCP_BL2=$SRC/cache/sources/marvell-binaries/mrvl_scp_bl2.img # ATTENTION! This is actually a required 'export', since it's picked up by ATF's make.
declare -g ATF_TARGET_MAP="USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr SECURE=0 PLAT=a80x0_mcbin;;build/a80x0_mcbin/release/bl31.bin"
declare -g UBOOT_TARGET_MAP="DEVICE_TREE=armada-8040-mcbin ;;flash-image.bin"
declare -g BOOTSCRIPT="boot-macchiatobin-doubleshot.cmd:boot.cmd"
declare -g SERIALCON='ttyS0'
else
declare -g ATF_TARGET_MAP="USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_800_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 PLAT=a3700;;build/a3700/release/bl31.bin"
declare -g UBOOT_TARGET_MAP="DEVICE_TREE=armada-3720-espressobin ;;flash-image-*.bin"
declare -g BOOTSCRIPT="boot-espressobin.cmd:boot.cmd"
declare -g SERIALCON='ttyMV0'
fi
case $BRANCH in
legacy)
declare -g KERNEL_MAJOR_MINOR="6.6" # Major and minor versions of this kernel.
declare -g KERNELBRANCH='branch:linux-6.6.y'
;;
current)
declare -g KERNEL_MAJOR_MINOR="6.12" # Major and minor versions of this kernel.
declare -g KERNELBRANCH='branch:linux-6.12.y'
;;
edge)
declare -g KERNEL_MAJOR_MINOR="6.18" # Major and minor versions of this kernel.
;;
esac
declare -g CPUMIN=200000
declare -g CPUMAX=1300000
declare -g GOVERNOR=ondemand
function write_uboot_platform() {
if [[ $BOARD = macchiatobin-doubleshot ]]; then
dd if=$1/flash-image.bin of=$2 bs=512 seek=1 status=noxfer > /dev/null 2>&1
else
# flashing process via u-boot only for now https://www.armbian.com/espressobin/
/bin/true
fi
}
function family_tweaks() {
if [[ $BOARD = "espressobin" ]]; then
echo "#Marvell Espressobin Console" >> "${SDCARD}/etc/securetty"
echo "ttyMV0" >> "${SDCARD}/etc/securetty"
fi
}
function family_tweaks_bsp() {
: "${destination:?destination is not set}"
if [[ $BOARD = "espressobin" ]]; then
cp "$SRC/packages/bsp/mvebu64/initramfs/99-uboot-fit" "$destination/etc/initramfs/post-update.d/"
fi
}
function atf_custom_postprocess() {
# prepare compilers for postprocess
ubootdir="$SRC/cache/sources/u-boot-worktree/$BOOTDIR/${BOOTBRANCH##*:}"
declare -g ATF1="${ATF_COMPILER}"
declare -g ATF2="arm-linux-gnueabi-"
declare -g BL33="${ubootdir}/u-boot.bin"
}
function uboot_custom_postprocess() {
# clean previous
run_host_command_logged rm -f "$ubootdir"/flash-image*
declare atfdir="$SRC/cache/sources/$ATFDIR/${ATFBRANCH##*:}"
declare ubootdir="$SRC/cache/sources/u-boot-worktree/$BOOTDIR/${BOOTBRANCH##*:}"
declare moxbootdir="$SRC/cache/sources/mox-boot"
cd "${atfdir}" || exit_with_error "Cannot enter ATF directory ${atfdir}"
if [[ $BOARD = macchiatobin-doubleshot ]]; then
run_host_command_logged make distclean
FILENAME="flash-image.bin"
display_alert "Building mvebu64 ${BOARD}" "$FILENAME" "info"
# http://wiki.macchiatobin.net/tiki-index.php?page=Build+from+source+-+Bootloader#Building_ATF
run_host_command_logged make distclean
run_host_command_logged "CFLAGS=-fdiagnostics-color=always" pipetty make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr PLAT=a80x0_mcbin CROSS_COMPILE=$ATF1 BL33=$BL33 mrvl_flash $CTHREADS
run_host_command_logged cp -pv build/a80x0_mcbin/release/flash-image.bin $ubootdir/$FILENAME
else
cd "${moxbootdir}" || exit_with_error "Cannot enter mox-boot directory ${moxbootdir}"
display_alert "Patching mox-boot for mvebu64 ${BOARD}" "crazy toolchain thing" "info"
[[ -f Makefile ]] && sed -i "s/aarch64-unknown-linux-gnu-/aarch64-linux-gnu-/" Makefile
[[ -f wtmi/a53_helper/Makefile ]] && sed -i "s/aarch64-unknown-linux-gnu-/aarch64-linux-gnu-/" wtmi/a53_helper/Makefile
run_host_command_logged pipetty regular_git diff -u || true
display_alert "Building" "mox-boot for mvebu64 ${BOARD}" "info"
run_host_command_logged make clean
run_host_command_logged "CFLAGS=-fdiagnostics-color=always" pipetty make "CROSS_CM3=$ATF2" wtmi_app.bin
cd "${atfdir}" || exit_with_error "Cannot enter ATF directory ${atfdir}"
display_alert "Building atf for mvebu64 ${BOARD}" "" "info"
declare -a clocks=("600_600" "800_800" "1000_800" "1200_750")
declare -a topology=("512m_1cs_0" "1g_2cs_2" "1g_1cs_4" "2g_2cs_7" "1g_1cs_5" "2g_2cs_6")
for i in "${clocks[@]}"; do
for j in "${topology[@]}"; do
declare ddrname="undetermined"
if [[ $j = *cs_5 || $j = *cs_6 ]]; then ddrname="DDR4"; else ddrname="DDR3"; fi
FILENAME="flash-image-$ddrname-$j-$i.bin"
DDR_TOPOLOGY="${j##*_}"
CLOCKSPRESET="CPU_${i%_*}_DDR_${i##*_}"
display_alert "Building mvebu64 not-macchiatobin-doubleshot: ${BOARD}" "$FILENAME" "info"
run_host_command_logged make distclean
run_host_command_logged "CFLAGS=-fdiagnostics-color=always" pipetty make "CROSS_COMPILE=$ATF1" \
"CROSS_CM3=$ATF2" \
USE_COHERENT_MEM=0 \
PLAT=a3700 \
"CLOCKSPRESET=$CLOCKSPRESET" "DDR_TOPOLOGY=$DDR_TOPOLOGY" \
"MV_DDR_PATH=$SRC/cache/sources/marvell-ddr" \
"WTP=$SRC/cache/sources/marvell-tools" \
"CRYPTOPP_PATH=$SRC/cache/sources/cryptopp" \
"BL33=$BL33" \
"WTMI_IMG=$moxbootdir/wtmi_app.bin" \
BOOTDEV=SPINOR PARTNUM=0 \
LOG_LEVEL=20 all fip mrvl_flash $CTHREADS
run_host_command_logged cp -pv build/a3700/release/flash-image.bin "${ubootdir}/${FILENAME}"
done
done
fi
cd "${ubootdir}" || exit_with_error "Cannot enter ATF directory ${ubootdir}"
}