Warrior tegra build cicular dependencies

Hi Folks,

I’ve had a request to port meta-mender-community tegra support to warrior. I see there’s no warrior branch yet on meta-mender and I see task MEN-2511 tracking a move to warrior, which mentions issues with grub support. Since I don’t use grub on this platform I’m assuming there’s a chance I can use the master branch?

I’ve noticed a problem attempting to build with a depency loop:

    ERROR: 2485 unbuildable tasks were found.
    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 /home/dan/mender-tegra-warrior/build/../sources/meta-tegra/recipes-bsp/u-boot/u-boot-    tegra_2016.07.bb:do_install (dependent Tasks ['pseudo_git.bb:do_populate_sysroot', 'u-boot-tegra_2016.07.bb:do_create_extlinux_config', 'u-boot-tegra_2016.07.bb:do_compile', 'tegra-minimal-initramfs.bb:do_image_complete'])
    Task /home/dan/mender-tegra-warrior/build/../sources/meta-tegra/recipes-bsp/u-boot/u-boot-tegra_2016.07.bb:do_populate_sysroot (dependent Tasks ['u-boot-tegra_2016.07.bb:do_install', 'binutils-cross_2.32.bb:do_populate_sysroot'])
    Task /home/dan/mender-tegra-warrior/build/../sources/meta-tegra/recipes-core/images/tegra-minimal-initramfs.bb:do_image_complete (dependent Tasks ['tegra-minimal-initramfs.bb:do_image_cpio', 'tegra-minimal-initramfs.bb:do_image', 'tegra-minimal-initramfs.bb:do_image_ext4', 'tegra-minimal-initramfs.bb:do_image_mender', 'u-boot-tegra_2016.07.bb:do_populate_sysroot'])
    ERROR: Command execution failed: Exited with 1

Notice the tegra-minimal-initramfs.bb:do_image_mender. I’m assuming this is related.

This looks similar to the issues I had building initially, where the I used do_image_mender[noexec]=“1” to keep the do_image_mender task from being associated with tegra-minimal-initramfs, since I’m assuming this task doesn’t need to run for initramfs.

For some reason I don’t understand do_image_mender[noexec]=“1” is now being ignored. Even if I add directly to tegra-minimal-initramfs.bb I still see do_image_mender listed when I do bitbake -c listtasks tegra-minimal-initramfs. I’ve tried deltask or adding an empty task too, no difference.

My bitbake mojo is not sufficient for understanding how do_image_mender is getting added and how to prevent it from being added to this task, so I’d appreciate anyone who can help educate me on this.

You should be able to reproduce with
git clone git@github.com:Trellis-Logic/mender-tegra-warrior.git
cd mender-tegra-warrior
git submodule init
git submodule update
. setup-environment tegra
bitbake -g tegra-minimal-initramfs

Thanks for any suggestions or pointers.

Edit: @mirzak: Apply syntax highlighting

Is initramfs used when you are using Mender? I am just thinking if one workaround is to simply disable the initramfs image,

TEGRA_INITRAMFS_INITRD = "0" 

Though it seems a bit odd that " do_image_mender[noexec]=“1” worked previously as this should still keep the dependencies in tact, but not execute task according to Bitbake docs.

If you want dependencies such as these to remain intact, use the [noexec] varflag to disable the task instead of using the deltask command to delete it:

do_b[noexec] = “1”

Thanks for the response @mirzak

I believe it’s needed to build the initramfs which is a part of the tegraflash package used for initial bootstrap of the full image, unless I can use cboot instead of uboot (and using cboot instead of uboot wouldn’t be an option for Mender support). So I think I ultimately need to figure this out, although I could probably hack something together in the short term by hand editing the tegraflash file with the result of an intitramfs build without the mender layer. I’ve verified adding

gets me past the circular dependency issue.

Though it seems a bit odd that " do_image_mender[noexec]=“1” worked previously

I think you’re correct, I believe the problem with thud wasn’t the circular dependency but rather that something failed during the task execution. Nonetheless I’m not understanding why deltask doesn’t remove the dependency based on Bitbake Docs, but I’m assuming it has something to do with how and where the dependency is associated with tegra-minimal-initramfs.bb, which is the part I don’t really understand.

I’m guessing bitbake has decided there’s a dependency between tegra-minimal-initramfs.bb and IMAGE_CMD_mender(), I’m guessing through mender-artifact-native:do_populate_sysroot(?) although I don’t understand how this mapping would occur and it looks like this logic was in the thud branch as well which I just built successfully ~2 weeks ago.

I suspect it relates to this commit in meta-tegra,

U-boot now has a dependency on the Linux kernel, and the Linux kernel will have dependency initramfs and I believe this is how it ends up in the loop. Though I still do not have a good suggestions on how to fix.

I will try to reproduce based on your instructions and see what I come up with.

Actually it seems that this line is causing the dependency loop,

Which came from this commit,

Which seems to have fixed some other dependency loop problem :slight_smile:

So adding the following to the tegra-minimal-initramfs.bbappend solves the problem,

EXTRA_IMAGEDEPENDS_remove = "u-boot"

And the problem here is that we in meta-mender add an dependency to U-boot for all images,

Which then results in a circular dependency since in the Tegra case you would have the follow chain:

U-boot -> tegra-minimal-initramfs -> U-boot

Thanks @mirzak for the great detailed explanation and the pointer to EXTRA_IMAGEDEPENDS.

I’ve verified this gets me past the dependency loop and added to the working changes for warrior

I’m still confused about how do_image_mender is getting linked to tegra-minimal-initramfs. Now that I can do bitbake -g tegra-minimal-initramfs without dependency loop I can see it is indeed linked through mender-artifact-native.

cat recipe-depends.dot | grep tegra-minimal-initramfs | grep mender
"tegra-minimal-initramfs" -> "mender-artifact-native"

I guess it doesn’t really matter, but if do_image_mender[noexec]="1" is necessary and is the correct thing to do here I’ll keep it there. I’ll experiment with taking it back out once I get the full build working.

Thanks again for your help!

This line adds “mender-image” to tegra-minimal-initramfs and any other “image” that is being built

But in the end the do_mender_image command did not matter and it was not the root of what was causing the dependency loop.

You can get rid of “mender-image” by adding the following in tegra-minimal-initramfs

 IMAGE_FSTYPES_remove = "mender mender.bmap"

Thanks @mirzak for the pointer, this makes sense to me now.

Understood, and thanks. I was just trying to determine if there was a better way to handle than do_image_mender[noexec]="1" and avoid outsmarting myself again on the next release :smile:.

This seems like a better solution, I’ve implemented and verified bitbake -c listtasks tegra-minimal-initramfs now doesn’t list mender tasks at all, which is what I was expecting earlier when I didn’t fully understand how noexec worked.

The project build is now completing on warrior after a handful of additional changes in meta-mender-community and meta-tegra. However I’m not able to boot, presumably due to flash layout template changes which need to be reflected an updated mender flash template and associated local.conf template variables. Will continue to work on this and hopefully won’t need to bug you anymore.

Thanks again for your help!

1 Like