This how-to describes the process of compiling a device tree blob.
Build Device Tree Blob is a part of the Xilinx design flow described in Getting Started.

Task Dependencies (Pre-requisites)

  • Fetch Sources (Device Tree Generator sources and Linux sources)
  • Hardware Project

Tools Required


Input Files Required

  • Hardware Project directory
  • Linux source directory

Output Files Produced

  • *.dts, *.dtsi, *.dtb

Task Description

Creating a Device Tree Source (.dts/.dtsi) files (Vivado 2014.2 onwards)

Generate HDF file from hardware project

  1. Open the hardware project in Vivado.
  2. Generate Block Design
IP Integrator: Generate Block Design
# Export the hardware system to SDK:
Vivado Menu: File > Export > Export Hardware
v1.png (In <project_name>.sdk HDF file is generated)


Generate a Device Tree Source (.dts/.dtsi) files from SDK

  1. Open SDK from Vivado or open SDK via command line (xsdk -hwspec <filename>.hdf -workspace <workspace>
    Vivado Menu: File > Launch SDK

  2. v2.png
  3. The Device Tree Generator Git repository needs to be cloned from the Xilinx. See the Fetch Sources page for more information on Git.
    # Otherwise for SDK 2014.2 use this repo:
    git clone git://github.com/Xilinx/device-tree-xlnx.git
  4. Add the BSP repository in SDK (for SDK 2014.2 and later select "device-tree-xlnx" from the checked out git area):
    SDK Menu: Xilinx Tools > Repositories > New... (<bsp repo>) > OK
  5. Create a Device Tree Board Support Package (BSP):
    SDK Menu: File > New > Board Support Package > Board Support Package OS: device-tree > Finish
  6. A BSP settings window will appear. This window can also be accessed by opening the Device Tree BSP's system.mss file and clicking 'Modify this BSP's Settings'. Fill in the values as appropriate:
    • The 'bootargs' parameter specifies the arguments passed to the kernel at boot time (kernel command line). ***
    • The 'console device' parameter specifies which serial output device will be used. Select a value from the drop-down.

The .dts/.dtsi files are now located in <SDK workspace>/device_tree_bsp_0/ folder.

*** e.g. console=<tty>,<baudrate> root=/dev/ram rw ip=:::::eth0:dhcp earlyprintk
*** Some example values for <tty> are ttyPS0 when using Zynq, ttyUL0 when using the UART Lite soft ip, or ttyS0 when using the UART16550 soft ip.

Generate a Device Tree Source (.dts/.dtsi) files on command line using HSM/HSI

  1. Source Xilinx design tools
  2. Run HSM or HSI (Vivado 2014.4 onwards)
    hsm
  3. Open HDF file
    open_hw_design <design_name>.hdf
  4. Set repository path (clone done in previous step in SDK) (On Windows use this format set_repo_path {C:\device-tree-xlnx})
    set_repo_path <path to device-tree-xlnx repository>
  5. Create SW design and setup CPU (for ZynqMP psu_cortexa53_0, for Zynq ps7_cortexa9_0, for Microblaze microblaze_0)
    create_sw_design device-tree -os device_tree -proc ps7_cortexa9_0
  6. Generate DTS/DTSI files to folder my_dts where output DTS/DTSI files will be generated
    generate_target -dir my_dts

Generate a Board file Device Tree Source (.dts/.dtsi) files on command line using HSM/HSI

  1. Source Xilinx design tools
  2. Run HSM or HSI (Vivado 2014.4 onwards)
 hsi
 
  • 3. Open HDF file
  • open_hw_design <design_name>.hdf
  • 4. Set repository path (clone done in previous step in SDK) (On Windows use this format set_repo_path {C:\device-tree-xlnx})
  • set_repo_path <path to device-tree-xlnx repository>
  • 5. Create SW design and setup CPU (for ZynqMP psu_cortexa53_0, for Zynq ps7_cortexa9_0, for Microblaze microblaze_0)
  • create_sw_design device-tree -os device_tree -proc ps7_cortexa9_0
  • 6. set_property CONFIG.periph_type_overrides "{BOARD zcu102-rev1.0}" [get_os]
  • set_property CONFIG.periph_type_overrides "{BOARD zcu102-rev1.0}" [get_os]

7. Generate DTS/DTSI files to folder my_dts where output DTS/DTSI files will be generated

generate_target -dir my_dts
8. In the generated my_dts folder zcu102-rev1.0.dtsi file should be present.

Compiling a Device Tree Blob (.dtb) file from the DTS

A utility called device tree compiler (DTC) is used to compile the DTS file into a DTB file. DTC is part of the Linux source directory. linux-xlnx/scripts/dtc/ contains the source code for DTC and needs to be compiled in order to be used. One way to compile the DTC is to build the Linux tree. The DTC might also be available through your OS's package manager.

Once the DTC is available, the tool may be invoked to generate the DTB:
./scripts/dtc/dtc -I dts -O dtb -o <devicetree name>.dtb <devicetree name>.dts
DTC may also be used to convert a DTB back into a DTS:
./scripts/dtc/dtc -I dtb -O dts -o <devicetree name>.dts <devicetree name>.dtb


Alternative: For ARM only
In the Linux source directory, making the target 'dtbs' will compile all DTS files from linux-xlnx/arch/arm/boot/dts/ into DTB files.
make ARCH=arm dtbs
The compiled DTB files will be located in linux-xlnx/arch/arm/boot/dts/.
A single linux-xlnx/arch/arm/boot/dts/<devicetree name>.dts may be compiled into linux-xlnx/arch/arm/boot/dts/<devicetree name>.dtb:
make ARCH=arm <devicetree name>.dtb



--NOTE! THIS IS SECTION BELOW on SDK 2014.1 IS NOW OBSOLETE. DO NOT USE THIS.--

Creating a Device Tree Source (.dts) file for SDK 2014.1 (or earlier)

  1. Open the hardware project in XPS.
  2. Export the hardware system to SDK:
    XPS Menu: Project > Export Hardware Design to SDK... > Export & Launch SDK
    # The Device Tree Generator Git repository needs to be cloned from the Xilinx. See the [[www/Fetch Sources|Fetch Sources]] page for more information on Git. Note that there are two repos for differing SDK versions below.
    > [[code]]
    > git clone git://github.com/Xilinx/device-tree.git bsp/device-tree_v0_00_x
    > [[code]]
    # Note: In order for SDK to be able to import the Device Tree Generator correctly, the file and directory hierarchy needs to look like:
    > <bsp repo>/bsp/device-tree//_v0_00_x/data/device-tree_v2_1_0.mld//
    > <bsp repo>/bsp/device-tree//_v0_00_x/////data/device-tree_v2_1_0.tcl//
    # Add the BSP repository in SDK (for SDK 2014.2 and later select "device-tree-xlnx" from the checked out git area):
    > [[code]]
    SDK Menu: Xilinx Tools > Repositories > New... (<bsp repo>) > OK
  3. Create a Device Tree Board Support Package (BSP):
    SDK Menu: File > New > Board Support Package > Board Support Package OS: device-tree > Finish
  4. A BSP settings window will appear. This window can also be accessed by opening the Device Tree BSP's system.mss file and clicking 'Modify this BSP's Settings'. Fill in the values as appropriate:
    • The 'bootargs' parameter specifies the arguments passed to the kernel at boot time (kernel command line). ***
    • The 'console device' parameter specifies which serial output device will be used. Select a value from the drop-down.

The .dts file is now located in <SDK workspace>/<device-tree bsp name>/<processor name>/libsrc/device-tree_v0_00_x/xilinx.dts.

*** e.g. console=<tty>,<baudrate> root=/dev/ram rw ip=:::::eth0:dhcp earlyprintk
*** Some example values for <tty> are ttyPS0 when using Zynq, ttyUL0 when using the UART Lite soft ip, or ttyS0 when using the UART16550 soft ip.

In the Linux source directory, there are also some DTS files available for use in linux-xlnx/arch/<architecture>/boot/dts/.

Release Notes


Build Steps

Related Links