简体   繁体   中英

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. 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(). Now, I want do_task_B() to execute after 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. However it does not guarantee the execution of task_B.

This requirement is that do_task_B() must run as the last task when the image is built.

Things that I have already tried:

  1. addtask task_B after do_task_A before do_build
  2. addtask task_B after do_task_A before do_image
  3. addtask task_B after do_task_A before do_image_complete

The above methods (1-3) failed due to circular dependency

  1. Adding task_B as a postfuncs for an existing task (ensuring all the dependencies are satisfied)
  2. Added task_B as a function inside another function
  3. Used bb.build.exec_func('task_B',d) inside a task/function that is successfully being executed.

The above methods (4-6) failed with Exception: IndexError: list index out of range

Is there any way to forcefully run task_B while building an image? I want do_task_B() to get executed by default, and not by using bitbake -c <task_name> <image_name>

build is the final task, so you have to set:

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()?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM