Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12452 Discussions

Booting Linux from QSPI on SoCKit board

Honored Contributor II

Hi, everyone! 


I'm trying to boot Linux from QSPI on Terasic SoCKit. 

I've reproduced steps from 'BootTheArrowSoCKitFromQSPI' document exept building Yocto root filesystem (I got errors while building rootfs in Yocto under Ubuntu 16 and under Ubuntu 12). So I use buildroot filesystem. Also I use arm-linux-gnueabihf from SoC EDS (16.1) tool chain to build Linux kernel (cloned from Rocketboards, version 4.1). MTD support is included in Linux kernel config file, mtd tools are included in buildroot as well. After flashing QSPI and booting from it I get a message "... Unable to mount rootfs..."  


I contacted Terasic support and they sent me all files to be flashed into QSPI : .dtb, .zImage, preloader_with_header,u-boot, altera-image-minimal-socfpga_cyclone5.jffs2. With all this files into QSPI I got following message: 


U-Boot SPL 2012.10 (Aug 01 2013 - 10:55:05) 

SDRAM : Initializing MMR registers 

SDRAM : Calibrationg PHY 

SEQ.C: Preparing to start memory calibration 


SF: Unsupported manufacturer 20 

SPI probe failed.# ## ERROR# ## Please RESET the board# ## 


Here we see that U-Boot SPL release is 2012.10. However, in 'BootTheArrowSoCKitFromQSPI' 2013.01.01 release is mentioned. So I tried flashing my own preloader and u-boot and 3 other files from Terasic, but again got "Unable to mount rootfs..." error. 


Hope to get replies with useful information.
0 Kudos
2 Replies
Honored Contributor II

I programmed QSPI-flash with my preloader and u-boot also rootfs,zImage, and .dtb from Terasic support. In this combination Linux boots normally from QSPI. 

But I can't build Linux Kernel and/or rootfs that allow to boot Linux from QSPI. I always get "Unable to mount rootfs..." message. 

If I take a Terasic SD-card (revF) and boot Linux from it I can check mtd partitions (command cat /proc/mtd gives information about two partitions defined in .dtb by default). But if I replace zImage file (Kernel 3.12 on Terasic SD revF) with zImage 4.1 that I've built in Ubuntu16 from linux-socfpga sources (cloned from rocketboards) I can't see mtd partitions anymore... MTD drivers support is turned on in menuconfig, so MTD drivers must be included into Kernel. I've tried to compile Kernel using linaro toolchain and SoC EDS toolchain, but in both cases result was negative.
Honored Contributor II

Finally I solve the problem. Many thanks to Terasic support team and Amy Zhou in particular. It turned out that socfpga_cyclone5_sockit.dts file in linux-socfpga folder didn't contain correct definition of QSPI-flash (my SocKit board is equipped with N25Q512A). So I got from Terasic support a correct version of .dts (here I adduce not a whole file, but only QSPI definition): 


&qspi { 

status = "okay"; 

flash0: n25q512a@0 { 

# address-cells = <1>; 

# size-cells = <1>; 

compatible = "n25q512a"; 

reg = <0>; /* chip select */ 

spi-max-frequency = <100000000>; 


page-size = <256>; 

block-size = <16>; /* 2^16, 64KB */ 

read-delay = <4>; /* delay value in read data capture register */ 

tshsl-ns = <50>; 

tsd2d-ns = <50>; 

tchsh-ns = <4>; 

tslch-ns = <4>; 

cdns,page-size = <256>; 

cdns,block-size = <16>; 

cdns,tshsl-ns = <50>; 

cdns,tsd2d-ns = <50>; 

cdns,tchsh-ns = <4>; 

cdns,tslch-ns = <4>; 



partition@qspi-boot { 

/* 8MB for raw data. */ 

label = "Flash 0 Raw Data"; 

reg = <0x0 0x800000>; 



partition@qspi-rootfs { 

/* 56MB for jffs2 data. */ 

label = "Flash 0 jffs2 Filesystem"; 

reg = <0x00800000 0x03800000>; 





I couldn't generate .dts file using sopc2dts command from SoC EDS shell as shown in 'GSRD v13.1 - Booting from QSPI' document on because of error ("Dont parse..."). 


To build a preloader-with-qspi-header.img and u-boot.img I used SoC EDS 16.1 under Win 8. As a reference Quartus project a GHRD-project from SoCKit_v.3.0.0_SystemCD Demonstrations\Linux_BSP\Console\GHRD has been used.  


Under Ubuntu16 I cloned linux-socfpga : git clone 

I used linux 4.1 : git checkout socfpga-4.1. 

Also I installed SoC EDS 16.1 to use it cross-compiler to build a Kernel and a .dtb-file. 


To build a root filesystem a buildroot was used : git clone git:// I set Filesystem images-> jffs2 root filesystem - Flash Type - Parallel flash with 64 kb erase size. 

Finally I flashed preloader-with-qspi-header.img, u-boot.img, socfpga.dtb, zImage and rootfs.jffs2 into QSPI-flash according to 'BootTheArrowSoCKitFromQSPI' document using linux mtd_debug utility. After these steps I can boot Linux from QSPI-flash.