99 lines
4.2 KiB
Plaintext
99 lines
4.2 KiB
Plaintext
#
|
|
# 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 ARCH=arm64
|
|
declare -g OFFSET=16
|
|
declare -g ATFSOURCE='https://github.com/mtk-openwrt/arm-trusted-firmware.git'
|
|
declare -g ATF_TARGET_MAP="PLAT=mt7988 BOOT_DEVICE=sdmmc USE_MKIMAGE=1 BOARD_BGA=1 HAVE_DRAM_OBJ_FILE=yes DRAM_USE_COMB=1 all;;build/mt7988/release/bl2.img build/mt7988/release/bl31.bin"
|
|
declare -g ATFBRANCH="branch:mtksoc-20250212"
|
|
declare -g BOOTDELAY=1
|
|
declare -g BOOTPATCHDIR="${BOOTPATCHDIR:-"u-boot-filogic"}"
|
|
declare -g BOOTBRANCH="${BOOTBRANCH:-"tag:v2025.04"}"
|
|
declare -g BOOTENV_FILE='filogic.txt'
|
|
declare -g UBOOT_TARGET_MAP=";;u-boot.bin u-boot_sdmmc.fip bl2.img"
|
|
declare -g BOOTSCRIPT='boot-filogic.cmd:boot.cmd'
|
|
declare -g IMAGE_PARTITION_TABLE="gpt"
|
|
declare -g LINUXFAMILY=filogic
|
|
|
|
# filogic is a network platform so Proton/WINE isn't probable.
|
|
unset -f armbian_kernel_config__enable_ntsync
|
|
|
|
# This build requires xxd
|
|
function add_host_dependencies__filogic_add_xxd_hostdep() {
|
|
display_alert "Adding xxd dep" "for ${BOARD} bootloader compile" "debug"
|
|
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} xxd arm-trusted-firmware-tools"
|
|
}
|
|
|
|
# Handling of FIP blobs
|
|
function uboot_custom_postprocess() {
|
|
run_host_command_logged rm -f "$SRC"/cache/sources/u-boot-worktree/u-boot/v2025.04/bl2.img
|
|
run_host_command_logged cp "$SRC"/cache/sources/arm-trusted-firmware/mtksoc-20250212/build/mt7988/release/bl2.img \
|
|
"$SRC"/cache/sources/u-boot-worktree/u-boot/v2025.04
|
|
|
|
run_host_command_logged rm -f "$SRC"/cache/sources/u-boot-worktree/u-boot/v2025.04/u-boot_sdmmc.fip
|
|
run_host_command_logged fiptool create \
|
|
--soc-fw "$SRC"/cache/sources/arm-trusted-firmware/mtksoc-20250212/build/mt7988/release/bl31.bin \
|
|
--nt-fw "$SRC"/cache/sources/u-boot-worktree/u-boot/v2025.04/u-boot.bin \
|
|
"$SRC"/cache/sources/u-boot-worktree/u-boot/v2025.04/u-boot_sdmmc.fip
|
|
}
|
|
|
|
case $BRANCH in
|
|
legacy)
|
|
KERNELSOURCE='https://github.com/chainsx/linux-filogic.git'
|
|
KERNELBRANCH="branch:linux-6.12.35"
|
|
declare -g KERNEL_MAJOR_MINOR="6.12"
|
|
KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
|
|
LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
|
|
;;
|
|
|
|
current)
|
|
KERNELSOURCE='https://github.com/frank-w/BPI-Router-Linux.git'
|
|
KERNELBRANCH="branch:6.12-main"
|
|
declare -g KERNEL_MAJOR_MINOR="6.12"
|
|
KERNELPATCHDIR="archive/${LINUXFAMILY}-${KERNEL_MAJOR_MINOR}"
|
|
LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
|
|
;;
|
|
|
|
edge)
|
|
#KERNELSOURCE='https://github.com/frank-w/BPI-Router-Linux.git'
|
|
#KERNELBRANCH="branch:6.16-rsslro"
|
|
declare -g KERNEL_MAJOR_MINOR="6.16"
|
|
KERNELPATCHDIR="archive/${LINUXFAMILY}-${KERNEL_MAJOR_MINOR}"
|
|
LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
|
|
;;
|
|
esac
|
|
|
|
write_uboot_platform() {
|
|
dd if=$1/bl2.img of=$2 bs=512 seek=34 status=noxfer > /dev/null 2>&1
|
|
dd if=$1/u-boot_sdmmc.fip of=$2 bs=512 seek=13312 status=noxfer >/dev/null 2>&1
|
|
|
|
# backup gpt table
|
|
LAST_START=$(parted "$2" unit s print | grep -v "^$" | tail -n 1 | awk '{print $2}' | tr -d 's')
|
|
LAST_SIZE=$(parted "$2" unit s print | grep -v "^$" | tail -n 1 | awk '{print $4}' | tr -d 's')
|
|
# write mtk gpt table
|
|
dd if="${SRC}/packages/blobs/filogic/gpt" of="$2" conv=notrunc
|
|
# append armbian rootfs info
|
|
echo "${LAST_START},${LAST_SIZE}" | sfdisk --no-reread --append "$2"
|
|
}
|
|
|
|
unset -f armbian_kernel_config__enable_various_filesystems
|
|
# This is an example of how to override an armbian_kernel_config hook.
|
|
# We don't *need* EXT4_FS to be a module [as opposed to the default as of 2026Jan it's built-in],
|
|
# but testing has so far shown it's not *mandatory* to be built-in AND we need an example.
|
|
function armbian_kernel_config__enable_various_filesystems() {
|
|
opts_m+=("BTRFS_FS") # Enables the BTRFS file system support
|
|
opts_y+=("BTRFS_FS_POSIX_ACL") # Enables POSIX ACL support for BTRFS
|
|
opts_m+=("EXT4_FS") # Enables EXT4 file system support as a module
|
|
opts_y+=("EXT4_FS_POSIX_ACL") # Enables POSIX ACL support for EXT4
|
|
opts_y+=("EXT4_FS_SECURITY") # Enables security extensions for EXT4 file system
|
|
opts_m+=("EROFS_FS") # Extended ReadOnly FS, useful for docker images
|
|
}
|