UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
8,465 Views
Registered: ‎09-28-2015

using a modified dts file (petalinux 2016.4) (or patching it)

Jump to solution

I need to modify the dts file that is generated automatically as a part of petalinux-build process

 

In petalinux 2015.2, I used to see the constituent dtsi files in the following directory

$ \ls subsystems/linux/configs/device-tree/*
subsystems/linux/configs/device-tree/pcw.dtsi
subsystems/linux/configs/device-tree/pl.dtsi
subsystems/linux/configs/device-tree/skeleton.dtsi
subsystems/linux/configs/device-tree/system-conf.dtsi
subsystems/linux/configs/device-tree/system-top.dts
subsystems/linux/configs/device-tree/zynq-7000.dtsi

 

I have a patch file that used to make the changes required. All was well. :-)

 

With 2016.4, I see them in

$ \ls components/plnx_workspace/device-tree-generation/*.dtsi

components/plnx_workspace/device-tree-generation/pcw.dtsi
components/plnx_workspace/device-tree-generation/pl.dtsi
components/plnx_workspace/device-tree-generation/skeleton.dtsi
components/plnx_workspace/device-tree-generation/system-conf.dtsi
components/plnx_workspace/device-tree-generation/zynq-7000.dtsi

 

Also, there are .dts files

$ \ls components/plnx_workspace/device-tree-generation/*.dts
components/plnx_workspace/device-tree-generation/plnx_arm-system.dts
components/plnx_workspace/device-tree-generation/system.dts
components/plnx_workspace/device-tree-generation/system-top.dts

 

But, according to https://www.xilinx.com/support/answers/68422.html , these files are not used. Hence no point in patching them.

 

I searched a number of forum queries and internet and figured out that I need to write a recipe for modifying the dts file. To that end, I added a patch file to

project-spec/meta-user/recipes-dt/device-tree/files/

and modifying the

device-tree-generation_%.bbappend

file to modify the

work/cortexa9hf-neon-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+11f81055d1-r0/plnx_arm-system.dts

 

But it fails!

The reason : This file is generated from the git and the patches can be applied only within git source tree files

 

$ \ls ./work/cortexa9hf-neon-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+11f81055d1-r0/git/device_tree/data/kernel_dtsi/2016.4/zynq/*
./work/cortexa9hf-neon-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+11f81055d1-r0/git/device_tree/data/kernel_dtsi/2016.4/zynq/skeleton.dtsi
./work/cortexa9hf-neon-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+11f81055d1-r0/git/device_tree/data/kernel_dtsi/2016.4/zynq/zynq-7000.dtsi

 

I further figured out that plnx_arm-system.dts is created using a number of tcl scripts and cannot be modified after being created. I am not very sure about this because my tcl knowledge is limited.

 

My question: Is there any way I can get a custom dts file to compile as a part of 2016.4 petalinux-build?

 

Thanks for checking

BDev.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
15,356 Views
Registered: ‎12-04-2016

Re: using a modified dts file (petalinux 2016.4) (or patching it)

Jump to solution

Hi

 

You can find more detailed info on zynq device tree customization below:

 

Configuring Devicetree
PetaLinux device tree configuration is associated with following config files that are located at <plnx-projroot>/components/plnx_workspace/device-tree-generation/ and <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/.
• pcw.dtsi
• plnx_aarch64-system.dts
• system.dts
• system-conf.dtsi

• system-top.dts

If you wish to add information, like the Ethernet PHY information, this should be included in the system-top.dts file. In this case, device tree should include the information relevant for your specific platform as information (here, Ethernet PHY information) is board level and board specific.
An example of a well-formed Device-tree node for the system-top.dts is below.
/dts-v1/;
/include/ "system-conf.dtsi"
/ {
};
&gem0 {
phy-handle = <&phy0>;
ps7_ethernet_0_mdio: mdio {
phy0: phy@7 {
compatible = "marvell,88e1116r";
device_type = "ethernet-phy";
reg = <7>;
};
};
};

 

You can add the custom dtsi files. All modified or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree.

 

You can add your custom dtsi files. All modifications or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree
The following example demonstrates adding sample-user-1.dtsi and
sample-user-2.dtsifile:
SRC_URI_append ="\
file://system-top.dts \
file://sample-user-1.dtsi \
file://sample-user-2.dtsi \
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_compile_prepend () {
install -m 644 ${WORKDIR}/sample-user-1.dtsi ${dts_dir}/
install -m 644 ${WORKDIR}/sample-user-2.dtsi ${dts_dir}/
}
changes in system-top.dts
/dts-v1/;
/include/ "system-conf.dtsi"
/include/ "sample-user-1.dtsi.dtsi"
/include/ "sample-user-2.dtsi.dtsi"
It is not recommended to change anything in
<plnx-proj-root>/coponents/plnx_workspace/device-tree-generation/

 

All the changes have to be made in meta-user only. For example, if you want to change anything, you can do in meta-user by rewriting the entire node with your changes in meta-user layer.

 

 

Best Regards

Shabbir

3 Replies
Moderator
Moderator
15,357 Views
Registered: ‎12-04-2016

Re: using a modified dts file (petalinux 2016.4) (or patching it)

Jump to solution

Hi

 

You can find more detailed info on zynq device tree customization below:

 

Configuring Devicetree
PetaLinux device tree configuration is associated with following config files that are located at <plnx-projroot>/components/plnx_workspace/device-tree-generation/ and <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/.
• pcw.dtsi
• plnx_aarch64-system.dts
• system.dts
• system-conf.dtsi

• system-top.dts

If you wish to add information, like the Ethernet PHY information, this should be included in the system-top.dts file. In this case, device tree should include the information relevant for your specific platform as information (here, Ethernet PHY information) is board level and board specific.
An example of a well-formed Device-tree node for the system-top.dts is below.
/dts-v1/;
/include/ "system-conf.dtsi"
/ {
};
&gem0 {
phy-handle = <&phy0>;
ps7_ethernet_0_mdio: mdio {
phy0: phy@7 {
compatible = "marvell,88e1116r";
device_type = "ethernet-phy";
reg = <7>;
};
};
};

 

You can add the custom dtsi files. All modified or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree.

 

You can add your custom dtsi files. All modifications or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree
The following example demonstrates adding sample-user-1.dtsi and
sample-user-2.dtsifile:
SRC_URI_append ="\
file://system-top.dts \
file://sample-user-1.dtsi \
file://sample-user-2.dtsi \
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_compile_prepend () {
install -m 644 ${WORKDIR}/sample-user-1.dtsi ${dts_dir}/
install -m 644 ${WORKDIR}/sample-user-2.dtsi ${dts_dir}/
}
changes in system-top.dts
/dts-v1/;
/include/ "system-conf.dtsi"
/include/ "sample-user-1.dtsi.dtsi"
/include/ "sample-user-2.dtsi.dtsi"
It is not recommended to change anything in
<plnx-proj-root>/coponents/plnx_workspace/device-tree-generation/

 

All the changes have to be made in meta-user only. For example, if you want to change anything, you can do in meta-user by rewriting the entire node with your changes in meta-user layer.

 

 

Best Regards

Shabbir

8,402 Views
Registered: ‎09-28-2015

Re: using a modified dts file (petalinux 2016.4) (or patching it)

Jump to solution

Thanks Shabbir, that helped. Accepting as a solution.

0 Kudos
Contributor
Contributor
8,253 Views
Registered: ‎11-09-2007

Re: using a modified dts file (petalinux 2016.4) (or patching it)

Jump to solution

I'm a little confused by this answer. Could you let me know if this is correct?

 

First, after creating the petalinux project I need to modify project-spec/meta-user/recipes/device-tree/device_tree-generation_%.bbappend to contain the following:

 

SRC_URI_append ="\
file://system-top.dts \
file://sample-user-1.dtsi \
file://sample-user-2.dtsi \
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_compile_prepend () {
install -m 644 ${WORKDIR}/sample-user-1.dtsi ${dts_dir}/
install -m 644 ${WORKDIR}/sample-user-2.dtsi ${dts_dir}/
}

 

And also modify  project-spec/meta-user/recipes/device-tree/files/system-top.dts to read (I am assuming the .dtsi.dtsi in your response was a typo)

 

/dts-v1/;
/include/ "system-conf.dtsi"
/include/ "sample-user-1.dtsi"
/include/ "sample-user-2.dtsi"

 

Thanks,

 

-Pete

 

0 Kudos