Introduction
The A10 SoC Development Kit can boot from an SD card, QSPI, NAND and FPGA. 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.
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 |
socfpga_arria10_socdk_sdmmc.dtb |
Linux Device Tree Blob file |
^ |
ghrd_10as066n2.core.rbf |
Compressed FPGA configuration file |
^ |
ghrd_10as066n2.periph.rbf |
Compressed FPGA IO configuration file |
^ |
zImage |
Compressed Linux kernel image file |
Partition 2 |
various |
Linux root filesystem |
Partition 3 |
n/a |
U-Boot Binary and U-Boot Device Tree 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 Bootloader (U-Boot) 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/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.6 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
Creating SD Card Image
This section presents how to use the script to create the bootable GSRD Arria 10 SD Card.
Note that the image is already part of the GSRD binaries package. This procedure is required whenever a new SD card image needs to be created.
1. cd to a new folder and gather the required files into the current folder:
Item |
Description |
---|
uboot_w_dtb-mkpimage.bin |
U-Boot and U-Boot Device Tree Image |
ghrd_10as066n2.core.rbf |
Compressed FPGA configuration file |
ghrd_10as066n2.periph.rbf |
Compressed FPGA IO configuration file |
socfpga_arria10_socdk_sdmmc.dtb |
Linux Device Tree Blob |
zImage |
Compressed Linux kernel image |
gsrd-console-image-arria10.tar.xz |
Root filesystem as compressed tarball (built together with kernel image) |
2. Get the SD image creation script from
Release Tags into the current folder and make it executable:
$ chmod +x make_sdimage.py
3. Create the root filesystem to be put on the SD card image (GNU tar 1.27.1):
$ mkdir rootfs
$ cd rootfs
$ sudo tar xf ../gsrd-console-image-arria10.tar.xz
$ cd ..
4. Call the make_sdimage.py script:
$ sudo make_sdimage.py \
-f \
-P uboot_w_dtb-mkpimage.bin,num=3,format=raw,size=10M,type=A2 \
-P rootfs/*,num=2,format=ext3,size=1500M \
-P zImage,ghrd_10as066n2.core.rbf,ghrd_10as066n2.periph.rbf,socfpga_arria10_socdk_sdmmc.dtb,num=1,format=vfat,size=500M \
-s 2G \
-n sdimage.img
This will create the file sd_card_image_a10.img.
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 /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 |
ghrd_10as066n2.core.rbf |
^ |
ghrd_10as066n2.periph.rbf |
^ |
socfpga_arria10_socdk_sdmmc.dtb |
^ |
uboot_w_dtb-mkpimage.bin |
$ sudo dd if=uboot_w_dtb-mkpimage.bin of=/dev/sdx3 bs=64k seek=0 |
root filesystem |
Mount /dev/sdx2 (ext3 FS) on the host machine and updatefiles accordingly |
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/partitions before and after plugging in the card reader into the host.