How to "clone" Linino including custom configurations

Hi there,

I would like to use Yun as a base for a product that I am developing.

Is it possible to "clone" the Yun image in order to replicate it (flash it) to another Yun ?

I know that one possibility is to build linino from scratch. However, I have not managed to do it using a Debian 6 distro
(instructions : Building a custom image for Arduino YUN)

Any help will be greatly appreciated,

Plan A:

  1. few GB Micro SD, 8GB nowday cost same as 4GB.

  2. Setup Rootfs on External Storage ( Micro SD)

  1. Install your code at new Rootfs.

  2. at another Yun.

nano /etc/config/fstab
config mount
        option target        /
        option device        /dev/sda1
        option fstype        ext4
        option options       rw,sync
        option enabled       1
        option enabled_fsck  0
  1. insert Micro SD into another Yun, make sure it work.

  2. use Raw Copy Tool duplicate Micro SD.

Plan B:

If you are hardware house, desolder smd flash chip (16MB) from master, copy image into fresh smd flash chip with flash memory copier. resolder it back into duplicate one.

Thanks,

But I thinking more in terms of: If I want to develop a product based on the Arduino Yun, how do I upload the Linino Config, Configurations, uboot and Sketches.

Would this same process work ?

Thanks again!

sonnyyu:
Plan B:

If you are hardware house, desolder smd flash chip (16MB) from master, copy image into fresh smd flash chip with flash memory copier. resolder it back into duplicate one.

Every thing except ATmega32u4's Sketches ( it sit in ATmega32u4 flash).

Sketches load afterward.

http://forum.arduino.cc/index.php?topic=209587.msg1542895#msg1542895

cd /tmp
/usr/bin/merge-sketch-with-bootloader.lua  /tmp/Blink.cpp.hex
/usr/bin/run-avrdude    /tmp/Blink.cpp.hex

Plan C.

bilica:
...
I know that one possibility is to build linino from scratch. However, I have not managed to do it using a Debian 6 distro
(instructions : Building a custom image for Arduino YUN)

All you need is multible core cpu ( more is better), fast harddisk (scsi or ssd, faster is better) , a lot of memory ( more is better) , It would not fix error but failed faster then you could retry quick. once you build image. flash the new image.

During buildroot you could add additional packages as well as remove unused packages from image, plus put your config file or programming file at files directory under buildroot directory.

files/etc/banner for customer banner
files/etc/rc.local customer init script
files/www/index.php customer web file

sonnyyu:
Plan C.

bilica:

I know that one possibility is to build linino from scratch. However, I have not managed to do it using a Debian 6 distro
(instructions : Building a custom image for Arduino YUN)

All you need is multible core cpu ( more is better), fast harddisk (scsi or ssd, faster is better) , a lot of memory ( more is better) , It would not fix error but failed faster then you could retry quick. once you build image. flash the new image.

http://arduino.cc/en/Tutorial/YunSysupgrade

Thanks!

I am trying again with Ubuntu 12.04 from the instructions described here:

http://playground.arduino.cc/Hardware/Yun#build_linino

One more thing internet connection speed, faster is better. 1 Gb is good start.

http://forum.arduino.cc/index.php?topic=207574.msg1526280#msg1526280

with -j n

n=number of core+1

Hi bilica and sonnyyu. Bilica, are you okay with using the read-only "rootfs" partition (mountpoint /rom) from Linino/OpenWRT as your baseline and then only backing up and restoring the "rootfs_data" partition (mountpoint /overlay) that contains all your written/modified apps/data? I am assuming you don't intend to always use a sdcard for your storage of modified apps/data storage and using only the internal flash. Just sharing what I've learned over the past couple weeks about the MTD file device and flash filesystems in case this may help you.

The Linino partition layout on the internal flash can be seen as per below:

root@Yun1:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00e50000 00010000 "rootfs"
mtd3: 00780000 00010000 "rootfs_data"
mtd4: 00140000 00010000 "kernel"
mtd5: 00010000 00010000 "nvram"
mtd6: 00010000 00010000 "art"
mtd7: 00f90000 00010000 "firmware"

General info about the flash partition layout:

(main caution: do not damage the u-boot, u-boot-env, or ART partitions accidentally!)

EDIT: my original suggestions in this post have been replaced with final instructions in my next post below. The original basis for this backup process came from here: [OpenWrt Wiki] Generic NOR backup

