Circular dependencies issue with wic and fitImage+Initramfs - yocto

I am trying to build sd card image by using wic in Yocto. And found that it triggers error if I enable fitImage with bundle initramfs. If I disable INITRAMFS_IMAGE it works OK. How to fix this circular dependencies issue ?
ERROR: 1099 unbuildable tasks were found.##################################################################### | ETA: 0:00:05
These are usually caused by circular dependencies and any circular dependency chains found will be printed below. Increase the debug level to see a list of unbuildable tasks.
Identifying dependency loops (this may take a short while)...
ERROR:
Dependency loop #1 found:
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_assemble_fitimage_initramfs (dependent Tasks ['device-tree.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image_complete', 'linux-xlnx_2018.3.bb:do_bundle_initramfs'])
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_deploy (dependent Tasks ['linux-xlnx_2018.3.bb:do_assemble_fitimage_initramfs', 'depmodwrapper-cross_1.0.bb:do_populate_sysroot', 'linux-xlnx_2018.3.bb:do_packagedata', 'linux-xlnx_2018.3.bb:do_populate_sysroot', 'linux-xlnx_2018.3.bb:do_bundle_initramfs'])
Task /build/zynq/yocto/tiny/sources/core/meta/recipes-core/images/core-image-minimal.bb:do_image_wic (dependent Tasks ['fsbl_git.bb:do_deploy', 'mtools_4.0.18.bb:do_populate_sysroot', 'bitstream-extraction_git.bb:do_deploy', 'gptfdisk_1.0.3.bb:do_populate_sysroot', 'device-tree.bb:do_deploy', 'u-boot-zynq-uenv.bb:do_deploy', 'core-image-minimal.bb:do_image', 'core-image-minimal.bb:do_rootfs_wicenv', 'u-boot-xlnx_2018.3.bb:do_deploy', 'external-hdf.bb:do_deploy', 'linux-xlnx_2018.3.bb:do_deploy', 'dosfstools_4.1.bb:do_populate_sysroot', 'parted_3.2.bb:do_populate_sysroot', 'xilinx-bootbin_1.0.bb:do_deploy'])
Task /build/zynq/yocto/tiny/sources/core/meta/recipes-core/images/core-image-minimal.bb:do_image_complete (dependent Tasks ['u-boot-xlnx_2018.3.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image_cpio', 'core-image-minimal.bb:do_image_wic', 'u-boot-zynq-uenv.bb:do_populate_sysroot', 'xilinx-bootbin_1.0.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image'])
Dependency loop #2 found:
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_assemble_fitimage_initramfs (dependent Tasks ['device-tree.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image_complete', 'linux-xlnx_2018.3.bb:do_bundle_initramfs'])
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_deploy (dependent Tasks ['linux-xlnx_2018.3.bb:do_assemble_fitimage_initramfs', 'depmodwrapper-cross_1.0.bb:do_populate_sysroot', 'linux-xlnx_2018.3.bb:do_packagedata', 'linux-xlnx_2018.3.bb:do_populate_sysroot', 'linux-xlnx_2018.3.bb:do_bundle_initramfs'])
Task /build/zynq/yocto/tiny/sources/core/meta/recipes-core/images/core-image-minimal.bb:do_image_wic (dependent Tasks ['fsbl_git.bb:do_deploy', 'mtools_4.0.18.bb:do_populate_sysroot', 'bitstream-extraction_git.bb:do_deploy', 'gptfdisk_1.0.3.bb:do_populate_sysroot', 'device-tree.bb:do_deploy', 'u-boot-zynq-uenv.bb:do_deploy', 'core-image-minimal.bb:do_image', 'core-image-minimal.bb:do_rootfs_wicenv', 'u-boot-xlnx_2018.3.bb:do_deploy', 'external-hdf.bb:do_deploy', 'linux-xlnx_2018.3.bb:do_deploy', 'dosfstools_4.1.bb:do_populate_sysroot', 'parted_3.2.bb:do_populate_sysroot', 'xilinx-bootbin_1.0.bb:do_deploy'])
Task /build/zynq/yocto/tiny/sources/core/meta/recipes-core/images/core-image-minimal.bb:do_image_complete (dependent Tasks ['u-boot-xlnx_2018.3.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image_cpio', 'core-image-minimal.bb:do_image_wic', 'u-boot-zynq-uenv.bb:do_populate_sysroot', 'xilinx-bootbin_1.0.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image'])
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_bundle_initramfs (dependent Tasks ['linux-xlnx_2018.3.bb:do_install', 'core-image-minimal.bb:do_image_complete'])
Dependency loop #3 found:
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_bundle_initramfs (dependent Tasks ['linux-xlnx_2018.3.bb:do_install', 'core-image-minimal.bb:do_image_complete'])
Task /build/zynq/yocto/tiny/sources/core/../meta-xilinx/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx_2018.3.bb:do_deploy (dependent Tasks ['linux-xlnx_2018.3.bb:do_assemble_fitimage_initramfs', 'depmodwrapper-cross_1.0.bb:do_populate_sysroot', 'linux-xlnx_2018.3.bb:do_packagedata', 'linux-xlnx_2018.3.bb:do_populate_sysroot', 'linux-xlnx_2018.3.bb:do_bundle_initramfs'])
Task /build/zynq/yocto/tiny/sources/core/meta/recipes-core/images/core-image-minimal.bb:do_image_wic (dependent Tasks ['fsbl_git.bb:do_deploy', 'mtools_4.0.18.bb:do_populate_sysroot', 'bitstream-extraction_git.bb:do_deploy', 'gptfdisk_1.0.3.bb:do_populate_sysroot', 'device-tree.bb:do_deploy', 'u-boot-zynq-uenv.bb:do_deploy', 'core-image-minimal.bb:do_image', 'core-image-minimal.bb:do_rootfs_wicenv', 'u-boot-xlnx_2018.3.bb:do_deploy', 'external-hdf.bb:do_deploy', 'linux-xlnx_2018.3.bb:do_deploy', 'dosfstools_4.1.bb:do_populate_sysroot', 'parted_3.2.bb:do_populate_sysroot', 'xilinx-bootbin_1.0.bb:do_deploy'])
Task /build/zynq/yocto/tiny/sources/core/meta/recipes-core/images/core-image-minimal.bb:do_image_complete (dependent Tasks ['u-boot-xlnx_2018.3.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image_cpio', 'core-image-minimal.bb:do_image_wic', 'u-boot-zynq-uenv.bb:do_populate_sysroot', 'xilinx-bootbin_1.0.bb:do_populate_sysroot', 'core-image-minimal.bb:do_image'])

