Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions extensions/gateway-dk-ask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Source repos and refs (pinned to match Yocto)
# For local testing: set ASK_REPO="file:///path/to/ASK" — the Docker mount hook below handles it
declare -g ASK_REPO="https://github.com/we-are-mono/ASK.git"
declare -g ASK_BRANCH="commit:252b6db5a274383917c7a7688c931d61409978c2"
declare -g ASK_BRANCH="commit:a211ea865379362058c6656b9c448e4a7050e93c"
declare -g FMLIB_REPO="https://github.com/nxp-qoriq/fmlib.git"
declare -g FMLIB_COMMIT="7a58ecaf0d90d71d6b78d3ac7998282a472c4394"
declare -g FMC_REPO="https://github.com/nxp-qoriq/fmc.git"
Expand Down Expand Up @@ -161,11 +161,13 @@ function post_install_kernel_debs__ask_module_autoload() {

# Copy patches into chroot before patched library builds (runs before build_ask_userspace)
function pre_customize_image__000_prepare_ask_patches() {
mkdir -p "${SDCARD}/tmp/ask-patches"
# Stage per-package trees (version subdirs preserved) so rebuild_patched_deb
# can pick the patch matching the upstream source version.
local patch_dirs=("libnetfilter-conntrack" "libnfnetlink")
for pdir in "${patch_dirs[@]}"; do
[[ -d "${ASK_CACHE_DIR}/patches/${pdir}" ]] || exit_with_error "ASK patch directory missing" "${ASK_CACHE_DIR}/patches/${pdir}"
cp "${ASK_CACHE_DIR}/patches/${pdir}/"*.patch "${SDCARD}/tmp/ask-patches/"
mkdir -p "${SDCARD}/tmp/ask-patches/${pdir}"
cp -a "${ASK_CACHE_DIR}/patches/${pdir}/." "${SDCARD}/tmp/ask-patches/${pdir}/"
done

# Enable deb-src for apt-get source (handles both Debian and Ubuntu)
Expand Down Expand Up @@ -409,8 +411,8 @@ Version: ${ask_version}
Architecture: arm64
Section: net
Priority: optional
Maintainer: Mono Technologies <support@mono.si>
Depends: linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver}), libxml2, libpcap0.8, iptables
Maintainer: Tomaz Zaman <tomaz@mono.si>
Depends: linux-image-${BRANCH}-${LINUXFAMILY} (>= ${kernel_ver}), libxml2 | libxml2-16, libpcap0.8, iptables
Description: NXP ASK hardware offloading userspace for Mono Gateway DK
Userspace tools (fmlib, fmc, libfci, libcli, dpa-app, cmm) and configuration
for NXP ASK data-plane acceleration on the LS1046A Gateway DK.
Expand Down Expand Up @@ -452,6 +454,9 @@ EOF
/etc/cdx_pcd.xml
/etc/cdx_sp.xml
/etc/config/fastforward
/etc/fmc/config/cfgdata.xsd
/etc/fmc/config/hxs_pdl_v3.xml
/etc/fmc/config/netpcd.xsd
/etc/sysctl.d/99-ls1046a-conntrack.conf
CONFFILES

Expand All @@ -461,7 +466,8 @@ CONFFILES
run_host_command_logged dpkg-deb -b "${pkgdir}" "${SRC}/output/debs/${debfile}" \
|| exit_with_error "dpkg-deb failed for ${debfile}"
cp "${SRC}/output/debs/${debfile}" "${SDCARD}/root/"
chroot_sdcard "dpkg -i /root/${debfile}" || exit_with_error "dpkg -i failed for ${debfile}"
chroot_sdcard "DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /root/${debfile}" \
|| exit_with_error "apt install failed for ${debfile}"
rm -f "${SDCARD}/root/${debfile}"

rm -rf "${pkgdir}"
Expand Down Expand Up @@ -495,8 +501,12 @@ function build_ask_patched_libraries() {
rm -rf "${SDCARD}/tmp/ask-patched-debs"
}

# Helper: rebuild a Debian package with an ASK patch in an isolated chroot directory
# Helper: rebuild a Debian package with an ASK patch in an isolated chroot directory.
# Usage: rebuild_patched_deb <pkg_name> <patch_file> <deb_globs>
# The patch is resolved under /tmp/ask-patches/<pkg>/<upstream_version>/<patch_file>,
# where <upstream_version> is parsed from the source tree's debian/changelog after
# apt-get source. This lets a single ASK repo cover multiple target distros whose
# upstream library versions differ (e.g. Trixie/Noble 1.1.0 vs Resolute 1.1.1).
function rebuild_patched_deb() {
local pkg="$1" patch="$2" debs="$3"
local workdir="/tmp/ask-rebuild-${pkg}"
Expand All @@ -507,7 +517,14 @@ function rebuild_patched_deb() {
rm -rf '${workdir}' && mkdir -p '${workdir}' && cd '${workdir}' && \
apt-get source '${pkg}' && \
cd \$(ls -d ${pkg}-*/ | head -1) && \
patch -p1 < '/tmp/ask-patches/${patch}' && \
upstream_ver=\$(dpkg-parsechangelog -l debian/changelog -S Version \
| sed -E 's/^[0-9]+://; s/-[^-]+\$//; s/^([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/') && \
patch_path=\"/tmp/ask-patches/${pkg}/\${upstream_ver}/${patch}\" && \
if [ ! -f \"\${patch_path}\" ]; then \
echo \"ERROR: no ASK patch for ${pkg} upstream \${upstream_ver} (looked for \${patch_path})\" >&2; \
exit 1; \
fi && \
patch -p1 < \"\${patch_path}\" && \
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -uc -us && \
cd '${workdir}' && dpkg -i ${debs} && \
cp ${debs} /tmp/ask-patched-debs/ && \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From: Tomaz Zaman <tomaz@mono.si>
Date: Tue, 14 Apr 2026 12:00:00 +0000
Subject: [PATCH] libbpf: const-correctness for strstr/strchr return values

In glibc 2.42+ (Ubuntu Resolute and later), the strstr() and strchr()
declarations in <string.h> are const-aware: when the input pointer is
const char*, the return type is const char* as well. Assigning that
result to a non-const char* triggers -Wdiscarded-qualifiers, which is
fatal under -Werror.

This breaks the linux-headers .deb postinst (which compiles
tools/bpf/resolve_btfids on the build host) when the host runs a
distribution with newer glibc.

Fix by declaring the receiving variables as const char*. The values
are only used for pointer arithmetic and NULL checks — no const-
casting elsewhere is needed.

This matches the upstream Linux 6.13+ fix; backported here for the
NXP lf-6.12.y SDK kernel.

Signed-off-by: Tomaz Zaman <tomaz@mono.si>
---
tools/lib/bpf/libbpf.c | 4 ++--
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e33cf3caf8b6..c574034fdab7 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -8166,7 +8166,7 @@ static int kallsyms_cb(unsigned long long sym_addr, char sym_type,
struct bpf_object *obj = ctx;
const struct btf_type *t;
struct extern_desc *ext;
- char *res;
+ const char *res;

res = strstr(sym_name, ".llvm.");
if (sym_type == 'd' && res)
@@ -11951,7 +11951,7 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz)
if (!search_paths[i])
continue;
for (s = search_paths[i]; s != NULL; s = strchr(s, ':')) {
- char *next_path;
+ const char *next_path;
int seg_len;

if (s[0] == ':')
Loading