[edited: see thomas-c post below How to "clone" Linino including custom configurations - #12 by system - Arduino Yún - Arduino Forum on how he managed to clone his Yun]

Thank you thomas-c!

I am a noob on this topic so you thorough answer is appreciated :slight_smile:

You are right: I do not want to use an sdcard (not sure about the reliability of delivering a product using one as the rootfs).

I would really like to know, for instance, if I buy spare components from a distributor, can I build my own Arduino Yun ? How would I go and flash all mtd (0..7) and not only rootfs /rootfs_data ?

Hopefully somebody here knows how this can be done :slight_smile:

Meanwhile I am trying to compile Linino to create a custom image.

Thanks again,

Plan D: (Experiment)

Very similar like Plan B, but without solder and desolder.

in Circuit Flash Programmer

After installing custom packages and customizing my Yún I verified the instructions below allowed me to create a backup image, reset Linino to its default state, then restore my backup image, and all my packages/settings returned. I don't have more than one Yún to test with but this method should still work.

This cloning method will duplicate the same 3 partitions that are contained in the default Linino Upgrade Image: rootfs, rootfs_data, and kernel. This method doesn't modify the u-boot-env or art partitions, so the MAC addresses for your different Yún's should remain unmodified and unique.

Cloning Instructions:

NOTE 1 - the backup image name you create must end in: squashfs-sysupgrade.bin
NOTE 2 - make sure you specify a '7' for the mtd7ro device
NOTE 3 - if your created backup image is not exactly 16,318,464 bytes then do NOT attempt to restore it

  1. Bootup the Yún you want to take an image of with a sdcard formatted/inserted then execute:
umount /overlay
dd if=/dev/mtd7ro of=/mnt/sda1/mybackup-squashfs-sysupgrade.bin
sync
halt (if you plan to disconnect power and remove the sdcard)
  1. only if your backup image is exactly 16,318,464 bytes in size then proceed to the next step

  2. Insert the sdcard into another Yún then follow the Yún sysupgrade tutorial.

Additional notes if you're interested:

When using a hex editor to look at either the default Linino image or your backup image, here are offsets/sizes for your reference:

rootfs      (RO SquashFS on /rom)   begins at offset 0x000000   bytes 7,143,424 (0x6d0000)
rootfs_data (RW JFFS2 on /overlay)  begins at offset 0x6d0000   bytes 7,864,320 (0x780000)
kernel                              begins at offset 0xe50000   bytes 1,310,720 (0x140000)

You'll notice when looking at offset 0x6d0000 in the default Linino image it is filled with 7.5 MB worth of 00's because the JFFS2 partition doesn't yet contain any modified overlay data. The marker to signify the beginning for the new JFFS2 filesystem is 0xdeadc0de ... so someone on the OpenWRT team was having some hexspeak fun. :slight_smile:

When I created a backup image using the above steps its file size was 16,318,464 bytes but the image size for the default Linino 1.0 Upgrade Image is 16,177,994 bytes. If you use a hex editor and look at the backup image you've created you'll see there are FF's as padding at the very end; the actual data for the kernel does not take up all 1,310,720 bytes that have been allocated for the kernel partition so the FF's are there to fill up the remaining kernel partition space. In the default Linino image these padding FF's have been removed and it may be that the Linino/OpenWRT image build process strips those FF's from the .bin file automatically (or perhaps more likely is that 3 partition .bin files were joined together to create the final .bin image, so the trailing padding FF's never existed in the first place at the end of the kernel partition/image).

bilica:
[edited: see thomas-c post below How to "clone" Linino including custom configurations - #12 by system - Arduino Yún - Arduino Forum on how he managed to clone his Yun]

I would really like to know, for instance, if I buy spare components from a distributor, can I build my own Arduino Yun ? How would I go and flash all mtd (0..7) and not only rootfs /rootfs_data ?

Hi,friend:
i am interested in your instance,have you build your arduino yun with a spare component?and now i just have a spare board copying yun,but the flash is empty ,how can i flash my spare flash with linino?

thanks a lot! :slight_smile:

I would seriously reconsider using the Yun in a product. For a prototype or demo, sure it's great but for a shipping product you are betting too much on issues outside your control.

For example what happens when the supply of Yuns is low, do you stop shipping your product? What happens when distributors can't sell you Yuns in the quantity you desire? Look at the pain with Beaglebone Black availability right now--there are similar startups that want to use the BBB in a product but are up a creek because availability is low.

Also what happens when the Arduino team releases Yun V2.0 without some critical component or support that your product needs? What guarantee do you have the Arduino team will spend any time to help support you when your product suddenly has critical bugs or issues?

If you're going to ship a product you really should do the work to design for manufacturing. There's no shortcut around it--if you're using a Yun it's only a matter of time until you (and your customers) get burned because of some issue outside your control.

I’m a high school student from China.And I love arduino so much.I was looking for a arduino board with Wifi.I used to use ethernet board. It’s a good news for me that yun comes out.But it isn’t available in China now. This is why I have to make a cloning board.But I can,t find the Design files for yun…

comment from : http://arduino.cc/en/Main/ArduinoBoardYun

sonnyyu:
Plan B:

If you are hardware house, desolder smd flash chip (16MB) from master, copy image into fresh smd flash chip with flash memory copier. resolder it back into duplicate one.

thanks , I' ll try this :slight_smile: but now I'have not a master chip.

Where I can found the file and reflash a new chip?

dd if=/dev/mtd0 of=/tmp/boot.backup
dd if=/dev/mtd1 of=/tmp/u-boot-env.backup
...
dd if=/dev/mtd5 of=/tmp/nvram.backup
dd if=/dev/mtd6 of=/tmp/art.backup
...

http://forum.arduino.cc/index.php?topic=235491.0

Get file from an other Yun.

I have my Linino side dead. Can somebody send me a file with Flash memory image?
I have a memory programmer and could reflash it
Thanks,

Can you upload YunSerialTerminal example via USB cable, open serial monitor, push the YUN RST button (the one near the leds) and paste what you see printed?

this is not possible. Sketch runs properly but YUN RST do nothing.
After pressing Yun Rst boot process don't initiates. I think boot flash is corrupted or erased.
Uboot d'ont work. USB led is ON. Linino side d'ont work .
Is not possible use YUN system for flashing memory . I Think the unique way is flashing the memory with a programmer with a valid image file....

Thanks you