Create Single Firmware Binary File

I want to create a binary file that contains the entire firmware (result on flash memory of ESP8266)
So that I can bring this bin file with any esp programming tool to ESP8266 devices without the need of mos CLI tool.

The easiest way is to flash an ESP8266 and read it

mos flash-read --platform esp8266 flash.bin

Now you have a full image of the device.

1 Like

Hi nliviu,

thanks for the idea.
I know that this is a possible way to read it after flashing from the device.
Unfortunately, it will not solve my issue.

We need to provide the entire firmware (including bootloader etc.) in one bin file and
personalize the firmware during the building process.

Therefore, it would be mandatory to “compile” a valid one bin file firmware during building process.

What you can do is to get a result of a normal build

Then, create a flash image by using dd or similar tool, copying respective areas at correct offsets. The result should be roughly what @nliviu suggested.

A question like that suggests that you’d like to get an image that you can mass-burn at a factory. Take care about the security aspect - sharing credentials embedded into an image could be dangeours. There are ways to deal with that using an auto-provisioning mechanism, but that goes beyond just firmware.

1 Like

I know this discussion is probably stale, but I’ll still leave this for future reference, as I just stumbled across this thread:

I had the same problem a while back and ended up implementing a tool for combining the contents of a firmware zip file into a single binary: github.com/yaourdt/mgos-combine

It is tested for esp8266, but will probably work for other architectures as well.

It doesn’t work with esp32 due to different manifest.json structure.

good point. added this to my todo list