I’m trying to port some linux kernel optimisation patches from OnePlus 5 to my Xiaomi Mi 6. Here are some quick notes for some issues and errors I’ve encountered.

Btw here is the kernel repo:

For someone who cares about this kernel, please use with precaution, I’m not sure if it works or not.

Issue 1


build/core/ *** Error: could not find jdk tools.jar 
at /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/../lib/tools.jar, 
please check if your JDK was installed correctly.  Stop.

Android buildroot script (makefiles) need two Java home path variables to make it works. The variables are JAVA_HOMEand ANDROID_JAVA_HOME.


Add two lines to ~/.zshrc or ~/.bashrc:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export ANDROID_JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

Issue 2


I terminated the iTerm session by mistake, so I didn’t get the full error log. But it should be something like this:

Could not find a supported mac sdk


Download macOS SDK package from here:

Then unzip to /Developer/SDKs

Issue 3


The boot animation could not be generated as
ImageMagick is not installed in your system.

Please install ImageMagick from this website:
./vendor/mk/bootanimation/ *** stop.


Install ImageMagick via brew: brew install imagemagick