Debian Edit Modify Build and Flash Kernel: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
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 RELEASE_BUSTER_V3.1_DART-MX8M as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_BUSTER_V3.1_DART-MX8M}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_BUSTER_V1.0_DART-MX8M-MINI}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing the Debian Linux kernel}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing the Debian Linux kernel}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Debian}} __toc__
<br>
<br>
Line 9: Line 9:
To build and install a custom device tree, add the filename to the variable <code>G_LINUX_DTB</code> of the machine-specific file.<br>
To build and install a custom device tree, add the filename to the variable <code>G_LINUX_DTB</code> of the machine-specific file.<br>


We will demonstrate it here exemplarily with the SOM VAR-SOM-MX8M-NANO, but the same applies to other modules:<br>
We will demonstrate it here exemplarily with the VAR-SOM-MX8M-NANO, but the same applies also to other modules.<br>
Assuming you have created a custom device tree '''{{#var:BUILD_FOLDER}}/src/kernel/arch/arm64/boot/dts/freescale/imx8mn-var-som-custom.dts''', you can add this to the <code>G_LINUX_DTB</code> list
Assuming you have created a custom device tree '''arch/arm64/boot/dts/freescale/imx8mn-var-som-custom.dts''', you can add this to the <code>G_LINUX_DTB</code> list
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
G_LINUX_DTB="freescale/imx8mn-var-som-symphony.dtb
G_LINUX_DTB="freescale/imx8mn-var-som-symphony.dtb
Line 21: Line 21:
</syntaxhighlight >
</syntaxhighlight >


for example, add the end:
for example, at the end:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
G_LINUX_DTB="freescale/imx8mn-var-som-symphony.dtb
G_LINUX_DTB="freescale/imx8mn-var-som-symphony.dtb
Line 36: Line 36:
After running the build script:
After running the build script:


  sudo MACHINE=imx8mn-var-som ./var_make_debian.sh -c all
  sudo MACHINE=imx8mn-var-som ./var_make_debian.sh -c kernel


the custom device tree should appear in the output folder: {{#var:BUILD_FOLDER}}/output/imx8mn-var-som-custom.dtb
the custom device tree should appear in the output folder: {{#var:BUILD_FOLDER}}/output/imx8mn-var-som-custom.dtb
It's also possible to run the build script by parts, please refer to {{Varlink|Debian Release Build Stage#Build by parts|{{#var:RELEASE_NAME}}|Build Debian by parts}}.


= Configuring the kernel =
= Configuring the kernel =
The default kernel configuration file used by Debian is part of the kernel source tree and is located at:
The default kernel configuration file used by Debian is part of the kernel source tree and is located at:
  {{#var:BUILD_FOLDER}}/src/kernel/arch/{{#ifeq: {{#var:SOC_SERIES}}|imx8|arm64|arm}}/configs/{{#var:KERNEL_DEFCONFIG}}
  {{#var:BUILD_FOLDER}}/src/kernel/arch/{{#ifeq: {{#var:SOC_SERIES}}|imx8|arm64|arm}}/configs/{{#var:KERNEL_DEFCONFIG}}
<br>
To configure the kernel using Debian:<br>


= Modifying the kernel configuration =
== Modifying the kernel configuration ==
To modify the kernel configuration (add/remove features and drivers) please follow the steps below: <br>
To modify the kernel configuration (add/remove features and drivers) please follow the steps below: <br>


Line 69: Line 65:
  $ sudo {{#var:BUILD_SCRIPT}} -c kernel
  $ sudo {{#var:BUILD_SCRIPT}} -c kernel
  $ sudo {{#var:BUILD_SCRIPT}} -c modules
  $ sudo {{#var:BUILD_SCRIPT}} -c modules
$ sudo {{#var:BUILD_SCRIPT}} -c kernelheaders
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som |
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X |{{#ifeq: {{#var:MACHINE_NAME_B0}} | imx8qxpb0-var-som |
Or, to build kernel, dtb, kernel modules for i.MXQXP SOC revision B0:
Or, to build kernel, dtb, kernel modules for i.MXQXP SOC revision B0:
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c kernel
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c kernel
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c modules
  $ sudo {{#var:BUILD_SCRIPT_B0}} -c modules
$ sudo {{#var: BUILD_SCRIPT_B0}} -c kernelheaders
|}}|}}
|}}|}}


Line 88: Line 86:
This will create {{#ifeq: {{#var:SOC_SERIES}}|imx8|a rootfs.tar.gz file that contains|rootfs.tar.gz and rootfs.ubi.img files that contain}} your new modules.
This will create {{#ifeq: {{#var:SOC_SERIES}}|imx8|a rootfs.tar.gz file that contains|rootfs.tar.gz and rootfs.ubi.img files that contain}} your new modules.


== Deploy the kernel image, dtb files and kernel modules ==
= Deploy the kernel image, dtb files and kernel modules =


== Deploy Kernel, dtb via network ==
== Deploy Kernel, dtb via network ==

Latest revision as of 21:39, 27 April 2023

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

This page is using the default release RELEASE_BUSTER_V3.1_DART-MX8M.
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 - Customizing the Debian Linux kernel


This section describes how to build a new kernel configuration using menuconfig and deploy it.

Building a custom device tree

To build and install a custom device tree, add the filename to the variable G_LINUX_DTB of the machine-specific file.

We will demonstrate it here exemplarily with the VAR-SOM-MX8M-NANO, but the same applies also to other modules.
Assuming you have created a custom device tree arch/arm64/boot/dts/freescale/imx8mn-var-som-custom.dts, you can add this to the G_LINUX_DTB list

G_LINUX_DTB="freescale/imx8mn-var-som-symphony.dtb
	freescale/imx8mn-var-som-symphony-root.dtb
	freescale/imx8mn-var-som-symphony-m7.dtb
	freescale/imx8mn-var-som-symphony-legacy.dtb
	freescale/imx8mn-var-som-symphony-legacy-root.dtb
	freescale/imx8mn-var-som-symphony-legacy-m7.dtb
	freescale/imx8mn-var-som-inmate.dtb"

for example, at the end:

G_LINUX_DTB="freescale/imx8mn-var-som-symphony.dtb
	freescale/imx8mn-var-som-symphony-root.dtb
	freescale/imx8mn-var-som-symphony-m7.dtb
	freescale/imx8mn-var-som-symphony-legacy.dtb
	freescale/imx8mn-var-som-symphony-legacy-root.dtb
	freescale/imx8mn-var-som-symphony-legacy-m7.dtb
	freescale/imx8mn-var-som-inmate.dtb
	freescale/imx8mn-var-som-custom.dtb"

File: ~/debian_imx8mq-var-dart/variscite/imx8mn-var-som/imx8mn-var-som.sh

After running the build script:

sudo MACHINE=imx8mn-var-som ./var_make_debian.sh -c kernel

the custom device tree should appear in the output folder: ~/debian_imx8mq-var-dart/output/imx8mn-var-som-custom.dtb

Configuring the kernel

The default kernel configuration file used by Debian is part of the kernel source tree and is located at:

~/debian_imx8mq-var-dart/src/kernel/arch/arm64/configs/imx8_var_defconfig

Modifying the kernel configuration

To modify the kernel configuration (add/remove features and drivers) please follow the steps below:

$ cd ~/debian_imx8mq-var-dart/src/kernel
$ sudo make ARCH=arm64 mrproper
$ sudo make ARCH=arm64 imx8_var_defconfig
$ sudo make ARCH=arm64 menuconfig

Navigate the menu and select the desired kernel functionality

Exit the menu and answer "Yes" when asked "Do you wish to save your new configuration?"

$ sudo make ARCH=arm64 savedefconfig
$ sudo cp arch/arm64/configs/imx8_var_defconfig arch/arm64/configs/imx8_var_defconfig.orig
$ sudo cp defconfig arch/arm64/configs/imx8_var_defconfig

Building a new kernel configuration

Build the kernel image, dtb files and kernel modules

$ cd ~/debian_imx8mq-var-dart
$ sudo MACHINE=imx8mq-var-dart ./var_make_debian.sh -c kernel
$ sudo MACHINE=imx8mq-var-dart ./var_make_debian.sh -c modules
$ sudo MACHINE=imx8mq-var-dart ./var_make_debian.sh -c kernelheaders


Note: If you have modules newly added / removed, make sure you run the following command:
$ sudo MACHINE=imx8mq-var-dart ./var_make_debian.sh -c rtar

This will create a rootfs.tar.gz file that contains your new modules.

Deploy the kernel image, dtb files and kernel modules

Deploy Kernel, dtb via network

Updating Device tree to target

Transfer dtbs to target
On PC:

$ cd ~/debian_imx8mq-var-dart
$ scp output/*.dtb root@<yourboard-ip>:/boot/

Once prompted give root as password. <yourboard-ip> is ipaddress of your board.
Once transfer is done, follow below commands
On Target Console:

# sync;reboot
Note: If you just intend to do dtb, then only follow this section and reboot the target


Updating kernel Image to target

Transfer the output/zImage kernel image to target
On PC:

$ scp output/zImage root@<yourboard-ip>:/boot/

Once prompted give root as password. <yourboard-ip> is ipaddress of your board.
Once transfer is done, follow below commands
On Target Console:

# sync;reboot