# Mender Integration failed while do\_image\_sdimage

**URL:** <https://hub.mender.io/t/mender-integration-failed-while-do-image-sdimage/6258>\
**Category:** Yocto Project\
**Tags:** yocto, nxp, wic, kirkstone, wks\
**Created:** [October 11, 2023, 3:09pm UTC](https://hub.mender.io/t/mender-integration-failed-while-do-image-sdimage/6258 "2023-10-11T15:09:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![annalenamarx](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/annalenamarx/32/2035_2.png) [@annalenamarx](https://hub.mender.io/u/annalenamarx)\
**Post date:** [October 11, 2023, 3:09pm UTC](https://hub.mender.io/t/mender-integration-failed-while-do-image-sdimage/6258/1 "2023-10-11T15:09:28Z")

</div>

# Board description

Custom board based on Phyboard Pollux by Phytec.

URL: [Phyboard Pollux](https://www.phytec.eu/en/produkte/single-board-computer/phyboard-pollux/)

# Issue

The actual integration of Mender on Yocto (kirkstone) seems to work fine, until it comes to the pretty much last step: `do_image_sdimg`.

There, the wic creation fails with the following error:

```auto
| INFO: Creating image(s)...
| 
| Traceback (most recent call last):
| File "/work/layers/poky/scripts/lib/wic/filemap.py", line 457, in get_mapped_ranges
| first_prev, last_prev = next(iterator)
| StopIteration
| 
| The above exception was the direct cause of the following exception:
| 
| Traceback (most recent call last):
| File "/work/layers/poky/scripts/wic", line 547, in <module>
| sys.exit(main(sys.argv[1:]))
| File "/work/layers/poky/scripts/wic", line 542, in main
| return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands)
| File "/work/layers/poky/scripts/lib/wic/help.py", line 83, in invoke_subcommand
| subcmd[0](args, usage)
| File "/work/layers/poky/scripts/wic", line 222, in wic_create_subcommand
| engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
| File "/work/layers/poky/scripts/lib/wic/engine.py", line 190, in wic_create
| plugin.do_create()
| File "/work/layers/poky/scripts/lib/wic/plugins/imager/direct.py", line 98, in do_create
| self.create()
| File "/work/layers/poky/scripts/lib/wic/plugins/imager/direct.py", line 185, in create
| self._image.prepare(self)
| File "/work/layers/poky/scripts/lib/wic/plugins/imager/direct.py", line 363, in prepare
| part.prepare(imager, imager.workdir, imager.oe_builddir,
| File "/work/layers/poky/scripts/lib/wic/partition.py", line 185, in prepare
| plugin.do_prepare_partition(self, srcparams_dict, creator,
| File "/work/layers/poky/scripts/lib/wic/plugins/source/rawcopy.py", line 95, in do_prepare_partition
| sparse_copy(src, dst)
| File "/work/layers/poky/scripts/lib/wic/filemap.py", line 539, in sparse_copy
| for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):
| RuntimeError: generator raised StopIteration
| WARNING: exit code 1 from a shell command.
| + bb_sh_exit_handler
| + ret=1
| + [1 != 0]
| + echo WARNING: exit code 1 from a shell command.
| + exit 1
ERROR: Task (/build/../work/layers/poky/meta/recipes-core/images/core-image-minimal.bb:do_image_sdimg) failed with exit code '1'

```

The files to be flashed as named in the generated wks file exist.

Do you have any hint what’s wrong here?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [October 13, 2023, 7:43am UTC](https://hub.mender.io/t/mender-integration-failed-while-do-image-sdimage/6258/2 "2023-10-13T07:43:23Z")

</div>

Hi @annalenamarx,

Sorry to hear you’re having problems with the integration. Not sure if it helps in your specific situation, but here are some ideas:

- the most common problem in the `do_image_sdimg` task is the `u-boot.env` file not being created
- this points at the `u-boot` patches not being applied properly, specifically this one
- check if the `MENDER_UBOOT_AUTO_CONFIGURE` flag is set accordingly: “0” if you maintain a custom patch set, “1” if you want to use the generic one
- check if `mender-uboot` is set in MENDER\_FEATURES\_ENABLE"
- if the BSP in question adds additional “magic” to the `u-boot` build process, make sure it does not conflict and the patches are applied cleanly. If in doubt, inspect the resulting source directory. Under some circumstances, layer priorities or ordering seem to have negative effects here.

Hope this helps, let me know if I can do something else!  
Josef

---

<div class="post-metadata">

**Author:** ![annalenamarx](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/annalenamarx/32/2035_2.png) [@annalenamarx](https://hub.mender.io/u/annalenamarx)\
**Post date:** [October 16, 2023, 8:40am UTC](https://hub.mender.io/t/mender-integration-failed-while-do-image-sdimage/6258/3 "2023-10-16T08:40:51Z")

</div>

Hi @TheYoctoJester

it was caused by another layer with higher priority which interferred with meta-mender.

Best,  
Anna
