@@ -7,6 +7,7 @@ COMPATIBLE_MACHINE = "beagle.*"
PV = "2024.10"
SRC_URI += "file://0001-scripts-dtc-pylibfdt-libfdt.i_shipped-Use-SWIG_Appen.patch"
+SRC_URI += "file://0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch"
UBOOT_GIT_URI = "git://github.com/beagleboard/u-boot.git"
UBOOT_GIT_PROTOCOL = "https"
@@ -18,3 +18,5 @@ SRCREV:pocketbeagle2-k3r5 = "4e0b6294a1185029d34eff6ed91f3ad1734b643f"
SRC_URI:append:pocketbeagle2 = " file://bootcmd-ti-mmc.cfg"
SRC_URI:append:beaglebone = " file://0001-arm-dts-am335x-pocketbeagle-Add-tick-timer.patch"
+
+SRC_URI += "file://0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch"
new file mode 100644
@@ -0,0 +1,55 @@
+From 886616d03b6afcc5ce8b34e7af91f7ccfbb0a5c Mon Sep 17 00:00:00 2001
+From: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+Date: Tue, 11 Aug 2026 13:21:01 +0000
+Subject: [PATCH] pylibfdt: Replace removed SWIG Python 2 compatibility macros
+
+SWIG 4.5.0 removed Python 2 compatibility macros (PyInt_*, PyString_*)
+from its runtime header pyhead.swg (see commit 79f7a2b7cb7d). Replace
+them with their Python 3 C API equivalents:
+
+- PyString_FromString -> PyUnicode_FromString
+- PyString_AsString -> PyBytes_AsString
+- PyInt_AsLong -> PyLong_AsLong
+
+The replacements are safe since the macros were already aliased to
+these exact functions in SWIG's Python 3 code path.
+
+This is a backport of dtc commit 5008d1d6a356 ("pylibfdt: Replace
+removed SWIG Python 2 compatibility macros").
+
+Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/2283713/]
+
+Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
+---
+ scripts/dtc/pylibfdt/libfdt.i_shipped | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
+index e4659489..326a15c7 100644
+--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
++++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
+@@ -1033,7 +1033,7 @@ typedef uint32_t fdt32_t;
+ PyObject *buff;
+
+ if ($1) {
+- resultobj = PyString_FromString(
++ resultobj = PyUnicode_FromString(
+ fdt_string(fdt1, fdt32_to_cpu($1->nameoff)));
+ buff = PyByteArray_FromStringAndSize(
+ (const char *)($1 + 1), fdt32_to_cpu($1->len));
+@@ -1064,13 +1064,13 @@ typedef uint32_t fdt32_t;
+ }
+ $1 = PyBytes_AsString($input);
+ %#else
+- $1 = PyString_AsString($input); /* char *str */
++ $1 = PyBytes_AsString($input); /* char *str */
+ %#endif
+ }
+
+ /* typemaps used for fdt_next_node() */
+ %typemap(in, numinputs=1) int *depth (int depth) {
+- depth = (int) PyInt_AsLong($input);
++ depth = (int) PyLong_AsLong($input);
+ $1 = &depth;
+ }
+
@@ -10,7 +10,7 @@ require ${COREBASE}/meta/recipes-bsp/u-boot/u-boot.inc
include ${@ 'recipes-bsp/u-boot/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''}
-FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot:"
+FILESEXTRAPATHS:prepend := "${THISDIR}/u-boot:${THISDIR}/files:"
FILES:${PN}-falcon = "boot/tifalcon.bin"
@@ -25,6 +25,9 @@ UBOOT_GIT_PROTOCOL ?= "https"
UBOOT_GIT_BRANCH ?= "branch=${BRANCH}"
SRC_URI = "${UBOOT_GIT_URI};protocol=${UBOOT_GIT_PROTOCOL};${UBOOT_GIT_BRANCH};name=uboot"
+SRC_URI:append:bsp-ti-6_12 = " file://0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch"
+SRC_URI:append:bsp-ti-6_18 = " file://0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch"
+
# Match the meta-ti trusted-firmware-a specific changes to memory locations
# for bl33 and k3 hardware.
TI_K3_TFA_CFG_FILES = "\
A recent change in oe-core [1] updated the version of SWIG which caused a build error in u-boot. This was fixed by adding a patch [2] in oe-core for u-boot which we are copying into our u-boot recipes as well. [1] https://git.openembedded.org/openembedded-core/commit/?id=84476421d9ccfcc1d2714026ad7caa6ca901853b [2] https://git.openembedded.org/openembedded-core/commit/?id=299a82a9c909b73a9b93877d6c1b381ec8f83b04 Signed-off-by: Ryan Eatmon <reatmon@ti.com> --- .../u-boot/u-boot-bb.org_2024.10.bb | 1 + .../u-boot/u-boot-bb.org_2025.10.bb | 2 + ...-removed-SWIG-Python-2-compatibility.patch | 55 +++++++++++++++++++ meta-ti-bsp/recipes-bsp/u-boot/u-boot-ti.inc | 5 +- 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 meta-ti-bsp/recipes-bsp/u-boot/files/0001-pylibfdt-Replace-removed-SWIG-Python-2-compatibility.patch