Author Topic: Is it possible to make complete backup of Oak?  (Read 2581 times)

malaire

  • Newbie
  • *
  • Posts: 28
Is it possible to make complete backup of Oak?
« on: January 03, 2017, 10:47:47 pm »
I've read that it is quite hard to do a full factory reset on Oak.

However I still have several Oaks which have never been powered. Is it possible to make a full backup of such Oak using "python esptool.py" and then use that backup to later restore Oak to its initial state?

Does the fact that Oak generates some encryption keys on first power up complicate this?

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Is it possible to make complete backup of Oak?
« Reply #1 on: January 04, 2017, 12:56:50 am »
In principle I don't see why not... it would probably complicate things later down the path if the Oak *did* get claimed and registered on Particle, but till then it wouldn't matter. Unfortunately all my Oaks have been claimed so I don't have a virgin Oak to test it out on.

The only other catch I can see is that the image would have to be device specific... as I would think the claim code, etc would be unique for each Oak, and tied to the device in some manner... but again, I haven't fiddled in this space, so I could be talking complete nonsense.

Edit: Also note that it seems that to read back from the Oak/ESP8266 will take a while ... reading back 1MB took somewhere in the order of 45 seconds, so to read the full 4MB of memory would take a few minutes...
« Last Edit: January 04, 2017, 01:33:15 am by PeterF »

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Is it possible to make complete backup of Oak?
« Reply #2 on: January 04, 2017, 09:32:45 am »
I actually did back up one of my Oaks after I brought I back from misbehaving but don't remember what state it was in. I'm guessing that as soon as I got it back to 3 blinks I grabbed all of the sectors and stored them in a directory associated with the Oak's name. Doesn't hurt to save the image.

Here are the commands. Just set your COM port and file names that are meaningful to you:
Code: [Select]
python esptool.py --baud 115200 --port COM3 read_flash 0x000000 0x100000 flash_bak_0x0.bin
Code: [Select]
python esptool.py --baud 115200 --port COM3 read_flash 0x100000 0x100000 flash_bak_0x1.bin
Code: [Select]
python esptool.py --baud 115200 --port COM3 read_flash 0x200000 0x100000 flash_bak_0x2.bin
Code: [Select]
python esptool.py --baud 115200 --port COM3 read_flash 0x300000 0x100000 flash_bak_0x3.bin
or this for all sectors...

Code: [Select]
python esptool.py --baud 115200 --port COM3 read_flash 0x000000 0x400000 flash_bak_full.bin
The writes would look like this but haven't had to do it...
Code: [Select]
python esptool.py -p COM3 -b 115200 write_flash -fs 32m 0x100000 flash_bak_0x1.binand so on.