Discussion:
[yocto] Keeping and modifying Source code in Yocto
Simon Chamlian
2018-07-06 15:20:12 UTC
Permalink
Hi,

Is there a way to keep the source code of a package to be able to modify it
and then compile?

For example, with LTIB ( Linux Target Image Builder ), it was possible with
a command to extract the source code from a package, make modifications and
then re-compile?

Thanks,
S
Rudolf J Streif
2018-07-06 15:25:14 UTC
Permalink
Hi Simon,
Post by Simon Chamlian
Is there a way to keep the source code of a package to be able to
modify it and then compile?

Yes, there is. devtool greatly simplifies this type of workflow. Please
refer to
https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#using-devtool-in-your-sdk-workflow
for details.

:rjs
Post by Simon Chamlian
Hi,
Is there a way to keep the source code of a package to be able to
modify it and then compile?
For example, with LTIB ( Linux Target Image Builder ), it was possible
with a command to extract the source code from a package, make
modifications and then re-compile?
Thanks,
S
--
Rudolf J Streif
Tim Hammer
2018-07-06 15:27:27 UTC
Permalink
Post by Simon Chamlian
Hi,
Is there a way to keep the source code of a package to be able to modify
it and then compile?
For example, with LTIB ( Linux Target Image Builder ), it was possible
with a command to extract the source code from a package, make
modifications and then re-compile?
I suggest you take a look at the devtool:
https://www.yoctoproject.org/software-item/devtool/

https://wiki.yoctoproject.org/wiki/TipsAndTricks/Patching_the_source_for_a_recipe
Post by Simon Chamlian
Thanks,
S
--
_______________________________________________
yocto mailing list
https://lists.yoctoproject.org/listinfo/yocto
--
.Tim
Marcelo E. Magallon
2018-07-09 12:43:10 UTC
Permalink
In my current project we have a simplified version in a
”component.bbclass”. It relies on a variable COMPONENT_DIR
defined in our local.conf.
A recipe located in ”recipe-xxxx/<package>/<package>_$PV.bb” doing
inherit component
will find its source code in $COMPONENT_DIR/<package>, making
the recipe simpler than that of the externalsrc bbclass. No need
for SRC_URI statements.
You mean you set S to $COMPONENT_DIR/<package>?

If there's no SRC_URI, does fetch run? If not, how does it detect
that the source code changed?

Marcelo
--
ChenQi
2018-07-10 01:32:56 UTC
Permalink
Hi Simon,

I usually use the following steps when I need to modify source for some
purpose.

1. bitbake A (or at least bitbake A -c configure)
*2. cd tmp/work/xxxxx/A/<source dir>**
**3. make the modification*
4. bitbake A -c compile -f
5. bitbake A

If you find the modification useful, make a patch from it.

Best Regards,
Chen Qi
Post by Simon Chamlian
Hi,
Is there a way to keep the source code of a package to be able to
modify it and then compile?
For example, with LTIB ( Linux Target Image Builder ), it was possible
with a command to extract the source code from a package, make
modifications and then re-compile?
Thanks,
S
Paul Eggleton
2018-07-10 06:18:27 UTC
Permalink
Post by ChenQi
I usually use the following steps when I need to modify source for some
purpose.
1. bitbake A (or at least bitbake A -c configure)
*2. cd tmp/work/xxxxx/A/<source dir>**
**3. make the modification*
4. bitbake A -c compile -f
5. bitbake A
If you find the modification useful, make a patch from it.
This is the old way of doing it which can under some circumstances result in
you losing your changes to the source tree, since the sources under tmp/work/
are only ever intended to be there temporarily. Devtool (as recommend by
others on this thread) is designed to enable this workflow in a much safer
manner.

Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre


