Contents

Introduction of Canting Kernel


Canting is an android kernel based on Google kernel-common merged over CAF-kernel. Built to provide security and stability improvement. Canting it self is a pen-like instrument used in the process of batik making.

Source Codes

xiaomi-msm8953

https://img.shields.io/github/v/release/khusika/canting_kernel_xiaomi_msm8953?style=flat-squarehttps://img.shields.io/github/stars/khusika/canting_kernel_xiaomi_msm8953?style=flat-squarehttps://img.shields.io/github/forks/khusika/canting_kernel_xiaomi_msm8953?style=flat-squarehttps://img.shields.io/github/issues/khusika/canting_kernel_xiaomi_msm8953?style=flat-square

xiaomi-sdm845

https://img.shields.io/github/v/release/khusika/canting_kernel_xiaomi_sdm845?style=flat-squarehttps://img.shields.io/github/stars/khusika/canting_kernel_xiaomi_sdm845?style=flat-squarehttps://img.shields.io/github/forks/khusika/canting_kernel_xiaomi_sdm845?style=flat-squarehttps://img.shields.io/github/issues/khusika/canting_kernel_xiaomi_sdm845?style=flat-square

Features

  • Upstream with latest linux-stable releases
  • Upstream with latest CAF-kernel releases
  • Clang supported
  • CPU Governors: schedutil, powersave, performance
  • I/O Schedulers: noop, cfq
  • Compat vDSO from Pixel kernel
  • TCP Congestion Algorithm: bbr, westwood, reno, cubic
  • WireGuard VPN support
  • Boeffla wakelock blocker
  • Simple Low Memory Killer
  • Sound Control: Speaker, Microphone, Headphone (Per-channel control)
  • KCAL & KLapse Interface
  • Vibration Intensity Control
  • backlight min option
  • Removed safetynet flags (no need of magisk to bypass safteynet)
  • Extend File System Support: F2FS, EXFAT, NTFS
  • and many more

Device Support

canting-3.18.y

canting-4.9.y

How to Build

This section describes how to set up your local work environment to build the Canting Kernel. You must use Ubuntu/Debian.

Set-up Environment

  1. Instal required packaged for Ubuntu based distro, according to the source.android.com and xdaforums.com. Install the following packaged:
1
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng
  1. Clone the kernel trees For an example, we are going to build canting-4.9.q for sdm845 into canting as directiories:
1
git clone https://github.com/khusika/canting_kernel_xiaomi_sdm845 -b canting-4.9-q canting

  3. Clone required toolchain, at this point only Clang with prebuilt binutils(arm and arm64) in it to build canting-kernel.

1
git clone https://github.com/khusika/prebuilt_google_clang -b master clang-toolchain

Compile Kernel

  1. Make sure to clean the kernel trees
1
make clean && make mrproper

  2. Export required crosscompile, previously we use prebuilt google-clang.

1
2
3
4
5
6
export CC='/clang-toolchain/bin/clang'
export CLANG_TRIPLE=aarch64-linux-gnu-
export CLANG_TRIPLE_ARM32=arm-linux-gnueabi-
export CROSS_COMPILE='/clang-toolchain/bin/aarch64-linux-gnu-'
export CROSS_COMPILE_ARM32='/clang-toolchain/bin/arm-linux-gnueabi-'
export KBUILD_COMPILER_STRING="$('/clang-toolchain/bin/clang' --version | head -n 1 | perl -pe 's/\((?:http|git).*?\)//gs' | sed -e 's/  */ /g')"

  3. Make the device config and build the kernel, at this point we will build dipper kernel.

1
2
make O=out ARCH=arm64 canting-dipper_defconfig
make -j$(nproc --all) O=out

Repack Kernel Image

At this point, we are going to repack the kernel image into flashable kernel.zip. There is a powerfull flashable.zip made by Chris Renshaw called AnyKernel. All of supported kernel are able to use those flashable.zip, just follow this guides:

  1. Clone Canting-AnyKernel repository, for an example we use dipper branch
1
git clone https://github.com/khusika/AnyKernel3 -b dipper canting-kernel-dipper

  2. Copy or move the kernel images into the AnyKernel directories

1
cp '/canting/out/arch/arm64/boot/Image.gz-dtb' '/canting-kernel-dipper'

  3. Compress the kernel using zip

1
zip -r9 kernel.zip * -x README.md kernel.zip

References