Project

General

Profile

Snagboot Command Instructions

Snagboot is an open-source and generic replacement to the vendor-specific, sometimes proprietary, tools used to recover and/or reflash embedded platforms. It combines the dfu and fastboot protocols.

Note: DFU alone can be used to boot and flash the SOM by itself. However due to the current u-boot implementation the throughput is only ~2.6MB/s. By switching to the fastboot protocol after reaching u-boot, we can flash at ~25.8MB/s saving significant flashing time. Fastboot also supports the android sparse image format so if the image file is created properly, it can skip sending large chunks of zeros or ones saving more time.

The following instructions are compatible for the MitySOM-AM62x, MitySOM-AM62A, and MitySOM-AM62P.

References

Installing Snagboot

  • Make snagboot project directory
    $ mkdir <WORK_DIR>/snagboot
    $ cd <WORK_DIR>/snagboot
    
  • Create a python virtual environment
    $ python3 -m venv myenv
    $ source myenv/bin/activate
    
  • Clone the github repository (for this example version v2.2)
    $ git clone https://github.com/bootlin/snagboot.git
    $ cd snagboot
    $ ./install.sh
    $ cd ..
    
  • Check that snagboot has been installed and you have access to snagboot commands
    $ snagrecover -h
    $ snagflash -h
    

Build a Snagboot Compatible U-boot

  • Update the build script and create the necessary binaries
    - make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O="$R5_BUILDDIR" "${MACHINE}_r5_defconfig" 
    + make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O="$R5_BUILDDIR" "${MACHINE}_r5_defconfig" am62x_r5_usbdfu.config
    - make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O="$A53_BUILDDIR" "${MACHINE}_a53_defconfig" 
    + make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O="$A53_BUILDDIR" "${MACHINE}_a53_defconfig" am6x_a53_snagfactory.config
    
  • Run the build script

Setup the device

  • Connect the device and host computer with a USB cable.
  • Set the boot switches to DFU/Snagboot mode. Switches: SW1 = [00001010] SW2 = [01000000].
  • Turn on the device.

Boot to U-boot Using Snagrecover

The snagrecovery step handles loading the bootloader into RAM to prep for flashing the emmc in the next stage.

  • Download firmware binaries .yaml file to your snagboot directory: am62xx-beagle-play.yaml
  • Copy the necessary binaries to your snagboot directory
    $ cp <U-BOOT_DIR>/u-boot-ti/build-mitysom_am62px_devkit/a53/u-boot.img <U-BOOT_DIR>/u-boot-ti/build-mitysom_am62px_devkit/a53/tispl.bin <U-BOOT_DIR>/u-boot-ti/build-mitysom_am62px_devkit/r5/tiboot3.bin <SNAGBOOT_DIR>
    
  • Run snagrecover command and boot to u-boot prompt
    $ snagrecover -s <am62x/a/p> -f am62xx-beagle-play.yaml
    
    • Your Serial Port terminal should have the following output: Terminal Output

Flash a Sparse File Using Snagflash

  • Find your device id.
    $ lsusb
    ...
    Bus 003 Device 041: ID 0451:6165 Texas Instruments, Inc. USB download gadget
    ...
    
  • Download the ext3 file you wish to flash and convert it to a sparse file
    $ img2simg <file.ext3> <file.ext3>.sparse
    
  • Run snagflash command and flash the spare file
    $ snagflash -P fastboot -p 0451:6165 -f oem-format
    $ snagflash -P fastboot -p 0451:6165 -f flash_sparse:<file.ext3.sparse>:rootfs
    
    • Your Serial Port terminal should have the following output: Terminal Output

TODO:

figure out how to run the following fastboot commands using snagflash and boot to the kernel

fastboot flash tiboot3 tiboot3.bin
fastboot flash tispl tispl.bin
fastboot flash uboot u-boot.img 

Summary

This wiki page has demonstrated the following:
  • Installing Snagboot from the github repository
  • Boot the devkit in DFU/Snagboot mode and create a snagboot compatible u-boot
  • Run snagboot to boot to u-boot prompt and snagflash to flash a sparse file onto the board

Go to top
Add picture from clipboard (Maximum size: 1 GB)