Skip to content

adeii/huawei-london-kernel

Repository files navigation


# kernel_huawei_msm8937

1. How to Build
	- get Toolchain
		From android git server , codesourcery and etc ..
		 - aarch64-linux-android-4.9
    Example:
    
       git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
      
	- edit Makefile
		edit "CROSS_COMPILE" to right toolchain path (You'd downloaded).
    Example:
		
       CROSS_COMPILE=/home/user/kernel/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
		
    Example:
    
       CROSS_COMPILE=/usr/local/toolchain/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
		
	// check the location of toolchain
	or try:
		
		export CROSS_COMPILE=arm-linux-androideabi-
		export PATH=$PATH:<toolchain_parent_dir>/aarch64-linux-android-4.9/bin

		$ make ARCH=arm64 L21_defconfig  (stock Y7 Prime 2018 kernel config + Ezz's SE Permissive)
		$ make ARCH=arm64 Image.gz-dtb   (full kernel zImage, currentilly updated to 3.18.67)
                
 NOTICE - separated commands make few error, use single line command from kernel folder like:
 
    $ make ARCH=arm64 CROSS_COMPILE=/home/ade/kernel/aarch64-linux-android-4.9/bin/aarch64-linux-android- L21_defconfig Image.gz-dtb
 

2. Output files
	- Kernel : arch/arm64/boot/Image.gz-dtb
	- module : drivers/*/*.o (not needed after all, even pass compiling but error 2 in the end.)
	
3. How to Clean

		$ make ARCH=arm64 distclean
		
4. Future upgrades
   Patch source: https://github.com/android-linux-stable/msm-3.18
   Look for commits "Merge 3.18.xx into android-3.18"
   Download it as patch....wget not works on SSL, use aria2c, ex. of 3.18.70 to 3.18.71
   
   aria2c https://github.com/android-linux-stable/msm-3.18/commit/7a365d34991f0eb95317bfaaa75cc482dd3f5dcb.patch
   
   Rename file as 3.18.71.patch into root of kernel sourcecode
   Check patch and apply it: 
   git apply --check 3.18.71.patch
   git am < 3.18.71.patch
   
   when error, manualy fix/edit files from xx/NN patch and skip that patch to next xx+1/NN and apply again.
   git am --skip
   git am < 3.18.71.patch
   
 5. Far future plan
    Add commits from various Xiaomi MSM8937 kernels to make new cpu gov/io or more compatible to Pie/Q/R...
    Like: https://github.com/LordShenron/Direwolf_unified ,
          https://github.com/sunnyraj84348/android_kernel_xiaomi_msm8917/tree/inferno ,
          https://github.com/ChimeraKernelProject/chimera_land-current ,
          https://github.com/Ubports-Land/android_device_xiaomi_msm8937-common ,
          https://github.com/linuxpanda/android_kernel_xiaomi_rosy/tree/3.18
    
################################################################################
This package make out Image.gz-dtb only, you have to get ramdisk and add kernel cmdline to generate a total kernel.img before replace your phone's kernelimage.

In AIKernel.zip, we got repacking tool from osmosis.
Place Image.gz-dtb to split_img folder. Rename it as KERNEL.img-zImage and use repackimg.bat (yes, it is Windows version).
For GNU/Linux use mktool - repack image [https://techstop.github.io/mktool/]

Current files are for rom 8.0.0.147 c432 from 2020-02.
If you use another version of rom, change file KERNEL.img-oslevel.
Tested and working!!!

UPDATE1> Let's test EVA-GCC (gcc v10)  --- WORKS with Nathan Chance's gcc7+ patch
1a - git clone https://github.com/mvaisakh/gcc-arm64.git -b gcc-master eva-gcc
1b - make ARCH=arm64 CROSS_COMPILE=/home/ade/kernel/eva-gcc/bin/aarch64-elf- L21_defconfig Image.gz-dtb
1c - patches (not needed): https://gist.github.com/mvaisakh/50cfeb0308d09636ba489a79e6d8aca9#file-gcc-inline-regressions-patch

UPDATE2> Let's test gcc v7    --- WORKS with Nathan Chance's gcc7+ patch
1a - git clone --depth=1 https://github.com/nathanchance/gcc-prebuilts -b aarch64-gnu-7.x gcc7
1b - make ARCH=arm64 CROSS_COMPILE=/home/ade/kernel/gcc7/bin/aarch64-gnu-linux-android- L21_defconfig Image.gz-dtb