mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
TI SDK supports images with real-time kernel. Add support for building such images for the `current` release by adding a config file for it. The RT image is built with the `current-rt` branch. Signed-off-by: Suhaas Joshi <s-joshi@ti.com>
123 lines
4.2 KiB
Plaintext
123 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 LINUXFAMILY="k3"
|
|
declare -g OVERLAY_DIR="/boot/dtb/ti/overlay"
|
|
|
|
declare -g KERNELSOURCE="https://github.com/TexasInstruments-Sandbox/ti-linux-kernel"
|
|
declare -g ATFSOURCE="https://github.com/TexasInstruments/arm-trusted-firmware"
|
|
declare -g BOOTSOURCE="https://git.ti.com/cgit/ti-u-boot/ti-u-boot"
|
|
|
|
declare -g BOOTSCRIPT="boot-k3.cmd:uEnv.txt"
|
|
declare -g SPD_OPTEED="SPD=opteed"
|
|
|
|
declare -g INSTALL_HEADERS="yes"
|
|
|
|
case "${BRANCH}" in
|
|
|
|
current | current-rt)
|
|
|
|
declare -g CORESDK_TAG="tag:11.00.09"
|
|
declare -g KERNEL_MAJOR_MINOR="6.12"
|
|
declare -g KERNELBRANCH="${CORESDK_TAG}"
|
|
declare -g KERNEL_DESCRIPTION="Texas Instruments currently supported SDK (vendor) kernel"
|
|
declare -g ATFBRANCH="commit:b11beb2b6bd30b75c4bfb0e9925c0e72f16ca53f"
|
|
declare -g OPTEE_BRANCH="tag:4.6.0"
|
|
declare -g TI_LINUX_FIRMWARE_BRANCH="${CORESDK_TAG}"
|
|
declare -g BOOTBRANCH="${CORESDK_TAG}"
|
|
;;
|
|
|
|
edge)
|
|
|
|
declare -g CORESDK_TAG="tag:11.00.12"
|
|
declare -g KERNEL_MAJOR_MINOR="6.12"
|
|
declare -g KERNELBRANCH="${CORESDK_TAG}"
|
|
declare -g ATFBRANCH="commit:b45324936bbba464b0623c83cd5aa53e1cd4cbdb"
|
|
declare -g OPTEE_BRANCH="tag:4.6.0"
|
|
declare -g TI_LINUX_FIRMWARE_BRANCH="${CORESDK_TAG}"
|
|
declare -g BOOTBRANCH="${CORESDK_TAG}"
|
|
EXTRAWIFI="no"
|
|
declare -g KERNEL_DESCRIPTION="Edge branch of TI Linux SDK"
|
|
;;
|
|
|
|
esac
|
|
|
|
ATF_PLAT="k3"
|
|
ATF_TARGET_MAP="PLAT=$ATF_PLAT TARGET_BOARD=$ATF_BOARD ${SPD_OPTEED} ${ATF_K3_USART_OFFSET} bl31;;build/$ATF_PLAT/$ATF_BOARD/release/bl31.bin:bl31.bin"
|
|
|
|
UBOOT_TARGET_MAP="BL31=bl31.bin TEE=${SRC}/cache/sources/optee-os/out/arm-plat-k3/core/tee-raw.bin BINMAN_INDIRS=${SRC}/cache/sources/ti-linux-firmware all;;tiboot3.bin ${SYSFW_FILE:+sysfw.itb} tispl.bin u-boot.img"
|
|
|
|
# To match what our current SDK produces
|
|
BOOT_FS_LABEL="boot"
|
|
ROOT_FS_LABEL="root"
|
|
|
|
function add_host_dependencies__k3_python3_dep() {
|
|
display_alert "Preparing K3 U-Boot host-side dependencies" "${EXTENSION}" "info"
|
|
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} python3-yaml python3-jsonschema yamllint python3-cryptography python3-pyelftools python3-setuptools"
|
|
}
|
|
|
|
function compile_k3_bootgen() {
|
|
# Source code checkout
|
|
(fetch_from_repo "https://github.com/TexasInstruments-Sandbox/ti-linux-firmware" "ti-linux-firmware" ${TI_LINUX_FIRMWARE_BRANCH})
|
|
|
|
pushd ${SRC}/cache/sources/u-boot-worktree/${BOOTDIR}/${BOOTBRANCH##*:} || exit
|
|
|
|
run_host_command_logged make -j$(nproc) CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm O=build-r5 ${TIBOOT3_BOOTCONFIG}
|
|
run_host_command_logged make -j$(nproc) CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm O=build-r5 BINMAN_INDIRS=${SRC}/cache/sources/ti-linux-firmware
|
|
|
|
popd
|
|
}
|
|
|
|
function compile_k3_optee() {
|
|
(fetch_from_repo "https://github.com/OP-TEE/optee_os.git" "optee-os" ${OPTEE_BRANCH})
|
|
pushd ${SRC}/cache/sources/optee-os || exit
|
|
run_host_command_logged make -j$(nproc) CROSS_COMPILE=arm-linux-gnueabihf- CFG_ARM64_core=y PLATFORM=${OPTEE_PLATFORM} ${OPTEE_ARGS}
|
|
popd
|
|
}
|
|
|
|
function pre_config_uboot_target__build_first_stage() {
|
|
# Compile first stage bootloader
|
|
compile_k3_optee
|
|
compile_k3_bootgen
|
|
|
|
cp ${SRC}/cache/sources/u-boot-worktree/${BOOTDIR}/${BOOTBRANCH##*:}/build-r5/${TIBOOT3_FILE} tiboot3.bin
|
|
cp ${SRC}/cache/sources/u-boot-worktree/${BOOTDIR}/${BOOTBRANCH##*:}/build-r5/${SYSFW_FILE} sysfw.itb || true
|
|
}
|
|
|
|
function post_uboot_custom_postprocess__update_uboot_names() {
|
|
cp ${TISPL_FILE} tispl.bin || true
|
|
cp ${UBOOT_FILE} u-boot.img || true
|
|
}
|
|
|
|
function pre_prepare_partitions() {
|
|
# Filesystem must fill partition regardless of alignment
|
|
mkopts[fat]='-a'
|
|
}
|
|
|
|
function post_create_partitions() {
|
|
display_alert "Setting boot partition flags on" "${SDCARD}.raw" "debug"
|
|
|
|
# ROM is very particular about boot flags
|
|
run_host_command_logged parted "${SDCARD}".raw set 1 boot on
|
|
run_host_command_logged parted "${SDCARD}".raw set 1 bls_boot off
|
|
}
|
|
|
|
function format_partitions() {
|
|
# ROM is very particular about partition IDs
|
|
run_host_command_logged sfdisk --part-type ${LOOP} 1 e
|
|
}
|
|
|
|
function write_uboot_platform() {
|
|
cp $1/tiboot3.bin ${MOUNT}/boot
|
|
cp $1/sysfw.itb ${MOUNT}/boot || true
|
|
cp $1/tispl.bin ${MOUNT}/boot
|
|
cp $1/u-boot.img ${MOUNT}/boot
|
|
}
|