# 开发插件

Source: [https://docs.qualcomm.com/doc/80-70017-50SC/topic/develop-plugins-for-sdk.html](https://docs.qualcomm.com/doc/80-70017-50SC/topic/develop-plugins-for-sdk.html)

Qualcomm IM SDK 使用 GStreamer 插件展示其功能。[下载并安装 eSDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-51/install-sdk.html#download-and-install-esdk) 以开发或自定义插件。

使用 Qualcomm IM SDK，用户可以执行以下操作：

- 更新或自定义现有插件以进行改进，或使其与最新版本的 GStreamer 框架兼容。
- 为 AI/ML 模型开发预处理和后处理插件。

## 自定义一个插件

Source: [https://docs.qualcomm.com/doc/80-70017-50SC/topic/develop-plugins-for-sdk.html](https://docs.qualcomm.com/doc/80-70017-50SC/topic/develop-plugins-for-sdk.html)

自定义 Qualcomm IM SDK 插件并将其安装至目标设备上。

### 关于此任务

例如，以下过程使用 `mlvdetection` 插件。

### 过程

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/QIMSDK_ESDK_6490/]Copy to clipboard
2. 下载 Qualcomm IM SDK 插件源代码。
                
cd $ESDK_ROOTCopy to clipboard

        devtool modify qcom-gstreamer1.0-plugins-oss-mlvdetectionCopy to clipboard

在此命令中，`qcom-gstreamer1.0-plugins-oss-mlvdetection` 是下载插件源代码的 BitBake recipe。

        NOTE: Starting bitbake server...
        Loading cache: 100% |######################################| Time: 0:00:00
        Loaded 9816 entries from dependency cache.
        Parsing recipes: 100% |####################################| Time: 0:00:01
        Parsing of 6700 .bb  files complete (6678 cached, 22 parsed). 9838 targets, 842 skipped, 0 masked, 0 errors.
        NOTE: Resolving any missing task queue dependencies
        Initialising tasks: 100% |#################################| Time: 0:00:55
        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-mlvdetection
        INFO: Recipe qcom-gstreamer1.0-plugins-oss-mlvdetection now setup to build from /local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-mlvdetectionCopy to clipboard

将插件源代码下载到 $ESDK\_ROOT/workspace/sources/qcom-gstreamer1.0-plugins-oss-mlvdetection。

        [/local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-mlvdetection]$ ls
        CMakeLists.txt    config.h.in    mlvdetection.h    modules
        [/local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-mlvdetection]$Copy to clipboard
3. 执行所需的定制并运行以下命令以重新编译插件： 
                
devtool build qcom-gstreamer1.0-plugins-oss-mlvdetectionCopy to clipboard

随即显示以下消息：

        NOTE: Starting bitbake server...
        Loading cache: 100% |################################################| Time: 0:00:00
        Loaded 9816 entries from dependency cache.
        Parsing recipes: 100% |##############################################| Time: 0:00:01
        Parsing of 6700 .bb  files complete (6678 cached, 22 parsed). 9838 targets, 842 skipped, 0 masked, 0 errors.
        NOTE: Resolving any missing task queue dependencies
        Initialising tasks: 100% |###########################################| Time: 0:00:55
        Checking sstate mirror object availability: 100% |###################| Time: 0:01:06
        Sstate Summary: Wanted 264 Local 0 Mirrors 0 Missed 264 Current 255 (0% match, 49% complete)
        Removing 1 stale sstate objects for arch qcs6490_rb3gen2_vision_kit: 100% |################################################| Time: 0:00:12
        Removing 1 stale sstate objects for arch armv8-2a: 100% |##################################################################| Time: 0:00:16
        NOTE: Executing Tasks
        NOTE: qcom-gstreamer1.0-plugins-oss-mlvdetection: compiling from external source tree /local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-mlvdetection
        NOTE: Task Summary: Attempted 1836 tasks of which 1827 didn't need to be rerun and all succeeded.Copy to clipboard
4. 请生成插件安装程序 (ipk)，以便在目标设备上安装应用程序： 
                
devtool package qcom-gstreamer1.0-plugins-oss-mlvdetectionCopy to clipboard

可安装软件包位于 `ls -1
                            $ESDK_ROOT/tmp/deploy/ipk/armv8-2a/`。

        qcom-gstreamer1.0-plugins-oss-mlvdetection_1.0-r0_armv8-2a.ipk
        qcom-gstreamer1.0-plugins-oss-mlvdetection_dbg_1.0-r0_armv8-2a.ipk
        qcom-gstreamer1.0-plugins-oss-mlvdetection_dev_1.0-r0_armv8-2a.ipk
        qcom-gstreamer1.0-plugins-oss-mlvdetection_src_1.0-r0_armv8-2a.ipk
        [/local/mnt/workspace/QIMSDK_ESDK_6490/workspace/sources/qcom-gstreamer1.0-plugins-oss-mlvdetection]$Copy to clipboard
5. 通过 SSH 与目标设备建立连接。相关说明，可参见[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
                
可通过其配置的 IP 地址访问开发套件。
6. 通过 SSH shell 在目标设备上安装编译好的参考应用程序：
                
ssh root@[IP Address of the device]Copy to clipboard

注释： 如果提示输入密码，请输入<var class="keyword varname">oelinux123</var>。
7. 在目标设备上，重新配置文件系统分区以支持读取和写入操作：
                
mount -o remount,rw /Copy to clipboard

        exitCopy to clipboard
8. 在主机上，将程序安装程序传输至目标设备：
                
cd $ESDK_ROOT/tmp/deploy/ipk/armv8-2a/Copy to clipboard

        scp qcom-gstreamer1.0-plugins-oss-mlvdetection_1.0-r0_armv8-2a.ipk root@<IP Address of the device>:/optCopy to clipboard
9. 登录 SSH shell：
                
ssh root@[IP Address of the device]Copy to clipboard
10. 在目标设备上，安装应用程序：
                
opkg --force-depends --force-reinstall --force-overwrite install /opt/qcom-gstreamer1.0-plugins-oss-mlvdetection_1.0-r0_armv8-2a.ipkCopy to clipboard
11. 验证 IPK 安装是否成功。
                
Installing qcom-gstreamer1.0-plugins-oss-mlvdetection (1.0) on root
        Configuring qcom-gstreamer1.0-plugins-oss-mlvdetection.Copy to clipboard

## 创建一个插件

Source: [https://docs.qualcomm.com/doc/80-70017-50SC/topic/develop-plugins-for-sdk.html](https://docs.qualcomm.com/doc/80-70017-50SC/topic/develop-plugins-for-sdk.html)

创建您自己的插件并将其编译为 Qualcomm IM SDK 的一部分。每个 ML 插件都作为独立的 BitBake 配方集成到 SDK 中。

### 关于此任务

要更新 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. 在 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer/ 处创建 BitBake 文件。
                
例如：

        $ESDK_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/gstreamer/qcom-gstreamer1.0-plugins-oss-sample-mlvclassification.bbCopy to clipboard

    1. 将现有插件的内容复制到步骤 2 中创建的新文件中。
    2. 更新 `SUMMARY`、`SRC_URI` 和 `S` 变量，如图：

            ...
            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 directories.
            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 插件源代码复制到该目录中。
                
注释： 确保 `sample-mlvclassification` 插件的源代码可用。

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
4. 要将 `qcom-gstreamer1.0-plugins-oss-sample-mlvclassification` 包含在软件包组中，请将其添加到 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/recipes-gst/packagegroups/packagegroup-qcom-gst.bb 目录中的 `RDEPENDS` 下。
                
RDEPENDS:${PN}:qcom-custom-bsp = " \
            ${PN}-dependencies \ 
            ${PN}-basic \ 
            . . . 
            qcom-gstreamer1.0-plugins-oss-sample-mlvclassification \
        "Copy to clipboard
5. 要将 `qcom-gstreamer1.0-plugins-oss-sample-mlvclassification:do_package_write_ipk` 包含在软件包组 bbclass 中，请将其添加到 $ESDK\_ROOT/layers/meta-qcom-qim-product-sdk/classes/qimsdk-pkg.bbclass 目录中的 `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 recipe。

        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

可安装软件包位于 `$ESDK_ROOT/tmp/deploy/ipk/armv8-2a/`。

        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
9. 通过 SSH 与目标设备建立连接。相关说明，请参阅[使用 SSH 登录](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
                
可以通过配置的 IP 地址访问 Qualcomm Linux。
10. 在 Qualcomm EVK 上，安装已编译的参考应用程序：
                
qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_1.0-r0_armv8-2a.ipkCopy to clipboard
11. 登录 SSH shell：
                
ssh root@[ip-addr]Copy to clipboard

注释： 如果提示输入密码，请输入<var class="keyword varname">oelinux123</var>。
12. 在目标设备上，重新配置文件系统分区以支持*读取*和*写入*： 
                
mount -o remount,rw /Copy to clipboard

        exitCopy to clipboard
13. 在主机上，将程序安装程序传输至目标设备：
                
cd $ESDK_ROOT/tmp/deploy/ipk/armv8-2a/Copy to clipboard

        scp qcom-gstreamer1.0-plugins-oss-sample-mlvclassification_1.0-r0_armv8-2a.ipk root@<ip_address>:/opt/Copy to clipboard
14. 在 SSH shell 中，在目标设备上运行命令来安装应用程序： 
                
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: Nov 11, 2025

[Previous Topic
qtismartvencbin](https://docs.qualcomm.com/bundle/publicresource/80-70017-50SC/topics/qtismartvencbin.md) [Next Topic
GStreamer 工具](https://docs.qualcomm.com/bundle/publicresource/80-70017-50SC/topics/im-sdk-base-uitilities.md)