# How to provision a device with an existing artifact

**URL:** <https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151>\
**Category:** General Discussions\
**Tags:** yocto, mender, mender-artifact, raspberry-pi-4\
**Created:** [August 25, 2023, 4:09pm UTC](https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151 "2023-08-25T16:09:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atsss](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/atsss/32/1985_2.png) [@atsss](https://hub.mender.io/u/atsss)\
**Post date:** [August 25, 2023, 4:09pm UTC](https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151/1 "2023-08-25T16:09:26Z")

</div>

Hi.

I’m planning to move from Balena to Mender now. Then I’m looking for how to provision a device with an existing artifact.

I’m using Raspberry Pi 4 and Yocto for building OS. What I want to do is run our application code soon after I insert the flashed SD card. The following command is what I do in Balena.

```auto
balena preload balena-rpi4.img --fleet my-fleet --commit my-commit

```

I was thinking I could integrate my existing artifact into my custom image which I built with Yocto somehow but I couldn’t find the way.

Any help would be useful. Thank you in advance.

---

<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:** [August 25, 2023, 7:33pm UTC](https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151/2 "2023-08-25T19:33:33Z")

</div>

Hi @atsss,

Why not just add your application to the Yocto build? Write a recipe for it, so it is integrated straight away. No magic needed. 🙂

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![atsss](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/atsss/32/1985_2.png) [@atsss](https://hub.mender.io/u/atsss)\
**Post date:** [August 28, 2023, 8:21am UTC](https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151/3 "2023-08-28T08:21:52Z")

</div>

Hi @TheYoctoJester

Thank you for your response.

I was expecting any solution provided by Mender because I guess it’s a common issue for embedded systems.

Are there any ways prepared by Meneder itself like passing a parameter or things like that?

Thanks

Ats

---

<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:** [August 28, 2023, 9:08am UTC](https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151/4 "2023-08-28T09:08:29Z")

</div>

Hi @atsss,

No, there are no means for an Artifact to be magically Pre-installed. The artifact format is extremely versatile, it can

- include arbitrary scripts that execute, including network calls and hardware dependent operations
- be of a type that the Mender client does not handle itself, for example if you use an Update Module

Hence we do not provide a way to do an offline install. If you are Yocto based and your Artifact is so simple that it does allow an offline install, then writing a recipe to unpack and install the files is very easy, and offers the additional benefit of reproducibility. If you need to add information for dependency tracking, then you can also pass that to the final artifact creation by using `https://docs.mender.io/operating-system-updates-yocto-project/variables#mender_artifact_extra_args`

Alternatively, you can automate the first installation through the device authorization [webhook](https://docs.mender.io/server-integration/webhooks)

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![atsss](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/atsss/32/1985_2.png) [@atsss](https://hub.mender.io/u/atsss)\
**Post date:** [August 29, 2023, 5:15pm UTC](https://hub.mender.io/t/how-to-provision-a-device-with-an-existing-artifact/6151/5 "2023-08-29T17:15:44Z")

</div>

Hi @TheYoctoJester

Thank you for your answer.

Sounds like adding my custom layer is a simple way.

Thank you so much

Ats
