Debian Edit Modify Build and Flash Kernel: Difference between revisions

From Variscite Wiki
(Add = Building a custom device tree =)
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_BUSTER_V1.0_DART-MX8M-MINI}}}} <!--
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_BUSTER_V1.0_DART-MX8M-MINI}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Customizing 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>
This section describes how to do menuconfig and build new kernel configuration and deploy it.  
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 G_LINUX_DTB in https://github.com/varigit/debian-var/blob/{{#var:DEBIAN_BRANCH}}/variscite/{{#var:MACHINE_NAME}}/{{#var:MACHINE_NAME}}.sh


= 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}}
Line 13: Line 15:
To configure the kernel using Debian:<br>
To configure the kernel using Debian:<br>


= How-to: Modify 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 28: Line 30:
  $ sudo cp defconfig arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}}
  $ sudo cp defconfig arch/{{#var:ARCH}}/configs/{{#var:KERNEL_DEFCONFIG}}


== Building New Kernel Configuration ==
== Building a new kernel configuration ==


=== Build kernel, dtb files and kernel modules ===
=== Build the kernel image, dtb files and kernel modules ===
  $ cd {{#var:BUILD_FOLDER}}
  $ cd {{#var:BUILD_FOLDER}}
  $ sudo {{#var:BUILD_SCRIPT}} -c kernel
  $ sudo {{#var:BUILD_SCRIPT}} -c kernel
Line 40: Line 42:
|}}|}}
|}}|}}


{{Note|Note: If you have modules newly added / removed, make sure you run below command.}}
{{Note|Note: If you have modules newly added / removed, make sure you run the following command:}}
$ sudo {{#var:BUILD_SCRIPT}} -c rtar
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#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:
$ sudo {{#var:BUILD_SCRIPT_B0}} -c rtar
|}}|}}
|
$ sudo {{#var:BUILD_SCRIPT}} -c rubi
}}


$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c rtar
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 rootfs.tar.gz that contains your new modules.
== Deploy the kernel image, dtb files and kernel modules ==
 
== Deploy Kernel and DTB ==
You can deploy the kernel and dtb or modules from any of the below methods,


== Deploy Kernel, dtb via network ==
== Deploy Kernel, dtb via network ==
Line 61: Line 69:
  }}
  }}
Once prompted give root as password. <yourboard-ip> is ipaddress of your board. <br>
Once prompted give root as password. <yourboard-ip> is ipaddress of your board. <br>
{{Note|Note: If you just intend to do dtb, then only follow this section and reboot the target}} <br>
Once transfer is done, follow below commands <br>
Once transfer is done, follow below commands <br>
On Target Console:<br>
On Target Console:<br>
Line 75: Line 82:
</pre>
</pre>
}}
}}
{{Note|Note: If you just intend to do dtb, then only follow this section and reboot the target}} <br>


=== Updating kernel image to target ===
=== Updating kernel Image to target ===
Transfer the output/{{#var:KERNEL_IMAGE}} kernel image to target <br>
Transfer the output/{{#var:KERNEL_IMAGE}} kernel image to target <br>
On PC:
On PC:
  $ scp output/{{#var:KERNEL_IMAGE}} root@<yourboard-ip>:{{#ifeq: {{#var:SOC_SERIES}}|imx8|/boot/|/tmp/}}
  $ scp output/{{#var:KERNEL_IMAGE}} root@<yourboard-ip>:{{#ifeq: {{#var:SOC_SERIES}}|imx8|/boot/|/tmp/}}
Once prompted give root as password. <yourboard-ip> is ipaddress of your board.<br>
Once prompted give root as password. <yourboard-ip> is ipaddress of your board.<br>
Once transfer is done, follow below commands <br>
Once transfer is done, follow below commands<br>
On Target Console:<br>
On Target Console:<br>
{{#ifeq: {{#var:SOC_SERIES}}|imx8|
{{#ifeq: {{#var:SOC_SERIES}}|imx8|

Revision as of 21:46, 19 February 2022

DART-MX8M-MINI - 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 G_LINUX_DTB in https://github.com/varigit/debian-var/blob/debian_buster_var01/variscite/imx8mm-var-dart/imx8mm-var-dart.sh

Configuring the kernel

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

~/var_mx8mm_dart_debian_buster/src/kernel/arch/arm64/configs/imx8_var_defconfig


To configure the kernel using Debian:

Modifying the kernel configuration

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

$ cd ~/var_mx8mm_dart_debian_buster/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 ~/var_mx8mm_dart_debian_buster
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c kernel
$ sudo MACHINE=imx8mm-var-dart ./var_make_debian.sh -c modules


Note: If you have modules newly added / removed, make sure you run the following command:
$ sudo MACHINE=imx8mm-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 ~/var_mx8mm_dart_debian_buster
$ 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/Image.gz kernel image to target
On PC:

$ scp output/Image.gz 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