Skip to content

Instantly share code, notes, and snippets.

@sxing
Last active February 10, 2018 16:14
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sxing/300b8a58c9f438fcc581 to your computer and use it in GitHub Desktop.
Raw commands for copying an Ubilinux image to an SD card.
# connect an SD card and mount it. Assuming Arduino expansion board. Also, mount the / partition into the rootcopy folder.
mkdir /home/sdcard
mkdir /home/rootcopy
mkdir /home/sdcard/image
mount /dev/mmcblk0p8 /home/rootcopy
mount /dev/mmcblk1p1 /home/sdcard
# copy the operating system to an empty ext4 image
dd if=/dev/zero of=/home/sdcard/edison-image-edison.ext4 count=1500 bs=1M iflag=fullblock
mkfs.ext4 /home/sdcard/edison-image-edison.ext4
mount /home/sdcard/edison-image-edison.ext4 /home/sdcard/image
cp -r /home/rootcopy/* /home/sdcard/image/
#unmount and cleanup
umount /home/sdcard/image
rm -r /home/sdcard/image
umount /home/sdcard
umount /home/rootcopy
rm -r /home/sdcard
rm -r /home/rootcopy
# thanks to Nick Chase for an updated dd command and checking through everything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment