Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cloning Edisons by making a flashable image from an existing Edison

This’ll make a flashable clone of an existing Intel Edison (with Yocto... Ubilinux here: I've wanted to extract a flashable image from my Edisons for a while; I usually hack straight on my Edison until something works and don't want to porting to the Yocto build process afterwards. To clone Edisons, I've been using rubidium's commands from the Intel forums, but I wanted a method that worked on top of the Phone Flash Tool used for flashing Edison since it'll be easier to distribute images. I've tested this for flashing Edisons from ww36 (1.0), ww05-2015 (2.0), and ww25.5-2015 (2.1) firmwares to an ww25.5-2015 (2.1) based clone image.

NOTE: I've noticed that this doesn't work well with Edisons that are cloned copies that were produced through copying the entire mmcblk0 block as done in the Intel forum thread referenced above. I've built a workaround for that, but it is a bit longer:

NOTE2: The "systemctl enable post-install" commands will reset your Edison access point name and access point password. If you have to preserve your AP settings, I recommend taking that line out. If not, I've noticed that enabling post-install to run after a flash usually takes cares of resizeing the root partition to the proper size.

  1. PREP EDISON: Prepare an Edison you want to copy. Make sure none of the files you want to copy are in the /home directory. /home isn't copied in the Phone Flash Tools process. Please let me know if it can be done, though!

  2. COPY EDISON: Now, we make a copy of the / partition. There’s a few ways of doing this, depending on how you want to transfer the generated file to your computer:

    1. Transfer through SCP. Run the following command in your Edison’s shell to generate a compressed image:

      systemctl enable post-install
      rm -rf /home/root/* && dd bs=4M if=/dev/mmcblk0p8 | gzip > /home/root/edison-image-edison.ext4.gz
    2. Transfer through SD card. This is the easiest in my opinion. Connect a 2GB or greater microSD card to your Edison and run:

      systemctl enable post-install
      dd bs=4M if=/dev/mmcblk0p8 of=/media/sdcard/edison-image-edison.ext4
      resize2fs -M edison-image-edison.ext4
    3. Transfer through USB key. This is not as easy as the SD card. Connect a 2GB or greater USB key to your Edison. In the case of the Arduino breakout, make sure to have an external power supply connected to the power jack and to have the microswitch switched towards the big USB type-A connector and away from the microUSB port. Then, run the following command:

      ls /dev/sda*

      Note what returns. This should be your USB drive device. It’s usually /dev/sda or /dev/sda1 for me, but that will vary across USB drives. If you get multiple devices, not a problem. You’ll just have to try all to see what sticks. Afterwards, run:

      mkdir /media/usb
      mount /dev/< change this with sda device name> /media/usb

      If you want to check to see if this is the right path to the drive, create a dummy file in /media/usb. If you move the drive from the Edison to your computer, you should see the file you created. To finish up, run:

      systemctl enable post-install
      dd bs=4M if=/dev/mmcblk0p8 of=/media/usb/edison-image-edison.ext4
      resize2fs -M edison-image-edison.ext4

    Afterwards, copy the file to your computer. If you have a gzipped image, un-archive it.

  3. MAKE FLASHING PACKAGE: Now that you have a copy of the edison-image-edison.ext4 file, download the latest Edison firmware. Once downloaded, unzip it and replace the edison-image-edison.ext4 file with the new one that you’ve generated. You now have a flashable Edison image!

  4. TEST PACKAGE: Now we have to test. Grab a new Edison to make into a clone and flash it!

  5. CHECK PACKAGE: Serial into your Edison after flashing. It should be an exact copy of your previous Edison, except for the files in the /home directory, which aren’t changed in the flash process. If you get an error that says “No directory, logging in with HOME=/”, making a new /home/root directory will fix the issue:

    mkdir /home/root

Hope this helps! Let me know if I should add anything or clarify stuff by messaging me on twitter @stevencrossing or emailing me at Comments are cool too, but I don't think I get the notifications for comments on a Gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment