Cloning Edison SOCs loaded with OpenAPS

 

4/6/22

Needed:

  1. An Edison Arduino board ( This was tested on the Intel version of the board )
  2. The original Edison SOC that is already loaded with Openaps
  3. Another Edison SOC that has the standard Yocto or Jubilinux already loaded on it so it can run Linux commands.    (I loaded a copy of Jubilinux 0.20 on it to get get started.  But this should work with the factory installed Yocto as well.)   (https://www.jubilinux.org/)
  4. A 9 to 12 volt power supply for the Edison Arduino board (center pin is + ) rated at 1 amp or more
  5. An empty USB memory stick drive at least 4 gigs in size.   I used an old 4 gig Sandisk.  Not sure how big it can be without causing issues.
  6. A PC - with Windows that has the drivers loaded necessary to flash an Edison.  (Refer to the Openaps docs)
  7. The terminal program PUTTY loaded on a PC. 

Procedure:

  1. Using your PC, create a small file on the empty USB stick drive that you will recognize.  An empty test.txt file is fine. 
  2. Mount the Edison SOC that has OpenAPS on it (the Edison you want to clone) onto the Arduino board.
  3. Insert the USB Stick drive into the USB A Socket.
  4. Slide the small switch on the right side marked SW11 towards the USB A socket.
  5. Connect your power supply to the barrel jack connector.  A green light should light on the board.
  6. In Windows, access the Control Panel - Device Manager - Ports and note the com ports that are present.   Leave the window open.
  7. On the right side of the board, connect your PC to the MicroUSB jack at the corner.
  8. Your PC should start loading the drivers necessary to communicate with the Edison.
  9. A new COM port should show up in the list of COM ports.   Make note of the port number and minimize the Device manager window.
  10.  Start PUTTY and connect to the board with the noted COM port and a 115200 baud serial connection.  You may have to wait for for the Edison to fully boot before you can connect to it.
  11. Log in with your User name and password.  User name should be root.

 

Via the Terminal screen copy the OpenAPS Edison memory block to the USB drive.

Command:  ls /dev/sda*

You should see a device named sda1.   If you see two sda devices, use the higher numerical device.  That should be the USB stick drive.

Make a directory:
Command: mkdir /media/usb  

Mount the sda device as  /media/usb:
Command: mount /dev/<replace this with sda device name> /media/usb

Verify that you have mounted the USB stick drive
Command: ls /media/usb

You should see the file that you previously created on the USB stick drive. 

Copy the main memory block out of the Edison SOC to the USB Stick drive
Command: dd if=/dev/mmcblk0 of=/media/usb/edison_backup.img

Let this run and note the number of blocks that was moved.  This will take 15 minutes or more.

Unplug the barrel power connector.
Unplug the Micro USB cable.

 

Write the saved image to the target Edison SOC

Remove your OpenAPS Edison SOC and replace it with the target Edison SOC.

Plug in the barrel power connector.
Connect the MicroUSB cable to the same corner port.

Connect to the destination Edison with PUTTY.  Note that the COM port may change!  Check the Device Manager window that you minimized.

Make a directory:
Command: mkdir /media/usb  

Mount the sda device as  /media/usb with:
Command: mount /dev/<replace this with sda device name> /media/usb

Copy the image on the USB Stick drive to the main memory block of the Edison SOC

dd if=/media/usb/edison_backup.img of=/dev/mmcblk0

This may take 30 minutes or so.
Note the number of blocks copied.   It should match the number of blocks written previously.

When it is done, disconnect the barrel power plug and microUSB cable.   Then reconnect the power cable and microUSB cable and reconnect via PUTTY.   Let the Edison boot, this may take a minute or more.   Check to see if the Edison is attempting to loop, via the “L” command.   You should see the Edison trying to loop.  If this works you likely have a clone of your original Edison SOC.   Insert it into an Explorer board and it should function the same as the original.

This was derived from several sources, the main being:
https://www.instructables.com/BackupRestore-Intel-Edison/

Note: My OpenAPS Edison with Jubilinx would not communicate with a SD card. So use of a USB Stick drive was necessary.

Also: 
https://gist.github.com/sxing/f02a4a1703b16803a7d4

Finally, lots of Edison information:

https://edison-fw.github.io/edison-wiki/