Hello,

I quite often have to clone a Beaglebone and dd is far too much time 
consuming for me. For that, I process that way:

   - make a reference installation on an eMMC (currently the single 
   partition image from Robert Nelson)
   - use a separate SD card image and boot from this.
   - create a mount point on the SD card and mount eMMC to the mount point
   - tar cvfz archive.tgz -C <mount point>

On the target system:

   - Boot from SD card
   - MLO and uImage are copied to eMMC from the ones on the SD card (this 
   is a weak point but working for me)
   - fdisk eMMC for one partition and mkfs.ext4
   - mount eMMC partition and untar tgz to it.
   - !!! remove ssh keys and generate new ones !!!
   - !!! edit uuid of the eMMC partition in uEnv.txt !!!  

I am starting this skript automatically after boot using a systemd process, 
when ready the board goes into powerdown. Whole flashing procedure takes 
about 2min. It is safe, if not working it can be re-done several times. 
Like to say from my experience that this is production grade.

That is done with a skript:

#!/bin/sh
# reference: 
https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSD/SDcard
# precondition: make a tgz of an existing eMMC installation
# boot from a SD card
# mount the eMMC into a mounting point and then compress it with tar cvfz 
-C <mountpoint>/

set -x -e

#umount mmc1
ntpdate -bv ptbtime2.ptb.de

export DISK=/dev/mmcblk1
dd if=/dev/zero of=${DISK} bs=1M count=10
dd if=/opt/backup/uboot/MLO of=${DISK} count=1 seek=1 conv=notrunc bs=128k
dd if=/opt/backup/uboot/u-boot.img of=${DISK} count=2 seek=1 conv=notrunc 
bs=384k

sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,,0x83,*
__EOF__

mkfs.ext4 ${DISK}p1 -L rootfs

sync

mount ${DISK}p1 mmc1

tar xfm <previouly_archived_root_file_system> -C mmc1

BLKID=`blkid -o export /dev/mmcblk1p1 | grep -i uuid`
UUID=$(echo $BLKID | tr '[:upper:]' '[:lower:]')
sed -i "s/uuid=.*/$UUID/I" mmc1/boot/uEnv.txt

rm -fv mmc1/etc/ssh/*key*
ssh-keygen -t dsa -b 1024 -f  mmc1/etc/ssh/ssh_host_dsa_key   -q -N ""
ssh-keygen -t rsa -b 1024 -f  mmc1/etc/ssh/ssh_host_rsa_key   -q -N ""
ssh-keygen -t ecdsa -b 256 -f mmc1/etc/ssh/ssh_host_ecdsa_key -q -N ""

umount mmc1
poweroff

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to