In production, sometimes it is not possible to build all necessary drivers and software into a Docker image. In cases like this or for some other specific reasons one might wish to clone the eMMC of the golden sample to other production units.
Utilizing the ability to boot from SD Card. We can create a bootable image for the SD Card and boot from this to handle the cloning and deployment of the eMMC.
For this to work, you will still need to use Docker to build a bootable image from SD Card. If you do not know how to set this up. We have some articles to get you started.
LTPP3(G2) - Tutorial (Ubuntu) - Setting Up Docker Desktop – Tibbo Technology Help Center
LTPP3(G2) Tutorial (Ubuntu) - Setting up Docker for SSH Access – Tibbo Technology Help Center
We have a specific image for making a SD Card bootable image and it can be found here:
tibbotech/ltpp3_g2_u Tags | Docker Hub
The version that you want is the latest version with .sd at the end. For example, at the time of writing this article, the version is "0.6.1.4.sd".
Once you get a new container running based on the image, navigate to \root\SP7021\ in the terminal that is connected to this container and type:
make
This will create the bootable image and the newly generated file is located at:
/root/SP7021/out/boot2linux_SDcard/ISP_SD_BOOOT.img
Download this file to your computer. Next, we need to create the bootable SDCard. The tool we will use for making bootable media is Balena Etcher.
Once installed please follow the steps:
Flash from file (ISP_SD_BOOT.img) > Select Target (SD Card) > Flash!
Once finished, you would have a bootable SD Card with Ubuntu. However, there's one problem, Balena Etcher only creates the minimum size for the partition. This means that there aren't enough space to copy the eMMC over. So, we now need to take the SD Card to a Linux system to extend the partition size. We used our LTPP3 for this purpose. First, we need to issue the below command:
sudo fdisk -u /dev/mmcblk1
Basically, we want to delete the second partition and then recreate the second partition as primary partition and provide a large enough space for the eMMC cloning. In the screenshot below can see the options chosen.
After the above is done, issue the resize2fs command to actually extend the space.
sudo resize2fs /dev/mmcblk1p2
Once this is done, we are ready to boot from the SD Card. Insert the SD Card then press and hold the MD button while the system boots up. After a couple seconds, you will see the system booting from the SD Card. Please log in and with enough space on the SD card we can now copy the eMMC
To copy from eMMC to file "mmc0" on SDCard:
sudo dd if=/dev/mmcblk0 of=~/mmc0 status=progress
To copy from SDCard to eMMC:
sudo dd if=~/mmc0 of=/dev/mmcblk0 status=progress
Comments
0 comments
Please sign in to leave a comment.