4.1.7. Program MMC boot media

4.1.7.1. Overview

This documentation provides 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.7.2. What is Needed

  • The most current Processor SDK for Linux installed on the host Linux PC used for development

  • SK-AM64B or AM64-EVM board and an ethernet cable to connect the board to the host PC

  • A 12V and 5V power supply compatible with the AM64-EVM and SK-AM64B respectively.

  • 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.7.3. Configure tftp

  • Steps to configure a TFTP Server on host PC can be found in TFTP Server

4.1.7.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

After the Yocto enviroment is setup, use the below step to build the Initramfs Image:

MACHINE=<machine> bitbake -k tisdk-tiny-initramfs

The bitbake command mentioned in the last line above builds the tisdk-tiny-initramfs cpio which can be located at deploy-ti/images/am64xx-evm.

  • 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 = <path to cpio>/tisdk-tiny-initramfs-am64xx-evm.cpio

Select General setup:

../../../_images/Program_flash_image1.PNG

Scroll down to Initial RAM Filesystem and RAM Disk (initramfs/initrd) support and Select it:

../../../_images/Program_flash_image2.PNG

Move down a line to Initramfs source file(s). Select it and fill in the location of the files:

../../../_images/menuconfig.png

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.7.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.bin, tispl.bin and u-boot.img files from <Processor-SDK>/board-support/prebuilt-images/am64xx-evm/ to the ~/tftpboot directory

  • 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.7.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
    
  • For creating eMMC boot partiton refer here

  • For writing bootloaders into eMMC boot partition

    mmc dev 0 1
    tftp ${loadaddr} tiboot3.bin
    mmc write ${loadaddr} 0x0 0x400
    tftp ${loadaddr} tispl.bin
    mmc write ${loadaddr} 0x800 0x1000
    tftp ${loadaddr} u-boot.img
    mmc write ${loadaddr} 0x1800 0x2000
    
  • To give the ROM access to the boot partition, the following commands must be used for the first time:

    mmc partconf 0 1 1 1
    mmc bootbus 0 2 0 0
    
  • 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

  • Enter the following command on Host PC’s Linux shell to transfer the wic image

tftp -b 1468 -g -r tisdk-default-image-am64xx-evm.wic.xz <SERVER_IP>
  • Flash the image into MMC-SD

    dd if=tisdk-default-image-am64xx-evm.wic.xz of=/dev/mmcblk1
    
  • Now reboot the board with SD boot mode and verify that it boots successfully