title: How to override the defined task order in a yocto recipe?
body: <p>First some context with my problem: </p>
  
  <p>I am trying to add some patches to modify some device trees from the source code used in linux-msm-4.4_git.bb recipe (which can be found in the <a href="https://github.com/mcharleb/meta-qti-bsp" rel="nofollow noreferrer">meta-qti-bsp</a> layer).</p>
  
  <p>My linux-msm-4.4_git.bbappend looks like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>FILESEXTRAPATHS_append := "${THISDIR}/files:"
  
  SRC_URI += " file://0001-patching-dts-stuff_1.patch"
  SRC_URI += " file://0002-patching-dts-stuff_2.patch"
  SRC_URI += " file://0003-patching-dts-stuff_3.patch"
  SRC_URI += " file://0004-patching-dts-stuff_4.patch"
  SRC_URI += " file://0005-patching-dts-stuff_5.patch"
  SRC_URI += " file://0006-patching-dts-stuff_6.patch"
  SRC_URI += " file://0007-patching-dts-stuff_7.patch"
  SRC_URI += " file://0008-patching-dts-stuff_8.patch"
  SRC_URI += " file://0009-patching-dts-stuff_9.patch"
  </code></pre>
  
  <p>But when I add my layer to the build/conf/bblayers.conf the recipe fails during the task <strong>do_shared_workdir</strong> because it doesn't find the <strong>certs/signing_key.pem</strong> file.</p>
  
  <p>Trying to solve that error I found the following information:</p>
  
  <p>meta-qti-bsp is slightly modified from the one that can be found in it's <a href="https://github.com/mcharleb/meta-qti-bsp" rel="nofollow noreferrer">repo</a> (I received the code in a zip file, so I don't know how many changes to externally maintained layers are made).</p>
  
  <p>I followed all includes, inheritances and requires from the recipe in order to know what was happening:
  <a href="https://i.stack.imgur.com/6kPa3.jpg" rel="nofollow noreferrer">Here is an image of that.</a></p>
  
  <p>And I discovered that do_shared_workdir is overridden from kernel.bbclass.</p>
  
  <p>When my layer <strong>is not</strong> included and I launch <strong>bitbake linux-msm-4.4</strong>, the execution order of the tasks is:</p>
  
  <ul>
  <li>fetch</li>
  <li>unpack</li>
  <li>prepare_recipe_sysroot</li>
  <li>unpack</li>
  <li>patch</li>
  <li>configure</li>
  <li>populate_lic</li>
  <li>compile</li>
  <li>shared_workdir</li>
  <li>kernel_link_images</li>
  </ul>
  
  <p>When my layer is included <strong>shared_workir</strong> and <strong>kernel_link_images</strong> are always swapped in execution order.</p>
  
  <p>So I tried if doing "<strong>addtask shared_workdir after do_compile before kernel_link_images</strong>" in my <strong>.bbappend</strong> overrides the "<strong>addtask shared_workdir after do_compile before do_compile_kernelmodules</strong>" from <strong>kernel.bbclass</strong>, to enforce the task order that doesn't end in error, which did not.</p>
  
  <p>Modifying it in kernel.bbclass <strong>did</strong> solve the error, but I would rather not have to make changes in layers that are not maintained by me.</p>
  
  <p>My main question:</p>
  
  <ul>
  <li>Is there a way to enforce the correct task order from my layer?</li>
  </ul>
  
  <p>Another question which I would like to know the response in order to further understand the yocto framework:</p>
  
  <p>If I created the layer using the command <strong>bitbake-layers add-layer meta-mylayer</strong>. I just added the same structure of recipes-*/<em>recipe-name</em>/<em>recipe</em>.bbappend that in the original layer, and this bbappend and it's files/<em>patches</em> are the only thing added by me. This patches and recipe do not define changes to task execution order.</p>
  
  <ul>
  <li>Why adding my layer causes the change of order in which this tasks are executed?</li>
  </ul>