Wiki

The most recent version of this page is a draft.DiffThis version (06 Feb 2021 20:26) was approved by Robin Getz.The Previously approved version (24 Sep 2019 12:48) is available.Diff

This is an old revision of the document!


Building the Intel SoC-FPGA kernel and devicetrees from source

The script method

We provide a script that does automates the build for SoC-FPGA using the Linaro toolchain.

The script takes up to 3 parameters, but if left blank, it uses defaults:

  1. <local_kernel_dir> - default is linux-adi if left blank ; use this, if you want to use an already cloned kernel repo
  2. <devicetree_file> - which device tree should be exported/copied from the build [argument is optional]
  3. <path_to_other_toolchain> - in case you have your own preferred toolchain [other than Linaro's or Intel's] you can use override it with this 3rd param

The script will:

  1. clone the ADI kernel tree
  2. download the Linaro GCC toolchain [if no other is specified]
  3. build the ADI kernel tree
  4. export/copy the Image file and device tree file out of the kernel build folder

Running the script in one line [with defaults]

wget https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/master/linux/build_socfpga_kernel_image.sh && chmod +x build_socfpga_kernel_image.sh && ./build_socfpga_kernel_image.sh 

Checkout the Release branch

If not otherwise required always use the latest release!
Release names and Branches
altera_4.0
altera_4.4
altera_4.6
altera_4.9
altera_4.14
dave@hal9000:~/github-linux-build/linux$ git checkout origin/altera_4.14 -b altera_4.14
Branch altera_4.14 set up to track remote branch altera_4.14 from origin.
Switched to a new branch '2015_R2'

Setup cross compile environment variables

There are a few toolchains that can be used.

Other toolchains/compilers for ARM may work as well, but the ones described here have been tested and found to work.

Using the Linaro toolchain

Alternatively, the Linaro toolchain/compiler can be used to compile to kernel. Linaro compilers (that work with Intel SoC-FPGA) can be downloaded from: https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabi/

Example:

wget https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabi/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz
tar -xvf gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz
export ARCH=arm
export CROSS_COMPILE=$(pwd)/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-

Configure the kernel

dave@hal9000:~/github-linux-build/linux$ make socfpga_adi_defconfig
#
# configuration written to .config
#
dave@hal9000:~/github-linux-build/linux$

Build the kernel

dave@hal9000:~/github-linux-build/linux$ make -j5 zImage
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  UPD     include/config/kernel.release
  CHK     include/generated/utsrelease.h

[ -- snip --]

  AS      arch/arm/boot/compressed/bswapsdi2.o
  AS      arch/arm/boot/compressed/piggy.gzip.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-3.17.0-126697-g611e217-dir
Created:      Fri Nov 28 10:20:40 2014
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3195872 Bytes = 3120.97 kB = 3.05 MB
Load Address: 00008000
Entry Point:  00008000
dave@hal9000:~/github-linux-build/linux$

Build the devicetree

Build the one that fits your FPGA carrier and FMC card

device tree board chip
socfpga_arria10_socdk_ad9136_fmc_ebz.dts eval-ad9135 EVAL-AD9136 AD9136
socfpga_arria10_socdk_ad9172_fmc.dts eval-ad9135 EVAL-AD9136 AD9171, AD9172, AD9173, AD9174, AD9175 and AD9176
socfpga_arria10_socdk_adin1300_dual-mii.dts TBA ADIN1300
socfpga_arria10_socdk_adin1300_dual-rgmii.dts TBA ADIN1300
socfpga_arria10_socdk_adrv9008-1.dts ADRV9008-1W/PCBZ ADRV9008-1
socfpga_arria10_socdk_adrv9008-2.dts ADRV9008-2W/PCBZ ADRV9008-2
socfpga_arria10_socdk_adrv9009.dts ADRV9009-W/PCBZ ADRV9009
socfpga_arria10_socdk_adrv9371.dts ADRV9371 board AD9371
dave@hal9000:~/github-linux-build/linux$ make socfpga_arria10_socdk_adin1300_dual-mii.dtb
  DTC     arch/arm/boot/dts/socfpga_arria10_socdk_adin1300_dual-mii.dtb
dave@hal9000:~/github-linux-build/linux$

Copy the generated files to your SD Card

dave@hal9000:~/github-linux-build/linux$ cp arch/arm/boot/zImage /media/BOOT/zImage
dave@hal9000:~/github-linux-build/linux$ cp arch/arm/boot/dts/socfpga_arria10_socdk_adin1300_dual-mii.dtb  /media/BOOT/socfpga_arria10_socdk_sdmmc.dtb
/srv/wiki.analog.com/data/pages/resources/tools-software/linux-build/generic/socfpga.txt · Last modified: 06 Feb 2023 03:24 by ALEXIS CZEZAR TORRENO