--
ChenQi
2018-07-10 08:27:31 UTC
Permalink
Post by Paul Eggleton
Post by ChenQi
I usually use the following steps when I need to modify source for some
purpose.
1. bitbake A (or at least bitbake A -c configure)
*2. cd tmp/work/xxxxx/A/<source dir>**
**3. make the modification*
4. bitbake A -c compile -f
5. bitbake A
If you find the modification useful, make a patch from it.
This is the old way of doing it which can under some circumstances result in
you losing your changes to the source tree, since the sources under tmp/work/
are only ever intended to be there temporarily. Devtool (as recommend by
others on this thread) is designed to enable this workflow in a much safer
manner.
Cheers,
Paul
Thanks Paul. I'll turn to use devtool.

Best Regards,

Chen Qi

--
Simon Chamlian
2018-07-11 15:27:34 UTC
Permalink
I am getting the following error using devtool:

$ devtool add help
ERROR: Layer directory '/home/jay/sources/poky/meta' does not exist! Please
check BBLAYERS in /home/jay/build/conf/bblayers.conf

$ whereis devtool
devtool: /opt/PHYTEC_BSPs/yocto_imx7/sources/poky/scripts/devtool

The paths are completely wrong.

Any hints?

Thanks,
S
Post by ChenQi
Post by Paul Eggleton
Post by ChenQi
I usually use the following steps when I need to modify source for some
purpose.
1. bitbake A (or at least bitbake A -c configure)
*2. cd tmp/work/xxxxx/A/<source dir>**
**3. make the modification*
4. bitbake A -c compile -f
5. bitbake A
If you find the modification useful, make a patch from it.
This is the old way of doing it which can under some circumstances result in
you losing your changes to the source tree, since the sources under tmp/work/
are only ever intended to be there temporarily. Devtool (as recommend by
others on this thread) is designed to enable this workflow in a much safer
manner.
Cheers,
Paul
Thanks Paul. I'll turn to use devtool.
Best Regards,
Chen Qi
Khem Raj
2018-07-11 20:46:20 UTC
Permalink
Post by Simon Chamlian
$ devtool add help
ERROR: Layer directory '/home/jay/sources/poky/meta' does not exist! Please check BBLAYERS in /home/jay/build/conf/bblayers.conf
$ whereis devtool
devtool: /opt/PHYTEC_BSPs/yocto_imx7/sources/poky/scripts/devtool
The paths are completely wrong.
Any hints?
may be there are two different workspaces being mixed here. Probably
you should start a fresh shell and setup
environment to run bitbake and then be able to run devtool in that
shell as well.
Post by Simon Chamlian
Thanks,
S
Post by ChenQi
Post by Paul Eggleton
Post by ChenQi
I usually use the following steps when I need to modify source for some
purpose.
1. bitbake A (or at least bitbake A -c configure)
*2. cd tmp/work/xxxxx/A/<source dir>**
**3. make the modification*
4. bitbake A -c compile -f
5. bitbake A
If you find the modification useful, make a patch from it.
This is the old way of doing it which can under some circumstances result in
you losing your changes to the source tree, since the sources under tmp/work/
are only ever intended to be there temporarily. Devtool (as recommend by
others on this thread) is designed to enable this workflow in a much safer
manner.
Cheers,
Paul
Thanks Paul. I'll turn to use devtool.
Best Regards,
Chen Qi
--
_______________________________________________
yocto mailing list
https://lists.yoctoproject.org/listinfo/yocto
--

Khem Raj
2018-07-10 01:44:24 UTC
Permalink
Hi,
Is there a way to keep the source code of a package to be able to modify it and then compile?
For example, with LTIB ( Linux Target Image Builder ), it was possible with a command to extract the source code from a package, make modifications and then re-compile?
Please use devtool which is aimed at exactly what you want to get done here.

https://www.yoctoproject.org/docs/2.6/sdk-manual/sdk-manual.html#sdk-a-closer-look-at-devtool-add
Thanks,
S
--
_______________________________________________
yocto mailing list
https://lists.yoctoproject.org/listinfo/yocto
--
Loading...