Preloading images onto devices at the factory and configuring them for specific deployment

I’m familiar with the Resin dashboard “Add a new device” flow for my application which allows me to download the resinOS image for my application and to create a device.

And I’m familiar with the steps of flashing the USB key and provisioning the device.

I see the Resin CLI Preload command which allows me to then update the image to the latest build of my application.

But I haven’t yet found how to create multiple devices at once for shipping from the factory. Does the provision step work if I provision multiple physical devices with the same image? Does the resin server automatically add all of the devices to the application dashboard?

There is a related topic in Preloading Images with Application - Still requires registering!? but the statement:

With a connection to the internet the device registers itself on the registry / dashboard and the application is starting immediately.

Doesn’t specify which code, resinOS or app, is doing the registration.

1 Like

I’m very much interested in this question.

Will this related question be answered first?

Seems like this is answered here:

TL;DR: the image is configured with a generic provisioning key for your application, which each device trades for a device-specific API key on first boot.

Before first boot when the image is flashed, it appears that the device pops up as “Not-Provisioned” with a UUID already assigned.

So there doesn’t appear to be a simple way to just not boot up the hard drive once it is flashes, copy it to multiple drives, and then run the “first boot”. I might be wrong though but that is just what I experienced during my flashing.

@jason10 to create multiple devices in the factory, you can take a resinOS image, use the preloader to add your latest code, then flash that .img on to hundreds of SD cards or eMMC, when the devices boot up, they will do the key exchange and provision in the application. The registration will either happen in the os here or in the supervisor as a redundancy here

On the topic of mass provisioning lots of devices we also have a blog post here: which walks through some other work flows like pre-registering cloud entities before the hardware is even available, so that would be worth looking at as well.

1 Like

Thanks @shaunmulligan - after I’d gone a few steps away from the “getting started” flow of

  • using the resin dashboard to create a new app and device
  • using the resin dashboard to download the initial resinOS image
  • using git or the resin cli to make changes to my app and deploy them to the device

it wasn’t clear how to get an image that could be flashed on new devices. After trying the resin preload command I see now how it takes prompts for the application name and release tag (with options presented) and can take the original resinOS.img that I had downloaded and update it to the latest version of my app.