VPP just won't work. God help

This commit is contained in:
2026-04-14 03:58:23 +08:00
parent 9027132a7d
commit 9225857db6
9 changed files with 402 additions and 110 deletions

View File

@@ -84,9 +84,10 @@ RUN rm -rf build-aarch64 && \
-Dkernel_dir=/usr/src/linux \
-Dexamples=l2fwd,l3fwd,helloworld \
-Dmax_lcores=4 \
-Dc_args="-g -Ofast -fPIC -ftls-model=local-dynamic -Wno-error=implicit-function-declaration -Wno-error=maybe-uninitialized \
-I/mnt/rootfs/usr/include \
-I/mnt/rootfs/usr/include/aarch64-linux-gnu" \
-Dc_args="-g3 -O0 -fPIC -fno-omit-frame-pointer \
-Wno-error=implicit-function-declaration -Wno-error=maybe-uninitialized \
-I/mnt/rootfs/usr/include \
-I/mnt/rootfs/usr/include/aarch64-linux-gnu" \
-Dc_link_args="-Wl,-rpath-link=/mnt/rootfs/usr/lib/aarch64-linux-gnu \
-L/mnt/rootfs/usr/lib/aarch64-linux-gnu \
-L/mnt/rootfs/usr/lib \
@@ -137,19 +138,44 @@ RUN set -eux; \
WORKDIR /src/vpp
# BEGIN LOCAL VPP PATCHES
COPY patches /tmp/patches
RUN apt-get update && apt-get install -y --no-install-recommends patch \
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
if [ -d /tmp/patches/vpp ]; then \
for p in /tmp/patches/vpp/*.patch; do \
[ -e "$p" ] || continue; \
if patch -p1 --dry-run --forward < "$p" >/dev/null 2>&1; then \
patch -p1 --forward < "$p"; \
elif patch -p1 -R --dry-run < "$p" >/dev/null 2>&1; then \
echo "already applied: $p"; \
else \
echo "failed to apply patch: $p" >&2; \
exit 1; \
fi; \
done; \
fi
# END LOCAL VPP PATCHES
# Sync libs for the linker
RUN ln -s /mnt/rootfs/usr/lib/aarch64-linux-gnu /mnt/rootfs/usr/lib/lib64 || true
RUN cd build-root && \
export DEB_BUILD_OPTIONS="nocheck nodoc noautodbgsym" && \
export DEB_BUILD_OPTIONS="nocheck nodoc noautodbgsym nostrip" && \
export CFLAGS="-O0 -g3 -fno-omit-frame-pointer" && \
export CXXFLAGS="-O0 -g3 -fno-omit-frame-pointer" && \
make V=1 \
PLATFORM=dpaa \
TAG=dpaa \
CROSS_SYSROOT=/mnt/rootfs \
CROSS_PREFIX=aarch64-linux-gnu \
DPDK_PATH=/mnt/rootfs/usr \
VPP_VERSION=${VPP_VERSION} \
vpp-install
PLATFORM=dpaa \
TAG=dpaa \
CROSS_SYSROOT=/mnt/rootfs \
CROSS_PREFIX=aarch64-linux-gnu \
DPDK_PATH=/mnt/rootfs/usr \
VPP_VERSION=${VPP_VERSION} \
vpp-install
ARG FMLIB_TAR
ARG FMC_TAR
@@ -236,98 +262,122 @@ RUN set -eux; \
\
# 1. Initialize policy.xml with the correct <netpcd> root tag
echo '<?xml version="1.0" encoding="UTF-8"?>' > /tmp/fmc_staging/policy.xml; \
echo '<netpcd>' >> /tmp/fmc_staging/policy.xml; \
\
# 2. Extract policy names and generate dummy blocks
# We use a subshell and tr to handle potential weird spacing
POLICY_NAMES=$(grep -o 'policy="[^"]*"' /tmp/fmc_staging/config.xml | cut -d'"' -f2 | sort -u); \
\
for NAME in $POLICY_NAMES; do \
echo " <policy name=\"$NAME\">" >> /tmp/fmc_staging/policy.xml; \
echo " <dist_order><distributionref name=\"dist_dummy\"/></dist_order>" >> /tmp/fmc_staging/policy.xml; \
echo " </policy>" >> /tmp/fmc_staging/policy.xml; \
done; \
\
# 3. Append the distribution and close the root tag
# Updated Distribution block for the Dockerfile RUN command
cat << 'EOF' >> /tmp/fmc_staging/policy.xml
<netpcd>
<policy name="hash_ipsec_src_dst_spi_policy_mac10">
<dist_order><distributionref name="dist_dummy"/></dist_order>
</policy>
<policy name="hash_ipsec_src_dst_spi_policy_mac9">
<dist_order><distributionref name="dist_dummy"/></dist_order>
</policy>
<distribution name="dist_dummy">
<queue count="1" base="0x900"/>
<protocols><protocolref name="ethernet"/></protocols>
</distribution>
</netpcd>
EOF
RUN set -eux; \
cd /src/vpp; \
mkdir -p debian; \
echo "10" > debian/compat; \
\
# 1. Start the Rules file
echo '#!/usr/bin/make -f' > debian/rules; \
echo '%:' >> debian/rules; \
printf '\tdh $@\n' >> debian/rules; \
\
echo 'override_dh_auto_configure:' >> debian/rules; \
printf '\t@echo "Skipping configure"\n' >> debian/rules; \
\
echo 'override_dh_auto_clean:' >> debian/rules; \
printf '\t@echo "Skipping clean"\n' >> debian/rules; \
\
echo 'override_dh_auto_build:' >> debian/rules; \
printf '\t@echo "Skipping build"\n' >> debian/rules; \
\
# 2. THE INSTALL STEP (Crucial: everything here must have a Tab)
echo 'override_dh_auto_install:' >> debian/rules; \
printf '\tmkdir -p debian/vpp/usr/bin\n' >> debian/rules; \
printf '\tmkdir -p debian/vpp/usr/lib\n' >> debian/rules; \
printf '\tmkdir -p debian/vpp/etc/fmc/config\n' >> debian/rules; \
\
# Copy VPP binaries from build-root
printf '\tcp -a build-root/install-dpaa-aarch64/vpp/. debian/vpp/usr/\n' >> debian/rules; \
\
# Copy FMC binary
printf '\tcp /src/fmc/source/fmc debian/vpp/usr/bin/\n' >> debian/rules; \
\
# PULL FROM THE STAGING AREA
printf '\tcp /tmp/fmc_staging/config.xml debian/vpp/etc/fmc/\n' >> debian/rules; \
printf '\tcp /tmp/fmc_staging/policy.xml debian/vpp/etc/fmc/\n' >> debian/rules; \
printf '\tcp /tmp/fmc_staging/config/* debian/vpp/etc/fmc/config/\n' >> debian/rules; \
\
# Copy system libs
printf '\tcp /mnt/rootfs/usr/lib/libfm-arm.so* debian/vpp/usr/lib/ 2>/dev/null || true\n' >> debian/rules; \
printf '\tcp /mnt/rootfs/usr/lib/libusdpaa.so* debian/vpp/usr/lib/ 2>/dev/null || true\n' >> debian/rules; \
\
echo 'override_dh_usrlocal:' >> debian/rules; \
printf '\t@echo "Skipping usrlocal fixup"\n' >> debian/rules; \
\
echo 'override_dh_shlibdeps:' >> debian/rules; \
printf '\t@echo "Skipping shlibdeps (cross-compile)"\n' >> debian/rules; \
\
chmod +x debian/rules; \
\
# 3. Control and Changelog (echo is fine here because these aren't Makefiles)
echo "Source: vpp" > debian/control; \
echo "Maintainer: NXP Builder <builder@nxp.com>" >> debian/control; \
echo "Section: net" >> debian/control; \
echo "Priority: optional" >> debian/control; \
echo "Build-Depends: debhelper (>= 10)" >> debian/control; \
echo "" >> debian/control; \
echo "Package: vpp" >> debian/control; \
echo "Architecture: arm64" >> debian/control; \
echo "Depends: \${shlibs:Depends}, \${misc:Depends}, libxml2, libtclap-dev" >> debian/control; \
echo "Description: VPP for NXP DPAA" >> debian/control; \
\
echo "vpp (${VPP_VERSION#lf-}-1) stable; urgency=low" > debian/changelog; \
echo " * Custom NXP Build" >> debian/changelog; \
echo " -- NXP Builder <builder@nxp.com> $(date -R)" >> debian/changelog
FROM --platform=linux/arm64 debian:trixie-slim AS runtime
# 5. Final Packaging
RUN cd /src/vpp && \
export DEB_BUILD_OPTIONS="nocheck nodoc noautodbgsym" && \
export CC=aarch64-linux-gnu-gcc && \
export CXX=aarch64-linux-gnu-g++ && \
dpkg-buildpackage -us -uc -b -aarm64 -d
ARG APT_PROXY
FROM scratch
ARG VPP_VERSION
COPY --from=build /src/vpp_${VPP_VERSION#lf-}-1_arm64.deb /
RUN if [ -n "${APT_PROXY}" ]; then \
echo "Acquire::http::Proxy \"http://${APT_PROXY}\";" > /mnt/rootfs/etc/apt/apt.conf.d/01proxy; \
fi
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/ /usr/
FROM --platform=linux/arm64 debian:trixie-slim AS runtime
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/bin/ /usr/bin/
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/etc/ /etc/
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/include/ /usr/include/
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/lib/ /usr/lib/
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/local/ /usr/local/
COPY --from=build /src/vpp/build-root/install-dpaa-aarch64/vpp/share/ /usr/share/
# FMC bits
COPY --from=build /src/fmc/source/fmc /usr/bin/
COPY --from=build /tmp/fmc_staging/config.xml /etc/fmc/
COPY --from=build /tmp/fmc_staging/policy.xml /etc/fmc/
COPY --from=build /tmp/fmc_staging/config/ /etc/fmc/config/
# NXP runtime libs
COPY --from=build /mnt/rootfs/usr/lib/libfm-arm.so* /usr/lib/
COPY --from=build /mnt/rootfs/usr/lib/libusdpaa.so* /usr/lib/
# RUN set -eux; \
# cd /src/vpp; \
# mkdir -p debian; \
# echo "10" > debian/compat; \
# \
# # 1. Start the Rules file
# echo '#!/usr/bin/make -f' > debian/rules; \
# echo '%:' >> debian/rules; \
# printf '\tdh $@\n' >> debian/rules; \
# \
# echo 'override_dh_auto_configure:' >> debian/rules; \
# printf '\t@echo "Skipping configure"\n' >> debian/rules; \
# \
# echo 'override_dh_auto_clean:' >> debian/rules; \
# printf '\t@echo "Skipping clean"\n' >> debian/rules; \
# \
# echo 'override_dh_auto_build:' >> debian/rules; \
# printf '\t@echo "Skipping build"\n' >> debian/rules; \
# \
# # 2. THE INSTALL STEP (Crucial: everything here must have a Tab)
# echo 'override_dh_auto_install:' >> debian/rules; \
# printf '\tmkdir -p debian/vpp/usr/bin\n' >> debian/rules; \
# printf '\tmkdir -p debian/vpp/usr/lib\n' >> debian/rules; \
# printf '\tmkdir -p debian/vpp/etc/fmc/config\n' >> debian/rules; \
# \
# # Copy VPP binaries from build-root
# printf '\tcp -a build-root/install-dpaa-aarch64/vpp/. debian/vpp/usr/\n' >> debian/rules; \
# \
# # Copy FMC binary
# printf '\tcp /src/fmc/source/fmc debian/vpp/usr/bin/\n' >> debian/rules; \
# \
# # PULL FROM THE STAGING AREA
# printf '\tcp /tmp/fmc_staging/config.xml debian/vpp/etc/fmc/\n' >> debian/rules; \
# printf '\tcp /tmp/fmc_staging/policy.xml debian/vpp/etc/fmc/\n' >> debian/rules; \
# printf '\tcp /tmp/fmc_staging/config/* debian/vpp/etc/fmc/config/\n' >> debian/rules; \
# \
# # Copy system libs
# printf '\tcp /mnt/rootfs/usr/lib/libfm-arm.so* debian/vpp/usr/lib/ 2>/dev/null || true\n' >> debian/rules; \
# printf '\tcp /mnt/rootfs/usr/lib/libusdpaa.so* debian/vpp/usr/lib/ 2>/dev/null || true\n' >> debian/rules; \
# \
# echo 'override_dh_usrlocal:' >> debian/rules; \
# printf '\t@echo "Skipping usrlocal fixup"\n' >> debian/rules; \
# \
# echo 'override_dh_shlibdeps:' >> debian/rules; \
# printf '\t@echo "Skipping shlibdeps (cross-compile)"\n' >> debian/rules; \
# \
# chmod +x debian/rules; \
# \
# # 3. Control and Changelog (echo is fine here because these aren't Makefiles)
# echo "Source: vpp" > debian/control; \
# echo "Maintainer: NXP Builder <builder@nxp.com>" >> debian/control; \
# echo "Section: net" >> debian/control; \
# echo "Priority: optional" >> debian/control; \
# echo "Build-Depends: debhelper (>= 10)" >> debian/control; \
# echo "" >> debian/control; \
# echo "Package: vpp" >> debian/control; \
# echo "Architecture: arm64" >> debian/control; \
# echo "Depends: \${shlibs:Depends}, \${misc:Depends}, libxml2, libtclap-dev" >> debian/control; \
# echo "Description: VPP for NXP DPAA" >> debian/control; \
# \
# echo "vpp (${VPP_VERSION#lf-}-1) stable; urgency=low" > debian/changelog; \
# echo " * Custom NXP Build" >> debian/changelog; \
# echo " -- NXP Builder <builder@nxp.com> $(date -R)" >> debian/changelog
#
# # 5. Final Packaging
# RUN cd /src/vpp && \
# export DEB_BUILD_OPTIONS="nocheck nodoc nostrip noautodbgsym" && \
# export CC=aarch64-linux-gnu-gcc && \
# export CXX=aarch64-linux-gnu-g++ && \
# dpkg-buildpackage -us -uc -b -aarm64 -d
#
# FROM scratch
# ARG VPP_VERSION
# COPY --from=build /src/vpp_${VPP_VERSION#lf-}-1_arm64.deb /