Introduction
The Arrow
SoCKit board 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.
Boot Flow
See
HPS Boot Flow.
SD Card Layout
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:
Location |
File Name |
Description |
---|
Partition 1 |
soc_system.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 |
^ |
n/a |
U-boot image |
The MBR (Master Boot Record) contains descriptions of the partitions on the card, including their type, location and length.
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.
Creating SD Card Image Using Provided Script
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
https://releases.rocketboards.org/2014.12/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-argparse
In 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 SoCEDS based on Quartus handoff information |
soc_system.rbf |
Compressed FPGA configuration file |
From GHRD delivered with GSRD |
soc_system.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-sockit.img |
U-boot image |
Generated and compiled with <nop>SoCEDS based on Quartus handoff information |
zImage |
Compressed Linux kernel image |
Compiled by Yocto with bitbake altera-gsrd-image |
sockit-gsrd-image.tar.gz |
Root filesystem as compressed tarball |
Compiled by Yocto with bitbake virtual/kernel |
bup.tar.gz |
Web server files - delivered with the release |
Does not need to be rebuilt |
sockit_patch.tar.gz |
SoCKit customisation files |
Does not need to be rebuilt |
The files can be downloaded from
Release Contents
Creating SD Card Image Using Prebuilt Binaries
Re-create the SD card image by using the precompiled binaries package and performing the following commands (ensure you have the linux-sockit-gsrd-14.0-bin.tar.gz, bup.tar.gz and sockit_patch.tar.gz files in the current folder or change paths accordingly):
1. Create
rootfs folder containing the root filesystem and the web server additional files:
$ tar xvzf linux-sockit-gsrd-14.01-bin.tar.gz
$ cd linux-sockit-gsrd-14.0-bin
$ mkdir rootfs
$ cd rootfs
$ sudo tar xzf ../sockit-gsrd-image.tar.gz
$ sudo tar xzf ../../bup.tar.gz
$ sudo tar xzf ../../sockit_patch.tar.gz
$ cd ..
2. Call the make_sdimage.py script:
$ sudo ./make_sdimage.py -f -P preloader-mkpimage.bin,u-boot-sockit.img,num=3,format=raw,size=10M,type=A2 -P rootfs/*,num=2,format=ext3,size=1200M -P zImage,u-boot.scr,soc_system.rbf,soc_system.dtb,num=1,format=vfat,size=300M -s 1700M -n gsrd_sd_card_image.img
3. Copy the image to the SD Card
$ Determine the device name by running $ cat /proc/partitions before and after plugging in the card reader into the host.
$ sudo dd if=gsrd_sd_card_image.img of=/dev/sdx bs=1M. Replace "sdx" with the device name of the SD card on your host system
$ sudo sync
Creating SD Card Image Using Rebuilt Binaries
This is very similar with creating using Prebuilt binaries, except using the files from where they are built. The default locations are:
Default File Location |
Comment |
---|
~/build/tmp/deploy/images/zImage |
Built by Yocto |
~/build/tmp/deploy/images/altera-gsrd-image-socfpga_cyclone5.tar.gz |
^ |
~/sockit_ghrd/output_files/soc_system.rbf |
Part of GHRD |
~/sockit_ghrd/software/spl_bsp/preloader-mkpimage.bin |
^ |
~/sockit_ghrd/software/spl_bsp/uboot-socfpga/u-boot.img |
^ |
~/sockit_ghrd/soc_system.dtb |
^ |
Note that the web server files from bup.tar.gz do not need to be rebuilt, they can be used as-is from the release package.
Creating SD Card Image Manually
You can also create the SD Card image manually, without using the provided script.
Refer to
/opt/altera-linux/bin/make_sdimage.sh script for the necessary commands to be executed.
Updating Individual Elements on the SD card
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:
File |
Update Procedure |
---|
zImage |
Mount DOS SD card partition 1 and replace file with new one: $ sudo mkdir sdcard $ sudo mount /dev/sdx1 sdcard/ $ sudo cp <file_name> sdcard/ $ sudo umount sdcard |
soc_system.rbf |
^ |
soc_system.dtb |
^ |
u-boot.scr |
^ |
preloader-mkpimage.bin |
$ sudo dd if=preloader-mkpimage.bin of=/dev/sdx3 bs=64k seek=0 |
u-boot.img |
$ sudo dd if=u-boot.img of=/dev/sdx3 bs=64k seek=4 |
root filesystem |
$ sudo dd if=sockit-gsrd-image.ext3 of=/dev/sdx2 |
Replace in the above command "sdx" with the device name of the SD card on your host system. You can find out the device name by running
$ cat /proc/partitionsbefore and after plugging in the card reader into the host.