Device Tree Generator

Summary

This guide describes how to use the device tree generator. The device tree generator is a Xilinx EDK tool that plugs into the Automatic BSP Generation features of the tool, XPS.

The purpose of the device tree generator is to produce a device tree file (xilinx.dts) that has the information for the hardware design in your EDK project. This alleviates having to create a device tree file with a text editor, which can be quite tedious.

The device tree generator is called device-tree, which is at git://git.xilinx.com/device-tree.git.1

Device Tree Documentation

The device tree is documented (somewhat) in the Linux kernel at Documentation/powerpc/booting-without-of.txt and in the dts-bindings directory.

The following link, http://ozlabs.org/~dgibson/papers/dtc-paper.pdf, also has some useful information.

Updates Since 3/25/09

  1. The device tree generator now has a fake version associated with it, "0.00.x" This is done because upcoming EDK 11.1 tools will require the version string to be present in order to recognize the BSP.
  2. The device tree generator generates compatible lists. The compatible list contains the core's version first, followed by the oldest core that is software compatible such that software drivers written for the older version will still work. This means that kernel drivers do not need to be updated if the only difference to the driver would be to change the version compatible string.

Updates Since 9/1/09

  1. The device tree generator now supports the MicroBlaze architecture.
  2. In commas that were passed in bootargs were being chopped off. This is a know issue and will be corrected in a future release of the EDK. A temporary work around has been added to allow for bootargs to generate commas by replacing semi-colons with commas during the parsing of the bootargs.

Getting the Device Tree Generator From Xilinx

The following command will get the device-tree repository from the Xilinx Git repository. For users without Git, see the page at http://git.xilinx.com as it indicates how to create a snapshot (tar ball) of the kernel.

bash> git clone git://git-dev.xilinx.com/device-tree.git

Setup

After getting the device tree generator from git://git.xilinx.com/device-tree.git, you will need to copy the 'bsp' directory and contents so that it can be used by XPS. The simplest approach is to copy the 'bsp' directory to the top of your project directory.2

cp -r bsp <path to project>/

If your project is currently open in XPS, you will need to close and re-open the project for XPS to notice the changes.

Using the Device Tree Generator

To use the device tree generator, select 'device-tree' in the pull down menu labeled 'OS' in the Software Platform Settings dialog box.

software_platform_settings-software_platform.png

Then select 'OS and Libraries' on the left, and enter the values for 'console device' and 'bootargs'

software_platform_settings-os_and_libraries.png

Finally close the Software Platform Settings dialog box by clicking on the 'OK' button, and select 'Generate Libraries and BSPs' from the software menu. The resulting device tree file (xilinx.dts) will reside in your project directory in pp440_0 (or ppc405)/libsrc/device-tree/xilinx.dts.

Console Device Option

The 'console device' option lets you select which IP core is to be used for the console. This value is needed by linux for output early during bootup. Put in the name of the instance (e.g. RS232_Uart_1) rather than the type of the core (e.g. not xps_uart16550). The IP instance name can be found in XPS using the 'System Assembly View' tab (in the middle of the XPS window).

Bootargs Option

The 'bootargs' option lets you type in the text for the linux kernel bootargs. The default value (at the time of this writting) is

console=ttyS0 root=/dev/ram

Change the text to what is needed for your system. The following section describes a few of the common options given in bootargs.

console

The value for console=… needs to select the same device given in the 'console device' option. The following is a table showing what device to select in 'console=' based on Xilinx device types commonly used for the console.

device type console text
xps_uart16550 console=ttySN
xps_uartlite console=ttyULN3
N is 0 for the first device of the type. N is 1 for the second device of the type etc.

ip

The option ip=… specifies the ip address used. To use dhcp to dynamically assign an ip address, specify

ip=on

To specify a static ip address, for example 192.168.1.10, use

ip=192.168.1.10

root

The option root=… tells the linux kernel where to find the root filesystem. The root filesystem can be in ram, on the compact flash disk, or even on an nfs share on a remote computer. Add the option rw after the option if you would like the filesystem to be read/writeable. Please note that for ramdisk images, any changes will be in ram only and lost on reboot.

The following is a table showing various bootarg options for different root filesystem locations.

root filesystem location bootarg options
ramdisk root=/dev/ram
compact flash disk root=/dev/xsysace/disc0/partN (where N is the partition number of the root file system.)4 5
nfs root=/dev/nfs nfsroot=<nfs server>:<nfs share>,tcp (e.g. root=/dev/nfs nfsroot=192.168.1.1:/nfsroots/development,tcp)
page_revision: 13, last_edited: 1256147873|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License