Debian Customizing Linux kernel AM62: Difference between revisions

From Variscite Wiki
No edit summary
 
(61 intermediate revisions by 2 users not shown)
Line 3: Line 3:
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--


--> {{#vardefine:BUILD_PAGE|Yocto_Build_Release}}  {{#vardefine:PLATFORM_OS|Yocto}}        <!-- Default to Yocto
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Debian Customize from source code}} {{DocImage|category1=Debian|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{#vardefine:CONFIG_PATH|{{#var:BUILD_FOLDER}}/build/arago-tmp-default-glibc/work/{{#var:MACHINE_NAME_}}-oe-linux/linux-variscite/<kernel-version>/build/.config}} <!--
--> {{#vardefine:DEFCONFIG_PATH|{{#var:BUILD_FOLDER}}/build/arago-tmp-default-glibc/work/{{#var:MACHINE_NAME_}}-oe-linux/linux-variscite/<kernel-version>/build/defconfig}} <!--
--> {{#vardefine:DTS_FILE|arch/arm64/boot/dts/ti/k3-am625-var-som-symphony.dts}} <!--


If >= Dunfell, KBUILD_DEFCONFIG is used, and using an out of tree defconfig is slightly different.
= Introduction =
--> {{#vardefine:EXTERNAL_DEFCONFIG | {{#ifexpr: {{#var:YOCTO_VERSION}} < 3.1 | my_defconfig | defconfig }} }} <!--
--> {{#vardefine:KERNEL_RECIPE_NAME | linux-variscite_% }} <!--
--> {{#vardefine:WORKDIR|~/{{#var:MACHINE_NAME}}-linux-kernel}} <!--
--> {{#vardefine:WORKDIR_ENV|$WORKDIR}} <!--


--> {{PageHeader|{{#var:HARDWARE_NAME}} - Yocto Customize from source code}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
The kernel is deployed as a Debian package during the build process. If there are changes to the kernel source code or configurations, the kernel must be recompiled with the updated changes using the ti-debian repository. Once recompiled, the updated Debian package for the kernel should be uploaded to the Debian package server.


* [https://github.com/varigit/ti-bdebstrap ti-bdebstrap] - Bdebstrap is for building the Debian image for {{#var:HARDWARE_NAME}}
* [https://github.com/varigit/var-debpkgs var-debian package sever] - Variscite debian package server
* [https://github.com/varigit/ti-debian-repos ti-debian-repos] - Contains ti-packages and variscite package to compile and create .deb packages
* [https://github.com/varigit/ti-linux-kernel ti-linux-kernel] - Linux kernel for {{#var:HARDWARE_NAME}}


= Use your own remote repository on GitHub =
'''Create your own GitHub account and fork the three repo to a new repository''':<br>


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 repository to your local machine, and push it later to your own account.<br>
<br>
<br>
After customizing the Linux kernel by following the below instructions, you can either bitbake your complete image (e.g. {{#var:DEFAULT_IMAGE_BB_NAME}}) and the updated kernel that will be used, or you can bitbake the kernel alone by running <code>{{#var:BB_ENV}} bitbake virtual/kernel</code> (see the {{Varlink|{{#var:BUILD_PAGE}}|{{#var:RELEASE_LINK}}|Build {{#var:PLATFORM_OS}} from source code}} page for the initial setup and for more info on using bitbake).
https://github.com/varigit/{{#var:KERNEL_REPO}}/tree/{{#var:KERNEL_BRANCH}}<br>


= Configuring the kernel =
https://github.com/varigit/{{#var:TI-DEBIAN}}/tree/{{#var:TI-DEBIAN_BRANCH}} <br>


The default kernel configuration file used by Yocto is part of the kernel source tree and is located at:
https://github.com/varigit/{{#var:VAR-DEBIAN}}/tree/{{#var:VAR-DEBIAN_BRANCH}} <br>
arch/arm64/configs/{{#var:KERNEL_DEFCONFIG}}


<br>
{{Note|'''Note:''' Don't forget to make your fork of {{#var:VAR-DEBIAN}} accessible via "GitHub Pages", according [https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch GitHub Docs].}}
To configure the kernel using Yocto:
* Follow steps 1-3 of the {{Varlink|{{#var:BUILD_PAGE}}|{{#var:RELEASE_LINK}}|Build {{#var:PLATFORM_OS}} from source code}} page.
* Run the script to set up the environment (stop after that - don't build any image). E.g.:{{AM62_SETUP_ENV_RETURN_YOCTO_TOOLCHAIN}}


* Run menuconfig and configure the kernel:
After forking the repository to your account, clone the kernel source code from your fork. Then, create a build directory:
{{#ifeq: {{#var:OS}} | Boot2Qt | {{#ifexpr: {{#var:YOCTO_VERSION}} >= 3.3 |
$ mkdir {{#var:BUILD_FOLDER_KERNEL}}
{{Note|'''Note:''' Starting from the B2Qt Hardknott release, the B2Qt standard toolchain's linker is now the gold linker, which is incompatible with the Linux kernel, causing menuconfig to fail when run from bitbake. Add the following line to <code>conf/local.conf</code> to run menuconfig:<br>
$ cd {{#var:BUILD_FOLDER_KERNEL}}
<pre>DISTRO_FEATURES:remove = "ld-is-gold"</pre> }} | }} | }}
$ git clone https://github.com/xxxx/{{#var:KERNEL_REPO}} -b your_branch_name
  $ {{#var:BB_ENV}} bitbake -c menuconfig virtual/kernel
  $ cd {{#var:KERNEL_REPO}}
When finished, save and exit.
edit any file or modify kernel configuration and save it.
$ git add "modified_file_path"
$ git commit -a -m "my_am62x_var_som_changes"
$ git push origin your_branch_name


The .config file is saved to <code>{{#var:CONFIG_PATH}}</code><br>
Get the latest commit hash:
<br>
  $ git rev-parse HEAD
* At this point, you can continue following the rest of step 4 of the {{Varlink|{{#var:BUILD_PAGE}}|{{#var:RELEASE_LINK}}|Build {{#var:PLATFORM_OS}} from source code}} page to build your image with the newly configured kernel, or just build the kernel by running <code>{{#var:BB_ENV}} bitbake virtual/kernel</code>, or, you can follow the next steps to use this configuration permanently.
<br>
To save the configuration in a defconfig format:
  $ {{#var:BB_ENV}} bitbake -c savedefconfig virtual/kernel
The defconfig file is saved to <code>{{#var:DEFCONFIG_PATH}}</code><br>
<br>
To make the kernel recipe use this configuration permanently, you can do either of the following:<br>
* Use any of the three methods described in the [[#Making changes in the source code|Making changes in the source code]] section below to overwrite the default configuration file in the source tree, arch/{{#switch: {{#var:SOC_SERIES}}|imx8|imx9=arm64|arm}}/configs/{{#var:KERNEL_DEFCONFIG}}, and replace it with the above defconfig.


* Make the kernel recipe use the defconfig from outside of the source tree:
Assume the latest commit hash is a1fcfd378e2364c15981945cca609c3a5fc12386.
Copy your defconfig:
  $ cd {{#var:BUILD_FOLDER_KERNEL}}
  $ cd {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_REPO}}/recipes-kernel/linux/
$ git clone https://github.com/xxxx/{{#var:VAR-DEBIAN_REPO}} -b your_branch_name
  $ mkdir -p files
  $ git clone https://github.com/xxxx/{{#var:TI-DEBIAN_REPO}} -b your_branch_name
$ cp {{#var:DEFCONFIG_PATH}} files/{{#var:EXTERNAL_DEFCONFIG}}
$ cd {{#var:TI-DEBIAN_REPO}}


Create a {{#var:KERNEL_RECIPE_NAME}}.bbappend file:
Also update the repository name on {{#var:TI-DEBIAN_REPO}} repo. open the file '''{{#var:BUILD_FOLDER_KERNEL}}/{{#var:TI-DEBIAN_REPO}}/{{#var:KERNEL_REPO}}-variscite/version.sh''' and change to the corresponding forked kernel repo.
$ vim {{#var:KERNEL_RECIPE_NAME}}.bbappend


and append the following to it:
  $ export git_repo="https://github.com/xxxx/{{#var:KERNEL_REPO}}.git"
{{#ifexpr: {{#var:YOCTO_VERSION}} < 3.1 |&nbsp;
  $ ./{{#var:KERNEL_REPO}}-variscite/update-commit.py ./{{#var:KERNEL_REPO}}-variscite/suite/{{#var:DEBIAN_NAME_S}}/debian/ {{#var:KERNEL_TI_VER}} a1fcfd378e2364c15981945cca609c3a5fc12386 "Author Name <author_name@xxx.com>"
  SRC_URI += "file://{{#var:EXTERNAL_DEFCONFIG}}"
  KERNEL_DEFCONFIG{{#var:YOCTO_OVERRIDE_PREFIX}}{{#var:MACHINE_NAME}} = "${WORKDIR}/{{#var:EXTERNAL_DEFCONFIG}}"
|&nbsp;
SRC_URI += "file://{{#var:EXTERNAL_DEFCONFIG}}"
  KBUILD_DEFCONFIG{{#var:YOCTO_OVERRIDE_PREFIX}}{{#var:MACHINE_NAME}} = ""
}}


= Making changes in the source code =
After the modifications push the changes to the forked '''https://github.com/xxxx/{{#var:TI-DEBIAN_REPO}}''' repo.
'''Choose one of the following three methods to customize the Linux kernel and build it using Yocto:'''
$ git add "modified_file_path"
$ git commit -a -m "update repo name & latest hash of kernel"
$ git push origin your_branch_name  #origin should be {{#var:TI-DEBIAN_REPO}} that is forked on your account


== Add your own patches on top of our source code ==
== Build Kernel ==
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>
'''Setup Yocto''':<br>
To configure the kernel using Yocto:
* Follow steps 1-3 of the {{Varlink|{{#var:BUILD_PAGE}}|{{#var:RELEASE_LINK}}|Build {{#var:PLATFORM_OS}} from source code}} page.
* Run the script to set up the environment (stop after that - don't build any image). E.g.:{{AM62_SETUP_ENV_RETURN_YOCTO_TOOLCHAIN}}
<br>
'''Get the source code''':<br>
$ {{#var:BB_ENV}} bitbake -c patch virtual/kernel
$ mkdir -p ../local_repos/{{#var:KERNEL_REPO}}
$ cp -a arago-tmp-default-glibc/work-shared/{{#var:MACHINE_NAME}}/kernel-source/. ../local_repos/{{#var:KERNEL_REPO}}
$ cd ../local_repos/{{#var:KERNEL_REPO}}
$ git reset --hard
$ git clean -fdx
<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/{{#var:KERNEL_REPO}}
$ vim {{#var:DTS_DIR}}{{#var:DTS_FILE}}
edit and save
$ git diff > my_device_tree_changes.patch
<br>
'''Update the recipes to use your patch''':<br>
Copy your patch:
$ cd {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_REPO}}/recipes-kernel/linux/
$ mkdir -p files
$ cp {{#var:BUILD_FOLDER}}/local_repos/{{#var:KERNEL_REPO}}/my_device_tree_changes.patch  files/


Create a {{#var:KERNEL_RECIPE_NAME}}.bbappend file:
Before building the kernel, follow the steps in {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Deploy_source|'''Build the Debian image'''}}.
  $ vim {{#var:KERNEL_RECIPE_NAME}}.bbappend
As part of building the image, the root filesystem (rootfs) needs to be extracted into a folder and used as the target for the chroot command.
$ mkdir -p ~/rootfs
$ sudo tar -xvf {{#var:BUILD_FOLDER}}/{{#var:TI-BDEBSTRAP}}/build/{{#var:DEBIAN_BUILD_TARGET}}/tisdk-am62-{{#var:DEBIAN_NAME_S}}-variscite-am62xx-var-som-rootfs.tar.xz -C ~/rootfs
$ . {{#var:BUILD_FOLDER_KERNEL}}/{{#var:TI-DEBIAN_REPO}}/chroot.sh -r ~/rootfs/tisdk-am62-{{#var:DEBIAN_NAME_S}}-variscite-am62xx-var-som-rootfs
this will enter into another terminal
$ apt update && apt install git build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison devscripts
$ cd /workdir
$ DEB_SUITE={{#var:DEBIAN_NAME_S}} ./run.sh {{#var:KERNEL_REPO}}-variscite
$ exit;
  $ cp {{#var:BUILD_FOLDER_KERNEL}}/{{#var:TI-DEBIAN_REPO}}/build/{{#var:DEBIAN_NAME_S}}/{{#var:KERNEL_REPO}}-variscite/*.deb {{#var:BUILD_FOLDER_KERNEL}}/{{#var:VAR-DEBIAN}}/var-ti/pool/{{#var:DEBIAN_NAME_S}}/l/
$ cd {{#var:BUILD_FOLDER_KERNEL}}/{{#var:VAR-DEBIAN}}
$ ./update-ppa.sh
this will update the new .deb package with updated kernel changes. Then push the changes to your corresponding var-debpkgs repo.
E.g '''https://github.com/xxxx/var-debpkgs'''


and append the following line to it:
$ git add "modified_file_path"
  SRC_URI += "file://my_device_tree_changes.patch"
  $ git commit -a -m "update kernel deb packages"  
$ git push origin your_branch_name  #origin should be var-debpkgs that is forked on your account


== Use a local repository ==
== Update the {{#var:TI-BDEBSTRAP}} to fetch the latest kernel debian package ==
Using this method Yocto will take the kernel source from a local repository instead of our remote ones on GitHub:<br>
  $ vi {{#var:BUILD_FOLDER}}/{{#var:TI-BDEBSTRAP}}/configs/bdebstrap_configs/{{#var:DEBIAN_BOOKWORM_CONFIG_YAML}}
<br>
Update the kernel image and headers with the new hash. Rebuilding the Debian image will then install the latest kernel Debian packages.
'''Setup Yocto''':<br>
To configure the kernel using Yocto:
* Follow steps 1-3 of the {{Varlink|{{#var:BUILD_PAGE}}|{{#var:RELEASE_LINK}}|Build {{#var:PLATFORM_OS}} from source code}} page.
* Run the script to set up the environment (stop after that - don't build any image). E.g.:{{AM62_SETUP_ENV_RETURN_YOCTO_TOOLCHAIN}}
<br>
'''Get the source code''':<br>
  $ {{#var:BB_ENV}} bitbake -c patch virtual/kernel
$ mkdir -p ../local_repos/{{#var:KERNEL_REPO}}
$ cp -a arago-tmp-default-glibc/work-shared/{{#var:MACHINE_NAME}}/kernel-source/. ../local_repos/{{#var:KERNEL_REPO}}
$ cd ../local_repos/{{#var:KERNEL_REPO}}
$ git reset --hard
$ git clean -fdx
<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/{{#var:KERNEL_REPO}}
$ vim {{#var:DTS_DIR}}{{#var:DTS_FILE}}
edit and save
$ git commit -a -m "my device tree changes"


  To list all of the commits:
  - linux-image-6.1.83-k3-var3+ef02b21f5d6fe1b1cd5678b0ad50f442a0fe8c8a-1
  $ git log
  - linux-headers-6.1.83-k3-var3+ef02b21f5d6fe1b1cd5678b0ad50f442a0fe8c8a-1
+ linux-image-6.1.83-k3-var4+a1fcfd378e2364c15981945cca609c3a5fc12386-1
+ linux-headers-6.1.83-k3-var4+a1fcfd378e2364c15981945cca609c3a5fc12386-1


Get the latest commit id:
Then update the variscite debian package github server to your own forked debian package server.
$ git rev-parse HEAD
<br>
'''Update the recipes to use the local repository instead of the default one:'''<br>
$ cd {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_REPO}}/recipes-kernel/linux/
 
Create a {{#var:KERNEL_RECIPE_NAME}}.bbappend file:
$ vim {{#var:KERNEL_RECIPE_NAME}}.bbappend
 
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://<var-ti-yocto_directory>/local_repos/</nowiki>{{#var:KERNEL_REPO}}<nowiki>;protocol=file"</nowiki>
SRCBRANCH{{#var:YOCTO_OVERRIDE_PREFIX}}{{#var:MACHINE_NAME}} = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)''
SRCREV{{#var:YOCTO_OVERRIDE_PREFIX}}{{#var:MACHINE_NAME}} = "''The commit id you'd like to use''"
<br>
{{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch<br>
(If you do so, make sure to run "{{#var:BB_ENV}} bitbake -c cleansstate virtual/kernel" before rebuilding the kernel)}}
 
== 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 to a new repository''':<br>
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 repository to your local machine, and push it later to your own account.<br>
<br>
https://github.com/varigit/{{#var:KERNEL_REPO}}/tree/{{#var:KERNEL_BRANCH}}


<br>
- 'echo "deb [trusted=yes] https://varigit.github.io/var-debpkgs/var bookworm main" | sudo tee $1//etc/apt/sources.list.d/var.list'
'''Update the recipes to use your remote repository instead of the default one''':<br>
- 'echo "deb [trusted=yes] https://varigit.github.io/var-debpkgs/var-ti bookworm main" | sudo tee $1//etc/apt/sources.list.d/var-ti.list'
<br>
- 'echo "deb [trusted=yes] https://varigit.github.io/var-debpkgs/am62x-var-som bookworm main" | sudo tee $1//etc/apt/sources.list.d/am62x-var-som.list'
  $ cd {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_REPO}}/recipes-kernel/linux/
+ 'echo "deb [trusted=yes] https://xxxx.github.io/var-debpkgs/var bookworm main" | sudo tee $1//etc/apt/sources.list.d/var.list'
+ 'echo "deb [trusted=yes] https://xxxx.github.io/var-debpkgs/var-ti bookworm main" | sudo tee $1//etc/apt/sources.list.d/var-ti.list'
+ 'echo "deb [trusted=yes] https://xxxx.github.io/var-debpkgs/am62x-var-som bookworm main" | sudo tee $1//etc/apt/sources.list.d/am62x-var-som.list'
- 'printf "Package: *\nPin: origin varigit.github.io/\nPin-Priority: 1002" >> $1/etc/apt/preferences.d/var'
- 'printf "Package: *\nPin: origin varigit.github.io/\nPin-Priority: 1003" >> $1/etc/apt/preferences.d/var-ti'
  - 'printf "Package: *\nPin: origin varigit.github.io/\nPin-Priority: 1004" >> $1/etc/apt/preferences.d/am62x-var-som'
+ 'printf "Package: *\nPin: origin xxxx.github.io/\nPin-Priority: 1002" >> $1/etc/apt/preferences.d/var'
+ 'printf "Package: *\nPin: origin xxxx.github.io/\nPin-Priority: 1003" >> $1/etc/apt/preferences.d/var-ti'
+ 'printf "Package: *\nPin: origin xxxx.github.io/\nPin-Priority: 1004" >> $1/etc/apt/preferences.d/am62x-var-som'


Create a {{#var:KERNEL_RECIPE_NAME}}.bbappend file:
After updating all the changes , Follow the steps to {{Varlink|Debian_Build_Release_TI|{{#var:RELEASE_LINK}}#Building_the_Debian_image|'''Build the Debian image'''}}
$ vim {{#var:KERNEL_RECIPE_NAME}}.bbappend


and append the following lines to it (see the previous section for listing the commits or getting the latest commit id):
This is the procedure to be followed to add custom packages or modifying any Variscite or TI packages.
 
KERNEL_SRC = <nowiki>"git://github.com/</nowiki>''your_account''/{{#var:KERNEL_REPO}}<nowiki>.git;protocol=git"</nowiki>
SRCBRANCH = "{{#var:KERNEL_BRANCH}}" ''(or your own created branch)''
SRCREV = "''The commit id you'd like to use''"
<br>
{{note|For the SRCREV value you can also use "${AUTOREV}" during development to get the latest commit of the branch<br>
(If you do so, make sure to run "{{#var:BB_ENV}} bitbake -c cleansstate virtual/kernel" before rebuilding the kernel)}}

Latest revision as of 17:10, 25 January 2025

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

The kernel is deployed as a Debian package during the build process. If there are changes to the kernel source code or configurations, the kernel must be recompiled with the updated changes using the ti-debian repository. Once recompiled, the updated Debian package for the kernel should be uploaded to the Debian package server.

Use your own remote repository on GitHub

Create your own GitHub account and fork the three repo 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/ti-linux-kernel/tree/ti-linux-6.1.y_09.02.01.10_var01

https://github.com/varigit/ti-debian-repos/tree/bookworm-09.02.01.10-var01

https://github.com/varigit/var-debpkgs/tree/master


Note: Don't forget to make your fork of var-debpkgs accessible via "GitHub Pages", according GitHub Docs.

After forking the repository to your account, clone the kernel source code from your fork. Then, create a build directory:

$ mkdir ~/am62_debian_kernel
$ cd ~/am62_debian_kernel
$ git clone https://github.com/xxxx/ti-linux-kernel -b your_branch_name
$ cd ti-linux-kernel

edit any file or modify kernel configuration and save it.

$ git add "modified_file_path"
$ git commit -a -m "my_am62x_var_som_changes"
$ git push origin your_branch_name
Get the latest commit hash:
$ git rev-parse HEAD

Assume the latest commit hash is a1fcfd378e2364c15981945cca609c3a5fc12386.

$ cd ~/am62_debian_kernel
$ git clone https://github.com/xxxx/var-debpkgs -b your_branch_name
$ git clone https://github.com/xxxx/ti-debian-repos -b your_branch_name
$ cd ti-debian-repos

Also update the repository name on ti-debian-repos repo. open the file ~/am62_debian_kernel/ti-debian-repos/ti-linux-kernel-variscite/version.sh and change to the corresponding forked kernel repo.

$ export git_repo="https://github.com/xxxx/ti-linux-kernel.git"
$ ./ti-linux-kernel-variscite/update-commit.py ./ti-linux-kernel-variscite/suite/bookworm/debian/ 6.1.83 a1fcfd378e2364c15981945cca609c3a5fc12386  "Author Name <author_name@xxx.com>"

After the modifications push the changes to the forked https://github.com/xxxx/ti-debian-repos repo.

$ git add "modified_file_path"
$ git commit -a -m "update repo name & latest hash of kernel" 
$ git push origin your_branch_name  #origin should be ti-debian-repos that is forked on your account

Build Kernel

Before building the kernel, follow the steps in Build the Debian image. As part of building the image, the root filesystem (rootfs) needs to be extracted into a folder and used as the target for the chroot command.

$ mkdir -p ~/rootfs
$ sudo tar -xvf ~/debian_am62x_var_som/ti-bdebstrap/build/am62-bookworm-09.02.01.010_var01/tisdk-am62-bookworm-variscite-am62xx-var-som-rootfs.tar.xz -C ~/rootfs
$ . ~/am62_debian_kernel/ti-debian-repos/chroot.sh -r ~/rootfs/tisdk-am62-bookworm-variscite-am62xx-var-som-rootfs

this will enter into another terminal

$ apt update && apt install git build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison devscripts
$ cd /workdir
$ DEB_SUITE=bookworm ./run.sh ti-linux-kernel-variscite
$ exit;
$ cp ~/am62_debian_kernel/ti-debian-repos/build/bookworm/ti-linux-kernel-variscite/*.deb ~/am62_debian_kernel/var-debpkgs/var-ti/pool/bookworm/l/
$ cd ~/am62_debian_kernel/var-debpkgs
$ ./update-ppa.sh

this will update the new .deb package with updated kernel changes. Then push the changes to your corresponding var-debpkgs repo. E.g https://github.com/xxxx/var-debpkgs

$ git add "modified_file_path"
$ git commit -a -m "update kernel deb packages" 
$ git push origin your_branch_name  #origin should be var-debpkgs that is forked on your account

Update the ti-bdebstrap to fetch the latest kernel debian package

$ vi ~/debian_am62x_var_som/ti-bdebstrap/configs/bdebstrap_configs/am62-bookworm-variscite.yaml

Update the kernel image and headers with the new hash. Rebuilding the Debian image will then install the latest kernel Debian packages.

- linux-image-6.1.83-k3-var3+ef02b21f5d6fe1b1cd5678b0ad50f442a0fe8c8a-1
- linux-headers-6.1.83-k3-var3+ef02b21f5d6fe1b1cd5678b0ad50f442a0fe8c8a-1
+ linux-image-6.1.83-k3-var4+a1fcfd378e2364c15981945cca609c3a5fc12386-1
+ linux-headers-6.1.83-k3-var4+a1fcfd378e2364c15981945cca609c3a5fc12386-1

Then update the variscite debian package github server to your own forked debian package server.

- 'echo "deb [trusted=yes] https://varigit.github.io/var-debpkgs/var bookworm main" | sudo tee $1//etc/apt/sources.list.d/var.list'
- 'echo "deb [trusted=yes] https://varigit.github.io/var-debpkgs/var-ti bookworm main" | sudo tee $1//etc/apt/sources.list.d/var-ti.list'
- 'echo "deb [trusted=yes] https://varigit.github.io/var-debpkgs/am62x-var-som bookworm main" | sudo tee $1//etc/apt/sources.list.d/am62x-var-som.list'
+ 'echo "deb [trusted=yes] https://xxxx.github.io/var-debpkgs/var bookworm main" | sudo tee $1//etc/apt/sources.list.d/var.list'
+ 'echo "deb [trusted=yes] https://xxxx.github.io/var-debpkgs/var-ti bookworm main" | sudo tee $1//etc/apt/sources.list.d/var-ti.list'
+ 'echo "deb [trusted=yes] https://xxxx.github.io/var-debpkgs/am62x-var-som bookworm main" | sudo tee $1//etc/apt/sources.list.d/am62x-var-som.list'
- 'printf "Package: *\nPin: origin varigit.github.io/\nPin-Priority: 1002" >> $1/etc/apt/preferences.d/var'
- 'printf "Package: *\nPin: origin varigit.github.io/\nPin-Priority: 1003" >> $1/etc/apt/preferences.d/var-ti'
- 'printf "Package: *\nPin: origin varigit.github.io/\nPin-Priority: 1004" >> $1/etc/apt/preferences.d/am62x-var-som'
+ 'printf "Package: *\nPin: origin xxxx.github.io/\nPin-Priority: 1002" >> $1/etc/apt/preferences.d/var'
+ 'printf "Package: *\nPin: origin xxxx.github.io/\nPin-Priority: 1003" >> $1/etc/apt/preferences.d/var-ti'
+ 'printf "Package: *\nPin: origin xxxx.github.io/\nPin-Priority: 1004" >> $1/etc/apt/preferences.d/am62x-var-som'

After updating all the changes , Follow the steps to Build the Debian image

This is the procedure to be followed to add custom packages or modifying any Variscite or TI packages.