From 48e0eeb50bf450ff754ad784d9c1ae819c8a09bc Mon Sep 17 00:00:00 2001 From: Andrei Aldea Date: Wed, 26 Mar 2025 04:17:53 -0500 Subject: [PATCH] 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 Signed-off-by: Suhaas Joshi --- config/boards/sk-am62b.conf | 1 + config/sources/families/k3.conf | 10 ++++++++ extensions/ti-debpkgs.sh | 37 +++++++++++++++++++++++++++ packages/bsp/ti/ti-debpkgs/ti-debpkgs | 3 +++ 4 files changed, 51 insertions(+) create mode 100644 extensions/ti-debpkgs.sh create mode 100644 packages/bsp/ti/ti-debpkgs/ti-debpkgs diff --git a/config/boards/sk-am62b.conf b/config/boards/sk-am62b.conf index b6e16a56d..fbd923331 100644 --- a/config/boards/sk-am62b.conf +++ b/config/boards/sk-am62b.conf @@ -15,3 +15,4 @@ SERIALCON="ttyS2" ATF_BOARD="lite" OPTEE_ARGS="CFG_TEE_CORE_LOG_LEVEL=1" OPTEE_PLATFORM="k3-am62x" +CC33XX_SUPPORT="yes" diff --git a/config/sources/families/k3.conf b/config/sources/families/k3.conf index 304d77833..c201feb89 100644 --- a/config/sources/families/k3.conf +++ b/config/sources/families/k3.conf @@ -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) diff --git a/extensions/ti-debpkgs.sh b/extensions/ti-debpkgs.sh new file mode 100644 index 000000000..116cd3d62 --- /dev/null +++ b/extensions/ti-debpkgs.sh @@ -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 +} diff --git a/packages/bsp/ti/ti-debpkgs/ti-debpkgs b/packages/bsp/ti/ti-debpkgs/ti-debpkgs new file mode 100644 index 000000000..436d12889 --- /dev/null +++ b/packages/bsp/ti/ti-debpkgs/ti-debpkgs @@ -0,0 +1,3 @@ +Package: * +Pin: origin texasinstruments.github.io +Pin-Priority: 1001