Flashing the eMMC
Before proceeding further, it’s recommended to familiarize yourself with the foundational concepts detailed in the Booting Essentials chapter. It will provides instructions on how to initiate the device from any accessible boot source, enabling you to proceed with the flashing procedure. Afterwards we’ll explore different approaches to flashing eMMC storage: from an SD card, over a network connection, and via USB or using partup or wic based images.
Flash eMMC from SD Card
By default, the phyBOARD-Lyra AM62Ax 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-AM62Ax 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.
Layout of a partup flashed eMMC
To generate bootable partup artifacts, we utilize partup. After flashing with partup, the eMMC layout is defined as follows:
Flash eMMC from SD card in U-Boot
Flash an SD card with a working image and create a third FAT partition. Copy the WIC image (phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic) to this partition. By default we deploy a compressed wic.xz file. As u-boot is not able to uncompress it, you should do so on your host machine.
host:~$ unxz phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.xz
Configure the bootmode switch to SD Card and insert the SD Card.
Power on the board and stop in U-Boot.
Load the image:
uboot:~# ls mmc 1:3 <DIR> 4096 . <DIR> 4096 .. 609646592 phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic uboot:~# load mmc 1:3 0xA0000000 phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic
Switch the mmc dev to use the eMMC device:
uboot:~# mmc list mmc@fa10000: 0 mmc@fa00000: 1 (SD) uboot:~# mmc dev 1 switch to partitions #0, OK mmc1 is current device
Flash your WIC image from the SD card to eMMC. This will partition the card and copy bootloader files, Image, dtb, dtbo, and root file system to eMMC:
uboot:~# setexpr nblk ${filesize} / 0x200 uboot:~# mmc write 0xA0000000 0x0 ${nblk} MMC write: dev # 0, block # 0, count 1190716 ... 1190716 blocks written: OK
Note
This step only works if the size of the image file is less than 1GB due to limited usage of RAM size in the Bootloader as we have marked some RAM regions as reserved for other components such as OPTEE. If the image file is too large use the Updating eMMC from SD card in Linux on Target subsection.
Update the Bootloader to the eMMC’s dedicated boot0 partition:
# Select eMMC boot0 partition uboot:~# mmc dev 0 1 uboot:~# load mmc 1 ${loadaddr} tiboot3.bin uboot:~# mmc write ${loadaddr} 0x0 0x400 uboot:~# load mmc 1 ${loadaddr} tispl.bin uboot:~# mmc write ${loadaddr} 0x400 0x1000 uboot:~# load mmc 1 ${loadaddr} u-boot.img uboot:~# mmc write ${loadaddr} 0x1400 0xC00
To give the ROM access to the boot partition, the following commands must be used for the first time:
uboot:~# mmc partconf 0 1 1 1 uboot:~# mmc bootbus 0 2 0 0
Power off the board and change the bootmode switch to eMMC, see Booting Essentials.
Flash eMMC from SD card in Linux
You can also flash the eMMC on Linux. You only need a partup package or WIC image saved on the SD card.
Show your saved partup package or WIC image files on the SD card:
phyboard-lyra-am62axx-2:~# ls phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.bmap phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.xz
Show list of available MMC devices:
phyboard-lyra-am62axx-2:~# ls /dev | grep mmc mmcblk0 mmcblk0boot0 mmcblk0boot1 mmcblk0rpmb mmcblk1 mmcblk1p1 mmcblk1p2 mmcblk1p3
Note
The eMMC device can be recognized by the fact that it contains two boot partitions: (mmcblk0boot0; mmcblk0boot1)
Write the image to the eMMC device (MMC device 0 without partition) using partup:
phyboard-lyra-am62axx-2:~# partup install phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup /dev/mmcblk0
Flashing the partup package has the advantage of using the full capacity of the eMMC device, adjusting partitions accordingly.
Note
Alternatively, bmaptool may be used instead:
phyboard-lyra-am62axx-2:~# bmaptool copy phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.xz /dev/mmcblk0
When utilizing bmap, it becomes necessary to manually update the bootloader files individually. This is due to the fact that wic images store the bootloader files in a distinct FAT/boot partition, which is incompatible with eMMC devices.
phyboard-lyra-am62axx-2:~# echo 0 > /sys/class/block/mmcblk0boot0/force_ro
phyboard-lyra-am62axx-2:~# dd if=/boot/tiboot3.bin of=/dev/mmcblk0boot0 count=1024 conv=fsync
phyboard-lyra-am62axx-2:~# dd if=/boot/tispl.bin of=/dev/mmcblk0boot0 seek=1024 count=3072 conv=fsync
phyboard-lyra-am62axx-2:~# dd if=/boot/u-boot.img of=/dev/mmcblk0boot0 seek=5120 count=3072 conv=fsync
The following must be run once per eMMC device in order for it to allow the bootROM to load the bootloaders from it. Once done for a given phyCORE-AM62Ax SOM, you won’t ever have to do this again for the life of that device.
phyboard-lyra-am62axx-2:~# mmc bootpart enable 1 1 /dev/mmcblk0
phyboard-lyra-am62axx-2:~# mmc bootbus set single_backward x1 x8 /dev/mmcblk0
phyboard-lyra-am62axx-2:~# mmc hwreset enable /dev/mmcblk0
Power off the development kit and configure the hardware to boot from the onboard eMMC flash. See the section Booting Essentials.
Flash eMMC from Network
The phyBOARD-Lyra AM62Ax has an Ethernet connector and can be updated over a network. Be sure to set up the development host correctly. The IP needs to be set to 192.168.3.10, the netmask to 255.255.255.0, and a TFTP server needs to be available. From a high-level point of view, an eMMC device is like an SD card. Therefore, it is possible to flash the WIC image (<name>.wic) from the Yocto build system directly to the eMMC. The image contains the bootloader, kernel, device tree, device tree overlays, and root file system.
Flash eMMC from Network in U-Boot
Note
This step only works if the size of the image file is less than 1GB due to limited usage of RAM size in the Bootloader as we have marked some RAM regions as reserved for other components such as OPTEE. If the image file is too large use the Updating eMMC from SD card in Linux on Target subsection.
Load your image via network to RAM:
uboot:~# tftp 0xA0000000 phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic
Write the image to the eMMC:
uboot:~# tftp 0xA0000000 phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic uboot:~# mmc dev 0 uboot:~# setexpr nblk ${filesize} / 0x200 uboot:~# mmc write 0xA0000000 0x0 ${nblk}
Update the Bootloader to the eMMC’s dedicated boot0 partition:
# Select eMMC boot0 partition mmc dev 0 1 tftp ${loadaddr} tiboot3.bin mmc write ${loadaddr} 0x0 0x400 tftp ${loadaddr} tispl.bin mmc write ${loadaddr} 0x400 0x1000 tftp ${loadaddr} u-boot.img mmc write ${loadaddr} 0x1400 0x2000
To give the ROM access to the boot partition, the following commands must be used for the first time:
uboot:~# mmc partconf 0 1 1 1 uboot:~# mmc bootbus 0 2 0 0
Power off the board and change the bootmode switch to eMMC, see Booting Essentials.
Flash eMMC from Network in Linux
Download the partup image:
phyboard-lyra-am62axx-2:~# tftp -r phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup -g 192.168.3.10
Now copy the image to the eMMC device using partup:
phyboard-lyra-am62axx-2:~# partup install phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup /dev/mmcblk0
Note
Alternatively, bmaptool may be used instead:
phyboard-lyra-am62axx-2:~# tftp -r phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.xz -g 192.168.3.10
phyboard-lyra-am62axx-2:~# tftp -r phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.bmap -g 192.168.3.10
phyboard-lyra-am62axx-2:~# bmaptool copy phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.xz /dev/mmcblk0
When utilizing bmaptool, it becomes necessary to manually update the bootloader files individually. This is due to the fact that wic images store the bootloader files in a distinct FAT/boot partition, which is incompatible with eMMC devices.
phyboard-lyra-am62axx-2:~# echo 0 > /sys/class/block/mmcblk0boot0/force_ro
phyboard-lyra-am62axx-2:~# dd if=/boot/tiboot3.bin of=/dev/mmcblk0boot0 count=1024 conv=fsync
phyboard-lyra-am62axx-2:~# dd if=/boot/tispl.bin of=/dev/mmcblk0boot0 seek=1024 count=3072 conv=fsync
phyboard-lyra-am62axx-2:~# dd if=/boot/u-boot.img of=/dev/mmcblk0boot0 seek=5120 count=3072 conv=fsync
The following must be run once per eMMC device in order for it to allow the bootROM to load the bootloaders from it. Once done for a given phyCORE-AM62Ax SOM, you won’t ever have to do this again for the life of that device.
phyboard-lyra-am62axx-2:~# mmc bootpart enable 1 1 /dev/mmcblk0
phyboard-lyra-am62axx-2:~# mmc bootbus set single_backward x1 x8 /dev/mmcblk0
phyboard-lyra-am62axx-2:~# mmc hwreset enable /dev/mmcblk0
Power off the board and change the bootmode switch to eMMC, see Booting Essentials.
Flash eMMC from Network in Linux from Host perspective
Download the partup image from our downloads server, see Pre-Built Binaries.
Copy the image to the target:
host:~$ scp phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup [email protected]
Flash using partup:
host:~$ ssh [email protected] "partup install phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup /dev/mmcblk0"
Power off the board and change the bootmode switch to eMMC, see Booting Essentials.
Flash eMMC from USB
The phyBOARD-Lyra AM62Ax provides two USB 2.0 Dual-Role Devices (DRD) subsystems via the three USB connectors (X43, X36, and X34). This guide will show you how to utilize the USB interface for flashing the eMMC device, either by using USB/DFU or a simple USB flash drive. The only requirement for flashing from a USB flash drive is a USB drive containing all relevant bootloader images and a phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup or phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.
Flash eMMC from USB flash drive in U-Boot
Load your image from USB drive to RAM:
uboot:~# usb start uboot:~# load 0xA0000000 phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic
Write the image to the eMMC:
uboot:~# mmc dev 0 uboot:~# setexpr nblk ${filesize} / 0x200 uboot:~# mmc write 0xA0000000 0x0 ${nblk}
Update the Bootloader to the eMMC’s dedicated boot0 partition:
# Select eMMC boot0 partition uboot:~# mmc dev 0 1 uboot:~# load usb 0 ${loadaddr} tiboot3.bin uboot:~# mmc write ${loadaddr} 0x0 0x400 uboot:~# load usb 0 ${loadaddr} tispl.bin uboot:~# mmc write ${loadaddr} 0x400 0x1000 uboot:~# load usb 0 ${loadaddr} u-boot.img uboot:~# mmc write ${loadaddr} 0x1400 0x2000
To give the ROM access to the boot partition, the following commands must be used for the first time:
uboot:~# mmc partconf 0 1 1 1 uboot:~# mmc bootbus 0 2 0 0
Flash eMMC from USB flash drive in Linux
Mount your USB flash drive:
phyboard-lyra-am62axx-2:~# mkdir /mnt/usb phyboard-lyra-am62axx-2:~# mount /dev/sda1 /mnt/usb
Write the image to the eMMC device (MMC device 0 without partition) using partup:
phyboard-lyra-am62axx-2:~# partup install /mnt/usb/phytec-qt6demo-image-phyboard-lyra-am62axx-2.partup /dev/mmcblk0
Flashing the partup package has the advantage of using the full capacity of the eMMC device, adjusting partitions accordingly.
Note
Alternatively, bmaptool may be used instead:
phyboard-lyra-am62axx-2:~# bmaptool copy /mnt/usb/phytec-qt6demo-image-phyboard-lyra-am62axx-2.wic.xz /dev/mmcblk0
When utilizing bmaptool, it becomes necessary to manually update the bootloader files individually. This is due to the fact that wic images store the bootloader files in a distinct FAT/boot partition, which is incompatible with eMMC devices.
phyboard-lyra-am62axx-2:~# echo 0 > /sys/class/block/mmcblk0boot0/force_ro
phyboard-lyra-am62axx-2:~# dd if=/mnt/usb/tiboot3.bin of=/dev/mmcblk0boot0 count=1024 conv=fsync
phyboard-lyra-am62axx-2:~# dd if=/mnt/usb/tispl.bin of=/dev/mmcblk0boot0 seek=1024 count=3072 conv=fsync
phyboard-lyra-am62axx-2:~# dd if=/mnt/usb/u-boot.img of=/dev/mmcblk0boot0 seek=5120 count=3072 conv=fsync
The following must be run once per eMMC device in order for it to allow the bootROM to load the bootloaders from it. Once done for a given phyCORE-AM62Ax SOM, you won’t ever have to do this again for the life of that device.
phyboard-lyra-am62axx-2:~# mmc bootpart enable 1 1 /dev/mmcblk0
phyboard-lyra-am62axx-2:~# mmc bootbus set single_backward x1 x8 /dev/mmcblk0
phyboard-lyra-am62axx-2:~# mmc hwreset enable /dev/mmcblk0
Power off the development kit and configure the hardware to boot from the onboard eMMC flash. See the section Booting Essentials.
RAUC
The RAUC (Robust Auto-Update Controller) mechanism support has been added to meta-ampliphy. It controls the procedure of updating a device with new firmware. This includes updating the Linux kernel, Device Tree, and root filesystem. PHYTEC has written an online manual on how we have intergraded RAUC into our BSPs: L-1006e.A5 RAUC Update & Device Management Manual.