Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21179 Discussions

Linux not Booting on custom Intel Cyclone V board

akashgupta
Novice
9,123 Views

Hello,

I was trying to build Linux file system from scratch for my custom Intel Cyclone V (5CSXFC6C6) board so I followed this (Embedded Linux Beginners Guide | Documentation | RocketBoards.org) guide. But it did not work out and I got a "Reset the board" error. I am using Ubuntu 18.04 and Quartus Prime Standard 18.1 edition.

 

Then, I tried the same procedure on Arrow SoCkit Evaluation Board 5CSXFC6D6F31C6N. The guide was accurate till step 8 (I wrote the preloader and u-boot.img on sd card and it gave the same output and errors of zImage as suggested in the guide) but since “rel_socfpga-4.1_15.09.01_pr” release is no more available for linux-socfpga from Altera, I had to opt for a newer version of linux-socfpga.

 

Now, newer versions of linux-socfpga do not support compilation using old “gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux” as suggested in the beginners guide, so I had to opt for a newer “gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf”. I further used “socfpga-5.15.50-lts” as the new and stable version of linux-socfpga for cyclone-v and buildroot to build the image but it also didn’t work out and u-boot output threw errors for commands like "fatload" command not used properly and "echo $fpgadata" was empty).

I tried another way (Building Bootloader for Cyclone V and Arria 10 | Documentation | RocketBoards.org 1) with Quartus 19.1 but it failed at bitbake step. It gave 2 errors after downloading 5+ GBs of data. I am stuck with this for more than 2 months.

 

Can anyone suggest a better way to build things for my custom board from scratch? All the guides available are specific to some software or hardware and none of them have resulted working linux kernel for me.

 

Note- Arrow SoCkit works fine when I load prebuilt image, which means all the hardware, sd card and switches are set correctly.

Labels (1)
0 Kudos
41 Replies
mabdrahi
Employee
5,178 Views

Hi,


I will investigate the better way to build thing at custom board by the way i will try the method from rocketboard first.


0 Kudos
akashgupta
Novice
5,154 Views

Hi, Thanks. I am happy that you replied early. Please help and determine the method for custom boards as per currently available gits and toolchains.

0 Kudos
mabdrahi
Employee
5,120 Views

Hi,


you can try use this way to compile linux.


---------------tool chain-------------------

$wget https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/\

$gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz

$tar xf gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz

$rm -f gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz

$export PATH=`pwd`/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin:$PATH

$export ARCH=arm64

$export CROSS_COMPILE=aarch64-none-linux-gnu-


------------building Yocto----------------

git clone -b kirkstone https://git.yoctoproject.org/poky

git clone -b kirkstone https://git.yoctoproject.org/meta-intel-fpga

source poky/oe-init-build-env ./build

echo 'MACHINE = "cyclone5"' >> conf/local.conf

echo 'BBLAYERS += " ${TOPDIR}/../meta-intel-fpga "' >> conf/bblayers.conf

# Uncomment next line to add more packages to the image

# echo 'CORE_IMAGE_EXTRA_INSTALL += "openssh gdbserver"' >> conf/local.conf

bitbake core-image-minimal

ln -s $ROOTFS_TOP/cv/build/tmp/deploy/images/cyclone5/core-image-minimal-cyclone5.tar.gz $LINUX_BIN/a9/






0 Kudos
mabdrahi
Employee
5,086 Views

Hi,


Any more question?


0 Kudos
akashgupta
Novice
5,060 Views
Hi, thanks for the info. I'll try and update soon.
0 Kudos
mabdrahi
Employee
5,025 Views

Hi,


I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


0 Kudos
akashgupta
Novice
4,953 Views

Hi,

I downloaded the "gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu" and declared "export ARCH=arm64" as you suggested but EmbeddedLinuxBeginnerSGuide failed at step 4 (Generating the Preloader) when I entered the make command. It asked to set ARCH=arm, after which it compiled successfully.

Then I cloned "u-boot-socfpga" and checked out rel_socfpga_v2023.01_23.09.02_pr branch. I followed the guide further till step 5 (Configure and Compile U-Boot) and it failed at "make" command. The output is as follows:

------------------------------------------------------------------------------------------------------------------------------------------

UPD include/generated/timestamp_autogenerated.h
ENVC include/generated/env.txt
ENVP include/generated/env.in
ENVT include/generated/environment.h
CC lib/asm-offsets.s
cc1: error: unknown value ‘generic-armv7-a’ for ‘-mtune’
cc1: note: valid arguments are: cortex-a34 cortex-a35 cortex-a53 cortex-a57 cortex-a72 cortex-a73 thunderx thunderxt88p1 thunderxt88 octeontx octeontx81 octeontx83 thunderxt81 thunderxt83 ampere1 emag xgene1 falkor qdf24xx exynos-m1 phecda thunderx2t99p1 vulcan thunderx2t99 cortex-a55 cortex-a75 cortex-a76 cortex-a76ae cortex-a77 cortex-a78 cortex-a78ae cortex-a78c cortex-a65 cortex-a65ae cortex-x1 ares neoverse-n1 neoverse-e1 octeontx2 octeontx2t98 octeontx2t96 octeontx2t93 octeontx2f95 octeontx2f95n octeontx2f95mm a64fx tsv110 thunderx3t110 zeus neoverse-v1 neoverse-512tvb saphira neoverse-n2 cortex-a57.cortex-a53 cortex-a72.cortex-a53 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a75.cortex-a55 cortex-a76.cortex-a55 cortex-r82 generic
scripts/Makefile.build:147: recipe for target 'lib/asm-offsets.s' failed
make[1]: *** [lib/asm-offsets.s] Error 1
Makefile:1936: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

------------------------------------------------------------------------------------------------------------------------------------------

 

Please suggest the solution for this.

0 Kudos
Kenny_Tan
Moderator
4,936 Views

Kindly follow the instructions above to reopen the case, as mentioned above, the case has been closed pending. 

Let me know if you failed to reopen the case. 

0 Kudos
akashgupta
Novice
4,893 Views

Hi, I opened "https://supporttickets.intel.com" for this ticket and posted my reply there. Do I need to do something else to reopen this post?

 

0 Kudos
mabdrahi
Employee
4,851 Views

Hi Akash


Below is the step. the hwlib need to clone in order to use it compiler.


git clone https://github.com/altera-opensource/intel-socfpga-hwlib

cd intel-socfpga-hwlib/tools

./install_linaro.sh

./generate_doxygen.sh

export PATH=`pwd`/gcc/bin:$PATH


Below is complete step from hardware build until uboot and create qspi


########################################

# create top folder

########################################

 

rm -rf artifacts

mkdir artifacts

cd artifacts

export TOP_FOLDER=`pwd`

 

########################################

# compile hardware design

########################################

 

cd $TOP_FOLDER

rm -rf ghrd-socfpga-QPDS-22.3pro-21.1std QPDS-22.3pro-21.1std.zip cv_soc_devkit_ghrd

wget https://github.com/altera-opensource/ghrd-socfpga/archive/refs/tags/QPDS-22.3pro-21.1std.zip

unzip QPDS-22.3pro-21.1std.zip

mv ghrd-socfpga-QPDS-22.3pro-21.1std/cv_soc_devkit_ghrd .

rm -rf ghrd-socfpga-QPDS-22.3pro-21.1std QPDS-22.3pro-21.1std.zip

cd cv_soc_devkit_ghrd

rm -rf software

~/intelFPGA/21.1/nios2eds/nios2_command_shell.sh \

make generate_from_tcl

~/intelFPGA/21.1/nios2eds/nios2_command_shell.sh \

make rbf

 

########################################

# get hwlibs, install toolchain

########################################

 

cd $TOP_FOLDER

git clone https://github.com/altera-opensource/intel-socfpga-hwlib

cd intel-socfpga-hwlib/tools

./install_linaro.sh

./generate_doxygen.sh

export PATH=`pwd`/gcc/bin:$PATH

 

########################################

# build u-boot

########################################

 

cd $TOP_FOLDER/cv_soc_devkit_ghrd

mkdir -p software/bootloader

~/intelFPGA/20.1/embedded/embedded_command_shell.sh \

bsp-create-settings \

  --type spl \

  --bsp-dir software/bootloader \

  --preloader-settings-dir "hps_isw_handoff/soc_system_hps_0" \

  --settings software/bootloader/settings.bsp

