In this tutorial we are going to create a flasheable microSD image with Debian 7 and we are going to add packages and programs to it. In this way, you can create a custom sd card that you could use to flash Debian into eMMC memory in all Beaglebones Black you want.
1) Get microSD eMMC flasher image from here and follow the steps to flash Debian into eMMC memory in Beaglebone Black. We need Debian running from eMMC to customize our microSD image.
2) Once you have Debian running from eMMC, we are going to use our microSD card with the flasher image into it, to customize the image, then we will be able to use this custom image with custom packages and programs and flash it in all beaglebones we want.
3) With Debian running from eMMC, insert your microSD card and mount it:
#cd /root #mkdir root_fs_sd #mount /dev/mmcblk1p2 /root/root_fs_sd/
The trick is to use the sd card’s filesystem instead of our current filesystem, this allow us to install programs in that filesystem, the tool used for this purpose is “chroot”.
4) Before executing chroot into root_fs_sd, we need to mount some directories:
mount /proc -t proc root_fs_sd/proc mount /sys -t sysfs root_fs_sd/sys mount /dev/pts -t devpts root_fs_sd/dev/pts mkdir root_fs_sd/run/lock cp /etc/resolv.conf root_fs_sd/etc/resolv.conf
5) Now we can chroot root_fs_sd directory
chroot root_fs_sd /bin/bash ln -s /run/lock /var/lock
6) Once we are inside sd card's filesystem, we are running our kernel with the filesystem mounted from microSD card, and we can install programs and packages in this filesystem, all changes will be saved into our microSD card. For example we can install lxde desktop:
aptitude install lxde
7) When we press CTRL+D, we go out from chroot command and our microSD card is ready to flash another Beaglebone Black, when we do that, that image will have lxde desktop installed.