meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sw:yocto:bitbake:tips [2025/05/08 09:58] niziaksw:yocto:bitbake:tips [2025/11/18 10:16] (current) niziak
Line 2: Line 2:
  
   * [[https://stackoverflow.com/questions/51002891/overwriting-yocto-classes-through-meta-layer|Overwriting Yocto Classes through meta-layer]]   * [[https://stackoverflow.com/questions/51002891/overwriting-yocto-classes-through-meta-layer|Overwriting Yocto Classes through meta-layer]]
 +
 +===== manual patching =====
 +
 +According to ''src/poky/meta/classes-recipe/kernel-yocto.bbclass'' kernel patches are skipped if 'patchdir' exists.
 +``kernel-yocto.bbclass`` cannot handle this special case so patches needs to be applied manually.
 +
 +<code bash>
 +OVERLAY_PREFIX="${SOURCE_PREFIX}/linux_5_15/overlay"
 +SRC_URI:append = " \
 +        file://0003-xxx.patch;patchdir=${OVERLAY_PREFIX};subdir=${OVERLAY_PREFIX} \
 +        file://0004-xxx.patch;patchdir=${OVERLAY_PREFIX};subdir=${OVERLAY_PREFIX} \
 +"
 +
 +do_patch:prepend() {
 +    patch -b -d ${OVERLAY_PREFIX} -p 1 -i 0003-xxx.patch
 +    patch -b -d ${OVERLAY_PREFIX} -p 1 -i 0004-xxx.patch
 +}
 +</code>
 +
 +It is possible to use generic Yocto patcher and call <code python>bb.build.exec_func('patch_do_patch', d)</code>
 +as it is performed by recipes: 
 +  * ''src/meta-openembedded/meta-oe/recipes-multimedia/id3lib/id3lib_3.8.3.bb''
 +  * ''src/meta-openembedded/meta-networking/recipes-support/netcat/netcat-openbsd_1.195.bb''
 +
 +===== black list recipe =====
 +
 +  * create bbappend and set ''COMPATIBLE_MACHINE = "x"'' to prevent use of recipe
 +  * BBMASK
 +    * <code bash>BBMASK += "meta-rity/meta/recipes-core/init-ifupdown/init-ifupdown_%.bbappend"</code>
 +
 +===== Pass env variables to bitbake =====
 +
 +To control additional or user defined recipe's variables from env (usefull for CI) add variables to ''BB_ENV_PASSTHROUGH_ADDITIONS'':
 +<code bash>
 +export foo="BAR"
 +export BB_ENV_PASSTHROUGH_ADDITIONS="${BB_ENV_PASSTHROUGH_ADDITIONS} foo BUILD_VERSION CI_COMMIT_BRANCH CI_COMMIT_SHORT_SHA"
 +bitbake ...
 +</code>
 +
 +
 +
  
 ===== add files to rootfs ===== ===== add files to rootfs =====