Android Customizing the Linux kernel

From Variscite Wiki
DART-MX8M - Android O8.1.0_r14 - Customizing the Linux kernel

Making changes to kernel configuration

$ cd ~/var_imx-o8.1.0_1.3.0_8m/android_build/vendor/variscite/kernel_imx/
$ make ARCH=arm64 mrproper
$ make ARCH=arm64 imx8m_var_dart_android_defconfig
$ make ARCH=arm64 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=arm64 savedefconfig
$ cp arch/arm64/configs/imx8m_var_dart_android_defconfig arch/arm64/configs/imx8m_var_dart_android_defconfig.orig 
$ cp defconfig arch/arm64/configs/imx8m_var_dart_android_defconfig

Making changes to the device tree

For example, edit the following file: ~/var_imx-o8.1.0_1.3.0_8m/android_build/vendor/variscite/kernel_imx/arch/arm64/boot/dts/freescale/fsl-imx8mq-var-dart-common.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_imx-o8.1.0_1.3.0_8m/android_build
$ source build/envsetup.sh
$ lunch dart_mx8m-userdebug
$ make bootimage
$ make dtboimage

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 boot_a out/target/product/dart_mx8m/boot.img
$ sudo `which fastboot` flash dtbo_a out/target/product/dart_mx8m/dtbo-<name>.img
$ sudo `which fastboot` flash vbmeta_a out/target/product/dart_mx8m/vbmeta-<name>.img

Replace <name> with the actual desired setup name according to the table in the "images created by the Android build" section in the "Build Android from source code" page.

$ sudo `which fastboot` reboot
  • Note: While flashing if you encouter like below
$ sudo `which fastboot` flash boot_a out/target/product/dart_mx8m/boot.img 
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
Fastboot Unlock and then follow the steps above