298 lines
10 KiB
Plaintext
298 lines
10 KiB
Plaintext
# BY401 Board Configuration with Kernel 6.12 and U-Boot 2025
|
|
# This file is the entry point for a9-by401 board building
|
|
#
|
|
# Configuration loading order:
|
|
# 1. amlogic_common.inc - Common Amlogic configuration
|
|
# 2. amlogic_k6.12.inc - Kernel 6.12 specific configuration
|
|
# 3. amlogic_uboot2025.inc - U-Boot 2025 specific configuration
|
|
# 4. Board-specific settings
|
|
|
|
# AMLOGIC TODO: Board configuration loading
|
|
display_alert "AMLOGIC TODO: Loading a9-by401 board configuration" "a9-by401" "info"
|
|
|
|
load_common_inc() {
|
|
local name="$1"
|
|
|
|
if [[ -z "$name" ]]; then
|
|
echo "Usage: load_common_inc amlogic${name}"
|
|
return 1
|
|
fi
|
|
|
|
local -a paths=(
|
|
"${AMLBIAN_DIR}/config/boards/include/amlogic${name}.inc"
|
|
"${SRC}/userpatches/config/boards/include/amlogic${name}.inc"
|
|
"${USERPATCHES_PATH}/config/boards/include/amlogic${name}.inc"
|
|
"amlogic${name}.inc"
|
|
)
|
|
|
|
for path in "${paths[@]}"; do
|
|
if [[ -f "${path}" ]]; then
|
|
display_alert "${name^^} TODO: Loading common config from" "${path}" "info"
|
|
source "${path}"
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
echo "No amlogic${name}.inc found"
|
|
return 1
|
|
}
|
|
|
|
# ==============================================================================
|
|
# Section 1: Load Common Configuration from include/
|
|
# ==============================================================================
|
|
|
|
# Try multiple paths to handle different Armbian loading scenarios
|
|
load_common_inc -local-sources
|
|
load_common_inc -noninteractive
|
|
load_common_inc _common
|
|
load_common_inc _k6.12
|
|
load_common_inc _uboot2025
|
|
load_common_inc _avalon
|
|
|
|
# ==============================================================================
|
|
# Section 2: Set bookworm gnome setting
|
|
# ==============================================================================
|
|
# Release
|
|
RELEASE="${RELEASE:-bookworm}"
|
|
|
|
# Build type
|
|
BUILD_DESKTOP="${BUILD_DESKTOP:-yes}"
|
|
BUILD_MINIMAL="${BUILD_MINIMAL:-no}"
|
|
|
|
# Desktop environment — only set when actually building desktop, otherwise
|
|
# Armbian validator errors with "DESKTOP_ENVIRONMENT is set, but BUILD_DESKTOP
|
|
# is not ==yes". Section 4 below may override BUILD_DESKTOP to "no".
|
|
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
|
|
FULL_DESKTOP="gnome"
|
|
DESKTOP_ENVIRONMENT="gnome"
|
|
fi
|
|
|
|
# Image type
|
|
IMAGE_TYPE="stable"
|
|
|
|
# Compress output
|
|
COMPRESS_OUTPUTIMAGE="${COMPRESS_OUTPUTIMAGE:-sha,img.xz}"
|
|
LINUX_DEFCONFIG="a9.cfg"
|
|
|
|
PACKAGE_LIST_AML="\
|
|
screen libdbus-1-dev libical-dev libreadline-dev python3-docutils libsystemd-dev \
|
|
systemd-timesyncd xterm \
|
|
gdm3 gnome-session gnome-shell dbus-x11 task-gnome-desktop \
|
|
libva2 libva-dev libva-drm2 libva-x11-2 \
|
|
tcpdump netcat-openbsd network-manager adbd/bookworm-backports android-libcutils/bookworm-backports \
|
|
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
|
|
libavcodec-dev libavformat-dev libavutil-dev libglib2.0-dev libdrm-dev \
|
|
gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
|
|
gstreamer1.0-plugins-bad gstreamer1.0-libav v4l-utils \
|
|
systemd libsystemd-dev"
|
|
|
|
# # ==============================================================================
|
|
# # Section 3: Load U-Boot Configuration (2023) from include/
|
|
# # ==============================================================================
|
|
|
|
# declare -a uboot_paths=(
|
|
# "${AMLBIAN_DIR}/config/boards/include/amlogic_uboot2023.inc"
|
|
# "${SRC}/userpatches/config/boards/include/amlogic_uboot2023.
|
|
# "${USERPATCHES_PATH}/config/boards/uboot/amlogic_uboot2023.inc"
|
|
# "${AMLBIAN_DIR}/config/boards/uboot/amlogic_uboot2023.inc"
|
|
# )
|
|
|
|
# for path in "${uboot_paths[@]}"; do
|
|
# if [[ -f "${path}" ]]; then
|
|
# display_alert "AMLOGIC TODO: Loading uboot config from" "${path}" "info"
|
|
# source "${path}"
|
|
# break
|
|
# fi
|
|
# done
|
|
|
|
# ==============================================================================
|
|
# Section 4: Board Identification
|
|
# ==============================================================================
|
|
|
|
BOARD="a9-by401"
|
|
BOARD_NAME="Amlogic A311Y3 by401 Reference Board"
|
|
BOARDFAMILY="meson-a9"
|
|
BOARD_MAINTAINER="Amlogic Armbian Team"
|
|
|
|
# Boot configuration
|
|
#BOOTCONFIG="a9_by401_debian"
|
|
BOOTCONFIG="a9_by401"
|
|
UBOOT_MACHINE="${BOOTCONFIG}"
|
|
|
|
# Build policy
|
|
RELEASE="${RELEASE:-bookworm}"
|
|
BUILD_DESKTOP="${BUILD_DESKTOP:-no}"
|
|
BUILD_MINIMAL="${BUILD_MINIMAL:-yes}"
|
|
FULL_DESKTOP="gnome"
|
|
|
|
# Hardware configuration
|
|
SERIALCON="ttyAML0"
|
|
BOOT_LOGO="desktop"
|
|
BOOT_FDT_FILE="amlogic/a9_a311y3_by401_linux.dtb"
|
|
ASOUND_STATE="asound.state.amlogic-by401"
|
|
|
|
# Chipset info
|
|
CHIPSET_NAME="A311Y3"
|
|
INSTALL_TYPE="EMMC"
|
|
|
|
# Initramfs modules
|
|
MODULES_INITRD="mesona9-by401-initrd"
|
|
|
|
# Work name for logging
|
|
WORK_BOARD="A311Y3-BY401"
|
|
if [ ${HDMIONLY} = "yes" ];then
|
|
KERNEL_DEVICETREE="a9_a311y3_by401_hdmi_linux.dtb"
|
|
else
|
|
KERNEL_DEVICETREE="a9_a311y3_by401_linux.dtb"
|
|
fi
|
|
|
|
# wifi config
|
|
WIFI_MODE="w2l"
|
|
WIFI_COMM="yes"
|
|
MACHINE_EXTRA_RRECOMMENDS+=" aml-wifi-w2l"
|
|
DISTRO_FEATURES+=" aml-wifi-w2l"
|
|
|
|
BT_MODE="w2l"
|
|
BT_HCIATTACH="yes"
|
|
BT_BLUEZ="yes"
|
|
|
|
MEDIA_ENCODER_HW_CONFIG="TAHOE HCODEC_JPEG"
|
|
|
|
TDK_VERSION="v3.8/dev/A311Y3"
|
|
PLATFORM_TDK_VERSION="v4.4.0"
|
|
|
|
MEDIA_FEATURES="libamljpegenc libtahoevenc gst-plugin-venc-jpeg"
|
|
|
|
DISTRO_FEATURES+=" vendor-files vendor-partition bluetooth amlogic-tv tvserver mediactrlsrc audio-sed"
|
|
MACHINE_EXTRA_RRECOMMENDS+=" aml-bt-w2 aml-bt-w2l"
|
|
|
|
AUTOLOGIN="${AUTOLOGIN:-yes}"
|
|
|
|
# ==============================================================================
|
|
# Section 5: Board-Specific U-Boot Functions
|
|
# ==============================================================================
|
|
|
|
# Smarter/faster/better to-spi writer
|
|
function write_uboot_platform_mtd__a9_by401() {
|
|
declare -a extra_opts_flashcp=("--verbose")
|
|
echo "Writing U-Boot to SPI flash /dev/mtd0 using flashcp... ${extra_opts_flashcp}" >&2
|
|
if flashcp -h 2>/dev/null | grep -q -e '--partition'; then
|
|
echo "Confirmed flashcp supports --partition" >&2
|
|
extra_opts_flashcp+=("--partition")
|
|
else
|
|
echo "flashcp does not support --partition, will write full blocks" >&2
|
|
fi
|
|
flashcp "${extra_opts_flashcp[@]}" "${1}/u-boot-spi.bin" /dev/mtd0
|
|
}
|
|
|
|
# Board-specific FIP post-processing
|
|
function post_uboot_custom_postprocess__a9_by401() {
|
|
display_alert "AMLOGIC TODO: a9-by401 Signing u-boot FIP" "${BOARD}" "info"
|
|
# AMLOGIC TODO: Implement FIP signing for by401
|
|
# uboot_a9_postprocess "${SRC}"/cache/sources/amlogic-boot-fip/mesona9-by401 a9
|
|
}
|
|
|
|
# Board-specific extra U-Boot config options
|
|
function post_config_uboot_target__a9_by401_extra_configs() {
|
|
display_alert "AMLOGIC TODO: post_config_uboot_target for a9-by401" "${BOARD}" "info"
|
|
# AMLOGIC TODO: Add by401-specific U-Boot config options
|
|
return 0
|
|
}
|
|
|
|
# ==============================================================================
|
|
# Section 6: Board-Specific Packaging
|
|
# ==============================================================================
|
|
|
|
function custom_image_packaging__a9_by401() {
|
|
display_alert "AMLOGIC TODO: Starting custom image packaging for a9-by401" "${BOARD}" "info"
|
|
# Call common implementation
|
|
custom_image_packaging__amlbian
|
|
}
|
|
|
|
function post_image_creation__a9_by401_custom_packaging() {
|
|
display_alert "AMLOGIC TODO: Post image creation hook for a9-by401" "${BOARD}" "info"
|
|
custom_image_packaging__a9_by401
|
|
}
|
|
|
|
# ==============================================================================
|
|
# Section 7: Enable AMLBIAN Extension
|
|
# ==============================================================================
|
|
|
|
ENABLE_EXTENSIONS="amlogic-overlay"
|
|
|
|
MODS=(amlogic_reset amlogic_snd_codec_es8389 amlogic_snd_codec_ad82120b amlogic-realtek rfcomm)
|
|
|
|
# ==============================================================================
|
|
# Section 8: Board-Specific Notes
|
|
# ==============================================================================
|
|
|
|
# To enable the SPI NOR, the -spi .dtb is required, because eMMC shares a pin with SPI on the REF board.
|
|
# To use SPI:
|
|
# fdtfile=amlogic/a9_s905d5_by401_linux-spinor.dtb in armbianEnv.txt and reboot, then run armbian-install
|
|
# After deploying to SPI-NOR/MTD, return back to the normal DTB, otherwise eMMC speed is impaired.
|
|
|
|
tweaks_platform() {
|
|
echo "tweaks_platform"
|
|
# audio server settings
|
|
if [ -f $ROOTFS_TEMP/etc/pulse/default.pa ]; then
|
|
|
|
echo 'load-module module-alsa-source device=hw:AMLAUGESOUND,3' | tee -a $ROOTFS_TEMP/etc/pulse/default.pa
|
|
sed -i "s/#set-default-source input/set-default-source alsa_input.hw_AMLAUGESOUND_3/" $ROOTFS_TEMP/etc/pulse/default.pa
|
|
elif [ -f $ROOTFS_TEMP/usr/share/pipewire/pipewire.conf ]; then
|
|
|
|
[ -d $ROOTFS_TEMP/etc/pipewire ] || mkdir -p $ROOTFS_TEMP/etc/pipewire
|
|
cp $ROOTFS_TEMP/usr/share/pipewire/pipewire.conf $ROOTFS_TEMP/etc/pipewire
|
|
cat <<-EOF >> $ROOTFS_TEMP/etc/pipewire/pipewire.conf
|
|
context.objects = [
|
|
# Configure properties in the system.
|
|
{ factory = adapter
|
|
args = {
|
|
factory.name = api.alsa.pcm.sink
|
|
node.name = "AML-PCM-Sink"
|
|
node.description = "alsa-sink"
|
|
media.class = "Audio/Sink"
|
|
api.alsa.path = "hw:AMLAUGESOUND,1"
|
|
audio.format = "S16LE"
|
|
audio.rate = 48000
|
|
audio.channels = 2
|
|
audio.position = "FL,FR"
|
|
}
|
|
}
|
|
|
|
{ factory = adapter
|
|
args = {
|
|
factory.name = api.alsa.pcm.sink
|
|
node.name = "AML-HDMI-Sink"
|
|
node.description = "hdmi-audio"
|
|
media.class = "Audio/Sink"
|
|
api.alsa.path = "hw:AMLAUGESOUND,4"
|
|
audio.format = "S16LE"
|
|
audio.rate = 48000
|
|
audio.channels = 2
|
|
audio.position = "FL,FR"
|
|
}
|
|
}
|
|
|
|
{ factory = adapter
|
|
args = {
|
|
factory.name = api.alsa.pcm.source
|
|
node.name = "AML-PCM-Source"
|
|
node.description = "alsa-source"
|
|
media.class = "Audio/Source"
|
|
api.alsa.path = "hw:AMLAUGESOUND,3"
|
|
audio.format = "S16LE"
|
|
audio.rate = 48000
|
|
audio.channels = 2
|
|
audio.position = "FL,FR"
|
|
}
|
|
}
|
|
]
|
|
|
|
EOF
|
|
fi
|
|
}
|
|
|
|
# ==============================================================================
|
|
# End of a9-by401-6.12-bookworm-gnome.conf
|
|
# ==============================================================================
|