-
Notifications
You must be signed in to change notification settings - Fork 1
How To Use
####Clone repository You can clone this repository to your local computer by typing command:
~/Mi_Kernel$ git clone [email protected]:MiCode/Xiaomi_Kernel_OpenSource.git
####Check your branch and tag
This repository have branches for different Xiaomi Phone platform. For example, Mi4's branch is cancro-kk-oss
, then check this branch out.
~/Mi_Kernel$ git checkout cancro-kk-oss
And then get release tag in git log. Normally it should be in the lastest log.
~/Mi_Kernel$ git log
For cancro-kk-oss
, the tag is LNX.LA.3.5.2.2.1-04310-8x74.0
Acutally, this step is optional. But this project integrates many tools such as cross compiler which are required for building our kernel. Of course you can use your own tools to compile kernel, but it may be a tough work to configure.
You can download the whole QAEP on Codeaurora
$ repo init -u git://codeaurora.org/platform/manifest.git -b [branch] -m [manifest] --repo-url=git://codeaurora.org/tools/repo.git --repo-branch=caf-stable
Where branch is list in the Codeaurora web page, usually it should be release
. And manifest is usually $tag.xml
, On cancro-kk-oss
branch, the command should be
~/Qualcomm_Android$ repo init -u git://codeaurora.org/platform/manifest.git -b release -m LNX.LA.3.5.2.2.1-04310-8x74.0.xml --repo-url=git://codeaurora.org/tools/repo.git --repo-branch=caf-stable
And then execute this command to start syncronization.
~/Qualcomm_Android$ repo sync -j8
FYI: This repository is relatively big. You may need hours to download it.
## Download JDK Java Develop Kit is required for building Android project. You can refer to this [link](https://source.android.com/source/initializing.html#installing-the-jdk).FYI: Qualcomm Android Enablement Project(QAEP) only supports Sun/Oracle JDK, you can only download it from this link rather than using apt-get
~/Qualcomm_Android$ rm -rf kernel/*
~/Qualcomm_Android$ cp -rf ~/Mi_Kernel/Xiaomi_Kernel_OpenSource/* kernel/
You need change KERNEL_DEFCONFIG variable to our production defconfig file:
You could do this by editing device/qcom/msm8974/AndroidBoard.mk
, in line 21 change
#----------------------------------------------------------------------
# Compile Linux Kernel
#----------------------------------------------------------------------
ifeq ($(KERNEL_DEFCONFIG),)
KERNEL_DEFCONFIG := msm8974_defconfig
endif
into
#----------------------------------------------------------------------
# Compile Linux Kernel
#----------------------------------------------------------------------
ifeq ($(KERNEL_DEFCONFIG),)
ifeq ($(TARGET_BUILD_VARIANT),eng)
KERNEL_DEFCONFIG := cancro_debug_defconfig
else
KERNEL_DEFCONFIG := cancro_user_defconfig
endif
endif
After all steps above is done, you can finally build the kernel. For Mi4 cancro in this example you can do this:
#generate git patch
~/Qualcomm_Android$ source build/envsetup.sh
~/Qualcomm_Android$ lunch msm8974-userdebug
~/Qualcomm_Android$ make bootimage -j4
Now if everything goes well, you will have a boot.img
file in out/target/product/msm8974
.
You can flash this image into Mi4. Now you can connect Mi4 to usb and press power key and volumn_down key to enter fastboot mode. And then execute this command
#generate git patch
~/Qualcomm_Android$ fastboot flash boot out/target/product/msm8974/boot.img
~/Qualcomm_Android$ fastboot reboot
Now here we go! You can then use adb
to debug linux now.