In your initramfs image recipe (the one specified in INITRAMFS_IMAGE), remove wic as an IMAGE_FSTYPE. This should remove it only for the initramfs image, and allow your main image still to build wic images.
IMAGE_FSTYPES_remove = " wic wic.gz"

Related

BitBake - what defines the order of tasks for a recipe?

Is there a way to list the order of tasks that shall be executed when a recipe is built with BitBake? I know I can build the recipe and then inspect log.task_order, but that's not what I'm after - I want to know where is the order of tasks defined for given recipe, without actually building it. I also know that there's bitbake <recipe_name> -c listtasks, but AFAIK, that lists all the available tasks, regardless if they are actually executed during the build.
Update:
The recipe I'm interested in is the kernel recipe, this is how its log.task_order looks like after a full clean build:
do_fetch
do_unpack
do_prepare_recipe_sysroot
do_kernel_checkout
do_symlink_kernsrc
do_validate_branches
do_kernel_metadata
do_patch
do_kernel_version_sanity_check
do_populate_lic
do_kernel_configme
do_configure
do_kernel_configcheck
do_compile
do_shared_workdir
do_kernel_link_images
do_compile_kernelmodules
do_strip
do_sizecheck
do_install
do_populate_sysroot
do_package
do_packagedata
do_package_qa
do_package_write_ipk
do_bundle_initramfs
do_deploy
I would expect that this sequence is defined somewhere in the recipe metadata, but I haven't found it.

Yocto: ROOTFS_POSTPROCESS_COMMAND and do_rootfs

I have a task which has a dependency set as below:
bb.build.addtask('do_function2', 'do_build', 'do_rootfs', d)
There is another task do_function1 that modifies some files in the rootfs:
ROOTFS_POSTPROCESS_COMMAND_append = " do_function1;"
I require do_function2 to be triggered only after rootfs for the image has been populated.
Query is whether the tasks that come under ROOTFS_POSTPROCESS_COMMANDS_append satisfy the do_rootfs dependency that I have set up in the addtask() call?
I want do_function2 to run only after do_function1. Is that the case even if do_function1 is specified under ROOTFS_POSTPROCESS_COMMAND_append?

Can psake ignore dependent tasks?

In PSake, is there an option to request that dependent tasks are not not run. For example:
In a build script, Build.ps1:
Task T1 {}
Task T2 -depends T1 {}
Is it possible to do Invoke-psake .\Build.ps1 T2 -ignoredependencies?
The reason for this is that with large projects, testing of tasks that have large number of dependencies (directly or indirectly) takes a long time since all the the dependencies are rebuilt but generally do not need.

How do I skip a rake task

Consider the following Rake tasks:
task deploy => [:package] do
end
task package => [:build] do
end
task build do
end
Is there a way to invoke Rake on the command line to execute the package and deploy tasks, but not the build task?
Short answer, no.
The way I usually go about this is instead of using the dependant task notion like you have above:
task deploy => [:package] do
end
I create an alias task for whatever action that is to be completed:
task all => [:build, :package, :deploy]
task fastDeploy => [:package, :deploy]
task deploy do
end
task package do
end
task build do
end
It's not very elegant, but I do find it to be more readable and you can visibly see the dependency of tasks on other tasks instead of the kind of spaghetti code structure the dependant notion can result in... when you have a lot of task it can be awkward to debug the logic to figure what's gone wrong and where at times.
Hope this helps.

Filtering available Gradle tasks by task group

With the command gradle tasks one can get a report of all available tasks. Is there any way to add a parameter to this command and filter tasks by their task group.
I would like to issue a command like gradle tasks group:Demo to filter all tasks and retrieve a list of only those tasks that belong to the task group called Demo.
From v5.1, you can do this: gradle tasks --group=<group-name>
Gradle docs.
You can do so by adding the following task to your build script:
task showOnlyMyTasks << {
tasks.each {
task -> if (task.group == 'My task group name') {
println(task.name)
}
}
}
And then run:gradle showOnlyMyTasks
If you need only the list, you can use gradle -q
Old answer: There is no such feature. Feel free to suggest new features at http://forums.gradle.org.
Now available since Gradle 5.1, see this answer: https://stackoverflow.com/a/54341658/4433326