[G4 General] steadfasterX:
The X cores GUIDE

About

I have created many bootloop-fix boot images in the past and as the way to do it on your own is (in general) very easy I wanted to write it down so everyone can do it by himself.

The reason? The ILAPO (hardware related bootloop) happens due to overheating and so throttling the device may help in extends the life of your device and can even resurrect your phone when in a bootloop.

Again using a reduced amount of cores will be a temporary fix only as the ILAPO is a

hardware

issue! Read the bootloop-fixit-list for details.

Maybe you do not need to create one - checkout the current available 4-core boot images here: temporary-bootloop-fix-thread

This requires an unlocked device to flash and use!

Howto

Creating a custom boot image is very easy and done in 5 sec.

you need the tool: abootimg - so Linux or FWUL (included since v3.0)

abootimg -i boot.img

note and copy the whole cmdline output. Example (in red and bold):

Android Boot Image Info:

* file name = boot.img

* image size = 29614080 bytes (28.24 MB)
page size = 4096 bytes

* Boot Name = ""

* kernel size = 26722280 bytes (25.48 MB)
ramdisk size = 1668572 bytes (1.59 MB)

* load addresses:
kernel: 0x00008000
ramdisk: 0x01000000
tags: 0x00000100

* [B][COLOR="Red"]cmdline = console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x37 boot_cpus=0-5 buildvariant=userdebug[/COLOR][/B]

* id = 0xf19c37df 0x9734fb7a 0x3c6b45f4 0x3a8d0267 0x32786841 0x00000000 0x00000000 0x00000000

Ok now you need to modify -

NOT

UNPACK the boot image!! thats 1) not necessary and 2) it will make your boot image unbootable (when using abootimg).

Now modify for your wanted amount of cores.

Let's assume you want to use in Android 4 cores as max and on boot 4 cores max as well:

abootimg -u boot.img -c "cmdline = [B]maxcpus=4 boot_cpus=0-3[/B] [COLOR="Red"]console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x37 boot_cpus=0-5 buildvariant=userdebug[/COLOR]"

Noted the bold part: maxcpus=4 boot_cpus=0-3 ? That is the magic which sets the wanted cores.

Noted the red part: console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x37 boot_cpus=0-5 buildvariant=userdebug ?

Thats just the regular cmdline copied from the original boot image you written done in the first step.

You may noticed that there is

another

boot_cpus value in that particular case set right? boot_cpus=0-5 in this case. You can remove or leave it as u like.

The reason is: the boot cmdline will be handled like: first match = wins. so when doing as explained you will set boot_cpus and maxcpus at the very beginning of the cmdline and so we will overwrite whatever comes next.

maxcpus=X (recommended value for bootloop devices: 4)

> Maximum number of processors that	an SMP kernel should make use of. maxcpus=n : n >= 0 limits the kernel to using 'n' processors. n=0 is a special case, it is equivalent to "nosmp", which also disables the IO APIC. (source)

X can be from 1 to 6 and defines the maximal available amount of cores in Android. If you set it to 4 Android can use 4 only. For Android you must enable them manually which requires always root access (e.g. by an app like Kernel Adiutor)

boot_cpus=Y-Z (recommended value for bootloop devices: "0-3" or if that still bootloops "0-1")

> Rather than attempting to online all possible CPUs at boot time, only online the specified set of CPUs. (source)

Y-Z can be 0-5(!) yes there is no 6! Thats the CPU core "IDs" to use on boot. 0-3 will use 4 cpus (so only the little cores which are: 0,1,2,3 - as 4 and 5 are the big ones causing the ILAPO more) on boot. Note that the setting differs to maxcpus as the numbers here starting from 0 where 0 is the first core. You can set a single core, comma separated core IDs or define ranges here. When you want to set just a single core here it may be required to set boot_cpus=1 instead of boot_cpus=0.

Verify your modified boot image:

abootimg -i boot.img

Android Boot Image Info:

* file name = boot.img

* image size = 29614080 bytes (28.24 MB)
page size = 4096 bytes

* Boot Name = ""

* kernel size = 26722280 bytes (25.48 MB)
ramdisk size = 1668572 bytes (1.59 MB)

* load addresses:
kernel: 0x00008000
ramdisk: 0x01000000
tags: 0x00000100

* [B]cmdline = maxcpus=4 boot_cpus=0-3 console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x37 boot_cpus=0-5[/B]
buildvariant=userdebug

* id = 0x00000160 0x4bd3a2b4 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000

Whats next?

So now you're prepared to flash your modified X cores boot image via fastboot and see if it boots ;)

fastboot boot boot.img

This above will *temporary* boot your modified boot image and is meant for testing it only.

To install it permanently use this command in fastboot mode:

fastboot flash boot boot.img

You can do this on every boot image or recovery image (so yes even on TWRP !)

Cheers

steadfasterX