onnxruntime: modify installation process to avoid QA error

ST's onnxruntime recipe moves a file in a way that triggers a QA error due to
file ownership issues. Copy the do_install() function as-is and modify the
offending line to copy the file instead. Create a dynamic layer for stm32mpu-ai
to include the bbappend.

https://onedigi.atlassian.net/browse/DEL-8308

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2023-04-21 17:02:15 +02:00
parent 163b229beb
commit 502cdecd9d
2 changed files with 47 additions and 0 deletions

View File

@ -14,6 +14,8 @@ BBFILES_DYNAMIC += " \
freescale-layer:${LAYERDIR}/dynamic-layers/freescale-layer/*/*/*.bbappend \ freescale-layer:${LAYERDIR}/dynamic-layers/freescale-layer/*/*/*.bbappend \
stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bb \ stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bb \
stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bbappend \ stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bbappend \
stm32mpu-ai:${LAYERDIR}/dynamic-layers/stm32mpu-ai/*/*/*.bb \
stm32mpu-ai:${LAYERDIR}/dynamic-layers/stm32mpu-ai/*/*/*.bbappend \
qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bb \ qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bb \
qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bbappend \ qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bbappend \
qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/${DEY_BUILD_PLATFORM}/*/*/*.bb \ qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/${DEY_BUILD_PLATFORM}/*/*/*.bb \

View File

@ -0,0 +1,45 @@
# Copyright 2023 Digi International Inc.
do_install() {
# Install onnxruntime dynamic library
install -d ${D}${libdir}
install -d ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 0644 ${B}/libonnxruntime.so ${D}${libdir}/libonnxruntime.so.${PVB}
# This shared lib is used by onnxruntime_shared_lib_test and onnxruntime_test_python.py
install -m 644 ${B}/libcustom_op_library.so ${D}${libdir}
# And this one only by onnxruntime_test_python.py
install -m 644 ${B}/libtest_execution_provider.so ${D}${libdir}
install -m 644 ${B}/libonnxruntime_providers_shared.so ${D}${libdir}/libonnxruntime_providers_shared.so
install -m 644 ${B}/onnxruntime_pybind11_state.so ${D}${libdir}/onnxruntime_pybind11_state.so
# Install the symlinks.
ln -sf libonnxruntime.so.${PVB} ${D}${libdir}/libonnxruntime.so.${MAJOR}
ln -sf libonnxruntime.so.${PVB} ${D}${libdir}/libonnxruntime.so
# Digi: copy instead of moving to avoid QA errors
# Copy the onnx_test_runner executable that was installed in /usr instead of /usr/local.
cp ${B}/onnx_test_runner ${D}${prefix}/local/bin/${PN}-${PVB}/tools
# These are not included in the base installation, so we install them manually.
install -m 755 ${B}/onnxruntime_perf_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 755 ${B}/onnxruntime_test_all ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 755 ${B}/onnxruntime_shared_lib_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 755 ${B}/onnxruntime_api_tests_without_env ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 755 ${B}/onnxruntime_global_thread_pools_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 755 ${B}/onnxruntime_test_python.py ${D}${prefix}/local/bin/${PN}-${PVB}/tools
install -m 755 ${B}/helper.py ${D}${prefix}/local/bin/${PN}-${PVB}/tools
cp -r ${B}/testdata ${D}${prefix}/local/bin/${PN}-${PVB}/tools
# We have to change some of the RPATH as well.
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_perf_test
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_shared_lib_test
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_api_tests_without_env
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_global_thread_pools_test
chrpath -r '$ORIGIN' ${D}${libdir}/libtest_execution_provider.so
# Install the Python package.
mkdir -p ${D}${PYTHON_SITEPACKAGES_DIR}/onnxruntime
cp -r ${B}/onnxruntime ${D}${PYTHON_SITEPACKAGES_DIR}
}