Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save silverzhaojr/77d3f7528460b7354c16a4a0d33cb8ff to your computer and use it in GitHub Desktop.
Save silverzhaojr/77d3f7528460b7354c16a4a0d33cb8ff to your computer and use it in GitHub Desktop.

Build PixelExperience kernel for whyred (xiaomi_sdm660) with GNU toolchain

Preparation

  1. download kernel source: https://github.com/PixelExperience-Devices/kernel_xiaomi_sdm660/tree/thirteen

  2. download cross compile toolchain: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

    • AArch32 GNU/Linux target with hard float (arm-none-linux-gnueabihf)
      • arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
    • AArch64 GNU/Linux target (aarch64-none-linux-gnu)
      • arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz
  3. install necessary dev library:

    sudo apt-get install libssl-dev
    

Build

  1. unzip the kernel source and the tool chain;

  2. set the necessary environment variables:

    export ARCH=arm64
    export CROSS_COMPILE=/home/zhaojr/android/toolchain-gnu/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
    export CROSS_COMPILE_ARM32=/home/zhaojr/android/toolchain-gnu/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
    
  3. run build command:

    make O=out whyred_defconfig
    
    # disable "-Werror" flag which makes all warnings into errors
    sed -i 's/CONFIG_CC_WERROR=y/CONFIG_CC_WERROR=n/' out/.config
    
    # remove "-Werror" flag for "qcacld" driver
    sed -i '/-Werror/d' drivers/staging/qcacld-3.0/Kbuild
    
    make -j4 O=out
    
  4. if you want to debug the wlan driver, set the debug flag:

    # set debug flag for "drivers/staging/qcacld-3.0/" and "drivers/staging/qca-wifi-host-cmn/"
    make -j4 O=out BUILD_DEBUG_VERSION=1
    

Flash kernel

The build takes about 15 minutes, and the generated kernel image is ./out/arch/arm64/boot/Image.gz-dtb, use "Anykernel" to flash the kernel.

@NopeNopeGuy
Copy link

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment