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:
The script will:
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
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'
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.
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-7/arm-linux-gnueabi/ . Always use the latest release just in case.
Example:
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz
export ARCH=arm export CROSS_COMPILE=$(pwd)/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-
If you do not yet have a local copy of ADI's kernel tree, you can get it via git from:
git clone https://github.com/analogdevicesinc/linux.git
Inside the repository, generate the configuration file before building the kernel tree.
dave@hal9000:~/github-linux-build/linux$ make socfpga_adi_defconfig # # configuration written to .config # dave@hal9000:~/github-linux-build/linux$
Build the kernel via 'make'. This is the same for all Intel SoC FPGAs.
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$
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 |
The device tree socfpga_arria10_socdk_sdmmc.dts can also be used for any Arria10 FPGA that uses an SD card for boot up. Building the device tree uses 'make' by turning the .dts file to a .dtb. The command is simply 'make' plus the device tree name with a .dtb file extension.
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$
The output files for building the kernel and device tree are zImage and <device_tree_name>.dtb. Refer to the code below to find their respective output directories. See kuiper-linux for more information in configuring the 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