How to put the config.json generated from Resin Dashboard to the compiled image when build?

I wanted to put the {applicationName}.config.json generated from Resin.io Dashboard into the custom built generated image resin-image-flasher-beaglebone.resinos-img then release it to other people.

My current approach is write the image to sdcard, copy the config.json in and then read it back to the disk image form but there should be a better way to do this? preferably while build the image so I can make that process automated?

How I can do that?

Hi, we have an open issue for allowing to inject config into the image file: https://github.com/resin-io/resin-cli/issues/762

Hi, we have an open issue for allowing to inject config into the image file: https://github.com/resin-io/resin-cli/issues/762

1 Like

A thought that came up in our internal conversation about this is that you could just mount the .img file, inject the file, unmount the .img and then etch the modified .img; would cut out the stage of having to go via an SD card to modify the .img.

well, yeah, because back then I’ve stuck on a windows machine so that’s the only way I got… after this I’ve mount the image on Linux, put config in and umount it, probably you should put this somewhere so people can see it?

mount -o loop,offset=4194304 -t vfat preload.img tmp/

Hi @SandPox,

Instead of manually mounting the image you can also try using resin config inject like

resin config inject /path/to/config.json --drive /path/to/image.img

We recently updated our documentation to reflect the fact that resin config inject can be used with both mounted SD cards and resinOS images in https://docs.resin.io/tools/cli/#config-inject-60-file-62- , and this should work cross-platform.

1 Like