|
7 | 7 | # https://github.com/armbian/build/ |
8 | 8 | # |
9 | 9 |
|
10 | | -declare -g ARCH="arm64" |
11 | 10 | declare -g LINUXFAMILY="k3" |
12 | | -declare -g OVERLAY_DIR="/boot/dtb/ti/overlay" |
13 | | - |
14 | 11 | declare -g KERNELSOURCE="https://github.com/TexasInstruments/ti-linux-kernel" |
15 | | -declare -g ATFSOURCE="https://github.com/TexasInstruments/arm-trusted-firmware" |
16 | 12 | declare -g BOOTSOURCE="https://github.com/TexasInstruments/ti-u-boot" |
17 | 13 |
|
18 | | -declare -g BOOTSCRIPT="boot-k3.cmd:uEnv.txt" |
19 | | -declare -g SPD_OPTEED="SPD=opteed" |
20 | | - |
21 | | -declare -g INSTALL_HEADERS="yes" |
22 | | - |
23 | | -declare -g TI_PACKAGES=() |
24 | | -if [[ "${CC33XX_SUPPORT}" == "yes" ]] ; then |
25 | | - if [[ "${RELEASE}" == "trixie" || "${RELEASE}" == "noble" ]] ; then |
26 | | - TI_PACKAGES+=("cc33xx-fw" "cc33xx-target-scripts" "cc33conf" "cc33calibrator") |
27 | | - fi |
28 | | -fi |
29 | | - |
30 | | -enable_extension "ti-debpkgs" |
31 | | -enable_extension "apa" |
32 | | - |
33 | 14 | case "${BRANCH}" in |
34 | 15 |
|
35 | 16 | current | current-rt) |
@@ -60,74 +41,4 @@ case "${BRANCH}" in |
60 | 41 |
|
61 | 42 | esac |
62 | 43 |
|
63 | | -ATF_PLAT="k3" |
64 | | -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" |
65 | | - |
66 | | -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" |
67 | | - |
68 | | -# To match what our current SDK produces |
69 | | -BOOT_FS_LABEL="boot" |
70 | | -ROOT_FS_LABEL="root" |
71 | | - |
72 | | -function add_host_dependencies__k3_python3_dep() { |
73 | | - display_alert "Preparing K3 U-Boot host-side dependencies" "${EXTENSION}" "info" |
74 | | - declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} python3-yaml python3-jsonschema yamllint python3-cryptography python3-pyelftools python3-setuptools" |
75 | | -} |
76 | | - |
77 | | -function compile_k3_bootgen() { |
78 | | - # Source code checkout |
79 | | - (fetch_from_repo "https://github.com/TexasInstruments/ti-linux-firmware" "ti-linux-firmware" ${TI_LINUX_FIRMWARE_BRANCH}) |
80 | | - |
81 | | - pushd ${SRC}/cache/sources/u-boot-worktree/${BOOTDIR}/${BOOTBRANCH##*:} || exit |
82 | | - |
83 | | - run_host_command_logged make -j$(nproc) CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm O=build-r5 ${TIBOOT3_BOOTCONFIG} |
84 | | - 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 |
85 | | - |
86 | | - popd |
87 | | -} |
88 | | - |
89 | | -function compile_k3_optee() { |
90 | | - (fetch_from_repo "https://github.com/OP-TEE/optee_os.git" "optee-os" ${OPTEE_BRANCH}) |
91 | | - pushd ${SRC}/cache/sources/optee-os || exit |
92 | | - run_host_command_logged make -j$(nproc) CROSS_COMPILE=arm-linux-gnueabihf- CFG_ARM64_core=y PLATFORM=${OPTEE_PLATFORM} ${OPTEE_ARGS} |
93 | | - popd |
94 | | -} |
95 | | - |
96 | | -function pre_config_uboot_target__build_first_stage() { |
97 | | - # Compile first stage bootloader |
98 | | - compile_k3_optee |
99 | | - compile_k3_bootgen |
100 | | - |
101 | | - cp ${SRC}/cache/sources/u-boot-worktree/${BOOTDIR}/${BOOTBRANCH##*:}/build-r5/${TIBOOT3_FILE} tiboot3.bin |
102 | | - cp ${SRC}/cache/sources/u-boot-worktree/${BOOTDIR}/${BOOTBRANCH##*:}/build-r5/${SYSFW_FILE} sysfw.itb || true |
103 | | -} |
104 | | - |
105 | | -function post_uboot_custom_postprocess__update_uboot_names() { |
106 | | - cp ${TISPL_FILE} tispl.bin || true |
107 | | - cp ${UBOOT_FILE} u-boot.img || true |
108 | | -} |
109 | | - |
110 | | -function pre_prepare_partitions() { |
111 | | - # Filesystem must fill partition regardless of alignment |
112 | | - mkopts[fat]='-a' |
113 | | -} |
114 | | - |
115 | | -function post_create_partitions() { |
116 | | - display_alert "Setting boot partition flags on" "${SDCARD}.raw" "debug" |
117 | | - |
118 | | - # ROM is very particular about boot flags |
119 | | - run_host_command_logged parted "${SDCARD}".raw set 1 boot on |
120 | | - run_host_command_logged parted "${SDCARD}".raw set 1 bls_boot off |
121 | | -} |
122 | | - |
123 | | -function format_partitions() { |
124 | | - # ROM is very particular about partition IDs |
125 | | - run_host_command_logged sfdisk --part-type ${LOOP} 1 e |
126 | | -} |
127 | | - |
128 | | -function write_uboot_platform() { |
129 | | - cp $1/tiboot3.bin ${MOUNT}/boot |
130 | | - cp $1/sysfw.itb ${MOUNT}/boot || true |
131 | | - cp $1/tispl.bin ${MOUNT}/boot |
132 | | - cp $1/u-boot.img ${MOUNT}/boot |
133 | | -} |
| 44 | +source "${BASH_SOURCE%/*}/include/k3_common.inc" |
0 commit comments