How to customize kernel for Android

Revision as of 09:50, 5 August 2019 by Registered User (Created page with "== Article purpose == This article is intended to a Distribution Package user (see Which STM32MPU Embedded Software Package for Android better suits your needs|Which Packag...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1. Article purpose[edit source]

This article is intended to a Distribution Package user (see Which Package better suits your needs for more information).

This page explains how to change the kernel configuration.

2. Prerequisites[edit source]

The environment must be installed using the Distribution Package adapted to your selected microprocessor device, STM32MP1 Distribution Package for Android. You must get kernel sources like explain How to build kernel for Android.

To be able to execute following instruction you need to work from your ST AOSP root directory STM32MP1 Distribution Package for Android, initialise your environment and then launch:

source build/envsetup.sh

lunch aosp-eval-userdebug

3. Updating kernel configuration[edit source]

Info white.png Information

The kernel configuration file used is a merge between the following files (merge operation is performed during kernel build):

  • The Android configuration files named android-base.kconf and android-recommended.kconf files available in the device/stm/stm32mp1-kernel/source/kconfig/<kernel version>/ directory.
  • The android-soc.config file available in the device/stm/stm32mp1-kernel/source/kconfig/<kernel version>/ directory.

By using menuconfig, you can update the configuration file for your needs. Some guidelines are given below.

3.1. Saving current configuration[edit source]

Before making any change in the kernel configuration using menuconfig, please save your current configuration in a defconfig.default file, which is in the same format used by the Linux kernel defconfig files:

build_kernel defaultconfig

A default config file named defconfig.default is generated in out-bsp/stm32mp1/KERNEL_OBJ/ directory.

3.2. Create configuration[edit source]

Start menuconfig:

build_kernel menuconfig

You can load a .config file and modify any entry using this interface. Please read on the top of the windows the instructions to navigate.

Don't forget to hit save. This will generate a .config file located in out-bsp/stm32mp1/KERNEL_OBJ/.

3.3. Apply the new configuration[edit source]

You need to compare the defconfig.default file with the one create above. You can you a graphical tool like meld.

meld out-bsp/stm32mp1/KERNEL_OBJ/myNewConfig.config out-bsp/stm32mp1/KERNEL_OBJ/defconfig.default

Then report the change in android-soc.config located in device/stm/stm32mp1-kernel/source/kconfig/<kernel version>/

3.4. Rebuild the kernel[edit source]

After all this change you can rebuild the kernel, for more details ou can read the page How to build kernel for Android.

build_kernel

4. Change kernel command line[edit source]

You can customize the kernel command line call at boot time. Arguments are defined in the BoardConfig.mk file located in device/stm/stm32mp1/<Board>/.

Adpat the variable BOARD_KERNEL_CMDLINE value to your needs.

5. Change the Device Tree[edit source]

The kernel device tree (DTB0 or DTB1) used is set in the dt.mk file available in the device/stm/stm32mp1/build/tasks/ directory.

This file is located inside the Linux kernel source code previously loaded and can be modified directly in device/stm/stm32mp1-kernel/linux-stm32mp1/arch/arm/boot/dts

No categories assignedEdit