4.1.18. Program MMC boot media¶
4.1.18.1. Overview¶
This documentation provide the steps for building flasher Image with initramfs-based boot support and programming the MMC device via CPSW Ethernet connection to a Linux host PC. This solution will work with a completely blank board / SK and can be used as a base to create a custom production programming solution.
To achieve this goal the following is required:
Use the SDK to build a separate “flasher” image which can be transferred from the host PC via Ethernet to program the MMC-SD device.
4.1.18.2. What is Needed¶
The most current Processor SDK for Linux installed on the host Linux PC used for development
AM68-SK board and a ethernet cable to connect the AM68-SK to the host PC
A 5V power supply compatible with the AM68-SK
A Serial Debug Cable is recommended to monitor U-Boot outputs
An image to flash. This can be derived from the SDK mentioned above
A Linux Filesystem small enough to be peripheral booted, with the functionality needed to do the necessary flashing operation. This can be derived from the SDK mentioned above
A Linux host PC to transfer the binary files
A configured TFTP Server
A SD card with pre-built U-Boot images from SDK
4.1.18.3. Configure tftp¶
Steps to configure a TFTP Server on host PC can be found in TFTP Server
4.1.18.4. Preparing the Flasher Image¶
First we need to create the flasher image with smaller filesystem on the host PC.
Prepare a rootfs
Navigate to <Processor-SDK>/filesystem
Create a directory called tisdk-tiny-image-j721s2-evm under <Processsor-SDK>/filesystem/
Extract SDK-provided “tiny” rootfs inside the tisdk-tiny-image-j721s2-evm directory
tar -C tisdk-tiny-image-j721s2-evm -xvf tisdk-tiny-image-j721s2-evm.tar.xz
Create an /init link pointing to /sbin/init. The Kernel requires this to boot from the initramfs:
ln -s sbin/init tisdk-tiny-image-j721s2-evm/init
Verify contents of initramfs root folder:
ls -l tisdk-tiny-image-j721s2-evm/
init should now be linked to sbin/init
Navigate to your linux repository to build flasher Image
cd <PSDK_PATH>/board-support/linux-[ver]/
Prepare Kernel with baked-in initramfs
Build device defconfig file
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- defconfig ti_arm64_prune.config
Make a backup copy of .config called .config.orig
Edit the current Kernel config using menuconfig as follows:
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- menuconfig
Set CONFIG_INITRAMFS_SOURCE = <Processor-SDK>/filesystem/tisdk-tiny-image-j721s2-evm
Select General setup:
Exit menuconfig and save the new configuration
Build the Kernel
Compile the zImage
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- Image
Copy arch/arm64/boot/Image to /tftpboot
4.1.18.5. Target Images¶
Populate pre-built U-Boot images from SDK into TFTP folder
Note
We can use the prebuilt U-Boot images as-is with no modifications needed
Populate bootloaders into the TFTP home directory
Copy tiboot3-j721s2-hs-fs-evm.bin, tispl.bin and u-boot.img files from <Processor-SDK>/board-support/prebuilt-images/ to the ~/tftpboot directory
Rename tiboot3-j721s2-* as tiboot3.bin inside ~/tftpboot
Populating rootfs into the TFTP home directory.
Download the default bootable SD card image (WIC file) available on the release page as tisdk-default-image-<machine>.wic.xz
Copy wic image to root directory /tftpboot
4.1.18.6. Program the Flash¶
Now that the flash image has been created we can now flash the SK
Note
In SK the TFTP server must be properly configured to transfer the flash image.
Connect SK to Linux host machine via Serial Debugging Cable
Open an active console window to monitor bootup messages
Connect ethernet cable to board
Boot the board in SD boot mode and “strike any key” to halt U-Boot at prompt
Enter the following commands
setenv serverip <SERVER_IP> dhcp
Enter command to boot Linux using initramfs image from TFTP server
run findfdt tftp ${loadaddr} Image tftp ${fdtaddr} ${name_fdt} booti ${loadaddr} - ${fdtaddr}
Enter the following command on Linux shell to transfer the wic image
tftp -b 1468 -g -r tisdk-default-image-j721s2-evm.wic.xz <SERVER_IP>
Flash the image into MMC-SD
dd if=tisdk-default-image-j721s2-evm.wic.xz of=/dev/mmcblk1
Now reboot the board with SD boot mode and verify that it boots successfully