The Development kit can boot from an SD card or from the onboard QSPI. The GSRD uses the SD card booting, because it is more convenient for the user.
This page presents the layout of the SD card image used by the GSRD, together with the instructions on how to re-create the SD card image, and also how to update individual elements on the SD card.HPS Boot Flow.
The picture below presents the layout of the SD card that is used by the GSRD:The following table summarizes the information that is stored on the SD card:
|Partition 1||socfpga.dtb||Device Tree Blob file|
|soc_system.rbf||FPGA configuration file|
|u-boot.scr||U-boot script for configuring FPGA|
|zImage||Compressed Linux kernel image file|
|Partition 2||various||Linux root filesystem|
|Partition 3||n/a||Preloader image|
Partition 3 is a custom partition with type=0xa2. It is required by the BootROM, which will identify it from the MBR and load the Preloader from the beginning of it.
Note that since the MBR describes the partitions, the order of partitions and their locations is not actually relevant. You could have a different order and/or gaps between them and the boot will still be successful.
This section presents details on how to create the GSRD bootable SD card image, similar with the SD card image that is provided as part of the precompiled binaries package.This release of the GSRD includes a tool that can be used to create a bootable SD card image from the items mentioned in the table above. The tool is named make_sdimage.py and is available at http://releases.rocketboards.org/release/2016.10/gsrd/tools/make_sdimage.py.
Note that the script requires argparse module, which is part of Python 2.7, but not included with previous versions. If you are using a Python version older than 2.7 you will need to obtain the argparse module separately.For example, the following command was executed on a CentOS6.5 machine with Python 2.6.6 to install argparse:
$ wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm $ sudo rpm -i epel-release-6-8.noarch.rpm $ rm epel-release-6-8.noarch.rpm $ sudo yum install python-argparseIn order to obtain more information about the tool, please run it with the '-h' option:
$ sudo ~/make_sdimage.py -h usage: make_sdimage.py [-h] [-P PART_ARGS] [-s SIZE] [-n IMAGE_NAME] [-f] Creates an SD card image for Altera's SoCFPGA SoC's optional arguments: -h, --help show this help message and exit -P PART_ARGS specifies a partition. May be used multiple times. file[,file ,...],num=,format=, size=[,type=ID] -s SIZE specifies the size of the image. Units K|M|G can be used. -n IMAGE_NAME specifies the name of the image. -f deletes the image file if exists Usage: PROG [-h] -P [-P ...] -P
The following items are required in order to be able to create the SD card image. They are all delivered as part of the precompiled binaries package but can also be rebuilt.
|Item||Description||How to Build|
|preloader-mkpimage.bin||Preloader image||Generated and compiled with SoC EDS based on Quartus handoff information|
|ghrd_5astfd5k3.rbf||Compressed FPGA configuration file||From GHRD delivered with GSRD|
|ghrd_5astfd5k3.dtb||Device Tree Blob||From GHRD delivered with GSRD|
|u-boot.scr||U-boot script for configuring the FPGA||Created with text editor and mkimage utility|
|u-boot-arria5.img||U-boot image||Compiled by Yocto with bitbake virtual/bootloader|
|zImage||Compressed Linux kernel image||Compiled by Yocto with bitbake altera-gsrd-image|
|altera-gsrd-image-arria5.tar.gz||Root filesystem as compressed tarball||Compiled by Yocto with bitbake virtual/kernel|
NOTE: Rename the ghrd_5astfd5k3.rbf to soc_system.rbf and ghrd_5astfd5k3.dtb to socfpga.dtb prior to proceeding with SD image creation
This section presents how to use the script to create the Arria V SD Card by using the prebuilt binaries. For Cyclone V the commands are very similar.1. Download the Arria V binaries into the home folder and extract them, and cd to the binaries folder:
$ cd ~ $ mkdir linux-socfpga-gsrd-16.1-av-bin $ wget http://releases.rocketboards.org/release/2016.10/gsrd/bin/linux-socfpga-gsrd-16.1-av-bin.tar.gz $ tar -xvzf linux-socfpga-gsrd-16.1-av-bin.tar.gz -C linux-socfpga-gsrd-16.1-av-bin2. Download the script and the webserver contents archive into the current folder:
$ cd ~ $ wget http://releases.rocketboards.org/release/2016.10/gsrd/tools/make_sdimage.py $ chmod +x ~/make_sdimage.py3. Create the root filesystem to be put on the SD card image:
$ cd ~/linux-socfpga-gsrd-16.1-av-bin $ mkdir rootfs $ xz -d gsrd-console-image-arria5.tar.xz $ sudo tar xf gsrd-console-image-arria5.tar -C rootfs4. Call the make_sdimage.py script:
$ cd ~/linux-socfpga-gsrd-16.1-av-bin $ sudo ~/make_sdimage.py \This will create the file sd_card_image_arria5.bin.
-P preloader-mkpimage.bin,u-boot-arria5.img,num=3,format=raw,size=10M,type=A2 \
-P rootfs/*,num=2,format=ext3,size=1500M \
-P zImage,u-boot.scr,soc_system.rbf,socfpga.dtb,num=1,format=vfat,size=500M \
-s 2G \
This section presents how to build the SD card image for Arria V from the rebuilt binaries.This is very similar with creating using Prebuilt binaries, except using the files from where they are built. The default locations are used:
|Default File Location||Comment|
|~/angstrom/build/tmp/deploy/images/zImage||Built by Yocto|
|~/av_soc_devkit_ghrd/output_files/ghrd_5astfd5k3.rbf||Part of GHRD|
It is time consuming to write the whole SD image to the card each time a modification is made. Therefore it is often preferable to create the SD card and write it to the card once, then update different elements individually.The following table presents how each item can be updated individually:
|zImage|| Mount /dev/sdx1 (FAT) on the host machine and update files accordingly:
$ sudo mkdir sdcard
$ sudo mount /dev/sdx1 sdcard/
$ sudo cp <file_name> sdcard/
$ sudo umount sdcard
|preloader-mkpimage.bin||$ sudo dd if=preloader-mkpimage.bin of=/dev/sdx3 bs=64k seek=0|
|u-boot-arria5.img||$ sudo dd if=u-boot-arria5.img of=/dev/sdx3 bs=64k seek=4|
|root filesystem||Mount /dev/sdx2 (ext3 FS) on the host machine and updatefiles accordingly|