Skip to content

Gamesmes90/build_android_kernel_oneplus_sm8350

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kernel build environment for OnePlus SM8350 Kernel

This repository uses various scripts to create a building environment for the OnePlus SM8350 kernel tree.

Requirements

  • A linux distro
  • Git
  • A Lineage OS ROM flashable zip, needed to build a working vendor_dlkm.img
  • A oneplus-sm8350 kernel tree

Getting Started

  • Download the kernel source in the root of this repository
    • The default name for the kernel source tree is android_kernel_oneplus_sm8350
    git clone [your-kernel-repo] android_kernel_oneplus_sm8350
    
  • Download a lineage os build and place it in the root of this repository
    • This will be used to extract the vendor_dlkm.img which will be used as a base for the vendor_dlkm.img of the kernel being built
  • Run build.sh
    ./build.sh
    
    • This will automatically build and package the kernel in an ak3 zip

Output

Final build files will be written in build folder. The environment produces the following

  • Image
    • Kernel image
  • vendord_dlkm.img
    • vendord_dlkm partition
  • modules
    • Folder containing vendor_ramdisk modules
  • kernel-oneplus-sm8350.zip
    • AnyKernel3 flashable zip of the kernel

Scripts Overview

Main script. Contains all possibile commands.

Commands list

  • toolchain_setup
  • kernel
  • kernel_clean
    • Runs make clean and make mrproper on the kernel source tree
    • Implemented in build_kernel.sh
  • vendor
    • Builds vendro_dlkm.img and ramdisk modules
    • Implemented in vendor.sh
  • ak3
    • Packages the kernel with anykernel3
    • See ak3.sh for details.
  • lemonade
    • Downloads the latest Lineage OS ROM for OnePlus 9
    • See lineage.sh for details.
  • lemonadep
    • Downloads the latest Lineage OS ROM for OnePlus 9 Pro
    • See lineage.sh for details.
  • clean
    • Cleans all build artifacts
    • Implemented in build.sh

Utils scripts

These scripts are used by the main scripts for various utility functions

  • colors.sh
    • Has cecho function for colored output
  • extract_vendor_dlkm.sh
    • Extracts the vendor_dlkm.img from the provided Lineage OS zip file
  • set_env.sh
    • Exports to PATH the locations of toolchain utilities
  • lineage.sh
    • Downloads the latest Lineage OS rom for the specified device

Toolchain

The toolchain is installed in ~/android/toolchain_oneplus_sm8350 and has the following tools

Notes

To get a kernel up and running on lemonade/lemonadep, all the modules built with the kernel need to be added in vendor_dlkm.img and a specific set of modules have to be put in vendor_ramdisk and then these have to be flashed with the kernel.

This repository uses a custom AnyKernel3 repo to achieve this.

In addition, the AnyKernel3 repo has a small kernelsu module that runs some kernel tweaks at boot, it is configurable.

Modules in vendor_ramdisk/lib/modules

  • msm_drm.ko
  • apr_dlkm.ko
  • q6_pdr_dlkm.ko
  • q6_notifier_dlkm.ko
  • adsp_loader_dlkm.ko
  • snd_event_dlkm.ko

An alternative to this would be to build the kernel with all the modules as built-in.

vendor_dlkm.img

Using a base image is necessary to build a vendor_dlkm.img, as the image contains other files that are not generated by just building the kernel (e.g. /etc/build.prop generated by the lineage build system). This approach is also easier as it allows to drop-in replacement/new modules in the extracted base image and swiftly generate the erofs image.

About

Build environment for oneplus_sm8350 kernel tree

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages