Debian Customizing U-Boot AM62: Difference between revisions

From Variscite Wiki
 
(24 intermediate revisions by the same user not shown)
Line 9: Line 9:
= Introduction =
= Introduction =


This guide demonstrates how to patch and rebuild the VAR-SOM-AM62 U-Boot images using Yocto.
This guide demonstrates how to patch and rebuild the VAR-SOM-AM62 U-Boot images.


To learn how to build the U-Boot images outside of Yocto, see: {{Varlink|Debian_Build_U-Boot_TI|{{#var:RELEASE_LINK}}|'''Build U-Boot from source code'''}}
To learn how to build the U-Boot images outside of Debian, see: {{Varlink|Debian_Build_U-Boot_TI|{{#var:RELEASE_LINK}}|'''Build U-Boot from source code'''}}
 
= Before Starting =
 
Before starting this guide, you must have the Yocto environment set and be able to build images for the VAR-SOM-AM62.
 
Please see: {{Varlink|Yocto_Build_Release|{{#var:RELEASE_LINK}}|'''Build Yocto from source code'''}}.
 
The remainder of the guide assumes the Yocto working directory is '''~/var-ti-yocto'''
 
= Making changes in the source code =
Choose one of the following three methods to customize the U-Boot source code and build it using Yocto:


== Add your patches on top of the Variscite source code ==
== Add your patches on top of the Variscite source code ==


Fetch the U-Boot source:
Fetch the U-Boot source:
  $ MACHINE={{#var:MACHINE_NAME}} bitbake -c unpack virtual/bootloader
  $ mkdir -p {{#var:BUILD_FOLDER_UBOOT}} && cd {{#var:BUILD_FOLDER_UBOOT}}
$ mkdir -p ../local_repos/{{#var:U-BOOT_REPO}}
  $ git clone https://github.com/varigit/{{#var:U-BOOT}} -b {{#var:U-BOOT_BRANCH}}
  $ cp -a arago-tmp-default-glibc/work/{{#var:MACHINE_NAME_}}-oe-linux/u-boot-variscite/<uboot version>/git/. ../local_repos/{{#var:U-BOOT_REPO}}
  $ cd {{#var:U-BOOT}}
  $ cd ../local_repos/{{#var:U-BOOT_REPO}}
$ git reset --hard
  $ git clean -fdx
  $ git clean -fdx


Next, make the desired changes to the U-Boot source code. After changing the source code, create a diff file:
Next, make the desired changes to the U-Boot source code. After changing the source code, create a diff file:
$ cd ~/var-ti-yocto/local_repos/ti-u-boot
  $ vim board/variscite/am62x_var_som/am62x_var_som.c
  $ vim board/variscite/am62x_var_som/am62x_var_som.c
  $ vim include/configs/am62x_var_som.h
  $ vim include/configs/am62x_var_som.h
edit and save
edit and save
  $ git diff > ~/var-ti-yocto/tisdk/sources/meta-variscite-bsp-ti/recipes-bsp/u-boot/u-boot-variscite/uboot.diff
  $ git diff > {{#var:BUILD_FOLDER_UBOOT}}/{{#var:U-BOOT}}/uboot.diff


Please refer {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Deploy_source|'''How to Download Debian Source Code'''}} and to apply the above created U-Boot patch when building the Debian image.After cloned the debian source code , the code will be located under '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/'''.
Refer to the instructions on how to download the Debian source code and apply the U-Boot patch during the Debian image build process. After cloning the Debian source code, it will be located in the '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/'''".


Create the directory  '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot''' and copy the '''uboot.diff''' patch.
Create the directory  '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot''' and copy the '''uboot.diff''' patch.
$ mkdir -p {{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot
$ cp {{#var:BUILD_FOLDER_UBOOT}}/{{#var:U-BOOT}}/uboot.diff  {{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot


$ cp ~/var-ti-yocto/tisdk/sources/meta-variscite-bsp-ti/recipes-bsp/u-boot/u-boot-variscite/uboot.diff  {{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot
Refer to {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Building_the_Debian_image|'''Build and flash the Debian image with uboot changes'''}}.
 
Refer to {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Building_the_Debian_image|'''Build and flash the debian image with uboot changes'''}}.


== Use your remote repository on GitHub ==
== Use your remote repository on GitHub ==
Using this method Yocto will fetch the source code from your remote repository on GitHub.<br>
Create a GitHub account and upload your proprietary U-Boot to a new repository:
Create a GitHub account and upload your proprietary U-Boot to a new repository:
You can fork our repository to your account by visiting the following link and clicking on "Fork" at the top right of the screen:
You can fork our repository to your account by visiting the following link and clicking on "Fork" at the top right of the screen:
Line 58: Line 42:
Alternatively, you can clone the repository to your local machine, and push it later to your account.<br>
Alternatively, you can clone the repository to your local machine, and push it later to your account.<br>


Refer {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Deploy_source|'''How to Download Debian Source Code'''}}. After downloaded the source open the file '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/configs/bsp_sources.toml''' and look for the tag '''{{#var:TI_RELEASE#var01}}'''.
Refer to {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Deploy_source|'''How to Download Debian Source Code'''}}. After downloading the source, open the file '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/configs/bsp_sources.toml''' and locate the tag '''{{#var:TI_RELEASE}}_var01'''.


     atf_srcrev = "00f1ec6b8740ccd403e641131e294aabacf2a48b"
     atf_srcrev = "00f1ec6b8740ccd403e641131e294aabacf2a48b"
     optee_srcrev = "012cdca49db398693903e05c42a254a3a0c0d8f2"
     optee_srcrev = "012cdca49db398693903e05c42a254a3a0c0d8f2"
     uboot_srcuri = "https://github.com/varigit/ti-u-boot.git"
     uboot_srcuri = "https://github.com/varigit/ti-u-boot.git" #change to your repository name of uboot
     uboot_srcrev = "80ceb4d91326e00edd22a3fabf5dd2d64f6a7635"
     uboot_srcrev = "80ceb4d91326e00edd22a3fabf5dd2d64f6a7635" #update the hash with the latest commit
     linux_fw_srcrev = "09.02.00.010"
     linux_fw_srcrev = "09.02.00.010"


= Building U-Boot using Yocto =
Finally refer to {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Building_the_Debian_image|'''Build the Debian image with updated u-boot repository'''}}.
 
After making the desired changes to the source code following one of the methods described in the [[#Making changes in the source code|Making changes in the source code]], you can build the U-Boot images by running:
 
$ cd ~/var-ti-yocto/tisdk/build
$ . conf/setenv
# Build only the U-Boot images:
$ MACHINE=am62x-var-som bitbake -c deploy u-boot-variscite                    # tispl.bin and u-boot.img
$ MACHINE=am62x-var-som bitbake -c deploy mc:k3r5:u-boot-variscite            # tiboot3.bin
# Optionally, you may skip building U-Boot and just build your image:
$ MACHINE=am62x-var-som bitbake <image name>
 
The relevant output files are:
 
deploy-ti/images/am62x-var-som/u-boot.img
deploy-ti/images/am62x-var-som/tispl.bin
deploy-ti/images/am62x-var-som/tiboot3.bin
 
see: {{Varlink|Yocto_Build_U-Boot_TI|{{#var:RELEASE_LINK}}#Update_U-Boot_on_running_system|'''Build U-Boot from source code'''}} to learn how to update a running board with these images.

Latest revision as of 22:24, 11 December 2024

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release am62-debian-bookworm-6.1.83_09.02.01.10-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
VAR-SOM-AM62 - Debian Customize from source code

Introduction

This guide demonstrates how to patch and rebuild the VAR-SOM-AM62 U-Boot images.

To learn how to build the U-Boot images outside of Debian, see: Build U-Boot from source code

Add your patches on top of the Variscite source code

Fetch the U-Boot source:

$ mkdir -p ~/am62_debian_uboot && cd ~/am62_debian_uboot
$ git clone https://github.com/varigit/ti-u-boot -b ti-u-boot-2023.04_09.02.01.10_var01
$ cd ti-u-boot
$ git clean -fdx

Next, make the desired changes to the U-Boot source code. After changing the source code, create a diff file:

$ vim board/variscite/am62x_var_som/am62x_var_som.c
$ vim include/configs/am62x_var_som.h

edit and save

$ git diff > ~/am62_debian_uboot/ti-u-boot/uboot.diff

Refer to the instructions on how to download the Debian source code and apply the U-Boot patch during the Debian image build process. After cloning the Debian source code, it will be located in the ~/debian_am62x_var_som/ti-bdebstrap/".

Create the directory ~/debian_am62x_var_som/ti-bdebstrap/patches/ti-u-boot and copy the uboot.diff patch.

$ mkdir -p ~/debian_am62x_var_som/ti-bdebstrap/patches/ti-u-boot
$ cp ~/am62_debian_uboot/ti-u-boot/uboot.diff  ~/debian_am62x_var_som/ti-bdebstrap/patches/ti-u-boot

Refer to Build and flash the Debian image with uboot changes.

Use your remote repository on GitHub

Create a GitHub account and upload your proprietary U-Boot to a new repository: You can fork our repository to your account by visiting the following link and clicking on "Fork" at the top right of the screen: https://github.com/varigit/ti-u-boot/tree/ti-u-boot-2023.04_09.02.01.10_var01

Alternatively, you can clone the repository to your local machine, and push it later to your account.

Refer to How to Download Debian Source Code. After downloading the source, open the file ~/debian_am62x_var_som/ti-bdebstrap/configs/bsp_sources.toml and locate the tag 09.02.01.10_var01.

   atf_srcrev = "00f1ec6b8740ccd403e641131e294aabacf2a48b"
   optee_srcrev = "012cdca49db398693903e05c42a254a3a0c0d8f2"
   uboot_srcuri = "https://github.com/varigit/ti-u-boot.git"  #change to your repository name of uboot
   uboot_srcrev = "80ceb4d91326e00edd22a3fabf5dd2d64f6a7635"  #update the hash with the latest commit
   linux_fw_srcrev = "09.02.00.010"

Finally refer to Build the Debian image with updated u-boot repository.