Wiki

This version is outdated by a newer approved version.DiffThis version (23 Apr 2018 11:33) was approved by Istvan Csomortani.The Previously approved version (19 Jan 2018 10:11) is available.Diff

This is an old revision of the document!


Linux on the Xilinx FPGA development Board

This guide provides some step-by-step instructions on how to build a Microblaze Linux Kernel image for the FMC board connected to an

Required Software

Microblaze gnu toolchain from Xilinx is no longer available on git. Please use gnu tools from SDK installation as below:

Dave@HAL9000:~/fmcomms1/linux$ export PATH=/opt/Xilinx/SDK/2015.2/gnu/microblaze/linux_toolchain/lin64_le/bin:$PATH
Dave@HAL9000:~/fmcomms1/linux$ export ARCH=microblaze
Dave@HAL9000:~/fmcomms1/linux$ export CROSS_COMPILE=microblazeel-xilinx-linux-gnu-

Build Linux - Step by Step instructions

Get Microblaze Little Endian Toolchain from Xilinx

Download the Vivado SDK from here Download And make sure you followed the instructions for Microblaze GNU Toolchain

Get Linux kernel source

This specifies any shell prompt running on the development host

Dave@HAL9000:~$ git clone https://github.com/analogdevicesinc/linux.git
Cloning into 'linux'...
remote: Counting objects: 2757163, done.
remote: Compressing objects: 100% (495484/495484), done.
remote: Total 2757163 (delta 2296596), reused 2687337 (delta 2234506)
Receiving objects: 100% (2757163/2757163), 782.04 MiB | 1.39 MiB/s, done.
Resolving deltas: 100% (2296596/2296596), done.
Dave@HAL9000:~$

Checkout master branch

This specifies any shell prompt running on the development host

Dave@HAL9000:~$ cd linux/
Dave@HAL9000:~/linux$ git checkout master
Checking out files: 100% (16412/16412), done.
Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'
Dave@HAL9000:~/linux$

Set Environmental Variables

This specifies any shell prompt running on the development host

Dave@HAL9000:~/linux$ source /opt/Xilinx/SDK/2014.2/settings64.sh
Dave@HAL9000:~/linux$ export ARCH=microblaze
Dave@HAL9000:~/linux$ export CROSS_COMPILE=microblazeel-xilinx-linux-gnu-

Configure Kernel

This specifies any shell prompt running on the development host

Dave@HAL9000:~/linux$ make adi_mb_defconfig
#
# configuration written to .config
#
Dave@HAL9000:~/linux$ 

Get Root File-System

Root File-system (initramfs) rootfs.cpio.gz must be placed in the root of your kernel tree.

This specifies any shell prompt running on the target or development host

Dave@HAL9000:~/linux$ wget http://wiki.analog.com/_media/resources/tools-software/linux-drivers/platforms/rootfs.cpio.gz
--2014-11-21 14:27:54--  http://wiki.analog.com/_media/resources/tools-software/linux-drivers/platforms/rootfs.cpio.gz
Resolving wiki.analog.com (wiki.analog.com)... 195.170.124.184
Connecting to wiki.analog.com (wiki.analog.com)|195.170.124.184|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3006465 (2.9M) [application/octet-stream]
Saving to: `rootfs.cpio.gz'

100%[===================================================================================================================================================================>] 3,006,465   75.1K/s   in 37s     

2014-11-21 14:28:32 (79.2 KB/s) - `rootfs.cpio.gz' saved [3006465/3006465]

Dave@HAL9000:~/linux$

Build kernel

The result of building the kernel is an elf file in arch/microblaze/boot named simpleImage.<dts file name> based on the dts specified.

The build process for the kernel searches in the arch/microblaze/boot/dts directory for a specified device tree file and then builds the device tree into the kernel image.

The following command shows the general format for the build target name. Note that the <dts file name> does not include the file extension “.dts”.

Dave@HAL9000:~/linux$ make simpleImage.<dts file name>

To see what device-trees for the different FPGA carrier and FMC module combination exist type:

Dave@HAL9000:~/linux$ ls -l arch/microblaze/boot/dts

This specifies any shell prompt running on the target or development host

Dave@HAL9000:~/linux$ make -j4 simpleImage.kcu105_ad_fmcdaq2_ebz
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  HOSTCC  scripts/dtc/checks.o
  CC      scripts/mod/empty.o

[ --snip-- ]

  CC      net/ipv4/xfrm4_output.o
  CC      net/ipv4/xfrm4_protocol.o
  LD      net/ipv4/built-in.o
  LD      net/built-in.o
  LINK    vmlinux
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  KSYM    .tmp_kallsyms1.o
  KSYM    .tmp_kallsyms2.o
  LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map
  CP      vmlinux arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz.unstrip
  OBJCOPY arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz
  UIMAGE  arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz
Image Name:   Linux-3.17.0-126658-g6807aea
Created:      Thu Nov 20 16:50:28 2014
Image Type:   MicroBlaze Linux Kernel Image (uncompressed)
Data Size:    8425035 Bytes = 8227.57 kB = 8.03 MB
Load Address: 80000000
Entry Point:  80000000
  STRIP   arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz
Kernel: arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz is ready  (#1642)
Dave@HAL9000:~/linux$

Boot Kernel on FPGA Microblaze

Then one method to load the kernel onto the already built and running FPGA which has the Microblaze processor is to launch XMD or XSDB from the Xilinx Vivado toolset from within …/linux/arch/microblaze/boot and run from the XMD or XSDB shell:

XMD has been deprecated and will be removed in the future. XSDB replaces XMD and provides additional functionality. Xilinx recommends you switch to XSDB for command line debugging. You can find more information about these tools in the Embedded System Tools Reference Manual (UG1043)
xmd> fpga -f system_top.bit
xmd> connect mb mdm
xmd> dow simpleImage.vc707_fmcomms2-3
xmd> run
xsdb> connect
xsdb> fpga -f system_top.bit
xsdb> targets
  1  xcku040
     2  MicroBlaze Debug Module at USER2
        3  MicroBlaze #0 (Running)
xsdb> targets 3
xsdb> dow simpleImage.kcu105_fmcdaq2
xsdb> con

(more details, methods of how to get bit file and kernel on flash and/or boot off SD Card is appreciated)

resources/tools-software/linux-drivers/platforms/microblaze.1524476009.txt.gz · Last modified: 23 Apr 2018 11:33 by Istvan Csomortani