Yocto Customizing the Linux kernel: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<!-- Set release according to "release" parameter in URL and use | <!-- Set release according to "release" parameter in URL and use PYRO_V1.0_VAR-SOM-MX6 as default | ||
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- | --> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- | ||
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM| | --> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_PYRO_V1.0_VAR-SOM-MX6}}}} <!-- | ||
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing the Linux kernel | --> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing the Linux kernel}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}} __toc__ | ||
Choose one of the following three methods to customize | Choose one of the following three methods to customize the Linux kernel and build it using Yocto: | ||
= Add your own patches on top of our source code = | = Add your own patches on top of our source code = | ||
Line 10: | Line 10: | ||
<br> | <br> | ||
'''Get the source code by cloning our repository''':<br> | '''Get the source code by cloning our repository''':<br> | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ mkdir -p local_repos | $ mkdir -p local_repos | ||
Line 17: | Line 16: | ||
$ cd linux-2.6-imx | $ cd linux-2.6-imx | ||
$ git checkout {{#var:KERNEL_BRANCH}} | $ git checkout {{#var:KERNEL_BRANCH}} | ||
<br> | <br> | ||
'''Make your changes in the source code and create a patch''':<br> | '''Make your changes in the source code and create a patch''':<br> | ||
Line 36: | Line 27: | ||
<br> | <br> | ||
'''Update the recipes to use your patch''':<br> | '''Update the recipes to use your patch''':<br> | ||
Copy your patch: | Copy your patch: | ||
$ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-kernel/linux/ | $ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-kernel/linux/ | ||
Line 47: | Line 37: | ||
and append the following line to it: | and append the following line to it: | ||
SRC_URI += "file://imx6qdl-var-som_device_tree_changes.diff" | SRC_URI += "file://imx6qdl-var-som_device_tree_changes.diff" | ||
= Use a local repository = | = Use a local repository = | ||
Using this method Yocto will take the kernel | Using this method Yocto will take the kernel source from a local repository instead of our remote ones on github:<br> | ||
<br> | <br> | ||
'''Get the source code by cloning our repository:'''<br> | '''Get the source code by cloning our repository:'''<br> | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ mkdir -p local_repos | $ mkdir -p local_repos | ||
Line 75: | Line 48: | ||
$ cd linux-2.6-imx | $ cd linux-2.6-imx | ||
$ git checkout {{#var:KERNEL_BRANCH}} | $ git checkout {{#var:KERNEL_BRANCH}} | ||
<br> | <br> | ||
'''Make your changes in the source code and commit them:'''<br> | '''Make your changes in the source code and commit them:'''<br> | ||
Line 111: | Line 76: | ||
SRCBRANCH = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)'' | SRCBRANCH = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)'' | ||
SRCREV = "''The commit id you'd like to use''" | SRCREV = "''The commit id you'd like to use''" | ||
<br> | <br> | ||
{{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch}} | {{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch}} | ||
Line 132: | Line 82: | ||
Using this method Yocto will take the source code from your own remote repository on github:<br> | Using this method Yocto will take the source code from your own remote repository on github:<br> | ||
<br> | <br> | ||
'''Create your own github account and upload your proprietary kernel | '''Create your own github account and upload your proprietary kernel to a new repository''':<br> | ||
For example, you can fork our | For example, you can fork our repository to your own account by visiting the following link and clicking on "Fork" at the top right of the screen.<br> | ||
Alternatively, you can clone our | Alternatively, you can clone our repository to your local machine, and push it later to your own account.<br> | ||
<br> | <br> | ||
https://github.com/varigit/linux-2.6-imx/tree/{{#var:KERNEL_BRANCH}} | https://github.com/varigit/linux-2.6-imx/tree/{{#var:KERNEL_BRANCH}} | ||
<br> | <br> | ||
'''Update the recipes to use your remote repository instead of the default one''':<br> | '''Update the recipes to use your remote repository instead of the default one''':<br> | ||
<br> | <br> | ||
$ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-kernel/linux/ | $ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-kernel/linux/ | ||
Line 153: | Line 98: | ||
and append the following lines to it (see the previous section for listing the commits or getting the latest commit id): | and append the following lines to it (see the previous section for listing the commits or getting the latest commit id): | ||
KERNEL_SRC = <nowiki>"git://github.com/ | KERNEL_SRC = <nowiki>"git://github.com/</nowiki>''your_account''<nowiki>/linux-2.6-imx.git;protocol=git"</nowiki> | ||
SRCBRANCH = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)'' | SRCBRANCH = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)'' | ||
SRCREV = "''The commit id you'd like to use''" | SRCREV = "''The commit id you'd like to use''" | ||
<br> | <br> | ||
{{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch}} | {{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch}} |
Revision as of 10:38, 2 October 2017
Choose one of the following three methods to customize the Linux kernel and build it using Yocto:
Add your own patches on top of our source code
Using this method Yocto will take the source code from our default remote repository, and apply your patches to it before building it:
Get the source code by cloning our repository:
$ cd ~/var-fslc-yocto $ mkdir -p local_repos $ cd local_repos $ git clone https://github.com/varigit/linux-2.6-imx.git $ cd linux-2.6-imx $ git checkout imx-rel_imx_4.1.15_2.0.0_ga-var02
Make your changes in the source code and create a patch:
You can use either diff or patch file types.
For example:
$ cd ~/var-fslc-yocto/local_repos/linux-2.6-imx $ gedit arch/arm/boot/dts/imx6qdl-var-som.dtsi edit and save $ git diff > imx6qdl-var-som_device_tree_changes.diff
Update the recipes to use your patch:
Copy your patch:
$ cd ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-kernel/linux/ $ mkdir -p files $ cp ~/var-fslc-yocto/local_repos/linux-2.6-imx/imx6qdl-var-som_device_tree_changes.diff files/
Create a linux-variscite_4.1.15.bbappend file:
$ gedit linux-variscite_4.1.15.bbappend
and append the following line to it:
SRC_URI += "file://imx6qdl-var-som_device_tree_changes.diff"
Use a local repository
Using this method Yocto will take the kernel source from a local repository instead of our remote ones on github:
Get the source code by cloning our repository:
$ cd ~/var-fslc-yocto $ mkdir -p local_repos $ cd local_repos $ git clone https://github.com/varigit/linux-2.6-imx.git $ cd linux-2.6-imx $ git checkout imx-rel_imx_4.1.15_2.0.0_ga-var02
Make your changes in the source code and commit them:
After making changes in the source code you need to commit them.
For example:
$ cd ~/var-fslc-yocto/local_repos/linux-2.6-imx $ gedit arch/arm/boot/dts/imx6qdl-var-som.dtsi edit and save $ git commit -a -m "imx6qdl-var-som device tree changes"
To list all of the commits: $ git log
Get the latest commit id: $ git rev-parse HEAD
Update the recipes to use the local repository instead of the default one:
Linux:
$ cd ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-kernel/linux/
Create a linux-variscite_4.1.15.bbappend file:
$ gedit linux-variscite_4.1.15.bbappend
and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):
KERNEL_SRC = "git://${BSPDIR}/local_repos/linux-2.6-imx;protocol=file" SRCBRANCH = "imx-rel_imx_4.1.15_2.0.0_ga-var02" (or your own created branch) SRCREV = "The commit id you'd like to use"
Use your own remote repository on github
Using this method Yocto will take the source code from your own remote repository on github:
Create your own github account and upload your proprietary kernel to a new repository:
For example, you can fork our repository to your own account by visiting the following link and clicking on "Fork" at the top right of the screen.
Alternatively, you can clone our repository to your local machine, and push it later to your own account.
https://github.com/varigit/linux-2.6-imx/tree/imx-rel_imx_4.1.15_2.0.0_ga-var02
Update the recipes to use your remote repository instead of the default one:
$ cd ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-kernel/linux/
Create a linux-variscite_4.1.15.bbappend file:
$ gedit linux-variscite_4.1.15.bbappend
and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):
KERNEL_SRC = "git://github.com/your_account/linux-2.6-imx.git;protocol=git" SRCBRANCH = "imx-rel_imx_4.1.15_2.0.0_ga-var02" (or your own created branch) SRCREV = "The commit id you'd like to use"