How to change kernel configuration on Android build

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to change kernel configuration on Android build

How to change kernel configuration on Android build

Tested on Android 10 (android_Q10.0.0_1.0.0)

After your the first BSP build the kernel sources are at:
${MY_ANDROID}/vendor/nxp-opensource/kernel_imx/

For the i.MX8M Mini, You can check the defconfig files being used on:
${MY_ANDROID}/device/fsl/imx8m/evk_8mm/UbootKernelBoardConfig.mk

# imx8mm kernel defconfig
TARGET_KERNEL_DEFCONFIG := android_defconfig
TARGET_KERNEL_ADDITION_DEFCONF := android_addition_defconfig

You could change one of them to add the desired configuration.

- android_defconfig - is ${MY_ANDROID}/vendor/nxp-opensource/kernel_imx/arch/arm64/configs/android_defconfig
- android_addition_defconfig - is on the same folder ${MY_ANDROID}/device/fsl/imx8m/evk_8mm/

"merge_config.sh" is called to generate the final defconfig file prior to building the kernel
Check out: https://source.android.com/devices/architecture/kernel/config

For example, I want to add DEVMEM support on my build:

1. Change the defconfig

I add the line below to android_addition_defconfig

CONFIG_DEVMEM=y

(Or could have added it android_defconfig)

2. Build the kernel

./imx-make.sh kernel -c -j8

3. Verify your change

After compiling, you can confirm your change by reading:

${MY_ANDROID}/out/target/product/evk_8mm/obj/KERNEL_OBJ/.config


Then rebuild boot.img and reprogram the target.

%3CLINGO-SUB%20id%3D%22lingo-sub-1114245%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20change%20kernel%20configuration%20on%20Android%20build%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114245%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ETested%20on%20Android%2010%20(android_Q10.0.0_1.0.0)%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAfter%20your%20the%20first%20BSP%20build%20the%20kernel%20sources%20are%20at%3A%3CBR%20%2F%3E%24%7BMY_ANDROID%7D%2Fvendor%2Fnxp-opensource%2Fkernel_imx%2F%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EFor%20the%20i.MX8M%20Mini%2C%20You%20can%20check%20the%20defconfig%20files%20being%20used%20on%3A%3CBR%20%2F%3E%24%7BMY_ANDROID%7D%2Fdevice%2Ffsl%2Fimx8m%2Fevk_8mm%2FUbootKernelBoardConfig.mk%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CBLOCKQUOTE%20class%3D%22jive_macro_quote%20jive-quote%20jive_text_macro%22%3E%3CP%3E%23%20imx8mm%20kernel%20defconfig%3CBR%20%2F%3ETARGET_KERNEL_DEFCONFIG%20%3A%3D%20android_defconfig%3CBR%20%2F%3ETARGET_KERNEL_ADDITION_DEFCONF%20%3A%3D%20android_addition_defconfig%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3E%3C%2FP%3E%3CP%3EYou%20could%20change%20one%20of%20them%20to%20add%20the%20desired%20configuration.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E-%20android_defconfig%20-%20is%20%24%7BMY_ANDROID%7D%2Fvendor%2Fnxp-opensource%2Fkernel_imx%2Farch%2Farm64%2Fconfigs%2Fandroid_defconfig%3CBR%20%2F%3E-%20android_addition_defconfig%20-%20is%20on%20the%20same%20folder%20%24%7BMY_ANDROID%7D%2Fdevice%2Ffsl%2Fimx8m%2Fevk_8mm%2F%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%22merge_config.sh%22%20is%20called%20to%20generate%20the%20final%20defconfig%20file%20prior%20to%20building%20the%20kernel%3CBR%20%2F%3ECheck%20out%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsource.android.com%2Fdevices%2Farchitecture%2Fkernel%2Fconfig%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fsource.android.com%2Fdevices%2Farchitecture%2Fkernel%2Fconfig%3C%2FA%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EFor%20example%2C%20I%20want%20to%20add%20DEVMEM%20support%20on%20my%20build%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1415421648%22%20id%3D%22toc-hId--499196468%22%3E1.%20Change%20the%20defconfig%3C%2FH2%3E%3CP%3EI%20add%20the%20line%20below%20to%20android_addition_defconfig%3C%2FP%3E%3CBLOCKQUOTE%20class%3D%22jive_macro_quote%20jive-quote%20jive_text_macro%22%3E%3CP%3ECONFIG_DEVMEM%3Dy%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3E(Or%20could%20have%20added%20it%20android_defconfig)%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId-1072091185%22%20id%3D%22toc-hId-1988316365%22%3E2.%20Build%20the%20kernel%3C%2FH2%3E%3CBLOCKQUOTE%20class%3D%22jive_macro_quote%20jive-quote%20jive_text_macro%22%3E%3CP%3E.%2Fimx-make.sh%20kernel%20-c%20-j8%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId--735363278%22%20id%3D%22toc-hId-180861902%22%3E3.%20Verify%20your%20change%3C%2FH2%3E%3CP%3EAfter%20compiling%2C%20you%20can%20confirm%20your%20change%20by%20reading%3A%3C%2FP%3E%3CP%3E%24%7BMY_ANDROID%7D%2Fout%2Ftarget%2Fproduct%2Fevk_8mm%2Fobj%2FKERNEL_OBJ%2F.config%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThen%20rebuild%20boot.img%20and%20reprogram%20the%20target.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1114245%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MX%208M%20%7C%20i.MX%208M%20Mini%20%7C%20i.MX%208M%20Nano%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
No ratings
Version history
Last update:
‎02-10-2020 04:41 PM
Updated by: