Yocto Customizing the Linux kernel: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use MORTY_BETA_DART-6UL as default
<!-- Set release according to "release" parameter in URL and use MORTY_V1.0_DART-6UL as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_BETA_DART-6UL}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-6UL}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing the Linux kernel and U-Boot}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}}
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing the Linux kernel and U-Boot}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}} __toc__
Once completed developing your own kernel and U-Boot, create your own github account and upload your proprietary kernel and U-Boot to a new repository.<br>
Replace Variscite's Kernel and U-Boot yocto links, to point to your newly created github branches. i.e. replace kernel link:<br>
https://github.com/varigit/meta-variscite-fslc/blob/{{#var:YOCTO_BRANCH}}/recipes-kernel/linux/linux-variscite_4.1.15.bb


SRCBRANCH = "{{#var:KERNEL_BRANCH}}"
Choose one of the following three methods to customize U-Boot and the Linux kernel and build them using Yocto:
SRCREV = "commit id"
KERNEL_SRC ?= "git://github.com/varigit/linux-2.6-imx.git;protocol=git"


with your own. For example:
= 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:<br>
<br>
'''Get the source code by cloning our repository''':<br>
<u>Linux</u>:
$ cd {{#var:BUILD_FOLDER}}
$ mkdir -p local_repos
$ cd local_repos
$ git clone {{#var:KERNEL_GIT}}
$ cd linux-2.6-imx
$ git checkout {{#var:KERNEL_BRANCH}}


  SRCBRANCH = "your desired branch (can stay the same)"
<u>U-Boot</u>:
  SRCREV = "your desired commit id"
$ cd {{#var:BUILD_FOLDER}}
  KERNEL_SRC ?= "git://github.com/customer/linux-2.6-imx.git;protocol=git"
$ mkdir -p local_repos
$ cd local_repos
$ git clone {{#var:U-BOOT_GIT}}
$ cd uboot-imx
  $ git checkout {{#var:U-BOOT_BRANCH}}
<br>
'''Make your changes in the source code and create a patch''':<br>
You can use either diff or patch file types.<br>
For example:
$ cd {{#var:BUILD_FOLDER}}/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
<br>
'''Update the recipes to use your patch''':<br>
<u>Linux</u>:<br>
Copy your patch:
  $ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-kernel/linux/
$ mkdir -p files
$ cp {{#var:BUILD_FOLDER}}/local_repos/linux-2.6-imx/imx6qdl-var-som_device_tree_changes.diff  files/


Also replace:<br>
Create a linux-variscite_4.1.15.bbappend file:
https://github.com/varigit/meta-variscite-fslc/blob/{{#var:YOCTO_BRANCH}}/recipes-bsp/u-boot/u-boot-common.inc
$ gedit linux-variscite_4.1.15.bbappend


SRCBRANCH = "{{#var:U-BOOT_BRANCH}}"
and append the following line to it:
  UBOOT_SRC = "git://github.com/varigit/uboot-imx.git;protocol=git"
  SRC_URI += "file://imx6qdl-var-som_device_tree_changes.diff"
SRCREV = "commit id"


with your own U-boot repository. For example:
<u>U-Boot</u>:<br>
SRCBRANCH = "your desired branch (can stay the same)"
Copy your patch:
  UBOOT_SRC = "git://github.com/customer/uboot-imx.git;protocol=git"
  $ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-bsp/u-boot/
  SRCREV = "your desired commit id"
$ mkdir -p files
$ cp {{#var:BUILD_FOLDER}}/local_repos/uboot-imx/my_u-boot_changes.diff files/


Create a u-boot-variscite.bbappend file:
$ gedit u-boot-variscite.bbappend
and append the following line to it:
SRC_URI += "file://my_u-boot_changes.diff"
Also update the u-boot-fw-utils recipe:
$ cp u-boot-variscite.bbappend u-boot-fw-utils.bbappend
= Use a local repository =
Using this method Yocto will take the kernel/U-Boot source from a local repository instead of our remote ones on github:<br>
<br>
'''Get the source code by cloning our repository:'''<br>
<u>Linux</u>:
$ cd {{#var:BUILD_FOLDER}}
$ mkdir -p local_repos
$ cd local_repos
$ git clone {{#var:KERNEL_GIT}}
$ cd linux-2.6-imx
$ git checkout {{#var:KERNEL_BRANCH}}
<u>U-Boot</u>:
$ cd {{#var:BUILD_FOLDER}}
$ mkdir -p local_repos
$ cd local_repos
$ git clone {{#var:U-BOOT_GIT}}
$ cd uboot-imx
$ git checkout {{#var:U-BOOT_BRANCH}}
<br>
'''Make your changes in the source code and commit them:'''<br>
After making changes in the source code ''you need to commit them''.<br>
For example:
$ cd {{#var:BUILD_FOLDER}}/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
<br>
'''Update the recipes to use the local repository instead of the default one:'''<br>
<u>Linux</u>:
$ cd {{#var:BUILD_FOLDER}}/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_{{#var:MACHINE_NAME}} = <nowiki>"git://${BSPDIR}/local_repos/linux-2.6-imx;protocol=file"</nowiki>
SRCBRANCH_{{#var:MACHINE_NAME}} = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)''
SRCREV_{{#var:MACHINE_NAME}} = "''The commit id you'd like to use''"
<u>U-Boot</u>:
$ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-bsp/u-boot/
Create a u-boot-variscite.bbappend file:
$ gedit u-boot-variscite.bbappend
and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):
UBOOT_SRC_{{#var:MACHINE_NAME}} = <nowiki>"git://${BSPDIR}/local_repos/uboot-imx;protocol=file"</nowiki>
SRCBRANCH_{{#var:MACHINE_NAME}} = "{{#var:U-BOOT_BRANCH}}" ''(or your own created branch)''
SRCREV_{{#var:MACHINE_NAME}} = "''The commit id you'd like to use''"
Also update the u-boot-fw-utils recipe:
$ cp u-boot-variscite.bbappend u-boot-fw-utils.bbappend
<br>
{{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch}}
= Use your own remote repository on github =
Using this method Yocto will take the source code from your own remote repository on github:<br>
<br>
'''Create your own github account and upload your proprietary kernel and U-Boot to new repositories''':<br>
For example, you can fork our repositories to your own account by visiting the following links and clicking on "Fork" at the top right of the screen.<br>
Alternatively, you can clone our repositories to your local machine, and push them later to your own account.<br>
<br>
<u>Linux</u>:<br>
https://github.com/varigit/linux-2.6-imx/tree/{{#var:KERNEL_BRANCH}}
<u>U-Boot</u>:<br>
https://github.com/varigit/uboot-imx/tree/{{#var:U-BOOT_BRANCH}}
<br>
'''Update the recipes to use your remote repository instead of the default one''':<br>
<br>
<u>Linux</u>:
$ cd {{#var:BUILD_FOLDER}}/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_{{#var:MACHINE_NAME}} = <nowiki>"git://github.com/customer/linux-2.6-imx.git;protocol=git"</nowiki>
SRCBRANCH_{{#var:MACHINE_NAME}} = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)''
SRCREV_{{#var:MACHINE_NAME}} = "''The commit id you'd like to use''"
<u>U-Boot</u>:
$ cd {{#var:BUILD_FOLDER}}/sources/meta-variscite-fslc/recipes-bsp/u-boot/
Create a u-boot-variscite.bbappend file:
$ gedit u-boot-variscite.bbappend
and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):
UBOOT_SRC_{{#var:MACHINE_NAME}} = <nowiki>"git://github.com/customer/uboot-imx.git;protocol=git"</nowiki>
SRCBRANCH_{{#var:MACHINE_NAME}} = "{{#var:U-BOOT_BRANCH}}" ''(or your own created branch)''
SRCREV_{{#var:MACHINE_NAME}} = "''The commit id you'd like to use''"
Also update the u-boot-fw-utils recipe:
$ cp u-boot-variscite.bbappend u-boot-fw-utils.bbappend
<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 09:16, 14 September 2017

DART-6UL - Customizing the Linux kernel and U-Boot

Choose one of the following three methods to customize U-Boot and the Linux kernel and build them 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:
Linux:

$ 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

U-Boot:

$ cd ~/var-fslc-yocto
$ mkdir -p local_repos
$ cd local_repos
$ git clone https://github.com/varigit/uboot-imx.git
$ cd uboot-imx
$ git checkout imx_v2015.04_4.1.15_1.1.0_ga_var03


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:
Linux:
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"

U-Boot:
Copy your patch:

$ cd ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-bsp/u-boot/
$ mkdir -p files
$ cp ~/var-fslc-yocto/local_repos/uboot-imx/my_u-boot_changes.diff  files/

Create a u-boot-variscite.bbappend file:

$ gedit u-boot-variscite.bbappend

and append the following line to it:

SRC_URI += "file://my_u-boot_changes.diff"

Also update the u-boot-fw-utils recipe:

$ cp u-boot-variscite.bbappend u-boot-fw-utils.bbappend

Use a local repository

Using this method Yocto will take the kernel/U-Boot source from a local repository instead of our remote ones on github:

Get the source code by cloning our repository:
Linux:

$ 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

U-Boot:

$ cd ~/var-fslc-yocto
$ mkdir -p local_repos
$ cd local_repos
$ git clone https://github.com/varigit/uboot-imx.git
$ cd uboot-imx
$ git checkout imx_v2015.04_4.1.15_1.1.0_ga_var03


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_imx6ul-var-dart = "git://${BSPDIR}/local_repos/linux-2.6-imx;protocol=file"
SRCBRANCH_imx6ul-var-dart = "imx-rel_imx_4.1.15_2.0.0_ga-var02" (or your own created branch)
SRCREV_imx6ul-var-dart = "The commit id you'd like to use"

U-Boot:

$ cd ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-bsp/u-boot/

Create a u-boot-variscite.bbappend file:

$ gedit u-boot-variscite.bbappend

and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):

UBOOT_SRC_imx6ul-var-dart = "git://${BSPDIR}/local_repos/uboot-imx;protocol=file"
SRCBRANCH_imx6ul-var-dart = "imx_v2015.04_4.1.15_1.1.0_ga_var03" (or your own created branch)
SRCREV_imx6ul-var-dart = "The commit id you'd like to use"

Also update the u-boot-fw-utils recipe:

$ cp u-boot-variscite.bbappend u-boot-fw-utils.bbappend


For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch

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 and U-Boot to new repositories:
For example, you can fork our repositories to your own account by visiting the following links and clicking on "Fork" at the top right of the screen.
Alternatively, you can clone our repositories to your local machine, and push them later to your own account.

Linux:
https://github.com/varigit/linux-2.6-imx/tree/imx-rel_imx_4.1.15_2.0.0_ga-var02

U-Boot:
https://github.com/varigit/uboot-imx/tree/imx_v2015.04_4.1.15_1.1.0_ga_var03


Update the recipes to use your remote 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_imx6ul-var-dart = "git://github.com/customer/linux-2.6-imx.git;protocol=git"
SRCBRANCH_imx6ul-var-dart = "imx-rel_imx_4.1.15_2.0.0_ga-var02" (or your own created branch)
SRCREV_imx6ul-var-dart = "The commit id you'd like to use"

U-Boot:

$ cd ~/var-fslc-yocto/sources/meta-variscite-fslc/recipes-bsp/u-boot/

Create a u-boot-variscite.bbappend file:

$ gedit u-boot-variscite.bbappend

and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):

UBOOT_SRC_imx6ul-var-dart = "git://github.com/customer/uboot-imx.git;protocol=git"
SRCBRANCH_imx6ul-var-dart = "imx_v2015.04_4.1.15_1.1.0_ga_var03" (or your own created branch)
SRCREV_imx6ul-var-dart = "The commit id you'd like to use"

Also update the u-boot-fw-utils recipe:

$ cp u-boot-variscite.bbappend u-boot-fw-utils.bbappend


For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch