OBMC 添加一个新的recipe

OBMC 添加一个新的recipe

obmc用的是yocto进行编译。

代码结构如下:

[penghu4x@bmcdev-S2600WF0dsg-openbmc-openbmc$ ls
bitbake       meta-amd        meta-google         meta-lenovo        meta-qualcomm     meta-yadro          setup
build         meta-ampere     meta-hpe            meta-microsoft     meta-quanta       oe-init-build-env   vscode-bitbake-build
code          meta-arm        meta-hxt            meta-nuvoton       meta-raspberrypi  openbmc-env
Jenkinsfile   meta-aspeed     meta-ibm            meta-openembedded  meta-security     openbmc-meta-xxx
LICENSE       meta-bytedance  meta-ingrasys       meta-openpower     meta-skeleton     OWNERS
MAINTAINERS   meta-evb        meta-inspur         meta-phosphor      meta-supermicro   poky
meta          meta-facebook   meta-xxx-openbmc  meta-poky          meta-x86          README.md
meta-alibaba  meta-fii        meta-inventec       meta-portwell      meta-xilinx       scripts
[penghu4x@bmcdev-S2600WF0dsg-openbmc-openbmc$ ls ./openbmc-meta-xxx/
CODEOWNERS  COPYING.apache-2.0  files        meta-ast2500  meta-common        meta-egs       meta-wht       README
conf        COPYING.MIT         Jenkinsfile  meta-ast2600  meta-common-small  meta-internal  meta-wolfpass  README.md

如何在项目中添加一个新的功能库呢?

1. 本地代码开发

在dsg-openbmc-openbmc目录下新建一个code文件夹,用来存放代码。

[penghu4x@bmcdev-S2600WF0helloyocto$ pwd
/media/disk3/penghu4x/work/dsg-openbmc-openbmc/code/helloyocto
[penghu4x@bmcdev-S2600WF0helloyocto$ ls
cmake  CMakeLists.txt  main.c  oe-logs  oe-workdir

添加main.c

#include <stdio.h>

int main (int argc, char **argv)
{
    printf ("Hello Yocto!\n");
  
    return 0;
} /* ----- End of main() ----- */

添加cmake,yocto支持cmake、meson、makefile

cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
project(helloyocto C)
AUX_SOURCE_DIRECTORY(. SRC_LIST)
add_executable (helloyocto ${SRC_LIST})

install(TARGETS helloyocto DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)

在功能目录下用devtool命令添加新的repo,

devtool add hello ../code/hello 其中 hello是repo的名字, …/code/hello 是代码的路径。

命令执行完成后会有提示:‘Recipe /media/disk3/penghu4x/work/dsg-openbmc-openbmc/build/workspace/recipes/hello/hello.bb has been automatically created’

[penghu4x@bmcdev-S2600WF0dsg-openbmc-openbmc$ export TEMPLATECONF=openbmc-meta-xxx/meta-egs/conf
[penghu4x@bmcdev-S2600WF0dsg-openbmc-openbmc$ source ./oe-init-build-env
Common targets are:
    xxxx-platforms
    obmc-phosphor-image
    qemu-helper-native
    virtual/kernel
    phosphor-ipmi-host
[penghu4x@bmcdev-S2600WF0build$ devtool add hello ../code/hello
NOTE: Starting bitbake server...
WARNING: Duplicate inclusion for /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta/conf/distro/include/security_flags.inc in /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta-phosphor/conf/distro/include/phosphor-defaults.inc
NOTE: Starting bitbake server...
WARNING: Duplicate inclusion for /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta/conf/distro/include/security_flags.inc in /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta-phosphor/conf/distro/include/phosphor-defaults.inc
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
NOTE: Reconnecting to bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
NOTE: Retrying server connection (#1)...
NOTE: Starting bitbake server...
WARNING: Duplicate inclusion for /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta/conf/distro/include/security_flags.inc in /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta-phosphor/conf/distro/include/phosphor-defaults.inc
INFO: Recipe /media/disk3/penghu4x/work/dsg-openbmc-openbmc/build/workspace/recipes/hello/hello.bb has been automatically created; further editing may be required to make it fully functional

之后用命令devtool编译代码: devtool build hello

-h 可以显示帮助信息,其中-c是clean。

[penghu4x@bmcdev-S2600WF0hello$ devtool build hello -h
NOTE: Starting bitbake server...
WARNING: Duplicate inclusion for /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta/conf/distro/include/security_flags.inc in /media/disk3/penghu4x/work/dsg-openbmc-openbmc/meta-phosphor/conf/distro/include/phosphor-defaults.inc
usage: devtool build [-h] [-s] [-c] recipename

Builds the specified recipe using bitbake (up to and including do_populate_sysroot, do_packagedata)

arguments:
  recipename            Recipe to build

options:
  -h, --help            show this help message and exit
  -s, --disable-parallel-make
                        Disable make parallelism
  -c, --clean           clean up recipe building results

至此,hello功能基本完成。

可以把bb文件加到meta中,把hello代码提交到gitlab中。

之后可以用devtool reset hello, 把该repo从当前工作环境中移除。

2. 添加bb文件到meta中

把之前生成的bb文件复制到一个meta目录中,具体路径需要根据你的功能去选择meta文件夹。

bb文件内容如下:

[penghu4x@bmcdev-S2600WF0hello$ cat /media/disk3/penghu4x/work/dsg-openbmc-openbmc/build/workspace/recipes/hello/hello.bb
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
#
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

# No information for SRC_URI yet (only an external source tree was specified)
SRC_URI = ""

inherit cmake

# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""


其中license,在代码开发过程中,添加license文件,重新devtool add的时候会生成相应的cheksum

SRC_URI:在提交代码到gitlab后,从新devtool add 会生成相应的gitlab地址,并会添加SRCREV指定commit的id。

# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "4a5c117d03d91a7a0a59c4eee4ad3f099f0099a8"

S = "${WORKDIR}/git"
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OBMC(Overlapped Block Motion Compensation)是一种用于视频编码的运动补偿算法,可以减少视频编码中的块效应。以下是OBMC一个Matlab代码示例[^2]: ```matlab function img = OBMC(imgP,imgC,mbSize,w,vectors) % 输入: % imgC 当前帧 % imgP 参考帧 % mbSize 匹配块尺寸 % w 重叠尺寸 % vectors 当前帧的运动向量 % 输出: % img 通过imgP和imgC内插出来的中间帧图像 [m, n] = size(imgP); % 创建一个空白的中间帧图像 img = zeros(m, n); % 根据重叠尺寸计算块的数量 blockNum = floor(n / (mbSize - w)); % 对每个块进行运动补偿和插值 for i = 1:blockNum % 计算当前块的位置 colPos = (i - 1) * (mbSize - w) + 1; % 获取当前块的运动向量 motionVector = vectors(:, i); % 根据运动向量从参考帧中获取对应的块 refBlock = imgP(:, colPos:colPos + mbSize - 1); % 进行运动补偿和插值 img(:, colPos:colPos + mbSize - 1) = refBlock + motionVector * (imgC(:, colPos:colPos + mbSize - 1) - refBlock); end end ``` 这段代码定义了一个函数`OBMC`,它接受当前帧`imgC`、参考帧`imgP`、匹配块尺寸`mbSize`、重叠尺寸`w`和当前帧的运动向量`vectors`作为输入。函数的输出是通过`imgP`和`imgC`内插出来的中间帧图像`img`。 该函数首先计算了图像的尺寸,并创建了一个空白的中间帧图像。然后,根据重叠尺寸计算块的数量,并对每个块进行运动补偿和插值。在每个块内,它根据运动向量从参考帧中获取对应的块,并利用运动补偿和插值的方法来生成中间帧图像`img`。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值