Intel® FPGA SDK for OpenCL™: Intel® Cyclone® V SoC Development Kit Reference Platform Porting Guide

ID 683435
Date 11/06/2017
Public
Document Table of Contents

1.5.2. Creating an SD Flash Card Image

You also have the option to create a new SD flash card image. Generic instructions on building a new SD flash card image and rebuilding an existing SD flash card image are available on the GSRD v17.1 - SD Card page of the RocketBoards.org website.

The steps below describe the procedure for creating the linux_sd_card_image.tgz image from the Golden System Reference Design (GSRD) SD flash card image:

Note: To create the image from the c5soc image, perform all applicable tasks outlined in this procedure.
  1. Download and unpack the GSRD SD flash card image version 17.0 from Rocketboards.org.
  2. Mount the file allocation table (fat32) and extended file system (ext3) partitions in this image as loop-back devices. To mount a partition, perform the following steps:
    1. Determine the byte start of the partition within the image by invoking the /sbin/fdisk -lu image_file command.
      For example, partition number 1 of type W95 FAT has a block offset of 2121728. With 512 bytes per block, the byte offset is 512 bytes x 2121728 = 1086324736 bytes.
    2. Identify a free loop device (for example, /dev/loop0) by typing the losetup -f command.
    3. Assuming /dev/loop0 is the free loop device, assign your flash card image to the loop block device by invoking the losetup /dev/loop0 image_file -0 1086324736 command.
    4. Mount the loop device by invoking the mount /dev/loop0 /media/disk1 command.
      Within the image file, /media/disk1 is now a mounted fat32 partition.
    5. Repeat steps a to d for the ext3 partition.
  3. Download the Cyclone V SoC FPGA version of the Intel® FPGA Runtime Environment for OpenCL package from the Download Center on the Altera website.
    1. Click the Download button beside Intel® Quartus® Prime software edition.
    2. Specify the release version, the operating system, and the download method.
    3. Click the Additional Software tab, and select to download Intel® FPGA Runtime Environment for OpenCL Linux Cyclone V SoC TGZ.
    4. After you download the aocl-rte-<version>.arm32.tgz file, unpack it to a directory that you own.
  4. Place the unpacked aocl-rte-<version>.arm32 directory into the /home/root/opencl_arm32_rte directory on the ext3 partition of the image file.
  5. Delete the hardware folder(s) of your Custom Platform, and then place the Custom Platform into the board subdirectory of /home/root/opencl_arm32_rte.
  6. Create the init_opencl.sh file in the /home/root directory with the following content:
    export INTELFPGAOCLSDKROOT=/home/root/opencl_arm32_rte
    export AOCL_BOARD_PACKAGE_ROOT=$INTELFPGAOCLSDKROOT/board/<board_name>
    export PATH=$INTELFPGAOCLSDKROOT/bin:$PATH
    export LD_LIBRARY_PATH=$INTELFPGAOCLSDKROOT/host/arm32/lib:$LD_LIBRARY_PATH
    insmod $AOCL_BOARD_PACKAGE_ROOT/driver/aclsoc_drv.ko

    The SDK user runs the source ./init_opencl.sh command to load the environment variables and the OpenCL Linux kernel driver.

  7. If you need to update the preloader, the DTS files, or the Linux kernel, you need the arm-linux-gnueabihf-gcc compiler from the SoC EDS. Follow the instructions outlined in the Intel® SoC FPGA Embedded Design Suite User Guide to acquire the software, recompile them, and update the relevant files on the mounted fat32 partition.
    Attention: It is most likely that you need to update the preloader if your Custom Platform has different pin usages than those in c5soc.
    Remember:

    If you recompile the Linux kernel, recompile the Linux kernel driver with the same Linux kernel source files. If there is a mismatch between the Linux kernel driver and the Linux kernel, the driver will not load. Also, you must enable the CMA.

    Refer to Recompiling the Linux Kernel for more information.

  8. Compile the hello_world OpenCL example design using your Custom Platform support. Rename the .rbf file that the Intel® FPGA SDK for OpenCL™ Offline Compiler generates as opencl.rbf, and place it on the fat32 partition within the SD flash card image.
    You can download the hello_world example design from the OpenCL Design Examples page on the Altera website.
  9. After you store all the necessary files onto the flash card image, invoke the following commands:
    1. sync
    2. unmount /media/disk1
    3. unmount <ext3_partition_directory>
      where <ext3_partition_directory> is the directory name you use for mounting the ext3 partition in 2 (for example, /media/disk2).
    4. losetup -d /dev/loop0
    5. losetup -d /dev/loop1
  10. Compress the SD flash card image by invoking the following command:
    tar cvfz <my_linux_sd_card_image>.tgz linux_sd_card_image
  11. Deliver the <my_linux_sd_card_image>.tgz file inside the root directory of your Custom Platform.
  12. To test your SD flash card image, perform the following tasks:
    1. Write the resulting uncompressed image onto a micro SD flash card.
    2. Insert the micro SD flash card into the SoC FPGA board.
    3. Power up the board.
    4. Invoke the aocl diagnose utility command.