SD Card
Create a Bootable SD Card
In order to create a bootable SD card a BSP image has to be flashed onto it. Flashing is a term used to describe the process of burning software images to a flash memory storage device, hence flashing. This section of the guide will outline the steps for flashing the complete .wic.xz image format to an SD Card. The .wic.xz image format is a compressed binary consisting of all the necessary binaries, as well information about the require disk partitions needed for booting the phyCORE-AM57x into Linux. This includes the bootloader, kernel and root filesystem.
In order to boot the phyCORE-AM57x development kit into Linux, it must load valid software from a memory storage device. It is typical for production systems to boot software from an onboard (non-removable) memory storage device such as eMMC memory but booting from an SD Card is more convenient during development. The phyCORE-AM57x development kit is configured to boot from an SD Card by default.
A pre-configured SD Card should have been included in the box with your development kit but this guide will walk through the creation of a bootable SD Card using Pre-Built Binaries or images you have generated on your own by following the Build the BSP guide.
Requirements
SDHC SD card, at least 4GB (Included in development kit)
SD card reader
Ubuntu 20.04 LTS, 64-bit Host Machine with root permission. (For Updating Individual Parts)
If using a virtual machine, VMWare Workstation, VMWare Player, and VirtualBox are all viable solutions.
Windows 10
If flashing whole default wic.xz image onto SD card.
Download Pre-Built Binaries (unless using custom image)
phytec-qt5demo-image-phycore-am57xx-1.wic.xz
Note
If you have built your own images by following the Build the BSP guide, then the images are located in: $YOCTO_DIR/build/arago-tmp-external-linaro-toolchain/deploy/images/<MACHINE>/
Flashing SD Card with Pre-Built Binaries
To create a bootable SD card, you’ll need to flash a BSP image onto it. “Flashing” refers to the process of burning software images onto a flash memory storage device. This guide section outlines three methods for flashing the complete .wic.xz image format to an SD Card. One method involves using balena-etcher, while the other two methods utilize Linux terminal commands: dd and bmaptool.
The .wic.xz image format is a compressed binary containing all the necessary binaries, as well as information about the required disk partitions needed for booting the phyCORE-AM57x into Linux. This includes the bootloader, kernel, and root filesystem.
To boot the phyCORE-AM57x development kit into Linux, it must load valid software from a memory storage device. While production systems typically boot software from onboard (non-removable) memory storage devices such as eMMC memory, booting from an SD Card is more convenient during development. The phyCORE-AM57x development kit is configured to boot from an SD Card by default.
Although a pre-configured SD Card should have been included in the box with your development kit, this guide will walk you through the creation of a bootable SD Card using Pre-Built Binaries or images you have generated on your own by following the Build the BSP guide.
Using balenaEtcher
Download the SD card flasher app BalenaEtcher
Download the prebuilt SD card image Pre-Built Binaries.
Now that your system is setup, use the BalenaEtcher SD card flasher to create a bootable SD card.
Open BalenaEthcher and select “Flash from file”.
Select the ‘phytec-qt5demo-image-phycore-am57xx-1.wic.xz’ SD card image file from your Downloads folder.
Then insert the SD card into the SD card reader.
Click on “Select Target” and select the SD card.
Begin flashing the SD card by pressing “Flash!”
Once BalenaEtcher is done flashing the SD card image, eject the SD card from the Host PC and insert the SD card into the development kit.
See the section “Booting from SD Card” for more information.
Using bmaptool (Linux)
Install bmaptool
host:~$ sudo apt install bmap-tools
Download the
.wic.xz
and.wic.bmap
Pre-Built Binaries for the latest BSP release and navigate to the location of these files using your Linux Host Machine:host:~$ cd ~/Downloads
Run the following command without the SD card connected to the host machine.
host:~$ ls /dev/sd*
Connect the SD card to the Ubuntu host machine.
Run the following command again with the SD card connected to the host machine.
host:~$ ls /dev/sd*
Unmount the SD card from the host machine. Do not remove the card from the machine.
host:~$ umount /dev/sdX*
Start with a clean SD card by deleting any previous partitions on the device.
host:~$ fdisk /dev/sdX # 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
Navigate to the directory containing the ‘.wic.xz’ file you wish to flash. This might be wherever you downloaded the pre-built image or it could be the deployment directory of your local BSP build at $YOCTO_DIR/build/arago-tmp-external-linaro-toolchain/deploy/images/<MACHINE>/
host:~$ cd <image location>
Flash the .wic.xz image to the SD Card using bmaptool:
host:~$ sudo bmaptool copy phytec-qt5demo-image-phycore-am57xx-1.wic.xz /dev/sdX
Unmount the partitions before removing the SD card:
host:~$ umount /media/<user>/boot /media/<user>/rootfs
The SD card should now be ready to boot your target hardware into Linux. For more information on how to boot from SD card, see the section “Booting from SD Card”.
Using dd (Linux)
Download the
.wic.xz
file from Pre-Built Binaries for the latest BSP release and navigate to the location of this file using your Linux Host Machine:host:~$ cd ~/Downloads
Run the following command without the SD card connected to the host machine.
host:~$ ls /dev/sd*
Connect the SD card to the Ubuntu host machine.
Run the following command again with the SD card connected to the host machine.
host:~$ ls /dev/sd*
Unmount the SD card from the host machine. Do not remove the card from the machine.
host:~$ umount /dev/sdX*
Start with a clean SD card by deleting any previous partitions on the device.
host:~$ fdisk /dev/sdX # 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
Navigate to the directory containing the ‘.wic.xz’ file you wish to flash. This might be wherever you downloaded the pre-built image or it could be the deployment directory of your local BSP build at $YOCTO_DIR/build/arago-tmp-external-linaro-toolchain/deploy/images/<MACHINE>/
host:~$ cd <image location>
Flash the .wic.xz image to the SD Card:
host:~$ sudo xz -dc phytec-qt5demo-image-phycore-am57xx-1.wic.xz | sudo dd of=/dev/sdc bs=4M conv=fsync
Unmount the partitions before removing the SD card:
host:~$ umount /media/<user>/boot /media/<user>/rootfs
The SD card should now be ready to boot your target hardware into Linux. For more information on how to boot from SD card, see the section “Booting from SD Card”.
Updating Individual Parts (Advanced, Linux Machine)
Once the SD card has been formatted the first time via flashing the complete .wic.xz image, you do not need to flash the entire contents of the SD Card image again to update the image components. The bootloader, kernel and root filesystem can be updated individually (depending on the changes being tested) to potentially save a lot of time during development. Find all the images and binaries for the phyCORE-AM57x development kit on the Pre-Built Binaries page.
Updating the Kernel
First, remove the existing kernel image and device tree files pertaining to your SOM (in this example we will assume the SOM is the standard kit option PCM-057-41300111I):
host:~$ sudo rm /media/<user>/root/boot/zImage host:~$ sudo rm /media/<user>/root/boot/oftree host:~$ sudo rm /media/<user>/root/boot/am57xx-phytec-pcm-948.dtb #Base Kernel Device Tree Blob for CB host:~$ sudo rm /media/<user>/root/boot/am5728-phytec-pcm-948-40300111I.dtb #Base Kernel Device Tree Blob
Note
You may notice that the /boot directory contains many dtb files for various SOM configurations. This is because the EEPROM on the phyCORE-AM57x SOM is used to help select which device tree should be used at boot. This strategy allows for the use of a single software image to support all phyCORE-AM57x variants.
For more information on this EEPROM mechanism, checkout Using the PHYTEC EEPROM Flashtool guide.
Load the new Linux kernel and device tree images to the SD Card.
host:~$ sudo cp zImage /media/<user>/root/boot/ host:~$ sudo cp oftree /media/<user>/root/boot/ host:~$ sudo cp am57xx-phytec-pcm-948.dtb /media/<user>/root/boot/ host:~$ sudo cp am5728-phytec-pcm-948-40300111I.dtb /media/<user>/root/boot/ host:~$ sudo sync /media/<user>/root/boot/Note
The U-boot expects the kernel to be named zImage and the standard SOM dtb file to be named am5728-phycore-kit-41300111i.dtb for the standard development kit.
Updating the Root Filesystem
Delete the contents of the current root filesystem:
host:~$ sudo rm -rf /media/<user>/root/*
Extract the new filesystem to the SD Card:
host:~$ sudo tar -xf phytec-qt5demo-image-phycore-am57xx-1.tar.xz -C /media/<user>/root/ && sync
Note
The tar.xz file can be found and downloaded in the first link on the Pre-Built Binaries page.
Updating the Bootloader
Remove the existing U-Boot and MLO images:
host:~$ sudo rm /media/<user>/boot/u-boot.img host:~$ sudo rm /media/<user>/boot/MLO
Copy the new images to the SD Card:
host:~$ sudo cp u-boot.img /media/<user>/boot/u-boot.img && sync host:~$ sudo cp MLO /media/<user>/boot/MLO && sync
Booting from SD Card
The phyCORE-AM57x development kit is configured to boot from an SD card slot by default and basic steps for performing this and establishing serial communication are outlined in the Quickstart. Boot switch (aka DIP switches) settings determine the location and method the boot ROM loads the first stage bootloader into memory before executing it.
With the phyCORE-AM57x Development kit powered off, set the following boot switch settings to boot from the SD Card.