Android Customizing the Linux kernel: Difference between revisions
From Variscite Wiki
No edit summary |
|||
(35 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- | --> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- | ||
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!-- | --> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!-- | ||
--> {{PageHeader|{{#var:HARDWARE_NAME}} - | --> {{PageHeader|{{#var:HARDWARE_NAME}} - {{#var:ANDROID_VERSION}} - Customizing the Linux kernel}} {{DocImage|category1=Android|category2={{#var:HARDWARE_NAME}}}} __toc__ | ||
== Making changes to kernel configuration == | == Making changes to kernel configuration == | ||
Line 11: | Line 9: | ||
$ make ARCH={{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}} {{#var:KERNEL_DEFCONFIG}} | $ make ARCH={{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}} {{#var:KERNEL_DEFCONFIG}} | ||
$ make ARCH={{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}} menuconfig | $ make ARCH={{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}} menuconfig | ||
Navigate the menu and select the desired kernel | Navigate through the menu, and select the desired kernel functionalities, save the new configuration, and exit.<br> | ||
Then, save the new configuration as the default configuration:<br> | |||
$ make ARCH={{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}} savedefconfig | $ make ARCH={{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}} savedefconfig | ||
$ cp arch/{{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}}/configs/{{#var:KERNEL_DEFCONFIG}} arch/{{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}}/configs/{{#var:KERNEL_DEFCONFIG}}.orig | $ cp arch/{{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}}/configs/{{#var:KERNEL_DEFCONFIG}} arch/{{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}}/configs/{{#var:KERNEL_DEFCONFIG}}.orig | ||
$ cp defconfig arch/{{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}}/configs/ | $ cp defconfig arch/{{#ifeq: {{#var:HARDWARE_NAME}} |VAR-SOM-MX6|arm|arm64}}/configs/{{#var:KERNEL_DEFCONFIG}} | ||
== Making changes to device tree == | == Making changes to the device tree == | ||
For example, edit the following file: {{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6| * VAR-SOM-MX6 : {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/vendor/variscite/kernel_imx/arch/arm/boot/dts/imx6qdl-var-som.dtsi <br> | |||
*DART-MX6: arch/arm/boot/dts/imx6qdl-var-dart.dtsi| arch/arm64/boot/dts/{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |freescale/fsl-imx8mq-var-dart-common.dtsi | freescale/fsl-imx8mm-var-dart.dts}}}} <br> | *DART-MX6: {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/vendor/variscite/kernel_imx/arch/arm/boot/dts/imx6qdl-var-dart.dtsi| {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}/vendor/variscite/kernel_imx/arch/arm64/boot/dts/{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |freescale/fsl-imx8mq-var-dart-common.dtsi | freescale/fsl-imx8mm-var-dart.dts}}}} <br> | ||
For example | For example, if you want to make changes related to the SPI configuration you can refer to: {{#ifeq: {{#var:HARDWARE_NAME}}|VAR-SOM-MX6 |[[{{#var:HARDWARE_NAME}} SPI|SPI]]|{{Varlink|DART-MX8M SPI|{{#var:RELEASE_LINK}}|SPI}}}} | ||
== Build | == Build a new boot.img == | ||
When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android. | When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android. | ||
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}} | $ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}} | ||
$ source build/envsetup.sh | $ source build/envsetup.sh | ||
$ lunch {{#var:ANDROID_MACHINE_NAME}}-userdebug | $ lunch {{#var:ANDROID_MACHINE_NAME}}-userdebug | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 | | |||
$ make bootimage | $ make bootimage | ||
| | |||
$ make bootimage | |||
$ make dtboimage | |||
}} | |||
== Flashing | == Flashing the boot image to the target == | ||
Run the following to boot the device into fastboot mode and reflash the boot image:<br> | |||
$ adb reboot bootloader | |||
$ sudo `which fastboot` flash boot{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 | out/target/product/var_mx6/boot-<setup-name>.img |_a out/target/product/{{#var:ANDROID_MACHINE_NAME}}/boot.img }} | |||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 | | |||
Replace setup-name as per above table. | Replace setup-name as per above table. | ||
| | | | ||
$ sudo flash dtbo_a out/target/product/{{#var:ANDROID_MACHINE_NAME}}/dtbo-<name>.img | $ sudo `which fastboot` flash dtbo_a out/target/product/{{#var:ANDROID_MACHINE_NAME}}/dtbo-<name>.img | ||
$ sudo flash vbmeta_a out/target/product/{{#var:ANDROID_MACHINE_NAME}}/vbmeta-<name>.img | $ sudo `which fastboot` flash vbmeta_a out/target/product/{{#var:ANDROID_MACHINE_NAME}}/vbmeta-<name>.img | ||
Replace <name> with the actual desired setup name according to the table in the {{Varlink|Android_NXP_Guide#Images_created_by_the_Android_build|{{#var:RELEASE_LINK}}|"images created by the Android build" section}} in the "Build Android from source code" page. | |||
Replace | }} | ||
$ sudo fastboot reboot | $ sudo `which fastboot` reboot | ||
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 || | |||
*Note: While flashing if you encouter like below <br> | |||
$ sudo `which fastboot` flash boot_a out/target/product/{{#var:ANDROID_MACHINE_NAME}}/boot.img <br> | |||
target reported max download size of 1073741824 bytes | |||
Sending 'boot_a' (49152 KB)... | |||
OKAY [ 1.740s] | |||
Writing 'boot_a'... | |||
FAILED (remote: device is locked.) | |||
Finished. Total time: 1.772s | |||
Make sure you unlock your device following<br> | |||
{{Varlink|Fastboot Unlock|{{#var:RELEASE_LINK}}|Fastboot Unlock}} and then follow the steps above | |||
}} |
Latest revision as of 21:59, 12 September 2023
VAR-SOM-MX6 - N7.1.1 - Customizing the Linux kernel
Making changes to kernel configuration
$ cd ~/var_n_711_100/n_711_100_build/vendor/variscite/kernel_imx/ $ make ARCH=arm mrproper $ make ARCH=arm imx_v7_var_android_defconfig $ make ARCH=arm menuconfig
Navigate through the menu, and select the desired kernel functionalities, save the new configuration, and exit.
Then, save the new configuration as the default configuration:
$ make ARCH=arm savedefconfig $ cp arch/arm/configs/imx_v7_var_android_defconfig arch/arm/configs/imx_v7_var_android_defconfig.orig $ cp defconfig arch/arm/configs/imx_v7_var_android_defconfig
Making changes to the device tree
For example, edit the following file:
- VAR-SOM-MX6 : ~/var_n_711_100/n_711_100_build/vendor/variscite/kernel_imx/arch/arm/boot/dts/imx6qdl-var-som.dtsi
- DART-MX6: ~/var_n_711_100/n_711_100_build/vendor/variscite/kernel_imx/arch/arm/boot/dts/imx6qdl-var-dart.dtsi
For example, if you want to make changes related to the SPI configuration you can refer to: SPI
Build a new boot.img
When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android.
$ cd ~/var_n_711_100/n_711_100_build $ source build/envsetup.sh $ lunch -userdebug $ make bootimage
Flashing the boot image to the target
Run the following to boot the device into fastboot mode and reflash the boot image:
$ adb reboot bootloader $ sudo `which fastboot` flash bootout/target/product/var_mx6/boot-<setup-name>.img Replace setup-name as per above table. $ sudo `which fastboot` reboot