cd software/bootloader

rm -rf u-boot-socfpga

git clone https://github.com/altera-opensource/u-boot-socfpga

cd u-boot-socfpga

# comment out next line to use the latest U-Boot branch

git checkout -b test-bootloader -t origin/socfpga_v2022.07

./arch/arm/mach-socfpga/qts-filter.sh cyclone5 ../../../ ../ ./board/altera/cyclone5-socdk/qts/

export CROSS_COMPILE=arm-eabi-

make socfpga_cyclone5_qspi_defconfig

make -j 48

 

########################################

# build application

########################################

 

cd $TOP_FOLDER

cd intel-socfpga-hwlib/examples/CVAV/Altera-SoCFPGA-HardwareLib-Timer-CV-GNU/

# build once to bring hwlibs code

make SEMIHOSTED=0 MEMORY=ddr

# cleanmak

make clean

# change hwlibs link address to match what U-Boot wants

sed -i 's/0x00100040/0x01000040/g' hwlib/src/linkerscripts/cvav-ddr.ld

# move stack out of the way just in case

sed -i 's/0x80000/0x00200000/g' hwlib/src/linkerscripts/cvav-ddr.ld

# build again with the new address

make SEMIHOSTED=0 MEMORY=ddr

# create binary file

arm-eabi-objcopy -O binary application.elf application.bin

# create img file

$TOP_FOLDER/cv_soc_devkit_ghrd/software/bootloader/u-boot-socfpga/tools/

mkimage -A arm -T standalone -C none -a 0x01000040 -e 0x01000040 -n "bare-metal image" -d application.bin application.img

 

########################################

# build QSPI image

########################################

 

cd $TOP_FOLDER

cat cv_soc_devkit_ghrd/software/bootloader/u-boot-socfpga/spl/u-boot-splx4.sfp \

     intel-socfpga-hwlib/examples/CVAV/Altera-SoCFPGA-HardwareLib-Timer-CV-GNU/application.img \

> qspi-image.bin


akashgupta
Novice
4,826 Views

Hi. Thanks for the reply. I am implementing the solution and will update the progress and result within 2 days.

0 Kudos
akashgupta
Novice
4,818 Views

Hi. 

I followed the solution step by step with Quartus 20.1.

 

I got an error while executing "arm-eabi-objcopy -O binary application.elf application.bin". So I executed "arm-eabi-objcopy -O binary application.axf application.bin" instead as there was an axf file present. Finally, I was able to generate application.bin and application.img.

 

QSPI part did not work and threw "cat: qspi-image.bin: No such file or directory".

 

Now I have u-boot.img, application.img and soc_system.rbf. Should I put these files on the sdcard as  (Embedded Linux Beginners Guide | Documentation | RocketBoards.org) had suggested? Then, u-boot.scr still needs to generated. 

 

Your earlier solution suggested using "gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu" with bitbake which is a different way. In case, you are following any approach, please elaborate.

0 Kudos
mabdrahi
Employee
4,798 Views

Hi Akash,


Base on the step below you suppose to combine u-boot-splx4.sfp with application.img to get qspi-image.bin. After that you can flash qspi_image.bin to QSPI flash.


########################################

# build QSPI image

########################################

 

cd $TOP_FOLDER

cat cv_soc_devkit_ghrd/software/bootloader/u-boot-socfpga/spl/u-boot-splx4.sfp \

     intel-socfpga-hwlib/examples/CVAV/Altera-SoCFPGA-HardwareLib-Timer-CV-GNU/application.img \

> qspi-image.bin


Thank you,

Aliff


0 Kudos
akashgupta
Novice
4,781 Views

Hi Aliff.

Thanks for the reply, I was able to generate qspi-image.bin. 

 

Your suggested method seems to be inspired from Building Bootloader Cyclone V.

If it is the case, setting "ARCH=arm64" and "CROSS_COMPILE=aarch64-none-linux-gnu-" does not result positively. Were you able to implement the method suggest in this guide successfully? What device did you use to implement the method?

 

Thanks,

Akash.

 

0 Kudos
mabdrahi
Employee
4,746 Views

Hi Akash,


Step i post was working for us and we are using Cyclone5 SoC devkit.


Thank you,

Aliff


0 Kudos
akashgupta
Novice
4,734 Views

Hi, 

I followed Building Bootloader CycloneV  line by line and was able to generate the sdcard_cv.img  without any error but it gives a blank screen on SoCkit i.e. u-boot doesn't boots up. I got a reference from cyclonev-programming-fpga-from-u-boot here and downloaded a prepared sdcard image which jackfrye11 has posted on google drive. 

Replacing his u-boot-with-spl.sfp with mine made my sdcard work. This determines that I have a problem in generating the u-boot-with-spl.sfp for sure. Since the guide used a GHRD zip to generate everything using nios_embedded_shell.sh and generate_from_tcl for their dev board, I don't get to see the complete project. What I generated using their commands was targeting to their dev board. How to approach this step (where make generate_from_tcl and make sof were executed) when using a custom board and design? Particularly this part below:

==============================================

cd $TOP_FOLDER
rm -rf ghrd-socfpga-QPDS22.1STD_REL_GSRD_PR QPDS22.1STD_REL_GSRD_PR.zip cv_soc_devkit_ghrd
wget https://github.com/altera-opensource/ghrd-socfpga/archive/refs/tags/QPDS22.1STD_REL_GSRD_PR.zip
unzip QPDS22.1STD_REL_GSRD_PR.zip
mv ghrd-socfpga-QPDS22.1STD_REL_GSRD_PR/cv_soc_devkit_ghrd .
rm -rf ghrd-socfpga-QPDS22.1STD_REL_GSRD_PR QPDS22.1STD_REL_GSRD_PR.zip
cd cv_soc_devkit_ghrd
rm -rf software
~/intelFPGA/22.1std/nios2eds/nios2_command_shell.sh \
make generate_from_tcl
~/intelFPGA/22.1std/nios2eds/nios2_command_shell.sh \
make sof

=================================================

 

 

Also, for EmbeddedLinuxBeginnerSGuide , there is a preloader-mkpimage file as a preloader in a2 partition. Its u-boot.img was generated using  "intelFPGA/18.1/embedded/host_tools/altera/preloader/uboot-socfpga.tar.gz" which is a 2013 version. This u-boot causes fatload command issue for me and I could see other people struggling with same issue for months. Otherwise this method seemed to have a better control over things. 

Overall both the methods fail for me due to u-boot. 

 

Thanks for your responses and support.

Akash.

0 Kudos
mabdrahi
Employee
4,600 Views

Hi Akash,


Im set a call with you today to look your case more closer because at our end we cannot reproduce it


Thank you,

Aliff


0 Kudos
akashgupta
Novice
4,581 Views

Hi,

It would be tough to demonstrate the error on work PC due to company policy. I would try to submit artifacts to you for detailed analysis. Give me 2 days to collect all artifacts.

 

Thanks,

Akash.

0 Kudos
akashgupta
Novice
4,547 Views

Hi, Please find attached the files from the project. 

I have compiled BuildingBootloaderCycloneV procedure from scratch 

 

command_list.txt > Contains the list of command executed sequentially.

cv_soc_devkit_ghrd.tar.xz> contains compiled project (for hps_isw_handoff reference, and output files)

linux-bin.zip > The linux-bin resulted after all procedure.

sdcard.tzr.gz > sdcard folder after all procedure.

u-boot.socfpga > u-boot folder after all procedure. (Contains the problematic u-boot-with-spl.sfp, I cloned and checked out v2022.04 as suggested in the guide. )

 

downloaded_spl_by_jackfrye11.zip > Replacing this "u-boot-with-spl.sfp" with the one I generated myself makes everything work fine and results working linux terminal.

 

Please use these to recreate the setup. You can burn the sdcard image directly and then you can replace the u-boot-with-spl.sfp file and burn it. It  should be working after replacing the u-boot-with-spl.sfp file.

 

Thanks,

Akash.

 

 

 

0 Kudos
mabdrahi
Employee
4,438 Views

Hi Akash

 

I upload the QSPI image here and sdcard image on the team chat as it too big to upload here.

 

Thank you,

Aliff

Reply