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: 
Contributor
Contributor
12,320 Views
Registered: ‎08-09-2013

how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

i look for this question in the community for a day but found little answers.

iam  a  new to the yocto,and found it  was hard to use and maybe this is the same to the one who is not familiar with the layers of the yocto.

here is one answer.

https://forums.xilinx.com/t5/Embedded-Linux/How-can-I-modify-kernel-source-code-in-meta-xilinx-kernel/m-p/730920#M17336

but i not understand this.

and this is an other example https://community.nxp.com/docs/DOC-95252

 

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
20,755 Views
Registered: ‎08-09-2013

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

and for the kernel modify

 

after build the kernel you will find the source code in the 

<plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source

 

1. modify the code source in the <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source

for example: drivers/w1/masters/w1-gpio.c

 

2. in the  <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source do like this

git add file1(like:drivers/w1/masters/w1-gpio.c) file2 ...

 

3. give a pacth tile

git commit -s -m 'your commit title'

 

4.create the pacth

git format-patch -1

    #and then you will see the .pacth in you current directory.

 

5. copy this .pacth to the <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/

and add the linux-xlnx_%.bbappend file in the <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/ 

like:
SRC_URI_append = " file://xxxx.patch"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

 

 

and then 

and then petaliunx-build 

 

and the new <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source code will add your patch.

 

and i think this will be helpful with you.

 

View solution in original post

6 Replies
Contributor
Contributor
12,311 Views
Registered: ‎08-09-2013

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

in the 2016.4 ug1144-petalinux-tools-reference-guide.pdf 

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_4/ug1144-petalinux-tools-reference-guide.pdf

you can find this:

 

Adding Patches to Source Repo
If the sources of a component is a git repo, you can apply patches on top of the repo.
An example to add patches for u-boot and to apply mypatch.patchis given below:
1. Copy the mypatch.patchto
<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/files
/
2. Open
<plnx-proj-root>/project-spec/meta-user/recipes-bsp/u-boot/u-boo
t-xlnx_%.bbappend and add the following line:
SRC_URI_append = " file://mypatch.patch"
If there is no bbappend for a utility, you have to create bbappend for that utility on the
similar lines. An example for sample utility with mypatch.patchis shown below:
a. Create directory
<plnx-proj-root>/project-spec/meta-user/recipes-apps/sampleuti
lity/files/
b. Copy mypatch.patch to
<plnx-proj-root>/project-spec/meta-user/recipes-apps/sampleuti
lity/files/
c. Open
<plnx-proj-root>/project-spec/meta-user/recipes-apps/sampleuti
lity/sampleutility_%.bbappend and add the following line:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
Yocto will apply the patch on the fetched git repo.

0 Kudos
Contributor
Contributor
12,303 Views
Registered: ‎08-09-2013

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

and i finally work it out like this

 

for device-tree i want to add a uart0 to the aliases like 

/ {
model = "bus_standard";
aliases {
serial0 = &uart1;
serial1 = &uart0;
ethernet0 = &gem0;
};
chosen {
bootargs = "console=ttyPS0,115200 earlyprintk";
stdout-path = "serial0:115200ns";
};
memory {
device_type = "memory";
reg = <0x0 0x40000000>;
};
};

 

because the kernel will stop when boot in "console [ttyPS0] enable"

add this file to the 

<plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/files/

and in the <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/device-tree-generation_%.bbappend copy like this 

SRC_URI_append ="\
file://system-top.dts\
file://system-conf.dtsi\
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

 

and then petaliunx-build 

it is ok

.and it is also ok if you directly change the source file in the 

<plnx-proj-root>/component/plnx_workspace/device-tree-generation/system-conf.dtsi

and ithink what ido in the <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree directory

is to overwite the <plnx-proj-root>/component/plnx_workspace/device-tree-generation/system-conf.dtsi when build.

 

0 Kudos
Highlighted
Contributor
Contributor
20,756 Views
Registered: ‎08-09-2013

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

and for the kernel modify

 

after build the kernel you will find the source code in the 

<plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source

 

1. modify the code source in the <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source

for example: drivers/w1/masters/w1-gpio.c

 

2. in the  <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source do like this

git add file1(like:drivers/w1/masters/w1-gpio.c) file2 ...

 

3. give a pacth tile

git commit -s -m 'your commit title'

 

4.create the pacth

git format-patch -1

    #and then you will see the .pacth in you current directory.

 

5. copy this .pacth to the <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/

and add the linux-xlnx_%.bbappend file in the <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/ 

like:
SRC_URI_append = " file://xxxx.patch"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

 

 

and then 

and then petaliunx-build 

 

and the new <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source code will add your patch.

 

and i think this will be helpful with you.

 

View solution in original post

Explorer
Explorer
12,274 Views
Registered: ‎11-22-2015

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

  As suggested, modifying the recipes and adding patches is the typical way but personally I find creating and maintaining patches a huge hassle.  If you have a private kernel repo, you just make you modifications in that repo and just create a recipe to use that private repo.   I keep my devicetree files in my private repo

  Also, this method allows you to just checkout just the kern repo and build it just using make.

 

jeff

0 Kudos
Contributor
Contributor
12,193 Views
Registered: ‎08-09-2013

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

it is truely very slow,when build the the kernel,as it will run the git every time you build.

but i think it is,as you siad, the   typical way may be  xilinx susggested, and it is new for petalinux 2016.4.

for 2016.3 there is the source code for xlnx-linux,but in 2016.4 you can not find the source code in the 

petalinux intstall directory, just a lot git.and i am  not very suited .

0 Kudos
Observer simalps
Observer
7,817 Views
Registered: ‎06-07-2016

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

Jump to solution

Make also sure to modify the priority for the meta-user layer to 7 in the project file <plnx-proj-root>/project-spec/meta-user/conf/layer.conf

 

see "Patching the Linux Kernel of a PetaLinux Project" in http://www.wiki.xilinx.com/PetaLinux+Yocto+Tips 

 

0 Kudos