【问题标题】:Overwriting Yocto Classes through meta-layer通过元层覆盖 Yocto 类
【发布时间】:2018-12-02 19:32:32
【问题描述】:

感谢您的时间和支持

我打算使用 swupdate 进行更新。所以,我需要创建一个额外的分区来存储恢复分区。

poky/meta/classes/image-live.bbclass

是创建分区和刷新根文件系统的类。我已经更新了上面的文件以创建一个更多的分区并存储 swupdate 根文件系统。

我怎样才能在我自己的 BSP 层中覆盖这个类,我不想接触 poky 源代码..

【问题讨论】:

    标签: linux embedded-linux yocto bsp


    【解决方案1】:

    一般在 Yocto 中没有办法像 .bb 文件那样覆盖 .bbclass 文件(使用 .bbappend em>),为了存档需要复制整个类文件并移动到另一层,我可以通过以下配置进行管理:

    层结构:

    $ tree ../meta-test/
    ../meta-test/
    ├── classes
    │   └── image-live.bbclass
    ├── conf
    │   └── layer.conf
    ├── COPYING.MIT
    ├── README
    └── recipes-example
        └── example.bb
    
    3 directories, 5 files
    

    example.bb 配方的内容:

    $ cat ../meta-test/recipes-example/example/example.bb 
    LICENSE = "CLOSED"
    inherit image-live
    

    最后非常重要的东西*,配置文件conf/bblayers.conf需要按照这个顺序配置meta-test/ meta/ 层之上:

    $ tail -n6 conf/bblayers.conf 
    BBLAYERS ?= " \
      /home/user/poky/meta-test \
      /home/user/poky/meta \
      /home/user/poky/meta-poky \
      /home/user/poky/meta-yocto-bsp \
      "
    
    $ bitbake -e example -D | grep ^DEBUG:\\sInheriting\\s.*image-live.bbclass\\s\(from
    DEBUG: Inheriting /home/user/poky/meta-test/classes/image-live.bbclass (from /home/user/poky/meta-test/recipes-example/example/example.bb:3)
    

    *我不知道为什么bitbake layer priority在这里不起作用,只有在conf/bblayers.conf中修改图层顺序才能实现主要目标:

    $ bitbake-layers show-layers
    NOTE: Starting bitbake server...
    layer                 path                                      priority
    ==========================================================================
    meta                  /home/user/poky/meta        5
    meta-test             /home/user/poky/meta-test   10
    meta-poky             /home/user/poky/meta-poky   5
    meta-yocto-bsp        /home/user/poky/meta-yocto-bsp  5
    
    conf/bblayers.confmeta/下面的

    meta-test/

    $ tail -n6 conf/bblayers.conf 
    BBLAYERS ?= " \
      /home/user/poky/meta \
      /home/user/poky/meta-test \
      /home/user/poky/meta-poky \
      /home/user/poky/meta-yocto-bsp \
      "    
    
    $ bitbake -e example -D | grep ^DEBUG:\\sInheriting\\s.*image-live.bbclass\\s\(from
    DEBUG: Inheriting /home/user/poky/meta/classes/image-live.bbclass (from /home/user/poky/meta-test/recipes-example/example/example.bb:3)
    

    【讨论】:

      【解决方案2】:

      2012 年在 yocto 邮件组上讨论过: https://lists.yoctoproject.org/pipermail/yocto/2012-January/004379.html

      只创建与 astor555 所写相同的类和重新排序层。您的 BSP 层将首先被解析/使用。

      【讨论】:

        【解决方案3】:

        另一种选择是将原始image-live.bbclass 复制到您自己现有的层中,并将其重命名为有意义的名称 (my-image-live.bbclass),然后在您需要的地方简单地继承它为inherit my-image-live

        【讨论】:

        • 试过了,但它不起作用。它从原始 .bbclass 中获取函数。
        猜你喜欢
        • 1970-01-01
        • 2014-01-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-06-26
        • 2011-11-12
        • 1970-01-01
        相关资源
        最近更新 更多