Bootable SD Card image - ArrowElectronics/data-storm-daq GitHub Wiki

The Cyclone V SoC FPGA has three sources that the ARM processor can boot from.

  • SD Card
  • NAND flash
  • QSPI (NOR) flash

The DataStorm DAQ provides the SD Card and QSPI flash options. The GSRD provided boots from the SD Card. This card is divided into three partitions (FAT32, EXT4 Linux, Binary). The Preloader and U-Boot are written to the binary partition. The FPGA Raw Binary File (RBF) image, the Linux Kernel and the Linux devicetree are written to the FAT32 partition, and the Linux Root Filesystem is written to the EXT4 Linux partition.

The user is provided with an SD card image that has the three partitions, with the Linux Root Filesystem installed in the Linux EXT4 partition. This image is not bootable in its downloaded state. The FAT partition and the Binary partition are not populated. The instructions below show how to obtain that image and also add the remainder of the SD card contents in the unpopulated partitions. The user must add the additional SD card contents for it to be fully bootable.

Compile the SD Card Image

Table of Contents

  1. Insert the SD card adapter
  2. Prepare and Install the SD Card
  3. Copy the Preloader and uboot images to the SD card
  4. Copy the FPGA image to the SD card
  5. Copy the Linux kernel image to the SD card
  6. Copy the devicetree file to the SD card
  7. Eject the SD card adapter

Insert the SD card adapter

Determine the device associated with the SD card on the host. Run the command below before and after inserting the SD card. The new drive letter will show up as /dev/sdx/ where x represents the actual letter (a,b,c,d etc). Substitute the letter x with the actual letter in the dd commands listed below.

    $ cat /proc/partitions
  • Insert the Micro SD Card into the USB to Micro SD card Adapter.

  • Plug the USB Adapter into the host PC.

  • The VM will detect the Adapter and ask the user to choose where it should be connected

      Choose "Connect to a virtual machine" and select OK
    

Two file manager windows will open in the VM. The first called BOOT represents the FAT partition. The second called rootfs represents the Linux root file system partition. Close this partition (by clicking on the 'X' in the top left part of the window) since it will not be utilized

Prepare and Install the SD Card

Copy the root filesystem to the SD card

Exercise caution: dd targeted at an incorrect drive letter can brick your computer!

  1. Open a shell (Ctrl+Alt+T)

  2. Download the SD card image by clicking on the following hyperlink tei0022_gsrd_20220310.tar.gz. Choose the option to Save the File. The file will be placed in the Downloads folder. Allow a few minutes for the download to complete.

  3. Extract the SD card image from the binaries archive.

     $ tar -xvzf ~/Downloads/tei0022_gsrd_20220310.tar.gz  -C ~/Downloads
    
  4. Use dd utility to write the SD image to the SD card. Use soceds1 as the password when prompted. Substitute the letter x with the actual drive letter discovered above.

     $ sudo dd if=~/Downloads/tei0022_gsrd_20220310.img of=/dev/sdx bs=1M status=progress
    
  5. Use sync utility to flush the changes to the SD card.

     $ sudo sync  
    

Copy the Preloader and uboot images to the SD card

Exercise caution: dd targeted at an incorrect drive letter can brick your computer.

  1. Use dd utility to write the Preloader image to the SD card binary partition. Use soceds1 as the password when prompted. Substitute the letter x with the actual drive letter discovered above.

     $ sudo dd if=~/datastorm_daq/hdl/projects/arrow_ghrd/tei0022/partial_source/software/spl_bsp/preloader-mkpimage.bin of=/dev/sdx3 bs=64k seek=0		
    
  2. Use dd utility to write the uboot image to the SD card binary partition. Use soceds1 as the password when prompted. Substitute the letter x with the actual drive letter discovered above.

     $ sudo dd if=~/datastorm_daq/hdl/projects/arrow_ghrd/tei0022/partial_source/software/spl_bsp/uboot-socfpga/u-boot.img of=/dev/sdx3 bs=64k seek=4 
    
  3. Use sync utility to flush the changes to the SD card.

     $ sudo sync  
    

Copy the FPGA image to the SD card

Convert the FPGA image file to the Raw Binary Format (RBF)

  1. Open a Nios II Command Shell

     $ ~/intelFPGA_lite/20.1/nios2eds/nios2_command_shell.sh
    
  2. Convert the FPGA image file to the RBF format

     $ cd ~/datastorm_daq/hdl/projects/arrow_ghrd/tei0022/partial_source/output_files
    
     $ quartus_cpf -c -o bitstream_compression=on system_top.sof soc_system.rbf
    

Copy the RBF file to the SD card

    $ mkdir /media/soceds/BOOT/output_files 

    $ cp /home/soceds/datastorm_daq/hdl/projects/arrow_ghrd/tei0022/partial_source/output_files/soc_system.rbf /media/soceds/BOOT/output_files

Copy the Linux kernel image to the SD card

    $ cp /home/soceds/datastorm_daq/linux/arch/arm/boot/zImage /media/soceds/BOOT

Copy the devicetree file to the SD card

    $ mv /home/soceds/datastorm_daq/linux/arch/arm/boot/dts/socfpga_cyclone5_tei0022_arrow_ghrd.dtb /home/soceds/datastorm_daq/linux/arch/arm/boot/dts/soc_system.dtb 

    $ cp /home/soceds/datastorm_daq/linux/arch/arm/boot/dts/soc_system.dtb /media/soceds/BOOT

Eject the SD card adapter

Note : Never remove the SD card media from the Linux host before it has been ejected.

To Eject the media :

  • Click on the eject button in the file manager partition named BOOT



Next - Modify the LEDs

Return - GSRD

⚠️ **GitHub.com Fallback** ⚠️