We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

FAQ: Is it possible to "clone" the firmware running on an Omega2 device and copy it to other Omega2 units?


  • administrators

    Yes! The firmware, installed packages, and configuration of a device can be "cloned" and written to other devices.

    This method is useful for quickly deploying a fleet of devices for the same application. Ie you have a single device setup and working for the application, and want to quickly get dozens or hundreds more devices up and running doing the same thing. This is an alternative to building your own firmware.

    Pros and Cons

    ✅ This cloning process serves as a quicker alternative to creating your own firmware from scratch using the build system (https://github.com/OnionIoT/source), which is more work intensive
    ❌ If a factory restore is triggered on a cloned device, it will revert to the original firmware. Meaning it will look and behave like an Omega device coming from the factory.

    Overview of the Process

    1. Create the clone image from the original device:
      • Set up device with all of the packages, files, and configuration that you'll need
      • Create a full filesystem image and copy it to external storage (usb drive, sd card, etc)
    2. Clone to other devices
      • Flash other Omega devices using the image
      • Run a script on the cloned device to restore its unique identifiers

    Step 1: Create the Clone Image from an Original

    • Set up an Omega2 device that will act as the original device. Meaning install all required packages, add files, perform configuration, etc
      • Take note of the firmware version the original device is running
    • When ready, plug in a USB drive (or other external storage)
    • Navigate to the mounted USB drive
      cd /mnt/sda1
    • Create the image
      dd if=/dev/mtd3 of=<IMAGE-NAME>.bin

    We recommend using a version number or a date to easily differentiate the clone images, for example:
    dd if=/dev/mtd3 of=/mnt/sda1/firmware-20200308.bin

    Step 2: Clone other devices

    • Boot a target device
    • Make sure the target device is running the same firmware version as the original device
    • Plug in the USB drive
    • Navigate to the mounted USB drive
      cd /mnt/sda1
    • Flash the image
      mtd -r write <IMAGE-NAME>.bin firmware
    • When the device reboots, restore the device's unique identifiers by running
      updateHostname -f

    Repeat Step 2 for all devices that you want to clone with the same setup as the original.



  • Hey Lazar,

    This is exactly what i was hoping for, thanks for that!
    I guess this is just cloning and injecting the overlay into a "fresh" omega right?

    Are there any concerns about using the same firmware version on both source and target?

    I can imagine that you wouldn't want to clone that overlay (maybe containing older version packages) to a firmware thats newer than those packages? Or the other way around... Any thoughts on that?

    I will keep on the safe side for now and will be checking for matching firmware versions using this method...

    Cheers, Tony


  • administrators

    Np!

    @tony-ter-neuzen said in FAQ: Is it possible to "clone" the firmware running on an Omega2 device and copy it to other Omega2 units?:

    I guess this is just cloning and injecting the overlay into a "fresh" omega right?

    The target device can be not "fresh" since this will overwrite the overlay partition (on /dev/mtd3). But just to be safe try to make sure the target device is fresh.

    For more info on openwrt flash layout, see this OpenWRT Docs article


    @tony-ter-neuzen said in FAQ: Is it possible to "clone" the firmware running on an Omega2 device and copy it to other Omega2 units?:

    Are there any concerns about using the same firmware version on both source and target?

    You raise a good point! I would recommend making sure you're using the same firmware version on both source and target. I've edited the procedure above to mention this.

    This process will only clone the overlay partition, that is, changes you've made to the device. This could potentially cause issues if the packages in the firmware of the target are a different version than on the source.



  • Hi Lazar,

    After having the auto-provisioning up and running I still have a small imperfection in play.

    Whenever mtd -r write <IMAGE-NAME>.bin firmware finishes it does not do the -r because it complains about not being able to [e]rase a block. ...it exits with 1

    Writing from 20211027-pan35-blusser-9-5.bin to firmware ...
    [e]Failed to erase block

    mtd verify doesn't end well either.

    After a reboot the omega seems to be running my custom firmware happily, so I dont worry too much yet, but it keeps nagging

    I have followed the instructions closely, also tried a couple of times more to make a new .bin file using the dd method.

    This is how that runs:

    root@Pandora3-74F3:/mnt/mmcblk0# dd if=/dev/mtd3 of=20211108-pan35-blusser-9-5.bin
    64896+0 records in
    64896+0 records out

    Any idea where i should look?

    Thanks, Tony



Looks like your connection to Community was lost, please wait while we try to reconnect.