# 创建自己的 Qualcomm IM SDK 插件

Source: [https://docs.qualcomm.com/doc/80-70015-15BY/topic/esdk-create-own-plugin.html](https://docs.qualcomm.com/doc/80-70015-15BY/topic/esdk-create-own-plugin.html)

本节介绍如何创建新的插件并将其编译为 Qualcomm Intelligent Multimedia Product SDK 的一部分。每个 ML 插件都作为独立的 bitbake 配方进行集成。

**更新 bitbake 文件以进行定制插件编译的步骤**

1. 搭建环境。

        cd $ESDK_ROOTCopy to clipboard

        source environment-setup-armv8-2a-qcom-linuxCopy to clipboard

        SDK environment now set up; additionally you may now run devtool to perform development tasks.
        Run devtool --help for further details. 
        [/local/mnt/workspace/Platform_eSDK_plus_QIM]$Copy to clipboard
2. 在以下添加新的 bitbake 文件 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer/
    例如， $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer/qcom-gstreamer1.0-plugins-oss-sample-mlvclassification.bb

    1. 将现有插件如 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer/qcom-gstreamer1.0-plugins-oss-mlvclassification.bb 中的内容复制到此新文件中。
    2. 按如下所示更新以下变量。

            SUMMARY = "My custom plugin for ML image categorization"
            SRC_URI = "file://gst-plugin-sample-mlvclassification"
            S = "${WORKDIR}/gst-plugin-sample-mlvclassification"Copy to clipboard

            ...
            inherit cmake pkgconfig  
             
            SUMMARY = "My custom plugin for ML image categorization" 
            SECTION= "multimedia" 
             
            LICENSE = "BSD-3-Clause-Clear" 
            LIC_FILES_CHKSUM - "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=7a43440b65lf4a472ca93716d01033a" 
             
            # Dependencies.
            DEPENDS：= "gstreamer1.0" 
            DEPENDS += "gstreamer1.0-plugins-base" 
            DEPENDS += "qcom-gstreamer1.0-plugins-oss-base" 
            DEPENDS += "cairo" 
             
            SRC_URI += "file://gst-plugin-sample-mlvclassification" 
            S = "${WORKDIR}/gst-plugin-sample-mlvclassification" 
             
            # Instal。
            INSTALL_INCDIR：= “${includedir}” 
            ...Copy to clipboard
3. 创建一个在路径$ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer/files
                中命名 `files` 的目录。在目录 files 下创建
                    gst-plugin-sample-mlvclassification 目录，并将 Qualcomm IM SDK
                    插件源代码复制到该目录内。

        files 
        | 
        +-- gst-plugin-sample-mlvclassification 
           | 
           +-- CMakeLists.txt 
           +-- config.h.in 
           +-- mlvclassification.c 
           +-- mlvclassification.h 
           +-- modules
              | 
              +-- CMakeLists.txt 
              +-- ml-vclassification-ocr.c 
              +-- ml-vclassification-qfr.c 
              +-- READMECopy to clipboard

Note: 假定源代码可用于
                        `sample-mlvclassification` 插件。
4. 更新 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/packagegroups/packagegroup-qcom-gst.bb 以添加 `qcom-gstreamer1.0-plugins-oss-sample-mlvclassification` 在  `RDEPENDS`。
RDEPENDS:${PN}：qcom-custom-bsp = “ \ 
            ${PN}- dependencies \ 
            ${PN}- basic \ 
            ... 
            qcom-gstreamer1.0-plugins-oss-sample-mlvclassification \ 
        "Copy to clipboard
5. 更新 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/classes/qimsdk-pkg.bbclass 以添加 `qcom-gstreamer1.0-plugins-oss-sample-mlvclassification:do_package_write_ipk` 在 `do_generate_qim_sdk[depends]`。
GST_PLUGINS = “ \ 
            gstd：do_package_write_ipk \ 
            gstreamer1.0：do_package_write_ipk \ 
            ... 
            qcom-gstreamer1.0-plugins-oss-sample-mlvclassification:do_package_write_ipk \ 
        "Copy to clipboard
6. 下载 Qualcomm IM SDK 插件源代码。

        cd $ESDK_ROOTCopy to clipboard

        devtool modify qcom-gstreamer1.0-plugins-oss-sample-mlvclassificationCopy to clipboard

其中 *qcom-gstreamer1.0-plugins-oss-sample-mlvclassification* 是下载插件源的 bitbake
                    配方。

        NOTE:Starting bitbake server...
        Loading cache:100% |############################################################################|Time:0:00:02 
        Loaded 9814 entries from dependency cache.
        Parsing recipes:100% |##########################################################################|Time:0:00:03 
        Parsing of 6702 .bb files complete (6670 cached, 32 parsed).9840 targets, 842 skipped, 0 masked, 0 errors.
        
        Summary:There were 0 WARNING messages.
        NOTE:Resolving any missing task queue dependencies  
        Initialising tasks:100% |#######################################################################|Time：0:00:08 
        Sstate summary:Wanted 10 Local 0 Mirrors 0 Missed 10 Current 10 (0% match, 50% complete) 
        NOTE:Executing Tasks 
        NOTE:Tasks Summary:Attempted 93 tasks of which 90 didn't need to be rerun and all succeeded.
        INFO: Source tree extracted to /local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-sample-mlvclassification  
        INFO: Recipe qcom-gstreamer1.0-plugins-oss-sample-mlvclassification now set up to build from /local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-sample-mlvclassificationCopy to clipboard

    插件源代码将下载到 $ESDK\_ROOT/workspace/sources/qcom-gstreamer1.0-plugins-oss-sample-mlvclassification。
7. 定制完成后，使用以下命令重新编译插件。

        devtool build qcom-gstreamer1.0-plugins-oss-sample-mlvclassificationCopy to clipboard

        NOTE:Starting bitbake server ...
        Loading cache:100% |                                     || ETA -:--:-- 
        Loaded 0 entries from dependency cache.
        ...Copy to clipboard
8. 生成插件安装程序 (.ipk) 以便在设备上安装插件。

        devtool package qcom-gstreamer1.0-plugins-oss-sample-mlvclassificationCopy to clipboard

NOTE:Starting bitbake server...
        Loading cache:100%|#############################################################|ETA 0:00:14 
        Loaded 9812 entries from dependency cache.
        Parsing recipes:100% |#################################################################################|Time:0:00:03 
        Parsing of 6702 .bb files complete (6674 cached, 28 parsed).9840 targets, 842 skipped, 0 masked, 0 errors. 
        NOTE:Resolving any missing task queue dependencies 
        Initialising tasks:100% |##############################################################################|Time:0:00:10 
        Checking sstate mirror object availability:100% |######################################################|Time:0:00:00 
        Sstate summary:Wanted 262 Local 0 Mirrors 0 Missed 262 Current 259 (0% match, 49% complete) 
        NOTE:Executing Tasks 
        NOTE:Tasks Summary:Attempted 1847 tasks of which 1847 didn't need to be rerun and all succeeded.
        
        Summary:There were 0 WARNING messages.
        INFO: Your packages are in /local/mnt/workspace/QIMSDK_ESDK_6490/tmp/deploy/ipkCopy to clipboard

    确认可安装软件包已位于以下路径。

        ls $ESDK_ROOT/tmp/deploy/ipk/armv8-2a | grep qcom-gstreamer1.0-plugins-oss-sample-mlvclassificationCopy to clipboard

        qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_1.0-r0_armv8-2a.ipk 
        qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_dbg_1.0-r0_armv8-2a.ipk 
        qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_dev_1.0-r0_armv8-2a.ipk 
        qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_src_1.0-r0_armv8-2a.ipk 
        [/local/mnt/workspace/Platform_eSDK_plus_QIM]$Copy to clipboard
9. 按照 [此处](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh)所述步骤，与设备建立 SSH 连接。连接成功后，就可以通过为 RB3Gen2 设备配置的 IP 地址访问该设备。
10. 复制 qcom-gstreamer1.0-plugins-oss-sample-mlvclassification\_1.0-r0\_armv8-2a.ipk 到 RB3Gen2 设备以安装完成编译的参考应用程序。
11. 登录 SSH shell：

        ssh root@<IP addr of the target device>Copy to clipboard

Note: 如果提示输入密码，则输入 oelinux123 作为 SSH shell 的密码。

    在目标设备上运行以下命令。

        mount -o remount,rw / 
        exitCopy to clipboard

    在主机上执行以下操作：

        cd $ESDK_ROOT/tmp/deploy/ipk/armv8-2a/
        scp qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_1.0-r0_armv8-2a.ipk root@< IP addr of the target device>:/opt/Copy to clipboard

    登录 SSH shell：

        ssh root@<IP addr of the target device>Copy to clipboard

    在目标设备上执行以下操作：

        opkg --force-depends --force-reinstall --force-overwrite install /opt/qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_1.0-r0_armv8-2a.ipkCopy to clipboard

    新插件现已安装，可供需要该插件的应用程序使用。

Last Published: Jan 26, 2026

[Previous Topic
创建自己的应用程序](https://docs.qualcomm.com/bundle/publicresource/80-70015-15BY/topics/esdk-create-own-app.md) [Next Topic
故障排除](https://docs.qualcomm.com/bundle/publicresource/80-70015-15BY/topics/troubleshooting.md)