Yocto Customizing U-Boot: 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 PYRO_V1.0_VAR-SOM-MX6 as default
<!-- Set release according to "release" parameter in URL and use SUMO_V2.0_VAR-SOM-MX8X as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_PYRO_V1.0_VAR-SOM-MX6}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_SUMO_V2.0_VAR-SOM-MX8X}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing U-Boot}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing U-Boot}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}} __toc__
<br>
<br>
Line 15: Line 15:
  $ cd {{#var:BUILD_FOLDER}}
  $ cd {{#var:BUILD_FOLDER}}
  $ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} {{#ifeq: {{#var:SOC_SERIES}}|imx8|-b {{#var:BUILD_FOLDER_XWAYLAND}}|{{#var:BUILD_FOLDER_X11}}}}
  $ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} {{#ifeq: {{#var:SOC_SERIES}}|imx8|-b {{#var:BUILD_FOLDER_XWAYLAND}}|{{#var:BUILD_FOLDER_X11}}}}
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som |
Or, to build for i.MXQXP SOC revision B0:
$ cd {{#var:BUILD_FOLDER}}
$ MACHINE={{#var:MACHINE_NAME_B0}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} -b {{#var:BUILD_FOLDER_XWAYLAND}}
|}}|}}
<br>
<br>
'''Get the source code''':<br>
'''Get the source code''':<br>
Line 59: Line 64:
  $ cd {{#var:BUILD_FOLDER}}
  $ cd {{#var:BUILD_FOLDER}}
  $ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} {{#ifeq: {{#var:SOC_SERIES}}|imx8|-b {{#var:BUILD_FOLDER_XWAYLAND}}|{{#var:BUILD_FOLDER_X11}}}}
  $ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} {{#ifeq: {{#var:SOC_SERIES}}|imx8|-b {{#var:BUILD_FOLDER_XWAYLAND}}|{{#var:BUILD_FOLDER_X11}}}}
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som |
Or, to build for i.MXQXP SOC revision B0:
$ cd {{#var:BUILD_FOLDER}}
$ MACHINE={{#var:MACHINE_NAME_B0}} DISTRO={{#var:BUILD_DISTRO}} {{#var:BUILD_SCRIPT}} -b {{#var:BUILD_FOLDER_XWAYLAND}}
|}}|}}
<br>
<br>
'''Get the source code''':<br>
'''Get the source code''':<br>

Revision as of 11:10, 19 May 2020

VAR-SOM-MX8X - Customizing U-Boot


Choose one of the following three methods to customize U-Boot.
After following one of the below methods you can either bitbake your complete image (e.g. fsl-image-gui) and the updated U-Boot will be used, or you can bitbake U-Boot alone by running "bitbake virtual/bootloader" (see the Build Yocto from source code page for the initial Yocto setup and for more info on using bitbake).

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:

Setup Yocto:

  • Follow steps 1-3 of the Yocto Build Release page.
  • Follow the first part of step 4 of the same page, to source the setup-environment script (stop after that - don't build any image). E.g.:
$ cd ~/var-fsl-yocto
$ MACHINE=imx8qxp-var-som DISTRO=fsl-imx-xwayland . var-setup-release.sh -b build_xwayland

Or, to build for i.MXQXP SOC revision B0:

$ cd ~/var-fsl-yocto
$ MACHINE=imx8qxpb0-var-som DISTRO=fsl-imx-xwayland . var-setup-release.sh -b build_xwayland


Get the source code:

$ bitbake -c unpack virtual/bootloader
$ mkdir -p ../local_repos/uboot-imx
$ cp -a tmp/work/imx8qxp_var_som-poky-linux/u-boot-variscite/1.0-r0/git/. ../local_repos/uboot-imx
$ cd ../local_repos/uboot-imx
$ git reset --hard
$ git clean -fdx


Make your changes in the source code and create a patch:
You can use either diff or patch file types.
For example:

$ cd ~/var-fsl-yocto/local_repos/uboot-imx
$ gedit board/variscite/imx8qxp_var_som/imx8qxp_var_som.c
$ gedit include/configs/imx8qxp_var_som.h
edit and save

$ git diff > my_imx8qxp_var_som_changes.diff


Update the recipes to use your patch:

Copy your patch:

$ cd ~/var-fsl-yocto/sources/meta-variscite-imx/recipes-bsp/u-boot/
$ mkdir -p files
$ cp ~/var-fsl-yocto/local_repos/uboot-imx/my_imx8qxp_var_som_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_imx8qxp_var_som_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 U-Boot source from a local repository instead of our remote ones on github:

Setup Yocto:

  • Follow steps 1-3 of the Yocto Build Release page.
  • Follow the first part of step 4 of the same page, to source the setup-environment script (stop after that - don't build any image). E.g.:
$ cd ~/var-fsl-yocto
$ MACHINE=imx8qxp-var-som DISTRO=fsl-imx-xwayland . var-setup-release.sh -b build_xwayland

Or, to build for i.MXQXP SOC revision B0:

$ cd ~/var-fsl-yocto
$ MACHINE=imx8qxpb0-var-som DISTRO=fsl-imx-xwayland . var-setup-release.sh -b build_xwayland


Get the source code:

$ bitbake -c unpack virtual/bootloader
$ mkdir -p ../local_repos/uboot-imx
$ cp -a tmp/work/imx8qxp_var_som-poky-linux/u-boot-variscite/1.0-r0/git/. ../local_repos/uboot-imx
$ cd ../local_repos/uboot-imx
$ git reset --hard
$ git clean -fdx


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-fsl-yocto/local_repos/uboot-imx
$ gedit board/variscite/imx8qxp_var_som/imx8qxp_var_som.c
$ gedit include/configs/imx8qxp_var_som.h
edit and save

$ git commit -a -m "my_imx8qxp_var_som_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:

$ cd ~/var-fsl-yocto/sources/meta-variscite-imx/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 = "git://${BSPDIR}/local_repos/uboot-imx;protocol=file"
SRCBRANCH = "imx_v2018.03_4.14.98_2.3.0_var01" (or your own created branch)
SRCREV = "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
(If you do so, make sure to run "bitbake -c cleansstate virtual/bootloader" before rebuilding U-Boot)

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 U-Boot 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/uboot-imx/tree/imx_v2018.03_4.14.98_2.3.0_var01


Update the recipes to use your remote repository instead of the default one:

$ cd ~/var-fsl-yocto/sources/meta-variscite-imx/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 = "git://github.com/your_account/uboot-imx.git;protocol=git"
SRCBRANCH = "imx_v2018.03_4.14.98_2.3.0_var01" (or your own created branch)
SRCREV = "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
(If you do so, make sure to run "bitbake -c cleansstate virtual/bootloader" before rebuilding U-Boot)