extensions: Add TI's repo and install specified packages in k3-*

Texas Instruments maintains a custom apt repository [0] that contains:
    * tools like k3conf, which run on K3 devices
    * TI's versions of upstream packages (such as mesa)
    * out-of-tree drivers and firmware for graphics, wifi etc

Therefore, add TI's custom repository as the highest priority repository
in the filesystem. Doing this ensures that if apt finds a version of a
package that exists in both upstream Debian and the TI repository, it
picks the latter.

Additionally, introduce K3_PACKAGES variable to store a list of packages
that should be installed by-default in a K3 image. Initialize it to hold
TI's CC33xx packages.

Also set EXTRAWIFI to "no" in `current` image.

[0] https://github.com/TexasInstruments/ti-debpkgs

Co-authored-by: Suhaas Joshi <s-joshi@ti.com>
Signed-off-by: Suhaas Joshi <s-joshi@ti.com>
This commit is contained in:
Andrei Aldea 2025-03-26 04:17:53 -05:00 committed by leggewie
parent dbe1b2bf4f
commit 48e0eeb50b
4 changed files with 51 additions and 0 deletions

View File

@ -15,3 +15,4 @@ SERIALCON="ttyS2"
ATF_BOARD="lite"
OPTEE_ARGS="CFG_TEE_CORE_LOG_LEVEL=1"
OPTEE_PLATFORM="k3-am62x"
CC33XX_SUPPORT="yes"

View File

@ -20,6 +20,15 @@ declare -g SPD_OPTEED="SPD=opteed"
declare -g INSTALL_HEADERS="yes"
declare -g TI_PACKAGES=()
if [[ "${CC33XX_SUPPORT}" == "yes" ]] ; then
if [[ "${RELEASE}" == "trixie" || "${RELEASE}" == "noble" ]] ; then
TI_PACKAGES+=("cc33xx-fw" "cc33xx-target-scripts" "cc33conf" "cc33calibrator")
fi
fi
enable_extension "ti-debpkgs"
case "${BRANCH}" in
current | current-rt)
@ -32,6 +41,7 @@ case "${BRANCH}" in
declare -g OPTEE_BRANCH="tag:4.6.0"
declare -g TI_LINUX_FIRMWARE_BRANCH="${CORESDK_TAG}"
declare -g BOOTBRANCH="${CORESDK_TAG}"
EXTRAWIFI="no"
;;
edge)

37
extensions/ti-debpkgs.sh Normal file
View File

@ -0,0 +1,37 @@
function extension_prepare_config__add_packages() {
if [[ ${#TI_PACKAGES[@]} -gt 0 ]] ; then
add_packages_to_rootfs "${TI_PACKAGES[@]}"
fi
}
function custom_apt_repo__install_ti_packages() {
# Read JSON array into Bash array safely
mapfile -t valid_suites < <(
curl -s https://api.github.com/repos/TexasInstruments/ti-debpkgs/contents/dists |
jq -r '.[].name'
)
display_alert "TI Repo has the following valid suites - ${valid_suites[@]}..."
if printf '%s\n' "${valid_suites[@]}" | grep -qx "${RELEASE}"; then
# Get the sources file
run_host_command_logged "mkdir -p \"$SDCARD/tmp\""
run_host_command_logged "wget -qO $SDCARD/tmp/ti-debpkgs.sources https://raw.githubusercontent.com/TexasInstruments/ti-debpkgs/main/ti-debpkgs.sources"
# Update suite in source file
chroot_sdcard "sed -i 's/bookworm/${RELEASE}/g' /tmp/ti-debpkgs.sources"
# Copy updated sources file into chroot
chroot_sdcard "cp /tmp/ti-debpkgs.sources /etc/apt/sources.list.d/ti-debpkgs.sources"
# Clean up inside the chroot
chroot_sdcard "rm -f /tmp/ti-debpkgs.sources"
chroot_sdcard "mkdir -p /etc/apt/preferences.d/"
run_host_command_logged "cp \"$SRC/packages/bsp/ti/ti-debpkgs/ti-debpkgs\" \"$SDCARD/etc/apt/preferences.d/\""
else
# Error if suite is not valid but continue building image anyway
display_alert "Error: Detected OS suite '$RELEASE' is not valid based on TI package repository. Skipping!"
display_alert "Valid Options Would Have Been: ${valid_suites[@]}"
fi
}

View File

@ -0,0 +1,3 @@
Package: *
Pin: origin texasinstruments.github.io
Pin-Priority: 1001