How to dump device tree from NAND flash to get dts (Zynq-7000)

In this article, I will dump the original device tree of the Zynq EBAZ4205 Board.

Since the Zynq EBAZ4205 Board is not a development board, the design information is not provided by the manufacturer. You need to get the necessary information yourself.

From the device tree source text (dts) file converted from the dumped device tree blob (dtb) file, you can get reference information when developing a custom Linux image using Vivado and PetaLinux.


Insert the microSD card into the Zynq EBAZ4205 Board. This microSD card is used to transfer the dumped dtb file to the PC.

If you can use Ethernet, you can transfer the file by other methods.


Boot original Linux from the NAND flash on the Zynq EBAZ4205 Board.

Make sure the microSD card is mounted.

  root@zedboard-zynq7:~# ls /run/media/mmcblk0p1/

Execute the following command to dump the device tree from the NAND flash and save it as dtb file on the microSD card.

  root@zedboard-zynq7:~# dd if=/dev/mtd2 of=/run/media/mmcblk0p1/ebaz4205_nand.dtb
  256+0 records in
  256+0 records out
  root@zedboard-zynq7:~# ls /run/media/mmcblk0p1


Copy the dtb file from the microSD card to your PC.

Convert dtb file to dts file. Use the device tree compiler (dtc) command for this conversion.

For Ubuntu, you can install it with the following command.

  $ sudo apt install -y device-tree-compiler

Execute the dtc command.

  $ dtc -I dtb -O dts -o ebaz4205_nand.dts ebaz4205_nand.dtb

Now you have a dts file.


One of the information that can be obtained from the dts file is the NAND flash timing parameters and existing partition information.

For example, in the dts file, it was described as follows.

flash@e1000000 {
    status = "okay";
    compatible = "arm,pl353-nand-r2p1";
    reg = <0xe1000000 0x1000000>;
    #address-cells = <0x1>;
    #size-cells = <0x1>;
    arm,nand-cycle-t0 = <0x5>;
    arm,nand-cycle-t1 = <0x5>;
    arm,nand-cycle-t2 = <0x2>;
    arm,nand-cycle-t3 = <0x2>;
    arm,nand-cycle-t4 = <0x2>;
    arm,nand-cycle-t5 = <0x1>;
    arm,nand-cycle-t6 = <0x2>;

    partition@nand-fsbl-uboot {
        label = "nand-fsbl-uboot";
        reg = <0x0 0x300000>;

    partition@nand-linux {
        label = "nand-linux";
        reg = <0x300000 0x500000>;

    partition@nand-device-tree {
        label = "nand-device-tree";
        reg = <0x800000 0x20000>;

    partition@nand-rootfs {
        label = "nand-rootfs";
        reg = <0x820000 0xa00000>;

    partition@nand-jffs2 {
        label = "nand-jffs2";
        reg = <0x1220000 0x1000000>;

    partition@nand-bitstream {
        label = "nand-bitstream";
        reg = <0x2220000 0x800000>;

    partition@nand-allrootfs {
        label = "nand-allrootfs";
        reg = <0x2a20000 0x4000000>;

    partition@nand-release {
        label = "nand-release";
        reg = <0x6a20000 0x13e0000>;

    partition@nand-reserve {
        label = "nand-reserve";
        reg = <0x7e00000 0x200000>;

For the timing parameters nand-cycle-t0 to nand-cycle-t6, refer to the Xilinx Wiki.

If you are developing a custom Linux image using Vivado and PetaLinux, set these parameters in Vivado. At this time, you should also check the NAND flash data sheet.

Note: The parameters in the screenshot are examples and have not been tested.

Partition information can be set in PetaLinux.

This information is reflected in the device tree automatically generated by PetaLinux. The device tree is generated in the following directory when you run the petalinux-build command.

  • /components/plnx_workspace/device-tree/device-tree

My Vivado design and PetaLinux project are available on GitHub.

If there are any mistakes in the description, please let me know.

0 件のコメント: