Root Nexus5x(The following process is normally needed when you have a totally new phone)
1. settings->about phone -> Build number(click multiple times): it will indicate you are a developer
2. enable 'OEM unlock' -> makes the user able to flash boot img.
enable 'USB debuging' -> enable the adb
3. power off the phone, enter the boot loader mode(or #adb reboot-bootloader)
4. #fastboot oem unlock (if DEVICE STATE locked)
5.$PROJECT_PATH\Nexus5X\FactoryImage\image_usedebug\flash-all.bat
6.
#adb root;
#adb disable-verity;
#adb reboot
Build kernel for Nexus5x
- Download source code and the cross-compiler
Source code https://android.googlesource.com/kernel/msm/+refs
package: android-msm-bullhead-3.10-marshmallow-mr2
cross-compiler: aarch64-linux-android-4.9
Extract the kernel source code and cross-compiler to proper path.
2. Run scripts: build_kernel.sh, content as follow
|
3. Insert your driver into below folder:
bullhead_androidM/drivers/misc/
4. Use the original boot.img with scripts in /make_n5_rom/image_sdcard/creat-img.sh to generate the boot.img-ramdisk folder.
Make sure that below two instructions are not commented out in the creat-img.sh script.
./extract-kernel.pl boot.img
./extract-ramdisk.pl boot.img
This step is to make sure that the right verity_key in ramdisk is generated and used.
5. Comment out ./extract-kernel.pl boot.img and ./extract-ramdisk.pl boot.img in /make_n5_rom/image_sdcard/creat-img.sh
6. Generat boot.img with scripts in /make_n5_rom/image_sdcard/creat-img.sh
7. Insert the i2c information in kernel: bullhead_androidM/arch/arm64/boot/dts/lge
msm8992-bullhead-misc.dtsi
8. Compile the kernel with build_kernel.sh
After you get Image.gz-dtb, then run the script:
make_N5x_rom/create_img.sh (this time you can comment out ./extract-kernel.pl boot.img
and ./extract-ramdisk.pl boot.img)
Then you can get boot.img
9. Bootloader mode: fastboot flash boot boot.img
(Replace kernel:
#fastboot boot boot.img ----àKernel will recover to old one when phone reboots
#fastboot flash boot boot.img ----àverified and flash boot.img)
PS: sometimes you host can not know the android device of Nexus5X even you have andriod device dirver. for this issue, you need to install an Qualcom driver since the AP of Nexus5X is Qualcom.