Debian Customizing U-Boot: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 5: Line 5:
--> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-u-boot}} <!--
--> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-u-boot}} <!--
--> {{#vardefine:WORKDIR_ENV|$WORKDIR}} <!--
--> {{#vardefine:WORKDIR_ENV|$WORKDIR}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian Customize from source code}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing U-Boot }} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__


= Introduction =
= Introduction =
Line 12: Line 12:


To learn how to build the U-Boot images outside of Debian, see: {{Varlink|Debian_Build_U-Boot|{{#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|{{#var:RELEASE_LINK}}|'''Build U-Boot from source code'''}}
== Prerequirements ==
Make sure you set up the Flexbuild Docker environment properly. Follow the instructions from step 5 of the {{Varlink|Debian_Build_Release_Flexbuild|{{#var:RELEASE_LINK}}|Build Debian from source code}} page.


== Add your patches on top of the Variscite source code ==
== Add your patches on top of the Variscite source code ==
The following steps can be executed outside or inside the container.


Fetch the U-Boot source:
Fetch the U-Boot source:
$ mkdir -p {{#var:BUILD_FOLDER_UBOOT}} && cd {{#var:BUILD_FOLDER_UBOOT}}
  $ git clone https://github.com/varigit/{{#var:U-BOOT}} -b {{#var:U-BOOT_BRANCH}}
  $ git clone https://github.com/varigit/{{#var:U-BOOT}} -b {{#var:U-BOOT_BRANCH}}
  $ cd {{#var:U-BOOT}}
  $ cd {{#var:U-BOOT}}
Line 24: Line 29:
  $ vim drivers/net/fsl_enetc.c
  $ vim drivers/net/fsl_enetc.c
  $ vim drivers/net/fsl_enetc.h
  $ vim drivers/net/fsl_enetc.h
After changing the source code, create a diff file, edit, and save:
$ git diff > {{#var:BUILD_FOLDER_UBOOT}}/{{#var: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 '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/'''".


Create the directory  '''{{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot''' and copy the '''uboot.diff''' patch.
After changing the source code, commit the changes locally and generate a patch file:
  $ mkdir -p {{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot
$ git add .
  $ cp {{#var:BUILD_FOLDER_UBOOT}}/{{#var:U-BOOT}}/uboot.diff  {{#var:BUILD_FOLDER}}/ti-bdebstrap/patches/ti-u-boot
  $ git commit -e
  $ git format-patch -1


Refer to {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Building_the_Debian_image|'''Build and flash the Debian image with uboot changes'''}}.
Once the patch is created, copy it to the U-Boot patch folder, which is inside the Flexbuild directory:
$ mkdir -p [...]/flexbuild/patch/uboot/
$ cp 0001-my-changes.patch [...]/flexbuild/patch/uboot/


== Use your remote repository on GitHub ==
== Build U-Boot individually ==
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/{{#var:U-BOOT_REPO}}/tree/{{#var:U-BOOT_BRANCH}}


Alternatively, you can clone the repository to your local machine, and push it later to your account.<br>
Do not run any 'git am' or 'git apply' command. That will be done inside the U-Boot Makefile.
Now, if you're not inside the container, get in with the following commands:
$ cd [...]/flexbuild            (Outside Docker environment)
$ . setup.env                    (Outside Docker environment)
$ bld docker                    (Outside Docker environment)


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'''.
Once you've entered the Docker environment, run:
$ bld -f sdk-var.yml -m {{#var:MACHINE_NAME}} uboot            (Inside Docker environment)


    atf_srcrev = "00f1ec6b8740ccd403e641131e294aabacf2a48b"
== Rebuild U-Boot ==
    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 {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Building_the_Debian_image|'''Build the Debian image with updated u-boot repository'''}}.
Once you've built U-Boot, a clean step is needed if a rebuild is required:
$ bld clean-bsp                                          (Inside Docker environment)
Then, just build U-Boot normally with:
$ bld -f sdk-var.yml -m {{#var:MACHINE_NAME}} uboot            (Inside Docker environment)

Latest revision as of 16:15, 27 June 2025

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

This page is using the default release mx8mm-debian-bookworm-6.6.52_24.12-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


DART-MX8M-MINI - Customizing U-Boot

Introduction

This guide demonstrates how to patch and rebuild Debian U-Boot images.

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

Prerequirements

Make sure you set up the Flexbuild Docker environment properly. Follow the instructions from step 5 of the Build Debian from source code page.

Add your patches on top of the Variscite source code

The following steps can be executed outside or inside the container.

Fetch the U-Boot source:

$ git clone https://github.com/varigit/uboot-imx -b lf_v2024.04_6.6.52-2.2.0_var01
$ cd uboot-imx
$ git clean -fdx

Next, make the desired changes to the U-Boot source code. Example:

$ vim drivers/net/fsl_enetc.c
$ vim drivers/net/fsl_enetc.h

After changing the source code, commit the changes locally and generate a patch file:

$ git add .
$ git commit -e
$ git format-patch -1

Once the patch is created, copy it to the U-Boot patch folder, which is inside the Flexbuild directory:

$ mkdir -p [...]/flexbuild/patch/uboot/
$ cp 0001-my-changes.patch [...]/flexbuild/patch/uboot/

Build U-Boot individually

Do not run any 'git am' or 'git apply' command. That will be done inside the U-Boot Makefile. Now, if you're not inside the container, get in with the following commands:

$ cd [...]/flexbuild             (Outside Docker environment)
$ . setup.env                    (Outside Docker environment)
$ bld docker                     (Outside Docker environment)

Once you've entered the Docker environment, run:

$ bld -f sdk-var.yml -m imx8mm-var-dart uboot             (Inside Docker environment)

Rebuild U-Boot

Once you've built U-Boot, a clean step is needed if a rebuild is required:

$ bld clean-bsp                                           (Inside Docker environment)

Then, just build U-Boot normally with:

$ bld -f sdk-var.yml -m imx8mm-var-dart uboot             (Inside Docker environment)