FORUMS
Remove All Ads from XDA

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

4,449 posts
Thanks Meter: 10,962
 
By steadfasterX, Recognized Developer on 12th December 2017, 06:31 PM
Post Reply Email Thread
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

* 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

* 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 = 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 buildvariant=userdebug"
  • 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

* 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
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
The Following 16 Users Say Thank You to steadfasterX For This Useful Post: [ View ]
 
 
12th December 2017, 06:31 PM |#2  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 10,962
 
Donate to Me
More
reserved.
The Following 3 Users Say Thank You to steadfasterX For This Useful Post: [ View ]
13th December 2017, 12:37 PM |#3  
Junior Member
Thanks Meter: 0
 
More
Any way to fix issue in locked device? Still stucked on lollipop with root.
13th December 2017, 01:05 PM |#4  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 10,962
 
Donate to Me
More
Quote:
Originally Posted by kalanakodicara

Any way to fix issue in locked device? Still stucked on lollipop with root.

depends on your device and current ARB. I added the aboot TOT flashing method which also works on locked devices but u need to take care of the ARB (all mentioned there including links etc):
https://forum.xda-developers.com/g4/...-list-t3667688

,
13th December 2017, 01:15 PM |#5  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by steadfasterX

depends on your device and current ARB. I added the aboot TOT flashing method which also works on locked devices but u need to take care of the ARB (all mentioned there including links etc):
https://forum.xda-developers.com/g4/...-list-t3667688

,

Its h815 SEA and can i use tot method for v29a or 20p?
19th January 2018, 12:45 AM |#6  
DomagojX's Avatar
Member
Flag Zagreb
Thanks Meter: 4
 
More
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
19th January 2018, 02:23 AM |#7  
Junior Member
Thanks Meter: 8
 
More
Quote:
Originally Posted by 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

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

* 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

* 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 = 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 buildvariant=userdebug"
  • 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

* 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
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-...w?usp=drivesdk
The Following User Says Thank You to lq092009 For This Useful Post: [ View ] Gift lq092009 Ad-Free
19th January 2018, 05:27 AM |#8  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 10,962
 
Donate to Me
More
Quote:
Originally Posted by DomagojX

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.


Quote:
Originally Posted by lq092009

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-...w?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
The Following User Says Thank You to steadfasterX For This Useful Post: [ View ]
19th January 2018, 06:14 AM |#9  
Junior Member
Thanks Meter: 8
 
More
Quote:
Originally Posted by steadfasterX

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
19th January 2018, 07:38 AM |#10  
steadfasterX's Avatar
OP Recognized Developer
Thanks Meter: 10,962
 
Donate to Me
More
Quote:
Originally Posted by lq092009

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
24th January 2018, 08:30 PM |#11  
Senior Member
Thanks Meter: 155
 
More
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!
The Following User Says Thank You to DoughMucker For This Useful Post: [ View ] Gift DoughMucker Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes