Skip to content
cyberknight777 edited this page Oct 16, 2022 · 12 revisions

Welcome to the NetErnels Mojito wiki!

We will be covering two things -

    - Standalone Building
    - Inline Building

Standalone Building


This section describes how to build only the kernel.

Pre-requisites

  1. Proper and fast internet connection
  2. A PC/Cloud Computer running Linux OS (Ubuntu/ArchLinux/*) ( IDC/IDK anything about WSL2 )
  3. A better processor ( better the processor, lower the compile times )
  4. Around 15 GB free space
  5. Brains and patience. Always remember, Google is your best friend. You should have some experience with Linux environment and you are aware of how to run a command and can differentiate commands.

Preparing the Build Environment

If you have not built a kernel on your system before, there are some packages needed before you can successfully build. You can get these installed with:

Ubuntu/Linux Mint

curl https://raw.githubusercontent.com/akhilnarang/scripts/master/setup/android_build_env.sh | bash

ArchLinux

curl https://raw.githubusercontent.com/akhilnarang/scripts/master/setup/arch-manjaro.sh | bash

Fedora

curl https://raw.githubusercontent.com/akhilnarang/scripts/master/setup/fedora.sh | bash

You have successfully finished setting up your build environment.

Obtaining sources

This subsections aims at downloading and building the kernel from source. Not applicable if you are trying to develop/work on the source since you have no authority to push changes. You will have no commit history hereby and it is not advisable to work on a source with no commit history.

Run the following command to clone the source locally.

git clone --depth 1 https://github.com/NetErnels/android_kernel_xiaomi_mojito.git mojito -b staging-test

Building

The building part is the easiest part here, since you are going to use my script to accomplish the task smoothly.

  1. Change directory to mojito folder. This is what you call root folder.

  2. Run the script. kver=1 zipn=NetErnels-mojito ./kernel.sh img mod mkzip will start building the kernel. Sit back and enjoy because this will download toolchains, flasher and few scripts. Everything in this point depends on your internet speed.

  3. If the build is successful, obtain the kernel zip from anykernel3-mojito folder inside root directory. At this point, I guess you know how the kernel zip looks like.

  4. Flash the zip and enjoy your newly built kernel.


Inline building


This section describes how to inline the kernel with the ROM you're building.

  1. Make sure this commit for enabling inline kernel compilation with newer versions of GCC exists in vendor/<rom> of the source as we will be a using GCC 12 unlike deprecated GCC 4.9 synced from AOSP git, else cherry-pick it.
  2. In your device tree, navigate to BoardConfig makefile and set the following flags
- TARGET_KERNEL_CLANG_COMPILE := false
- TARGET_KERNEL_NEW_GCC_COMPILE := true
- KERNEL_TOOLCHAIN := $(PWD)/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin
- TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-elf-
- TARGET_KERNEL_CROSS_COMPILE_PREFIX_ARM32 := arm-eabi-
  1. Now Clone EvaGCC from Statix Org
  • Trace through dependencies by adding the following to rom.dependencies
  {
    "remote": "github",
    "repository": "StatiXOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-elf",
    "target_path": "prebuilts/gcc/linux-x86/aarch64/aarch64-elf",
    "branch": "12.0.0"
  },
  {
    "remote": "github",
    "repository": "StatiXOS/android_prebuilts_gcc_linux-x86_arm_arm-eabi",
    "target_path": "prebuilts/gcc/linux-x86/arm/arm-eabi",
    "branch": "12.0.0"
  }
  • Else, just add the following to vendorsetup.sh
# Eva GCC
git clone --depth=1 https://github.com/StatiXOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-elf -b 12.0.0 prebuilts/gcc/linux-x86/aarch64/aarch64-elf
git clone --depth=1 https://github.com/StatiXOS/android_prebuilts_gcc_linux-x86_arm_arm-eabi -b 12.0.0 prebuilts/gcc/linux-x86/arm/arm-eabi
  1. Use neternels_defconfig as the defconfig instead of mojito_defconfig
  2. Use inline branch of the kernel, not the main branch as inline branch is made for inline builds.
  3. Use an updated distro with newer GLIBC.
  4. If you get spams regarding libtinfo6, do install libtinfo6 in your distro to solve it.
  5. Incase you run into the following error during the build:-
[  2% 1811/62106] Building Kernel Image (Image.gz-dtb)
/bin/bash -c "(PATH=/home/workspace/citric/out/host/linux-x86/bin:\$PATH PATH=/home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-/bin:\$PATH PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/bin:\$PATH LD_LIBRARY_PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/lib:\$LD_LIBRARY_PATH PERL5LIB=/home/workspace/citric/prebuilts/tools-citric/common/perl-base BISON_PKGDATADIR=/home/workspace/citric/prebuilts/build-tools/common/bison /home/workspace/citric/prebuilts/build-tools/linux-x86/bin/make  -j8 CFLAGS_MODULE=\"-fno-pic\" CPATH=\"/usr/include:/usr/include/x86_64-linux-gnu\" HOSTCFLAGS=\"-fuse-ld=lld\" HOSTLDFLAGS=\"-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld\" HOSTCC=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang HOSTCXX=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++ LEX=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/bison M4=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/m4 -C kernel/xiaomi/sm6150 O=/home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\"/usr/bin/ccache /home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-\" CROSS_COMPILE_ARM32=\"/home/workspace/citric/prebuilts/gcc/linux-x86/arm/arm-eabi/bin/arm-eabi-\"    Image.gz-dtb ) && (if grep -q '^CONFIG_OF=y' /home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ/.config; then                   echo \"Building DTBs\";                         PATH=/home/workspace/citric/out/host/linux-x86/bin:\$PATH PATH=/home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-/bin:\$PATH PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/bin:\$PATH LD_LIBRARY_PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/lib:\$LD_LIBRARY_PATH PERL5LIB=/home/workspace/citric/prebuilts/tools-citric/common/perl-base BISON_PKGDATADIR=/home/workspace/citric/prebuilts/build-tools/common/bison /home/workspace/citric/prebuilts/build-tools/linux-x86/bin/make  -j8 CFLAGS_MODULE=\"-fno-pic\" CPATH=\"/usr/include:/usr/include/x86_64-linux-gnu\" HOSTCFLAGS=\"-fuse-ld=lld\" HOSTLDFLAGS=\"-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld\" HOSTCC=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang HOSTCXX=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++ LEX=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/bison M4=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/m4 -C kernel/asus/sdm660 O=/home/workspace/citric/out/target/product/X01BD/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\"/usr/bin/ccache /home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-\" CROSS_COMPILE_ARM32=\"/home/workspace/citric/prebuilts/gcc/linux-x86/arm/arm-eabi/bin/arm-eabi-\"    dtbs;             fi ) && (if grep -q '=m' /home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ/.config; then                         echo \"Building Kernel Modules\";                       PATH=/home/workspace/citric/out/host/linux-x86/bin:\$PATH PATH=/home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-/bin:\$PATH PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/bin:\$PATH LD_LIBRARY_PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/lib:\$LD_LIBRARY_PATH PERL5LIB=/home/workspace/citric/prebuilts/tools-citric/common/perl-base BISON_PKGDATADIR=/home/workspace/citric/prebuilts/build-tools/common/bison /home/workspace/citric/prebuilts/build-tools/linux-x86/bin/make  -j8 CFLAGS_MODULE=\"-fno-pic\" CPATH=\"/usr/include:/usr/include/x86_64-linux-gnu\" HOSTCFLAGS=\"-fuse-ld=lld\" HOSTLDFLAGS=\"-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld\" HOSTCC=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang HOSTCXX=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++ LEX=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/bison M4=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/m4 -C kernel/asus/sdm660 O=/home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\"/usr/bin/ccache /home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-\" CROSS_COMPILE_ARM32=\"/home/workspace/citric/prebuilts/gcc/linux-x86/arm/arm-eabi/bin/arm-eabi-\"    modules || exit \"\$?\";                  echo \"Installing Kernel Modules\";                     PATH=/home/workspace/citric/out/host/linux-x86/bin:\$PATH PATH=/home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-/bin:\$PATH PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/bin:\$PATH LD_LIBRARY_PATH=/home/workspace/citric/prebuilts/tools-citric/linux-x86/lib:\$LD_LIBRARY_PATH PERL5LIB=/home/workspace/citric/prebuilts/tools-citric/common/perl-base BISON_PKGDATADIR=/home/workspace/citric/prebuilts/build-tools/common/bison /home/workspace/citric/prebuilts/build-tools/linux-x86/bin/make  -j8 CFLAGS_MODULE=\"-fno-pic\" CPATH=\"/usr/include:/usr/include/x86_64-linux-gnu\" HOSTCFLAGS=\"-fuse-ld=lld\" HOSTLDFLAGS=\"-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld\" HOSTCC=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang HOSTCXX=/home/workspace/citric/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang++ LEX=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/bison M4=/home/workspace/citric/prebuilts/build-tools/linux-x86/bin/m4 -C kernel/asus/sdm660 O=/home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=\"/usr/bin/ccache /home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/aarch64-elf-\" CROSS_COMPILE_ARM32=\"/home/workspace/citric/prebuilts/gcc/linux-x86/arm/arm-eabi/bin/arm-eabi-\"    INSTALL_MOD_PATH=/home/workspace/citric/out/target/product/X01BD/obj/PACKAGING/kernel_modules_intermediates INSTALL_MOD_STRIP=1 modules_install;                        kernel_release=\$(cat /home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ/include/config/kernel.release)                   kernel_modules_dir=/home/workspace/citric/out/target/product/mojito/obj/PACKAGING/kernel_modules_intermediates/lib/modules/\$kernel_release                       ;   modules=\$(find \$kernel_modules_dir -type f -name '*.ko');                      (    mkdir -p /home/workspace/citric/out/target/product/mojito/vendor/lib/modules ) && (cp \$modules /home/workspace/citric/out/target/product/mojito/vendor/lib/modules/ ) && (rm -rf /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates ) && (mkdir -p /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/vendor/lib/modules ) && (cp \$modules /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/vendor/lib/modules ) && (/home/workspace/citric/out/host/linux-x86/bin/depmod -b /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates 0.0 ) && (sed -e 's/\\(.*modules.*\\):/\\/\\1:/g' -e 's/ \\([^ ]*modules[^ ]*\\)/ \\/\\1/g' /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/modules.dep > /home/workspace/citric/out/target/product/X01BD/vendor/lib/modules/modules.dep ) && (cp /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/modules.softdep /home/workspace/citric/out/target/product/mojito/vendor/lib/modules ) && (cp /home/workspace/citric/out/target/product/mojito/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/modules.alias /home/workspace/citric/out/target/product/mojito/vendor/lib/modules ) && (rm -f /home/workspace/citric/out/target/product/mojito/vendor/lib/modules/modules.load ) && (for MODULE in ; do basename \$MODULE >> /home/workspace/citric/out/target/product/mojito/vendor/lib/modules/modules.load; done);                                      fi )"
make: Entering directory '/home/workspace/citric/kernel/xiaomi/mojito'
make[1]: Entering directory '/home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ'
  SLNTOLD include/config/auto.conf
  GEN     ./Makefile
  CHK     include/config/kernel.release
  GEN     ./Makefile
  CHK     include/generated/uapi/linux/version.h
  Using /home/workspace/citric/kernel/xiaomi/mojito as source for kernel
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    /home/workspace/citric/kernel/xiaomi/mojito/scripts/checksyscalls.sh
  LD      arch/arm64/kernel/vdso/vdso.so.dbg
/home/workspace/citric/prebuilts/gcc/linux-x86/aarch64/aarch64-elf/bin/../lib/gcc/aarch64-elf/12.0.0/../../../../aarch64-elf/bin/ld: unrecognised emulation mode: aarch64linux
Supported emulations: aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb
collect2: error: ld returned 1 exit status
make[2]: *** [/home/workspace/citric/kernel/xiaomi/mojito/arch/arm64/kernel/vdso/Makefile:47: arch/arm64/kernel/vdso/vdso.so.dbg] Error 1
make[1]: *** [arch/arm64/Makefile:200: vdso_prepare] Error 2
make[1]: Leaving directory '/home/workspace/citric/out/target/product/mojito/obj/KERNEL_OBJ'
make: *** [Makefile:152: sub-make] Error 2
make: Leaving directory '/home/workspace/citric/kernel/xiaomi/mojito'
13:05:45 ninja failed with: exit status
  • Then your vendor/<rom/> is missing this commit which intentionally points out the 32-bit GCC Path for vdso32 compilation. Cherry-pick it and the build should run without any hassle now.
  1. Incase you run into this error during the build:-
[  2% 1811/62106] Building Kernel Image (Image.gz-dtb)
Outputs: /home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ/arch/arm64/boot/dtbo.img
Error: exited with code: 1
Command: /bin/bash -c "(PATH=/home/vishusingapuriya_gmail_com/ssos/out/host/linux-x86/bin:\$PATH PATH=/home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-/bin:\$PATH PATH=/home/vishusingapuriya_gmail_com/ssos/prebuilts/tools-sssos/linux-x86/bin:\$PATH LD_LIBRARY_PATH=/home/vishusingapuriya_gmail_com/ssos/prebuilts/tools-ssos/linux-x86/lib:\$LD_LIBRARY_PATH PERL5LIB=/home/vishusingapuriya_gmail_com/ssos/prebuilts/tools-ssos/common/perl-base BISON_PKGDATADIR=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/common/bison /home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/make  -j8 CFLAGS_MODULE=\"-fno-pic\" CPATH=\"/usr/include:/usr/include/x86_64-linux-gnu\" HOSTCFLAGS=\"-fuse-ld=lld\" HOSTLDFLAGS=\"-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld\" HOSTCC=/home/vishusingapuriya_gmail_com/ssos/prebuilts/clang/host/linux-x86/clang-r416183b1/bin/clang HOSTCXX=/home/vishusingapuriya_gmail_com/ssos/prebuilts/clang/host/linux-x86/clang-r416183b1/bin/clang++ LEX=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/bison M4=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/m4 -C kernel/xiaomi/sm6150 O=/home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ ARCH=arm64 CROSS_COMPILE=\" /home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/aarch64/arm64-gcc/bin/aarch64-elf-\" CROSS_COMPILE_ARM32=\"/home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel-\" CROSS_COMPILE_COMPAT=\"/home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel-\"    mojito_defconfig ) && (PATH=/home/vishusingapuriya_gmail_com/ssos/out/host/linux-x86/bin:\$PATH PATH=/home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-/bin:\$PATH PATH=/home/vishusingapuriya_gmail_com/ssos/prebuilts/tools-sssos/linux-x86/bin:\$PATH LD_LIBRARY_PATH=/home/vishusingapuriya_gmail_com/ssos/prebuilts/tools-ssos/linux-x86/lib:\$LD_LIBRARY_PATH PERL5LIB=/home/vishusingapuriya_gmail_com/ssos/prebuilts/tools-ssos/common/perl-base BISON_PKGDATADIR=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/common/bison /home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/make  -j8 CFLAGS_MODULE=\"-fno-pic\" CPATH=\"/usr/include:/usr/include/x86_64-linux-gnu\" HOSTCFLAGS=\"-fuse-ld=lld\" HOSTLDFLAGS=\"-L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -fuse-ld=lld\" HOSTCC=/home/vishusingapuriya_gmail_com/ssos/prebuilts/clang/host/linux-x86/clang-r416183b1/bin/clang HOSTCXX=/home/vishusingapuriya_gmail_com/ssos/prebuilts/clang/host/linux-x86/clang-r416183b1/bin/clang++ LEX=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/bison M4=/home/vishusingapuriya_gmail_com/ssos/prebuilts/build-tools/linux-x86/bin/m4 -C kernel/xiaomi/sm6150 O=/home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ ARCH=arm64 CROSS_COMPILE=\" /home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/aarch64/arm64-gcc/bin/aarch64-elf-\" CROSS_COMPILE_ARM32=\"/home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel-\" CROSS_COMPILE_COMPAT=\"/home/vishusingapuriya_gmail_com/ssos/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androidkernel-\"    dtbs ) && (/home/vishusingapuriya_gmail_com/ssos/out/host/linux-x86/bin/mkdtboimg.py create /home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ/arch/arm64/boot/dtbo.img --page_size=4096 \$(find /home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ/arch/arm64/boot/dts -type f -name \"*.dtbo\" | sort) )"
Output:
make: Entering directory '/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150'
make[1]: Entering directory '/home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ'
  GEN     ./Makefile
#
# configuration written to .config
#
make[1]: Leaving directory '/home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ'
make: Leaving directory '/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150'
make: Entering directory '/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150'
make[1]: Entering directory '/home/vishusingapuriya_gmail_com/ssos/out/target/product/mojito/obj/DTBO_OBJ'
  GEN     ./Makefile
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  GEN     ./Makefile
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  Using /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150 as source for kernel
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CC      arch/arm64/kernel/asm-offsets.s
In file included from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/include/asm/atomic.h:41,
                 from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/include/linux/atomic.h:5,
                 from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/include/linux/rcupdate.h:38,
                 from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/include/linux/rculist.h:11,
                 from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/include/linux/pid.h:5,
                 from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/include/linux/sched.h:14,
                 from /home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/kernel/asm-offsets.c:21:
/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/include/asm/cmpxchg.h: In function '__xchg_case_1':
/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/include/asm/cmpxchg.h:38:22: error: expected string literal before 'ARM64_LSE_ATOMIC_INSN'
   38 |         asm volatile(ARM64_LSE_ATOMIC_INSN(                             \
      |                      ^~~~~~~~~~~~~~~~~~~~~
/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/include/asm/cmpxchg.h:50:1: note: in expansion of macro '__XCHG_CASE'
   50 | __XCHG_CASE(w, b,     1,        ,  ,  ,  ,         )
      | ^~~~~~~~~~~
/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/include/asm/cmpxchg.h:36:28: warning: unused variable 'tmp' [-Wunused-variable]
   36 |         unsigned long ret, tmp;                                         \
      |                            ^~~
/home/vishusingapuriya_gmail_com/ssos/kernel/xiaomi/sm6150/arch/arm64/include/asm/cmpxchg.h:50:1: note: in expansion of macro '__XCHG_CASE'
   50 | __XCHG_CASE(w, b,     1,        ,  ,  ,  ,         )
      | ^~~~~~~~~~~
  • Then remove CONFIG_ARM64_LSE_ATOMICS=y from neternels_defconfig
  1. If you get the following spams in your build:-
"llvm-objdump" is not allowed to be used. See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
  • Then you need this commit in your build/soong and your build won't have any spams.
  1. If your ROM uses ArrowOS vendor as a base or enforces LLVM Binutils in which case you might encounter the following error:-
clang-14: error: unable to execute command: Executable "ld" doesn't exist!
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
  • Then you will need this commit in your vendor/<rom> and you will need to set the following flags in your device tree:-
TARGET_KERNEL_LLVM_BINUTILS := true
TARGET_KERNEL_USE_IAS := false

(Once you do this, you can ignore step 11 and 12).

  1. Pick this commit in your vendor/<rom> to use LLVM binutils.
  • Then add the following flag in your boardconfig.mk:
KERNEL_SUPPORTS_LLVM_TOOLS := true
  1. Pick this commit in your vendor/<rom> to fully utilize LLVM binutils from EvaGCC.
  • Then add the following flag in your boardconfig.mk:
LLVM_TOOLS := $(KERNEL_TOOLCHAIN)

That's all, hope you have a fun time compiling my kernel for personal usage or inlining my kernel, I know the steps are sorta complex, but trust me it's worth it :).


Additional Notes


- If you face any errors or bugs, feel free to create a github issue in the repository tab with proper logs, or you can join [@neternels_chat](https://t.me/neternels_chat) and let me know abouut the error / bug you're facing.
- There wont be any OC, UC, UV variant or messed up display refresh rate variant.
- Android R and S is supported. MIUI is not supported yet it may boot in MIUI. Usage of my kernel in MIUI is fully on your own responsibility.
- I don't do retarded power tweaks so don't expect "super fast" charging or "super slow" charging in my kernel as power drivers are left as per stock but with logging reduced.
- I use an efficient frequency setup hence the big cluster will only have 2 frequency steps.
- I put in alot of work for this kernel, the difference between using my kernel and other kernels are highly noticable :).
- There's hardly logspams in my kernel and the kernel is fully debloated from OEM crap plus unnecessary drivers are not built.
- Tune kprofiles for better performance / battery backup / balanced usage.

Credits


  • @ElectroPerf for his cool readme of his kernel.
  • @Panchajanya1999 for his cool wiki of his kernel.
  • Those I cherry-pick from.
  • My testers, as without them this kernel would not be what it is today :).
Clone this wiki locally