Booting Linux from QSPI on Arria 10 Dev Kit with the 15.0.1 Release
Prerequisites
You will need the following items:
- Arria 10 SoCDevelopment Kit, including:
- DDR4 Memory Card
- QSPI Boot Card
- Host PC with:
- Linux OS - required for compiling U-Boot, which is not supported on Windows
- Minimum 16GB or RM - required for building the hardware design
- Serial terminal (for example minicom
- TFTP Server - for getting Linux binaries to U-Boot to be written to QSPI
- SoC EDS 15.0.1b60 - for generating and building U-Boot
- ACDS 15.0b145 - for compiling the hardware design
- Local Ethernet network, with DHCP server (will be used to provide IP address to the board).
Overview
This page provides instructions on how to boot the A10 SoC from QSPI, by using the 15.0.1 release of the GSRD. Complete instructions, sources and precompiled binaries are included.
Note: Because this page was created after the official release of the 15.0.1 GSRD, some instructions are more complex than what they need to be. This will be remedied in future releases.

Booting from QSPI involves the following:
- Generic Flow - required for any system booting from QSPI:
- Updating the Hardware Design to use QSPI as the boot source instead of SD/MMC which is the default for GSRD.
- Compiling the Hardware Design to generate the FPGA configuration file and U-Boot handoff information
- Generating and compiling U-Boot and U-Boot device tree based on the new handoff information.
- Writing combined U-Boot and U-Boot Device Tree Image and rbf file to QSPI
- Booting U-Boot from QSPI
- Linux Specific Flow - required for booting Linux from QSPI:
- Building Linux kernel and a small rootfs (that would fit in QSPI)
- Updating the Linux Device Tree to match new QSPI Layout
- Writing the Linux binaries to QSPI from U-Boot console
- Booting Linux from QSPI
The generic steps above are enough to get the user to boot to the U-Boot console.
The Linux specific steps above are required for enabling Linux to boot from QSPI.
QSPI Layout
The following layout was chosen for the QSPI:
Item |
Start Address (Hex) |
Size (Hex) |
Size (Bytes) |
---|
4 x U-Boot Images |
0x00000000 |
0x00100000 |
1048576 |
Linux Device Tree |
0x00100000 |
0x00020000 |
131072 |
Linux Kernel |
0x00120000 |
0x00600000 |
6291456 |
FPGA Configuration (compressed RBF) |
0x00720000 |
0x014E0000 |
21889024 |
Root Filesystem (JFFS2) |
0x01C00000 |
0x06400000 |
104857600 |
Notes:
- Location of the Bootloader at offset 0x0 in QSPI is required by BootROM.
- The FPGA configuration file needs to have the U-Boot (mkimage) wrapper.
- Location of RBF file, Linux kernel and Linux Device Tree are hardcoded in U-Boot source code as U-Boot environment variables (qspirbfaddr, qspibootimageaddr, qspifdtaddr). Their default values can be changed by editing the U-Boot source code file include/configs/socfpga_arria10.h.
- Location of root file system is defined in the Linux Device Tree.
Updating and Building the Hardware Design
This section presents how to update the hardware design to boot from QSPI and then how to build it. This is part of the generic flow, and is required for any A10 @SoC System booting from QSPI.
The input to this flow is the GHRD delivered with SoC EDS, while the output is an mkimage wrapped rbf file and the handoff information for generating the Bootloader.
1. Make a copy of the Hardware Design, from the archive delivered with @SoC EDS.
~/altera/15.0/embedded/embedded_command_shell.sh
cd ~
mkdir a10_soc_devkit_ghrd_qspi
cd a10_soc_devkit_ghrd_qspi/
tar xvzf ~/altera/15.0/embedded/examples/hardware/a10_soc_devkit_ghrd/tgz/*.tar.gz
2. Update the Hardware Design makefile to enable booting from QSPI:
sed -i 's/HPS_BOOT_DEVICE := SDMMC/HPS_BOOT_DEVICE := QSPI/g' Makefile
3. Update the Hardware Design makefile to create just a single RBF file instead of two.
sed -i 's/QUARTUS_CPF_ENABLE_SPLIT_RBF := 1/QUARTUS_CPF_ENABLE_SPLIT_RBF := 0/g' Makefile
4. Update the hardware design:
make scrub_clean
make quartus_generate_top quartus_generate_qsf_qpf qsys_generate_qsys
5. Compile the hardware design:
make sof
This will create the hardware configuration file
~/a10_soc_devkit_ghrd/output_files/ghrd_10as066n2.sof and also the handoff information in the folder
hps_isw_handoff.
Note that compiling the hardware desing can also be done using the instructions from
http://rocketboards.org/foswiki/view/Documentation/A10GSRDV1501CompilingHardwareDesign.
6. Generate the rbf file:
make rbf
This will create the following file:
~/a10_soc_devkit_ghrd/output_files/ghrd_10as066n2.rbf.
Creating the rbf file can also be achieved by running the command:
quartus_cpf -c -o bitstream_compression=on ~/a10_soc_devkit_ghrd/output_files/ghrd_10as066n2.sof ~/a10_soc_devkit_ghrd/output_files/ghrd_10as066n2.rbf
Note that we are not using the "--hps" option, since for booting from QSPI we are using just a single combined rbf file, containing both the I/O configuration and the FPGA fabric configuration.
7. Add the U-Boot mkimage header on top of the rbf file:
mkimage -A arm -T firmware -C none -O u-boot -a 0 -e 0 -n "RBF" \
-d output_files/ghrd_10as066n2.rbf \
output_files/ghrd_10as066n2.rbf.mkimage
This will create the following file:
~/a10_soc_devkit_ghrd/output_files/ghrd_10as066n2.rbf.mkimage.
Generating U-Boot and U-Boot Device Tree
The flow for generating and compiling U-Boot and the U-Boot device tree is similar with the SDMMC flow described at
http://rocketboards.org/foswiki/view/Documentation/A10GSRDV1501GeneratingUBootAndUBootDeviceTree.
The only difference is that the
boot_device needs to be set to "Boot from QSPI", and that the
peripheral_rbf_filename and
core_rbf_filename do not have any meaning in this scenario.

After generating and compiling U-Boot, you will obtain the following file:
~/a10_soc_devkit_ghrd/software/uboot_bsp/uboot_w_dtb-mkpimage.bin – bootable image, containing 4 combined U-Boot and U-Boot Device Tree images, each wrapped with the mkpimage header.
Writing generic Binaries to QSPI and Booting U-Boot
This section presents how to write to QSPI the U-Boot and the FPGA configuration file and then boot from QSPI to U-Boot prompt.
1. Connect a micro USB cable from connector J22 to the PC (used for JTAG connection) and a mini USB cable from connector J10 to the PC (used for serial connection).
2. Start a serial terminal on PC and connect to the board using 115,200-8-N-1.
3. Power up the board. Observe the serial terminal. If U-Boot tries to boot, press any key to stop it. This is required because the HPS Flash programmer can have problems connecting to the board when Linux is running.
4. Program the files from an Embedded Command Shell
~/altera/15.0/embedded/embedded_command_shell.sh
cd ~/a10_soc_devkit_ghrd_qspi
quartus_hps --cable=1 --operation=PV --addr=0x0 software/uboot_bsp/uboot_w_dtb-mkpimage.bin
quartus_hps --cable=1 --operation=PV --addr=0x720000 output_files/ghrd_10as066n2.rbf.mkimage
Note: Programming U-Boot to QSPI takes ~3 minutes, while programming the RBF file takes ~45 minutes.
5. Power cycle the board and observe the serial terminal. U-Boot will run. Press any key to get to the U-Boot console.
Building Linux Kernel, Device Tree and Root Filesystem
The build process relies on an additional Yocto layer called
meta-qspiboot that was added on top of the A10
Golden System Reference Design (GSRD) User Manuals 15.01 release and which contains the following (create a file in
/sources/meta-altera/recipe-images/angstrom/console-image-qspi.bb):
- definition of a new image recipe (console-image-qspi.bb) that adds a rootfs target called console-image-qspi :
require recipes-images/angstrom/console-image.bb
DESCRIPTION = "Small image suitable for QSPI boot"
IMAGE_INSTALL += "mtd-utils openssh gdbserver"
export IMAGE_BASENAME = "console-image-qspi"
export EXTRA_IMAGECMD_jffs2 = "--squash -s 256 -e 64KiB"
export IMAGE_FSTYPES = "jffs2"
- definition of a Linux kernel recipe (linux-altera-ltsi_3.10.bbappend) that brings in the correct Linux kernel tag (ACDS15.0.1_REL_GSRD_UPDATE1_PR) and applies the following kernel patch to fix an issue with the QSPI partitioning in the Linux Device Tree:
diff -Naur linux-socfpga/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts linux-socfpga.patched/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts
--- linux-socfpga/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts 2015-07-22 13:17:08.000000000 -0500
+++ linux-socfpga.patched/arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts 2015-08-19 16:12:36.623848316 -0500
@@ -49,11 +49,11 @@
partition@qspi-boot {
label = "Boot and fpga data";
- reg = <0x0 0x1B20000>;
+ reg = <0x0 0x1C00000>;
};
partition@qspi-rootfs {
label = "Root Filesystem - JFFS2";
- reg = <0x1B20000 0x64E0000>;
+ reg = <0x1C00000 0x6400000>;
};
};
};
Note that the updated recipes are available for download as shown below, and the user does not have to manually type the information above, which is provided for reference.
The complete instructions on how to build the binaries required to boot Linux from QSPI are:
1. Please follow the steps described in Compiling Linux Kernel and Root Filesystem section Host Setup for Yocto to configure your host with the necessary packages to run Yocto.
2. Run the following commands to get and build the updated Angstrom Yocto recipes:
cd ~
wget https://releases.rocketboards.org/2015.08/a10qspiboot/src/angstrom-socfpga-qspiboot.tar.gz
tar xvzf angstrom-socfpga-qspiboot.tar.gz
cd angstrom-socfpga-qspiboot
MACHINE=arria10 ./oebb.sh config arria10
source ./environment-angstrom-v2014.12
MACHINE=arria10 bitbake virtual/kernel console-image-qspi
This will create the following in the folder ~/angstrom-socfpga/deploy/glibc/images/arria10/:
File |
Description |
---|
zImage |
Linux kernel |
socfpga_arria10_socdk_qspi.dtb |
Linux Device Tree |
console-image-qspi-arria10.jffs2 |
Root Filesystem |
socfpga_arria10_socdk_qspi.dtb |
Linux Device Tree Binary |
Writing Linux Binaries to QSPI and Booting Linux
1. On host PC, make sure you have an TFTP server configured and running.
2. On Host PC, copy ht eLinux binaries to the TFTP folder. The following assume that the TFTP shared folder is /tftpboot.
cd ~/angstrom-socfpga/deploy/glibc/images/arria10/
cp zImage /tftpboot/
cp socfpga_arria10_socdk_qspi.dtb /tftpboot/
cp console-image-qspi-arria10.jffs2 /tftpboot/
3. Boot the board up to U-Boot console, by powering it up and pressing any button while U-Boot displays the countdown timer.
4. At the U-Boot console, run the following commands to erase the flash locations where the Linux Device Tree, Linux kernel and Linux filesystem will be written
sf probe
sf erase 0x00100000 0x00020000
sf erase 0x00120000 0x00600000
sf erase 0x01C00000 0x06400000
Note: Erasing QSPI from U-Boot takes ~1hr. This can be done faster (~25min) with the HPS Flash Programmer by running the following commands:
~/altera/15.0/embedded/embedded_command_shell.sh
quartus_hps --cable=1 --operation=E --addr=0x00100000 --size=0x00020000
quartus_hps --cable=1 --operation=E --addr=0x00120000 --size=0x00600000
quartus_hps --cable=1 --operation=E --addr=0x01C00000 --size=0x06400000
5. At the U-Boot console, download and write the Linux binaries to flash:
tftp $loadaddr socfpga_arria10_socdk_qspi.dtb
sf write $loadaddr 0x0100000 $filesize
tftp $loadaddr zImage
sf write $loadaddr 0x00120000 $filesize
tftp $loadaddr console-image-qspi-arria10.jffs2
sf write $loadaddr 0x01C00000 $filesize
6. Power cycle the board. It should boot to the Linux console.
Deliverables
The associated files are available at https://releases.rocketboards.org/2015.08/a10qspiboot and consist of the following:
The precompiled binaries archive contains the following:
File |
Description |
---|
console-image-qspi-arria10.jffs2.gz |
Compressed JFFS2 rootfs partition image |
console-image-qspi-arria10.tar.xz |
Compressed root file system archive |
ghrd_10as066n2.rbf.mkimage |
FPGA Configuration RBF wrapped with mkimage header |
ghrd_10as066n2.sof |
FPGA Configuration File SOF |
qspi.img.gz |
Compressed image of the QSPI |
socfpga_arria10_socdk_qspi.dtb |
Updated Linux Device Tree file |
uboot_w_dtb-mkpimage.bin |
Precompiled U-Boot and U-Boot Device Tree Image |
vmlinux |
Linux kernel executable |
zImage |
Linux kernel compressed image |
The prebuilt binaries are provided for reference, and can enable the user to skip some or all of the steps from the flow.