You can experiment with source code changes and create a simple patch without leaving the BitBake environment. To get started, be sure to complete a build at least through the kernel configuration task:
$ bitbake linux-yocto -c kernel_configme -f
Taking this step ensures you have the sources prepared
and the configuration completed.
You can find the sources in the
${
WORKDIR
}/linux
directory.
You can edit the sources as you would any other Linux source
tree.
However, keep in mind that you will lose changes if you
trigger the
do_fetch
task for the recipe.
You can avoid triggering this task by not using BitBake to
run the
cleanall
,
cleansstate
,
or forced
fetch
commands.
Also, do not modify the recipe itself while working
with temporary changes or BitBake might run the
fetch
command depending on the
changes to the recipe.
To test your temporary changes, instruct BitBake to run the
compile
again.
The -f
option forces the command to run
even though BitBake might think it has already done so:
$ bitbake linux-yocto -c compile -f
If the compile fails, you can update the sources and repeat
the compile
.
Once compilation is successful, you can inspect and test
the resulting build (i.e. kernel, modules, and so forth) from
the following build directory:
${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build
Alternatively, you can run the deploy
command to place the kernel image in the
tmp/deploy/images
directory:
$ bitbake linux-yocto -c deploy
And, of course, you can perform the remaining installation and packaging steps by issuing:
$ bitbake linux-yocto
For rapid iterative development, the edit-compile-repeat loop described in this section is preferable to rebuilding the entire recipe because the installation and packaging tasks are very time consuming.
Once you are satisfied with your source code modifications,
you can make them permanent by generating patches and
applying them to the
SRC_URI
statement as described in the
"Applying Patches"
section.
If you are not familiar with generating patches, refer to the
"Creating the Patch"
section in the Yocto Project Development Manual.