Nexus 5X bootloop fix - Install Android monthly security updates

This article is my checklist to install the monthly Android security updates into my Nexus 5X.

Since my phone is cursed with the Bootloop of Death (BLOD) hardware problem, I cannot install the vanilla OTA updates. Instead, I have to manually download the official Android image from Google, edit it to apply the fix, and then flash the fixed image into the phone.

About the bootloop: One day, while using my Nexus 5X, it suddenly restarted and became unusable, stuck in an endless boot process (bootloop). Unfortunately, this is a known hardware problem that occurs in both the Nexus 5X and Nexus 6P phones. There is a hacky fix: via software, you should disable two of the six available cores in the phone processor (SoC). Read more about it here, here and here.

Step 1 - Unlock the bootloader

The phone’s bootloader must be unlocked so you can flash the fixed images.

Tutorial: How to unlock the Nexus 5X bootloader

Step 2 - Download the necessary files

Download and unzip the official Android SDK Platform Tools, which contains the required fastboot binary:

Download the Python script used to modify the Android boot images, disabling the faulty hardware:

Download from Google the official, most recent Android image for the Nexus 5X (nicknamed bullhead):

Step 3 - Prepare the files

Unzip the Android image into a new folder. This will be our work folder.

Inside there will be another zip file which contains the boot images. Unzip that too.

# Using Oreo 8.1 files as an example

unzip bullhead-opm1.171019.011-factory-3be6fd1c.zip

cd bullhead-opm1.171019.011

unzip image-bullhead-opm1.171019.011.zip

Now copy here the downloaded Python script:

cp ~/Downloads/disable_cpu_cores.py .

Also copy here the fastboot binary:

cp ~/Downloads/platform-tools/fastboot .

At this point, all the necessary files are on the same folder:

android-info.txt
boot.img
bootloader-bullhead-bhz31a.img
disable_cpu_cores.py
fastboot
flash-all.bat
flash-all.sh
flash-base.sh
radio-bullhead-m8994f-2.6.40.4.04.img
recovery.img
system.img
vendor.img

Step 4 - Apply the image fix

Run the Python script on both the boot and recovery images:

python disable_cpu_cores.py boot.img boot_4c.img

python disable_cpu_cores.py recovery.img recovery_4c.img

Note that the fixed files have a _4c suffix to make it clear that those are the modified images (limited to 4 cores).

Step 5 - Prepare the phone

Put the phone in Fastboot Mode: turn off the phone and hold Volume Down and Power buttons until the fastboot screen appears.

Tutorial: Nexus 5X: How to Boot into Fastboot Mode

Plug the phone to your computer and make sure it is listed as an available device:

./fastboot devices

If nothing appears, try using another cable. Some cables I tried here were charging-only.

Step 6 - Flash all the images to your phone

Run the official Google script to install the base system images to your phone (bootloader and radio):

PATH="$PWD:$PATH" ./flash-base.sh

The PATH variable is necessary so the script can find the ./fastboot file.

Now flash all the other images, making sure your are using the _4c version for the boot and recovery images.

./fastboot flash boot boot_4c.img
./fastboot flash recovery recovery_4c.img
./fastboot flash system system.img
./fastboot flash vendor vendor.img

Now just reboot your phone and enjoy the updated Android!

./fastboot reboot

Troubleshooting: Clear cache partition

Only one time this update process failed on me and I was back stuck on the bootloop. The fix was simple: booting into Recovery Mode and clearing the cache partition.

Tutorial: Nexus 5X: How to Wipe the Cache Partition

— EOF —
GitHub