Build Linux Image for HDL Coder

11 views (last 30 days)
John
John on 24 Feb 2025
Commented: John about 13 hours ago
I'm trying to follow along with the documentation here: https://www.mathworks.com/help/hdlcoder/ug/xilinx-zynq-linux-image-for-custom-boards.html for creating the Linux image using Mathwork's buildroot. Eventually I have a custom board that I need to create an image for but initially I was trying to build image for the Arrow SoC kit. I did a git clone https://github.com/mathworks/buildroot and I checked out the mathworks_socfpga_R23.2.0 tag. I ran the command:
python build.py -b sockit -p socfpga --brconfig BR2_TOOLCHAIN_EXTERNAL_PATH='/opt/linaro/aarch32-6.3.1-2017.02'
However, it keeps failing on:
Incorrect selection of kernel headers: expected 3.1.x, got 4.6.x
I'm not able to resolve this by changing the header selection in make menuconfig. I'd appreciate any suggestions on how to resolve this. Thank you.
  1 Comment
John
John on 24 Feb 2025
I got passed this error by editing the following lines of board/mathworks/socfpga/defconfig/linaro.defconfig:
BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_6=y
However, I am now getting the error:
freadahead.c: In function 'freadahead':
freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
92 | #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
| ^~~~~
Thanks for any help.

Sign in to comment.

Accepted Answer

Kiran Kintali
Kiran Kintali on 20 Dec 2025 at 22:58
Build Custom Linux Image for HDL Coder IP Core
This example shows how to build a custom Linux® image for an HDL Coder IP core by using the MathWorks® build system for the Digilent Zybo Z7-10 Zynq® board. The example also demonstrates how to set up the build environment and create a Linux image for the Digilent Zybo Z7-10 Zynq board. You can use the same process to create Linux image for other Zynq platforms.
The MathWorks build system is a tool that generates custom Linux images through cross-compilation. The MathWorks build system wraps the buildroot in pre- and post-processing scripts to automate the generation of system images for various platforms. The build system uses scripts that take the target board, platform, or image description file as an input and output a complete system image, including the boot loaders, kernel, and user space.
Requirements
  1 Comment
John
John 1 minute ago
Thanks this was an old post and I was able to get this build a while ago by following in the instructions exactly in the link you referenced. I had to install Debian 9 in a virtual machine and I specifically used version 17.0 of the SOC FPGA Ebedded Development Suite installed to /opt. I had to edit /etc/apt/sources.list to contain the line: deb http://archive.debian.org/debian/ stretch main. I added to the i386 architecture packages. I had to install python 2.7, lib32stdc++6 and a few other missing packages. I then was able to checkout tags/mathworks_socfpga_R23.2.0 and then i could successfully build it with the command: python build.py -b sockit -p socfpga --brconfig BR2_TOOLCHAIN_EXTERNAL_PATH='/opt/intelFPGA/17.0/embedded/ds-5/sw/gcc/'

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!