.. _emmcboot-57: eMMC ========= Flashing the eMMC ------------------- By default, the phyCORE-AM57x development kit is configured to boot from an SD Card. This is generally one of the most convenient methods to boot your hardware throughout development because it allows for easy software updates and file transfers between your Host and target systems. In addition to creating a standard bootable SD card formatted with the phyCORE-AM57x Linux BSP, the following steps can be used to burn bootable software images to the onboard eMMC flash memory of the SOM, thus freeing up the SD Card slot on the carrier board. The easiest way to access the SOM's eMMC is to boot the SOM into Linux from an SD Card (you may already be doing this). The Linux instance running from the SD Card will need access to software binaries to flash to the eMMC; thus, we will also need to transfer those binaries to the SD Card so that they are present and accessible at runtime. .. note:: When you boot into Linux from an SD Card, obviously all the required binaries for boot are all already present on the SD Card. But, the tricky part with copying the "in-use" software components, specifically the root filesystem of the SD Card, is that it is already actively mounted in memory while Linux is up and running. This makes copying the root filesystem to the eMMC complicated and prone to filesystem corruption/errors. For this reason, it is best to transfer the tarballed rootfs to the SD Card itself so that we have a inactive, unmounted copy of the root filesystem in userspace (it's sort of like root filesystem "inception", like that one confusing movie with Leonardo DiCaprio). Requirements ---------------- * Ubuntu 20.04 LTS, 64-bit Host Machine with root permission. * If using a virtual machine, VMWare Workstation, VMWare Player, and VirtualBox are all viable solutions. * Only needed if using Linux Host * Windows 10 * Only needed if using Windows Host * CAT5e cable (comes included with the development kit) * For transferrring files * If not using SD card reader * Network switch connected to a DHCP enabled network * For transferrring files * If not using SD card reader * SD Card Reader * For transferrring files * If not using SCP method * 4GB SD Card or larger (Included in development kit) Preparing to Flash eMMC (Software) ------------------------------------ * Download the prebuilt SD card image (wic.xz) on your machine. Find the pre-build images on the :ref:`PreBuilts-57` guide. .. warning:: The machine number for the BSP image can be impacted based on the processor you are developing with. Please refer to the table in the :ref:`ReleaseNotes-57` to assist in selecting the correct machine. SD Card Reader (Linux Machine only) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Power off the development kit and insert the SD card from the development kit to your SD card reader. .. code-block:: none :caption: Target (Linux) poweroff * Transfer the SD card image onto the SD card. .. code-block:: none :caption: Host (Ubuntu) cd sudo cp phytec-qt5demo-image-phycore-am57xx-1.wic.xz /media//root sudo sync /media//root * Safely eject the SD card from the Linux host machine. * Insert the micro-SD card into the development kit. SCP (Windows or Linux) ~~~~~~~~~~~~~~~~~~~~~~~ * With the develeopment kit booted into Linux, confirm the development kit's ethernet IP address (DHCP). For more information on how to change the from a static IP address to a DHCP address, see the :ref:`Ethernet-57` interface guide. .. code-block:: none :caption: Target (Linux) ip addr * Transfer the SD card image onto the SD card. .. note:: For Windows users, use the Command Prompt tool. This can be accessed by typing "cmd" in the Windows search bar. .. code-block:: none :caption: Host cd scp "phytec-qt5demo-image-phycore-am57xx-1.wic.xz" root@:~ Preparing to Flash eMMC (Hardware) -------------------------------------- * With the development kit powered off, verify that the boot switches are set to boot from **SD card, not eMMC**. See the table on :ref:`BootEssentials-57` page to confirm SD card boot switches. Starting with a Clean eMMC ----------------------------- * Check the eMMC for existing filesystem partitions .. note:: The eMMC is */dev/mmcblk1* and the SD Card is */dev/mmcblk0*. .. code-block:: none :caption: Target (Linux) fdisk -l /dev/mmcblk1 .. code-block:: none :caption: Example Output root@phycore-am57xx-1:~# fdisk -l /dev/mmcblk1 Disk /dev/mmcblk1: 7264 MB, 7616856064 bytes, 14876672 sectors 929792 cylinders, 1 heads, 16 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 0,0,0 0,0,0 1 14876671 14876671 7263M ee EFI GPT * In the above example output, we see that */dev/mmcblk1* has a one partition on it. For the sake of this guide, we are going to first delete any and all existing partitions so that we can start from a clean eMMC flash device. We can do this using an ``fdisk`` interactive session. .. code-block:: none :caption: Target (Linux) umount /dev/mmcblk1* fdisk /dev/mmcblk1 # Use the following command sequence for reference once in the fdisk interactive session. d # delete partition (you will need to repeat this for every partition present) w # write the changes to the disk Flash the eMMC ----------------- * Now we can flash the eMMC using the SD card binary you previously downloaded. .. code-block:: none :caption: Target (Linux) xzcat -dc phytec-qt5demo-image-phycore-am57xx-1.wic.xz | dd of=/dev/mmcblk1 bs=4M conv=fsync * Now when you run the following *'fdisk'* command the eMMC should be partitioned into two parts. .. code-block:: none :caption: Target (Linux) fdisk -l /dev/mmcblk1 .. code-block:: none :caption: Expected Output root@phycore-am57xx-1:~# fdisk -l /dev/mmcblk1 Disk /dev/mmcblk1: 7264 MB, 7616856064 bytes, 14876672 sectors 116224 cylinders, 4 heads, 32 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 * 16,0,1 1023,3,32 2048 133119 131072 64.0M c Win95 FAT32 (LBA) /dev/mmcblk1p2 1023,3,32 1023,3,32 133120 2036277 1903158 929M 83 Linux * Power off the development kit and configure the hardware to boot from the onboard eMMC flash. See the section "Booting from eMMC" for more information on that. Booting from eMMC ----------------- With the phyCORE-AM57x Development kit powered off, set the following boot switch settings to boot from the onboard eMMC. .. image:: ../../images/phycore-am57x/pb-057948_boot-emmc.png :width: 250px :alt: eMMC Boot Switch Settings .. image:: ../../images/phycore-am57x/pb-057948-bootswitch_closeup.png :width: 250px :alt: phyCORE-AM57x Boot Switch Location