简体   繁体   English

如何在 yocto 任务列表的末尾添加自定义 bitbake 任务? 我希望自定义任务在构建图像时作为最后一个任务运行

[英]How to add a custom bitbake task at the end of task list in yocto? I want the custom task to run as the last task while building the image

I want to add a task in bitbake which is supposed to run after a task but not before any task.我想在 bitbake 中添加一个任务,该任务应该在任务之后而不是在任何任务之前运行。 In other words, I want the custom task to run as the last task while building the image.换句话说,我希望自定义任务在构建图像时作为最后一个任务运行。

Example:例子:

I have two tasks named do_task_A() and do_task_B().我有两个名为 do_task_A() 和 do_task_B() 的任务。 Now, I want do_task_B() to execute after do_task_A().现在,我希望 do_task_B() 在 do_task_A() 之后执行。

    do_task_A() {
        ..........
        ..........
        ..........
    }
    addtask task_A
    
    do_task_B() {
        ..........
        ..........
        ..........
    }
    addtask task_B after do_task_A

The above snippet ensures that task_B if executed, gets executed after task_A.上面的代码片段确保 task_B 如果执行,则在 task_A 之后执行。 However it does not guarantee the execution of task_B.但是它不保证 task_B 的执行。

This requirement is that do_task_B() must run as the last task when the image is built.这个要求是 do_task_B() 必须在构建镜像时作为最后一个任务运行。

Things that I have already tried:我已经尝试过的事情:

  1. addtask task_B after do_task_A before do_build在 do_task_A 之后在 do_build 之前添加任务 task_B
  2. addtask task_B after do_task_A before do_image在 do_task_A 之后在 do_image 之前添加任务 task_B
  3. addtask task_B after do_task_A before do_image_complete在 do_task_A 之后在 do_image_complete 之前添加任务 task_B

The above methods (1-3) failed due to circular dependency上述方法(1-3)因循环依赖而失败

  1. Adding task_B as a postfuncs for an existing task (ensuring all the dependencies are satisfied)添加 task_B 作为现有任务的 postfuncs(确保满足所有依赖项)
  2. Added task_B as a function inside another function在另一个 function 中添加 task_B 作为 function
  3. Used bb.build.exec_func('task_B',d) inside a task/function that is successfully being executed.在成功执行的任务/函数中使用了 bb.build.exec_func('task_B',d) 。

The above methods (4-6) failed with Exception: IndexError: list index out of range上述方法(4-6)失败并出现异常:IndexError:列表索引超出范围

Is there any way to forcefully run task_B while building an image?有没有什么办法可以在构建镜像的时候强行运行task_B? I want do_task_B() to get executed by default, and not by using bitbake -c <task_name> <image_name>我希望 do_task_B() 默认执行,而不是使用 bitbake -c <task_name> <image_name>

build is the final task, so you have to set: build 是最后的任务,所以你必须设置:

addtask do_task_A after do_deploy before do_build
addtask do_task_B after do_task_A before do_build

Maybe you can take a look here: How can I add a task after do_deploy()?也许你可以看看这里: How can I add a task after do_deploy()?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Yocto错误:do_package任务中构建libreoffice软件包失败 - Yocto error: Building libreoffice package fails in do_package task BitBake中的任务do_patch()期间失败 - Failure during task do_patch() in BitBake Yocto一次只执行一项任务 - Yocto runs only one task inside at a time TOOLCHAIN_HOST_TASK 与 TOOLCHAIN_TARGET_TASK - TOOLCHAIN_HOST_TASK Vs TOOLCHAIN_TARGET_TASK 向 Yocto 生成的自定义 Linux 映像添加新的内核参数 - Add New Kernel Parameter To Custom Linux Image Generated By Yocto Linux RTOS sleep()-定时器任务的wakeup() - Linux RTOS sleep() - wakeup() for timer task 任务 415 (virtual:native:/home/user/Yocto/Poky/poky/meta/recipes-devtools/automake/automake_1.15.bb, do_compile) 失败,退出代码为“1” - Task 415 (virtual:native:/home/user/Yocto/Poky/poky/meta/recipes-devtools/automake/automake_1.15.bb, do_compile) failed with exit code '1' 如何在使用 Yocto Project for BeagleBone Black 构建映像之前配置 GPIO - How do I configure the GPIO before building the image with Yocto Project for BeagleBone Black yocto 自定义映像将 defconfig 更改应用到 kernel 构建 - yocto custom image apply defconfig changes to kernel build 添加条目到task_struct并初始化为默认值 - Adding entry to task_struct and initializing to default value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM