Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

Cyclone V SoC Devkit problems compiling Angstrom kernel

Altera_Forum
Honored Contributor II
3,674 Views

Hello to everyone. 

 

I’m a doctorate of the department of Electronics Engineering of the University of Modena and Reggio Emilia (Italy) and I’m working in collaboration with a company in Bologna (Italy). This company gave me an Altera Cyclone V SOC Development Kit (already used by others inside the company, but I made sure it was brought back in the factory settings depicted by the user manual). 

I have to admit that I’m pretty new to Linux, and I have little knowledge about the way operating systems work (much more about how a transistor works or is made). I have followed no one course in my academic career about how to bother with operating systems compilations. I instead have a good knowledge about C language and a sufficient knowledge about assembly and matlab. And, as you will have noticed, not being a native speaker, even my English is not perfect: sorry for that.  

I work on Ubuntu 14.04 LTS operating in a virtual machine (VirtualBox version 5.2.12) running on Windows 8.1 operating in my laptop; Ubuntu is updated to the latest version and also all the packages installed. 

 

Using the included SDcard image (with Angstrom Linux) and all the factory settings the kit works just fine, with no particular trouble.  

 

Now, in the last weeks I was slavishly following the “getting started” guides available at rocketboards.org for the 17.1 toolkit (at the time when I have started 18.0 was not yet delivered).  

 

  • I have started with “Compiling the Hardware Design” using the 2017.10 GSRD and using the 17.1 version of Quartus, generating the system in Platform Developer. The procedure terminates correctly and all the files supposed to be generated, they are. 

  • Then following the guide “Generating and Compiling the Preloader” I generate and compile the preloader and again this time it seems that all the required files have been generated correctly in the appropriate folder. 

  • Next, I generate the device tree using the device tree generator (sopc2dts) adopting the following settings: 

 

sopc2dts --input soc_system.sopcinfo 

--output socfpga.dtb 

--type dtb 

--board soc_system_board_info.xml 

--board hps_common_board_info.xml 

--bridge-removal all 

--clocks 

--verbose 

And the file is generated, I suppose correctly, again, but I have read that sometimes sopc2dts can give some problems. 

 

  • The next step is the Linux compilation, made following again the apposite guide on rocketboards.org, again in the version for the 17.1 gsrd release. I have set the host with all the packages shown in the guide; the only trouble is with ia32-libs needed since my machine is 64 bits: that package cannot be found and so cannot be installed. Then I proceed by building kernel and rootfs using angstrom 2017.10 distribution, i.e. using the following commands: 

 

cd ~ 

mkdir angstrom-build 

cd angstrom-build 

wget http://releases.rocketboards.org/release/2017.10/gsrd/src/altera.xml 

wget http://commondatastorage.googleapis.com/git-repo-downloads/repo 

chmod 777 repo 

export PATH=$PATH:~/angstrom-build 

repo init -u git://github.com/Angstrom-distribution/angstrom-manifest -b angstrom-v2017.06-yocto2.3 

mkdir -p .repo/local_manifests 

mv altera.xml .repo/local_manifests/ 

repo sync 

MACHINE=cyclone5 . ./setup-environment# Replace machine name (eg. MACHINE=cyclone5) with the target family, options are: cyclone5, arria5, arria10 and stratix10 

sed -i '/meta-altera/a \ \ ${TOPDIR}\/layers\/meta-altera-refdes \\' conf/bblayers.conf# This is to add the meta-altera-refdes layer to conf/bblayers.conf 

sed -i '/meta-atmel/d' conf/bblayers.conf# We do not need this layer 

sed -i "s%/usr/bin/env python$%/usr/bin/env python2%" ~/bin/repo 

export KERNEL_PROVIDER=linux-altera-ltsi 

export KERNEL_TAG=refs/tags/ACDS17.1_REL_GSRD_UPDATE1_PR# Check above for newer release tags and replace it with the version you are building with 

export UBOOT_TAG=refs/tags/ACDS17.1_REL_GSRD_UPDATE1_PR# Check above for newer release tags and replace it with the version you are building with 

export KBRANCH=socfpga-4.9.78-ltsi# Check above for release branch to use 

BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE KBRANCH KERNEL_TAG UBOOT_TAG KERNEL_PROVIDER" 

 

sudo bitbake gsrd-console-image 

The only differences from the scripts found in the guide is the substitution of the machine name target with cyclone5, and in the line sed -i '/meta-altera/a \ \ ${TOPDIR}\/layers\/meta-altera-refdes \\' conf/bblayers.conf# This is to add the meta-altera-refdes layer to conf/bblayers.conf “layers” has replaced “sources” in the folder path since in the downloaded and extracted packet the sources folder doesn’t exist. 

Now, the final report is:  

NOTE: Tasks Summary: Attempted 3359 tasks of which 6 didn't need to be rerun and all succeeded. 

NOTE: Writing buildhistory 

 

Summary: There were 131 WARNING messages shown. 

Of the images that should be generated, I can’t find the evidenced ones, I don’t know why. 

u-boot-* u-boot elf file 

u-boot-*.bin u-boot binary file 

u-boot-*.img u-boot image 

vmlinux kernel elf file 

zImage Compressed kernel image 

gsrd-console-image-*.cpio GSRD Root Filesystem in cpio archive format 

gsrd-console-image-*.ext3 GSRD Root Filesystem as ext3 image 

gsrd-console-image-*.tar.gz GSRD Root Filesystem in tar gzip archive format 

gsrd-console-image-*.tar.xz GSRD Root Filesystem in tar archive format 

gsrd-console-image-*.jffs2 GSRD Root Filesystem in jffs2 format 

console-image-*.cpio Standard Angstrom Root Filesystem in cpio archive format 

console-image-*.ext3 Standard Angstrom Root Filesystem as ext3 image 

console-image-*.tar.gz Standard Angstrom Root Filesystem in tar gzip archive format 

console-image-*.tar.xz Standard Angstrom Root Filesystem in tar archive format 

console-image-*.jffs2 GSRD Root Filesystem in jffs2 format 

 

  • I have created once the u-boot.scr script using the instructions in the guide “Progremming FPGA”. 

 

 

continue...
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
1,479 Views

  • Finally, I proceed with the creation of the SDcard image, and here the problems begin. I started with the paragraph “Creating SD Card Image Using Provided Script”. The guide, as I read, 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. The tool used is make_sdimage.py. 

 

Of the files required, I cannot find the one indicated as “u-boot-arria5.img: U-boot image, Compiled by Yocto with bitbake virtual/bootloader” and the problem is probably related to the recompilation of the kernel. 

Now the guide offers two possibilities: 

1. Creating SD Card Image Using Prebuilt Binaries: this section presents how to use the script to create the Cyclone V SD Card by using the prebuilt binaries. 

In this case the instructions I run are: 

Download the binaries into the home folder and extract them, and cd to the binaries folder: 

cd ~ 

mkdir linux-socfpga-gsrd-17.1-cv-bin 

# 17.1 

wget https://releases.rocketboards.org/release/2017.10/gsrd/bin/linux-socfpga-gsrd-17.1std-cv.tar.gz 

tar -xvzf linux-socfpga-gsrd-17.1std-cv.tar.gz -C linux-socfpga-gsrd-17.1-cv-bin 

Download the script and the webserver contents archive into the current folder: 

cd ~ 

# 17.1 

wget http://releases.rocketboards.org/release/2017.10/gsrd/tools/make_sdimage.py 

chmod +x ~/make_sdimage.py 

Create the root filesystem to be put on the SD card image: 

cd ~/linux-socfpga-gsrd-17.1-cv-bin 

mkdir rootfs 

xz -d gsrd-console-image-cyclone5.tar.xz  

sudo tar xf gsrd-console-image-cyclone5.tar -C rootfs 

Copy u-boot.scr in the working folder 

cd ~ 

cp u-boot.scr ~/linux-socfpga-gsrd-17.1-cv-bin 

Call the make_sdimage.py script: 

cd ~/linux-socfpga-gsrd-17.1-cv-bin 

sudo ~/make_sdimage.py  

-f  

-P preloader-mkpimage.bin,u-boot-cyclone5.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  

-n sd_card_image_cyclone5.bin 

Now, the image is created, but when I run it on the Devkit, it gets stuck with the following 

U-Boot SPL 2013.01.01 (Nov 01 2017 - 07:15:02) 

BOARD : Altera SOCFPGA Cyclone V Board 

CLOCK: EOSC1 clock 25000 KHz 

CLOCK: EOSC2 clock 25000 KHz 

CLOCK: F2S_SDR_REF clock 0 KHz 

CLOCK: F2S_PER_REF clock 0 KHz 

CLOCK: MPU clock 925 MHz 

CLOCK: DDR clock 400 MHz 

CLOCK: UART clock 100000 KHz 

CLOCK: MMC clock 50000 KHz 

CLOCK: QSPI clock 370000 KHz 

RESET: COLD 

INFO : Watchdog enabled 

SDRAM: Initializing MMR registers 

SDRAM: Calibrating PHY 

SEQ.C: Preparing to start memory calibration 

SEQ.C: CALIBRATION PASSED 

SDRAM: 1024 MiB 

SDRAM: Initializing SDRAM ECC 

SDRAM: ECC initialized successfully with 1589 ms 

SDRAM: ECC Enabled 

ALTERA DWMMC: 0 

 

 

U-Boot 2013.01.01-00138-g239ae4d (Oct 31 2017 - 10:12:21) 

 

CPU : Altera SOCFPGA Platform 

BOARD : Altera SOCFPGA Cyclone V Board 

I2C: ready 

DRAM: 1 GiB 

MMC: ALTERA DWMMC: 0 

*** Warning - bad CRC, using default environment 

 

In: serial 

Out: serial 

Err: serial 

Net: mii0 

Hit any key to stop autoboot: 0 

reading u-boot.scr 

128 bytes read in 3 ms (41 KiB/s) 

# # Executing script at 02000000 

Wrong image format for "source" command 

reading zImage 

4099440 bytes read in 189 ms (20.7 MiB/s) 

reading socfpga.dtb 

25180 bytes read in 5 ms (4.8 MiB/s) 

# # Flattened Device Tree blob at 00000100 

Booting using the fdt blob at 0x00000100 

Loading Device Tree to 03ff6000, end 03fff25b ... OK 

 

Starting kernel ... 

 

[ 0.000000] Booting Linux on physical CPU 0x0 

[ 0.000000] Initializing cgroup subsys cpuset 

[ 0.000000] Linux version 4.1.33-ltsi-altera (esv@eswdmz3) (gcc version 5.2.1 20151005 (Linaro GCC 5.2-2015.11-2) )# 1 SMP Tue Oct 31 10:09:29 MYT 2017 

[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d 

[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache 

[ 0.000000] Machine model: Altera SOCFPGA Cyclone V 

[ 0.000000] cma: Reserved 16 MiB at 0x3f000000 

[ 0.000000] Memory policy: Data cache writealloc 

[ 0.000000] PERCPU: Embedded 12 pages/cpu @eefc8000 s19712 r8192 d21248 u49152 

 

[cut] 

 

[ 2.588630] Freeing unused kernel memory: 424K (c07ca000 - c0834000) 

[ 2.777810] systemd[1]: Failed to insert module 'autofs4': No such file or directory 

[ 2.794851] systemd[1]: systemd 226 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD +IDN) 

[ 2.813148] systemd[1]: Detected architecture arm. 

 

Welcome to The Ångström Distribution v2015.12! 

 

[ 2.841796] Unhandled fault: imprecise external abort (0x406) at 0x8f97e2f7 

[ 2.848729] pgd = ee068000 

[ 2.851423] [8f97e2f7] *pgd=00000000 

[ 2.860516] systemd[1]: Caught <BUS>, dumped core as pid 692. 

[ 2.866449] systemd[1]: Freezing execution. 

And I cannot explain what happens: probably there is no correspondence from what is described in the device tree and what the kernel expects. 

 

continue...
0 Kudos
Altera_Forum
Honored Contributor II
1,479 Views

2. Creating SD Card Image Using Rebuilt Binaries: in this case the guide is very laconic, as it explains that: 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. 

This is followed by the list of locations.  

Now, I try to recover the files required by the list following the locations shown; Obviously, lacking the file u-boot-cyclone5.img, I have tried to rename the file u-boot.img that I have found in the folder created after the kernel compilation. So, I have written the following set of instructions: 

cd ~ 

mkdir linux-socfpga-gsrd-17.1-cv-bin 

cd ~/linux-socfpga-gsrd-17.1-cv-bin 

mkdir rootfs 

cp /home/davide/angstrom-build/deploy/glibc/images/cyclone5/gsrd-console-image-cyclone5.tar.xz /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

xz -d gsrd-console-image-cyclone5.tar.xz  

sudo tar xf gsrd-console-image-cyclone5.tar -C rootfs 

 

cp /home/davide/angstrom-build/deploy/glibc/images/cyclone5/zImage /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cp /home/davide/SDcard/u-boot-cyclone5.img /home/davide/linux-socfpga-gsrd-17.1-cv-bin# cd /home/davide/angstrom-build/deploy/glibc/images/cyclone5# mkdir prova# cp /home/davide/angstrom-build/deploy/glibc/images/cyclone5/gsrd-console-image-cyclone5.tar.gz /home/davide/angstrom-build/deploy/glibc/images/cyclone5/prova# cd /home/davide/angstrom-build/deploy/glibc/images/cyclone5/prova# gunzip gsrd-console-image-cyclone5.tar.gz# cp /home/davide/angstrom-build/deploy/glibc/images/cyclone5/prova/gsrd-console-image-cyclone5.tar /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cp /home/davide/cv_soc_devkit_ghrd/soc_system.rbf /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cp /home/davide/cv_soc_devkit_ghrd/software/spl_bsp/preloader-mkpimage.bin /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cp /home/davide/cv_soc_devkit_ghrd/socfpga.dtb /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cp /home/davide/u-boot.scr /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cp /home/davide/u-boot-socfpga/u-boot.img /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

cd /home/davide/linux-socfpga-gsrd-17.1-cv-bin 

mv u-boot.img u-boot-cyclone5.img 

Now, writing again the image created on the SD card, the DevKit again gets stuck (with no surprise). The output is:  

U-Boot SPL 2013.01.01 (May 16 2018 - 13:45:39) 

BOARD : Altera SOCFPGA Cyclone V Board 

CLOCK: EOSC1 clock 25000 KHz 

CLOCK: EOSC2 clock 25000 KHz 

CLOCK: F2S_SDR_REF clock 0 KHz 

CLOCK: F2S_PER_REF clock 0 KHz 

CLOCK: MPU clock 925 MHz 

CLOCK: DDR clock 400 MHz 

CLOCK: UART clock 100000 KHz 

CLOCK: MMC clock 50000 KHz 

CLOCK: QSPI clock 370000 KHz 

RESET: COLD 

INFO : Watchdog enabled 

SDRAM: Initializing MMR registers 

SDRAM: Calibrating PHY 

SEQ.C: Preparing to start memory calibration 

SEQ.C: CALIBRATION PASSED 

SDRAM: 1024 MiB 

SDRAM: Initializing SDRAM ECC 

SDRAM: ECC initialized successfully with 1588 ms 

SDRAM: ECC Enabled 

ALTERA DWMMC: 0 

 

 

U-Boot 2013.01.01-00138-g239ae4d (May 22 2018 - 16:25:58) 

 

CPU : Altera SOCFPGA Platform 

BOARD : Altera SOCFPGA Cyclone V Board 

I2C: ready 

DRAM: 1 GiB 

MMC: ALTERA DWMMC: 0 

*** Warning - bad CRC, using default environment 

 

In: serial 

Out: serial 

Err: serial 

Net: mii0 

Hit any key to stop autoboot: 0 

reading u-boot.scr 

128 bytes read in 3 ms (41 KiB/s)# # Executing script at 02000000 

Wrong image format for "source" command 

reading zImage 

4376720 bytes read in 202 ms (20.7 MiB/s) 

reading socfpga.dtb 

24490 bytes read in 6 ms (3.9 MiB/s)# # Flattened Device Tree blob at 00000100 

Booting using the fdt blob at 0x00000100 

Loading Device Tree to 03ff7000, end 03ffffa9 ... OK 

 

Starting kernel ... 

 

  • NOTE: since I work with Virtualbox, Ubuntu cannot see the SD card reader, so I transfer the image created to a shared folder with the host PC operating windows. Then I burn the SDcard with the Win32DiskImager program. When I use this program with the SDcard image delivered with the kit, it works fine, so I guess the problem doesn’t sits in this step. 

 

 

Now, I follow for most of the procedure the guides on rocketboards.org, but I have the problems depicted. Something is surely wrong, but since I’m a newbie, I cannot discriminate where a mistake is made and/or which is the correct procedure. 

My guess is that something goes wrong during compilation and something also during the SDcard image creation. Unluckily the guides are stingy od details and explanations of the steps, so it is difficult to me to understand what I am exactly doing. 

 

Sorry for the length of the post, and also for my poor English. I hope I have given you as much detail as possible and that these details have been helpful in understanding my problem. If you need some clarifications, please ask, it is not a problem for me. 

 

Best regards,  

Davide Bombarda 

 

 

[/INDENT]
0 Kudos
Altera_Forum
Honored Contributor II
1,479 Views

I think I have the exact same problem as the one in your 2nd post. 

 

I'm using an Arrow SoCKit board and running Ubuntu 16.04 LTS on virtualbox. 

 

As I knew that the pre-built GSRD 16.01 worked I tried to work my way backwards.  

I copied the GSRD 16.01 to my sd-card, then I replaced the preloader, rootfs and soc-system.rbf with one rebuilt using GHRD 1601. This worked fine and Linux booted fine. 

I then tried to switch out zImage file with the one I've compiled myself using Yocto, but that caused a lot of different errors. 

 

So I'm not sure where the error is. However there is one warning in my Yocto build that is concerning. 

 

I think the freezing error is caused by bad u-boot.img and/or u-boot.scr, but I'm extremely uncertain of this. 

 

WARNING: No recipes available for: 

.../work/sockit/angstrom-v2016.12-yocto2.2/layers/meta-arrow-sockit/recipes-core/webkit/webkitgtk_2.12.5.bbappend *This is fine I guess. 

.../work/sockit/angstrom-v2016.12-yocto2.2/layers/meta-arrow-sockit/recipes-kernel/linux/linux-altera-ltsi_4.1%.bbappend *But I think this one is causing some real issues 

 

It also seems like someone has deleted some branches on github that might cause some broken builds with Yocto. 

https://forum.rocketboards.org/t/yocto-build-broken-due-to-branch-deletion-on-github/1329 

 

 

I would try to work myself backwards from sd-card you know that works. 

 

 

Hope this helps, and if you find a solution, please post it :) 

 

-aln
0 Kudos
Altera_Forum
Honored Contributor II
1,479 Views

No one can help me?

0 Kudos
Reply