Transfer huge amount of source files via network (SCP + GZip)


I’ve got a modified AOSP (Mokee, ~50GB with repo cache) need to be transferred from my Mac to my Thinkpad. But macOS does not support linux file systems while Linux does not support apple file systems too.


After a quick Google, I’ve found a way to solve this issue by using WiFi to transfer.

Simply transfer the file with SCP/FTP is not fast enough as the source tree is way too large. Here we use GZip to compress the data, then put it to SCP’s pipe, and decompress the data on the target machine.

The command is:

tar zcvf - mokee | ssh [email protected] "cd /home/hu/target/mokee/directory; tar zx"


Looks good, 25~35MB/s with 802.11ac (867Mbps, 2×2 MIMO) connection.


Compile Android kernel without AOSP buildroot environment


Recently I’ve started a kernel porting project for Xiaomi Mi 6, porting optimisation patches from open source community (e.g. XDA-Developer’s OnePlus 5 forum). Here is a quick note for environment setup and compiling the kernel only without AOSP buildroot.


  1. Install dependencies: sudo apt install kernel-package git-core
  2. Download the source: git clone
  3. Toolchain setup: you can either try using Android perbuilt toolchains (may not work on my kernel project due to compiler argument in CFLAG is not supported with GCC 4.9), or build by your own with crosstool-ng


  • Set environment variables:
export CROSS_COMPILE=aarch64-your-toolchain-name-
export ARCH=arm64
  • Load configuration file
make defconfig sagit_user_defconfig
  • Build the kernel
make -j8

Creating flashable package

  • Create a DTB-bundled kernel image. Since Xiaomi’s kernel building script somehow messed up, the Image.gz-dtb is the same as Image.gz. So we have to do the merge by our own:
cat arch/arm64/boot/Image.gz arch/arm64/boot/dts/qcom/*.dtb > zImage

Android kernel compilation on macOS


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