Build kernel for Nexus5x

本文详细介绍了如何将Nexus5X解锁为开发者模式,启用OEM解锁和USB调试,进入 bootloader 模式并使用 fastboot 命令解锁设备。接着,通过下载源代码和交叉编译器来编译内核,插入自定义驱动,并生成新的 boot.img。文章还涵盖了如何处理verity_key以确保正确生成,并提供了生成 boot.img 的步骤。最后,通过 fastboot 闪存新内核,确保设备的安全启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

  1. 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

  export PATH=~/work/tools/aarch64_4.9/bin:$PATH

  export ARCH=arm64

  export CROSS_COMPILE=aarch64-linux-android-

  make menuconfig bullhead_defconfig

  make

    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.

https://www.reddit.com/r/androiddev/comments/kfrabd/is_bootverity_key_still_used_in_android_verified/

 

    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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值