Skip to content

Commit cf84157

Browse files
Balki01ConchuOD
authored andcommitted
board: microchip: Recalculate and re-sign IPA modules
Buildroot strips its binaries post-installation as an optimization, which invalidates the original IPA module signatures done during installation. This causes libcamera to treat them as closed-source and attempt to run them in isolation using IPC, which fails if the modules aren't designed for isolated execution/doesn't have IPC support.Recalculating and re-signing the IPA module signatures is therefore necessary to ensure proper functionality. Add support for this in 'post-build.sh', conditionally if the libcamera IPA module is selected. This ensures IPA modules are signed correctly after they are built and installed. Signed-off-by: Balakrishnan Sambath <[email protected]> Signed-off-by: Conor Dooley <[email protected]>
1 parent 5e6f695 commit cf84157

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

board/microchip/sam9x/post_build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,27 @@ if grep -Eq "^BR2_PACKAGE_GREENGRASS_CORE=y$" ${BR2_CONFIG}; then
4444
_EOF_
4545
fi
4646
fi
47+
48+
# Only run if libcamera IPA is enabled
49+
if grep -Eq "^BR2_PACKAGE_LIBCAMERA_MCHP_IPA=y$" "${BR2_CONFIG}"; then
50+
echo "===== Re-signing IPA modules ====="
51+
52+
# Extract libcamera-mchp version
53+
LIBCAMERA_MCHP_VERSION=$(grep -E '^LIBCAMERA_MCHP_VERSION\s*=' "${BR2_EXTERNAL_MCHP_PATH}/package/libcamera-mchp/"* | cut -d= -f2 | xargs)
54+
55+
# Find the libcamera build directory
56+
LIBCAMERA_DIR="${BUILD_DIR}/libcamera-mchp-${LIBCAMERA_MCHP_VERSION}"
57+
58+
if [ -d "${LIBCAMERA_DIR}" ]; then
59+
echo "Using libcamera-mchp version: ${LIBCAMERA_MCHP_VERSION}"
60+
fi
61+
62+
if [ -d "${TARGET_DIR}/usr/lib/libcamera" ] && [ -n "${LIBCAMERA_DIR}" ]; then
63+
find "${TARGET_DIR}/usr/lib/libcamera" -name "ipa_*.so" \
64+
-exec "${LIBCAMERA_DIR}/src/ipa/ipa-sign-install.sh" \
65+
"${LIBCAMERA_DIR}/build/src/ipa-priv-key.pem" {} \; \
66+
-exec touch {}.sign \;
67+
fi
68+
69+
echo "===== IPA modules signing complete ====="
70+
fi

board/microchip/sama7/post_build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,27 @@ fi
4343

4444
# Mount debugfs on boot
4545
echo "debugfs /sys/kernel/debug debugfs defaults 0 0" >> ${TARGET_DIR}/etc/fstab
46+
47+
# Only run if libcamera IPA is enabled
48+
if grep -Eq "^BR2_PACKAGE_LIBCAMERA_MCHP_IPA=y$" "${BR2_CONFIG}"; then
49+
echo "===== Re-signing IPA modules ====="
50+
51+
# Extract libcamera-mchp version
52+
LIBCAMERA_MCHP_VERSION=$(grep -E '^LIBCAMERA_MCHP_VERSION\s*=' "${BR2_EXTERNAL_MCHP_PATH}/package/libcamera-mchp/"* | cut -d= -f2 | xargs)
53+
54+
# Find the libcamera build directory
55+
LIBCAMERA_DIR="${BUILD_DIR}/libcamera-mchp-${LIBCAMERA_MCHP_VERSION}"
56+
57+
if [ -d "${LIBCAMERA_DIR}" ]; then
58+
echo "Using libcamera-mchp version: ${LIBCAMERA_MCHP_VERSION}"
59+
fi
60+
61+
if [ -d "${TARGET_DIR}/usr/lib/libcamera" ] && [ -n "${LIBCAMERA_DIR}" ]; then
62+
find "${TARGET_DIR}/usr/lib/libcamera" -name "ipa_*.so" \
63+
-exec "${LIBCAMERA_DIR}/src/ipa/ipa-sign-install.sh" \
64+
"${LIBCAMERA_DIR}/build/src/ipa-priv-key.pem" {} \; \
65+
-exec touch {}.sign \;
66+
fi
67+
68+
echo "===== IPA modules signing complete ====="
69+
fi

0 commit comments

Comments
 (0)