Showing results for 
Search instead for 
Did you mean: 
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.



Device tree is one way to describe embedded hardware. It can be passed to linux kernel for the binding of port address, irq number and other parameters. A default device tree data can be built into kernel image, or it can be passed to kernel at boot time via boot loader, such as u-boot. It will allow a single kernel image work on several different configurations or boards. Nios2 linux will migrate to device tree, which will replace the hwselect of nommu or sopc_create_header_files of mmu.

The source file of a device tree is called "dts". You can generate a dts file from sopcinfo file of your project via a tool callled Sopc2dts, written by Walter Goossens. Then you can edit the dts to add other board information. Next, the dts is compiled to "dtb" via a device tree compiler "dtc". Finally, the dtb is linked to kernel or passed to kernel by boot loader.

0. install jdk so that you can build the tool.

1. clone the tools.git on sopc server.

git clone git://

2. go to the tool dir. You may need to rebuild the jar using "make" in order to get the up-to-date executable.

cd tools/sopc2dts


3. run the sopc2dts.jar from this directory.

java -jar sopc2dts.jar -t dts -i path_to_your_system.sopcinfo -o path_to_your_system.dts

4. edit the dts file for kernel bootargs, mtd partitions or add your spi or i2c devices information. please refer to the doc at linux-2.6/Documentation/devicetree/bindings/. for mtd partitions [...]/bindings/mtd/mtd-physmap.txt, for spi [...]/bindings/spi/spi-bus.txt, etc.

5. enable device tree support in your uClinux-dist kernel config. enter the full path to your dts file in (), which will be dtc compiled and the dtb is linked into the kernel.

NiosII board configuration --->

(X) Generic devicetree based NiosII system

Processor type and features -->

[*] Devicetree support

(full_path_to_your_dts) Devicetree source file


Mapping drivers for chip access --->

<*> Flash device in physical memory map based on OF description

LED support

[*] OpenFirmware platform device bindings for GPIO LEDs

If you use Altera UART and Altera JTAG UART in your design, also make sure that you only selected only one of them for console and entered the correct name in the bootargs in the dts.

For console on Altera UART:

Character devices --->

Serial drivers --->

[ ] Altera JTAG UART console support

[*] Altera UART console support

bootargs = "debug console=ttyAL0,115200";

For console on Altera JTAG UART:

Character devices --->

Serial drivers --->

[*] Altera JTAG UART console support

[ ] Altera UART console support

bootargs = "debug console=ttyJ0,115200";

6. run "make" in uClinux-dist, a dtc compiler will be built in dir uClinux-dist/linux-2.6.x/scripts/dtc

If you have dtb linked into kernel, you may run the image now.

7. Optionally, you may compile your dts manually.

dtc -O dtb -o your_system.dtb -b 0 -p 1024 your_system.dts

then pass the dtb to your boot loader

eg, in u-boot, add "#define CONFIG_OF_LIBFDT" to your u-boot config header.

tftp ${fdtaddr} ${fdtfile};tftp ${loadaddr} ${vmfile};bootm ${loadaddr} - ${fdtaddr}

##Booting kernel from Legacy Image at c1000000 ...

  Image Name:  Linux-2.6.37-00819-g732ca8b-dirt

  Image Type:  NIOS II Linux Kernel Image (gzip compressed)

  Data Size:   1416956 Bytes = 1.4 MiB

  Load Address: c0000000

  Entry Point: c0000000

  Verifying Checksum ... OK

## Flattened Device Tree blob at c1800000

  Booting using the fdt blob at 0xc1800000

  Uncompressing Kernel Image ... OK

Linux version 2.6.37-00819-g732ca8b-dirty

Note for users of the "igor_mac" referenced at, device tree support has been changed slightly compared to the "custom fpga" build method. With the "custom_fpga" build method, there were two different driver options in the kernel build process that worked. The device tree build method only supports the "OpenCores 10/100 Mbps Ethernet MAC support" driver, not the "Opencores (Igor) Emac support" driver that worked under the older build method.

Version history
Last update:
‎06-26-2019 04:56 AM
Updated by: