[GUIDE][any UNLOCKED G4]create a custom X cores boot image (ILAPO tempfix)

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
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)

Code:
abootimg -i boot.img
note and copy the whole cmdline output. Example (in red and bold):

Code:
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:

Code:
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:

Code:
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 ;)

Code:
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:

Code:
fastboot flash boot boot.img

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


Cheers
steadfasterX
 
Last edited:

DomagojX

Member
Feb 29, 2012
41
4
38
Zagreb
How can I extract boot.img from phone or KDZ file, so I can modify it. I tryed to make backup from twrp, but the file is boot.emmc.win...
I have H815 20g_00_0720.kdz, rooted, TWRP
 

lq092009

Member
Dec 11, 2017
10
8
3
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

Code:
abootimg -i boot.img
note and copy the whole cmdline output. Example (in red and bold):

Code:
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:

Code:
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)
X can be 1-6 and this defines the maximal amount of cores in Android. If you set it to 4 Android can use 4 only.

boot_cpus=Y-Z (recommended value for bootloop devices: "0-3" or if that still bootloops "0-1")
Y-Z can be 0-5(!) yes no 6! Thats the CPU core number to use on boot. 0-3 will use 4 cpus (so only the little ones) on boot. The difference to maxcpus is that the cpu number starting from 0 where 0 is the first core.

Verify your modified boot image:

Code:
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 ;)

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


Cheers
steadfasterX



Snapdaragon 808 only!
All you have to do is flashing in twrp
Off the kernel's big core

https://drive.google.com/file/d/1ij-qm5qWezoRykwjoTlg0BcQ-do21QIp/view?usp=drivesdk
 
  • Like
Reactions: steadfasterX

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
How can I extract boot.img from phone or KDZ file, so I can modify it. I tryed to make backup from twrp, but the file is boot.emmc.win...
I have H815 20g_00_0720.kdz, rooted, TWRP
Use SALT to take a basic backup. You will find the boot image there too.
Use SALT as well to extract a kdz.


Snapdaragon 808 only!
All you have to do is flashing in twrp
Off the kernel's big core

https://drive.google.com/file/d/1ij-qm5qWezoRykwjoTlg0BcQ-do21QIp/view?usp=drivesdk
Awesome. I have everything prepared to modify boot images on the fly but no time yet to finish it.
Before I started with implementing this I tried unpacking and packaging like you do here (mkbootimg etc) and failed:

Unless you use special versions of unpack image your method will not work for the g4 and results in a soft brick as we need to unpack and pack including the dt.img. Otherwise the kernel will not boot. I tried that already and that was an issue with TWRP long time ago, too.

But thanks anyways and let me know if you can do the same but including the dt




Sent from my LG-H815 using XDA Labs
 
  • Like
Reactions: DomagojX

lq092009

Member
Dec 11, 2017
10
8
3
Use SALT to take a basic backup. You will find the boot image there too.
Use SALT as well to extract a kdz.



Awesome. I have everything prepared to modify boot images on the fly but no time yet to finish it.
Before I started with implementing this I tried unpacking and packaging like you do here (mkbootimg etc) and failed:

Unless you use special versions of unpack image your method will not work for the g4 and results in a soft brick as we need to unpack and pack including the dt.img. Otherwise the kernel will not boot. I tried that already and that was an issue with TWRP long time ago, too.

But thanks anyways and let me know if you can do the same but including the dt



Sent from my LG-H815 using XDA Labs
It must be flashing before modifying the kernel with a magisk or supersu
 

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
It must be flashing before modifying the kernel with a magisk or supersu
Sure. That's not the problem. I referring to the dt.img which does not get extracted from the boot image the way you do it. Without this the device will not boot as the bootloader aboot needs it!

This has nothing to do with magisk or supersu.





Sent from my LG-H815 using XDA Labs
 

DoughMucker

Senior Member
Sep 11, 2013
314
168
63
I've been using this on a phone that was overheating a couple times a day. It's been two days without a reboot/loop. Thanks!

You've given new life for a phone that was sitting in a drawer. This, combined with the bootloader unlock, and the roms are fantastic!
 
  • Like
Reactions: steadfasterX

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
I've been using this on a phone that was overheating a couple times a day. It's been two days without a reboot/loop. Thanks!

You've given new life for a phone that was sitting in a drawer. This, combined with the bootloader unlock, and the roms are fantastic!
I'm glad it helps :)



Sent from my LG-H815 using XDA Labs
 
  • Like
Reactions: DoughMucker

obvious

Senior Member
Mar 8, 2005
826
344
83
I've had a quick look for a way to do this from within android but had no luck. I wonder if there's a kitchen tool in the play store that would work, or some android shell or busybox type add-on.
 

izzle47

Member
Jan 7, 2014
13
2
3
@steadfasterX Apologies for the noob request, I am not very good with linux , i followed the steps above , and when i try to flash the boot image it raises an error in fastboot remote:image is not a boot image
Kindly assist me.
 
Last edited:

izzle47

Member
Jan 7, 2014
13
2
3
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

Code:
abootimg -i boot.img
note and copy the whole cmdline output. Example (in red and bold):

Code:
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:

Code:
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)
X can be 1-6 and this defines the maximal amount of cores in Android. If you set it to 4 Android can use 4 only.

boot_cpus=Y-Z (recommended value for bootloop devices: "0-3" or if that still bootloops "0-1")
Y-Z can be 0-5(!) yes no 6! Thats the CPU core number to use on boot. 0-3 will use 4 cpus (so only the little ones) on boot. The difference to maxcpus is that the cpu number starting from 0 where 0 is the first core.

Verify your modified boot image:

Code:
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 ;)

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


Cheers
steadfasterX
Hello @steadfasterX
I wanted to request your assistance in creating a custom boot image for my device I tried to do it from your thread a couple of times I really don't know what the issue could be.
It raises the error remote :image is not a boot image when I try to flash it in fastboot
I have attached a link to my boot.bin image file
Thanks.https://mega.nz/#!m8QRXSJJ!R90SoS48O...IJ_Uvdrsp9tYoE
I am on the latest twrp for N posted on your server
 

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
Hello @steadfasterX
I wanted to request your assistance in creating a custom boot image for my device I tried to do it from your thread a couple of times I really don't know what the issue could be.
It raises the error remote :image is not a boot image when I try to flash it in fastboot
I have attached a link to my boot.bin image file
Thanks.https://mega.nz/#!m8QRXSJJ!R90SoS48O...IJ_Uvdrsp9tYoE
I am on the latest twrp for N posted on your server
first of all I have a friendly advice for you never ever quote big posts like mine. Regarding your problem try FWUL to modify it. I have no time at the moment sorry but maybe someone else can help you as well if FWUL doesn't help


Sent from my LG-H815 using XDA Labs
 

capricorn85

Member
Oct 10, 2011
22
2
0
Hi

Thanks for sharing the method. I want to boot with only 1 core and later use 4 cores. How can i write for that:

maxcpus=4 boot_cpus=0-0
OR
maxcpus=4 boot_cpus=0

Also wanted to confirm that when do the maxcpus=4 become functional, i gues that starts to happen right after the LG logo appears or it happens when the boot process has finished.

I am guessing that boot_cpus=0-0 and 0 are not working. I can guess that because of the speed the animated logo appears. WHen it set it like max_cpus=1 it only boots and works on one core.

WHat i want is to boot with one core and later automatically switch to 4 cores when the system has loaded.