# Warrior tegra build cicular dependencies

**URL:** <https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757>\
**Category:** General Discussions\
**Tags:** tegra, warrior\
**Created:** [June 27, 2019, 4:23am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757 "2019-06-27T04:23:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwalkes](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dwalkes/32/41_2.png) [@dwalkes](https://hub.mender.io/u/dwalkes)\
**Post date:** [June 27, 2019, 4:23am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/1 "2019-06-27T04:23:59Z")

</div>

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](https://tracker.mender.io/browse/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:

```auto
    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”](https://github.com/mendersoftware/meta-mender-community/blob/thud/meta-mender-tegra/recipes-core/images/tegra186-minimal-initramfs.bbappend#L1) 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](https://github.com/madisongh/meta-tegra/blob/warrior/recipes-core/images/tegra-minimal-initramfs.bb) I still see do\_image\_mender listed when I do `bitbake -c listtasks tegra-minimal-initramfs`. I’ve tried [deltask](https://www.yoctoproject.org/docs/latest/bitbake-user-manual/bitbake-user-manual.html#deleting-a-task) 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](mailto: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

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 27, 2019, 9:41am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/2 "2019-06-27T09:41:11Z")

</div>

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

```auto
TEGRA_INITRAMFS_INITRD = "0" 

```

Though it seems a bit odd that " [do\_image\_mender[noexec]=“1”](https://github.com/mendersoftware/meta-mender-community/blob/thud/meta-mender-tegra/recipes-core/images/tegra186-minimal-initramfs.bbappend#L1) worked previously as this should still keep the dependencies in tact, but not execute task according to [Bitbake docs](https://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#deleting-a-task).

> 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”

---

<div class="post-metadata">

**Author:** ![dwalkes](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dwalkes/32/41_2.png) [@dwalkes](https://hub.mender.io/u/dwalkes)\
**Post date:** [June 28, 2019, 3:26am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/3 "2019-06-28T03:26:57Z")

</div>

Thanks for the response @mirzak

> [@mirzak](#):
>
> Is initramfs used when you are using Mender?

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

> [@mirzak](#):
>
> ```auto
> TEGRA_INITRAMFS_INITRD = "0" 
> 
> ```

gets me past the circular dependency issue.

> Though it seems a bit odd that " [do\_image\_mender[noexec]=“1” ](https://github.com/mendersoftware/meta-mender-community/blob/thud/meta-mender-tegra/recipes-core/images/tegra186-minimal-initramfs.bbappend#L1) 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](https://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#deleting-a-task), 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](https://github.com/madisongh/meta-tegra/blob/warrior/recipes-core/images/tegra-minimal-initramfs.bb) and [IMAGE\_CMD\_mender()](https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/classes/mender-artifactimg.bbclass#L21), I’m guessing through [mender-artifact-native:do\_populate\_sysroot](https://github.com/mendersoftware/meta-mender/blob/b84f89e1a2bbc25eacd1c1eee2c97d370596fda7/meta-mender-core/classes/mender-artifactimg.bbclass#L13)(?) although I don’t understand how this mapping would occur and [it looks like this logic was in the thud branch as well](https://github.com/mendersoftware/meta-mender/commit/760ed3035353536d2e380bc2ad14e8ed045c6c34) which I just built successfully ~2 weeks ago.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 28, 2019, 7:08am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/4 "2019-06-28T07:08:42Z")

</div>

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

> <https://github.com/madisongh/meta-tegra/commit/2cb3d4a2b58147b18246acc402a6f5a21ee34a58#diff-a59fcb9470971d01a73271978e305378>

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.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 28, 2019, 7:22am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/5 "2019-06-28T07:22:25Z")

</div>

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

> <https://github.com/madisongh/meta-tegra/blob/warrior/recipes-bsp/u-boot/u-boot-tegra-common-2016.07.inc#L37>

Which came from this commit,

> <https://github.com/madisongh/meta-tegra/commit/d377317bfc3bd3e9365602d91e3fdeb5960de07d#diff-1a0692206731e8b8f30653280c3d070a>

Which seems to have fixed some other dependency loop problem 🙂

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 28, 2019, 7:54am UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/6 "2019-06-28T07:54:58Z")

</div>

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

```auto
EXTRA_IMAGEDEPENDS_remove = "u-boot"

```

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

> <https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/classes/mender-setup-uboot.inc#L1>

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

---

<div class="post-metadata">

**Author:** ![dwalkes](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dwalkes/32/41_2.png) [@dwalkes](https://hub.mender.io/u/dwalkes)\
**Post date:** [June 28, 2019, 2:17pm UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/7 "2019-06-28T14:17:37Z")

</div>

Thanks @mirzak for the great detailed explanation and the pointer to [EXTRA\_IMAGEDEPENDS](https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-EXTRA_IMAGEDEPENDS).

I’ve verified this gets me past the dependency loop and added to the [working changes for warrior](https://github.com/Trellis-Logic/meta-mender-community/commit/befef06b6f4d50f29f0525a73256ac05c0637e28)

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!

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 28, 2019, 6:40pm UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/8 "2019-06-28T18:40:17Z")

</div>

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

> <https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/classes/mender-setup-image.inc#L1>

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"
```

---

<div class="post-metadata">

**Author:** ![dwalkes](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dwalkes/32/41_2.png) [@dwalkes](https://hub.mender.io/u/dwalkes)\
**Post date:** [June 30, 2019, 2:11pm UTC](https://hub.mender.io/t/warrior-tegra-build-cicular-dependencies/757/9 "2019-06-30T14:11:36Z")

</div>

> [@mirzak](#):
>
> This line adds “mender-image” to `tegra-minimal-initramfs` and any other “image” that is being built

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

> [@mirzak](#):
>
> 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.

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 😄.

> [@mirzak](#):
>
> You can get rid of “mender-image” by adding the following in `tegra-minimal-initramfs`
> 
> Copy
> 
> ```auto
> IMAGE_FSTYPES_remove = "mender mender.bmap"
> 
> ```

This seems like a better solution, [I’ve implemented](https://github.com/Trellis-Logic/meta-mender-community/commit/fcb079760a73b7ec1b9128616871db3fdb4fa22b) 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](https://github.com/Trellis-Logic/mender-tegra-warrior) after a handful of additional changes in [meta-mender-community](https://github.com/Trellis-Logic/meta-mender-community/commits/warrior) and [meta-tegra](https://github.com/Trellis-Logic/meta-tegra/commits/warrior). However I’m not able to boot, presumably due to [flash layout template changes](https://github.com/Trellis-Logic/meta-mender-community/commit/9df77a949e5b8fdf08b089cb56dd794a768c85d8) 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!
