mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
68 lines
2.7 KiB
Plaintext
68 lines
2.7 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
|
|
|
|
# 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
|
|
|
|
current)
|
|
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}"
|
|
|
|
;;
|
|
esac
|
|
|
|
#KERNELPATCHDIR="archive/filogic-${KERNEL_MAJOR_MINOR}"
|
|
|
|
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"
|
|
}
|