Contents

Free AOSP source tree compilation Android kernel

In order to let the old Note4 play the residual heat, get rid of the damn SELinux, compile the kernel, macOS can’t compile, lack elf.h, check the solution is quite troublesome, just open a new ubuntu, and try the said good Apple Hypervisor framework [Performance + 10, memory occupancy -50].

Traditional cross compiling needs to checkout the entire Android source code library of more than 20 Gs. Even if shallow clone is specified, it will cost 17 and 8G. This article will throw away unused branches and projects through the black magic of some repo commands to obtain a kernel compilation. lightweight environment.

Environment configuration

Just copy and paste. My environment is a fresh installation of Ubuntu Server 16.04.3

sudo apt-get install git-core gnupg flex bison gperf \
  build-essential zip curl zlib1g-dev gcc-multilib g++-multilib \
  libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev \
  ccache libgl1-mesa-dev libxml2-utils xsltproc unzip \
  repo openjdk-8-jdk bc lzop
cd ~/android  # Change to your favorite Dir
repo init --depth=1 \
  --groups=-all,custom \
  -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest \
  -b android-6.0.1_r3 \
  --repo-url https://mirrors.tuna.tsinghua.edu.cn/git/git-repo  # add last param when having trouble connecting Google

Regarding the selection of the branch detected in the repo command, here you can use the six consecutive letters in the < gt r = “3”/> string, combined with the official website information [^ ver] to determine the specific branch. For example, my < gt r = “4”/>, the version code is < gt r = “5”/>, and the corresponding version is android-1_r3. Some models can also get this value through the < gt r = “6”/> attribute.

There is a hidden all group in the groups parameter, which can exclude all projects at once, and then we write a manifest ourselves, and customize a custom group to whitelist the codebase we want. Save the following file as < gt r = “7”/> and do < gt r = “8”/>

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
   <remove-project name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" />
   <project path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" clone-depth="1" remote="aosp" groups="custom" />
</manifest>

Well, to make it clear that the source effect of git clone is the same.

< Gt r = “9”/> Encountered a little problem… The compiled zImage cannot be brushed in, indicating that the model is incorrect. in trouble. It seems that I am the only one on the entire network who encounters this kind of problem, and I feel so out of place.: (Continue to update after solving

References