How to modify a ResinOS img to switch from an app to an other

support

#1

When downloading a new ResinOS image preconfigured for your application, you have the “advanced” option to “Download configuration file only”.

I guess this option allow you to reuse a downloaded image for an other application without downloading again the full 1.8 Go (I know it’s compressed during download, but still).

Is there a doc somewhere on how to use this configuration file on an existing image ? Do you have to edit it (name and/or content) ? What would be the software to mount and edit the .img file without flashing it on a microSD card ?


#2

@Tristan107 You have a few options:

  • burn your image, take the downloaded appnicationslug.config.json and replace the config.json on the SD card or USB stick that you’ve burned to (resin-boot partition). Just have to make sure that the image and the configuration are for the same device types.
  • burn your image, and run the resin-cli to inject the configuration: sudo resin config inject appnicationslug.config.json --type devicetype and it will prompt you for your SD card or USB stick path
  • you can modify the image to put the config.json there, replacing the one that it was downloaded with: take the image file and mount the resin-boot partition from there (recommend using kpartx -a resin-applicationslug-xyz.img), and copy the appnicationslug.config.json there over the config.json. Unmount and detach with kpartx -d ...., and then when you burn the file, you will get devices for that application.

How are these? And yeah, we’ll need to document more of the nitty-gritty of these advanced options and their usage.

Btw, the compressed image is on the order of ~140MB for the Pi for example, you can choose to download the .gz images for example to see that - it’s the same compression just explicitly. Or you can choose .zip compression there too.


#3

Ok, thanks for this quick and complete answer !

Just one more thing : Does the downloaded file has to be renamed to config.json to be recognized or any file with *.config.json naming pattern is ok ?


#4

It has to be config.json. Naturally there can be only one config file for one device / one SD card, so it has a fixed name.