[DEV][KERNEL]Kexec-hardboot patch

Search This thread

alvinhochun

Senior Member
Oct 3, 2010
175
202
I would like to explain this a little bit:

What is kexec?
It is a function which allows you to boot an alternative kernel without needing to flash it or using `fastboot boot`. I am not going to write a thousand words to explain this, so if you want more info, search it yourself.

What is kexec hardboot?
It does the same as what kexec aims to do, but instead of booting another kernel directly, it reboots the device before doing so so that the hardware can be reinitialized by the bootloader. Normal kexec boots the kernel with the hardware in an unclean state, which is not very healthy. Kexec hardboot is somehow healthier.

I know I am not explaining very well, so please refer to the original thread by @Tasssadar

So what is this post about?
At this moment, there aren't any non-stock ROM, CAF or CM kernel isn't ported yet, so this is pretty useless actually.
In the future, if there are any custom ROMs, this will come in handy because it will allow "installing" multiple ROMs without having to flash them to the device memory.
Basically, this is just to prepare for the future.

Who should be reading this?
Well, developers who can properly compile a kernel.

Patches:
Kernel patch: https://gist.github.com/alvinhochun/7945428
Or, if you cloned my github stock kernel tree, check this: https://github.com/alvinhochun/sony-xperia-m-kernel/commit/2e818d81f21f6a627bc629e477052045426b0663
This is the kernel patch. Only the host kernel needs to be patched.
Related CONFIG options:
  • CONFIG_KEXEC=y
  • CONFIG_KEXEC_HARDBOOT=y
  • CONFIG_ATAGS_PROC=y
All these options must be enabled.

Userspace kexec binary: Use the one compiled by @Tasssadar on http://xdaforums.com/showthread.php?p=46223952

Usage:
I have wrote a simple shell script to automatically set the correct cmdline here:
https://gist.github.com/alvinhochun/7945270

Basically, the most important thing is to make sure the addresses are correct and the cmdline has the proper information in it.
The script requires kernel to be packed with CWM which also provides /boot/busybox. You can use this tool: http://xdaforums.com/showthread.php?t=2481864
Just download the kexec binary and put it in place.

Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices.
My patch is based on the one by @Tasssadar on http://xdaforums.com/showthread.php?p=46223952
 
Last edited:

nabelar82

Senior Member
Dec 30, 2010
118
4
I would like to explain this a little bit:

What is kexec?
It is a function which allows you to boot an alternative kernel without needing to flash it or using `fastboot boot`. I am not going to write a thousand words to explain this, so if you want more info, search it yourself.

What is kexec hardboot?
It does the same as what kexec aims to do, but instead of booting another kernel directly, it reboots the device before doing so so that the hardware can be reinitialized by the bootloader. Normal kexec boots the kernel with the hardware in an unclean state, which is not very healthy. Kexec hardboot is somehow healthier.

I know I am not explaining very well, so please refer to the original thread by @Tasssadar

So what is this post about?
At this moment, there aren't any non-stock ROM, CAF or CM kernel isn't ported yet, so this is pretty useless actually.
In the future, if there are any custom ROMs, this will come in handy because it will allow "installing" multiple ROMs without having to flash them to the device memory.
Basically, this is just to prepare for the future.

Who should be reading this?
Well, developers who can properly compile a kernel.

Patches:
Kernel patch: https://gist.github.com/alvinhochun/7945428
Or, if you cloned my github stock kernel tree, check this: https://github.com/alvinhochun/sony-xperia-m-kernel/commit/2e818d81f21f6a627bc629e477052045426b0663
This is the kernel patch. Only the host kernel needs to be patched.
Related CONFIG options:
  • CONFIG_KEXEC=y
  • CONFIG_KEXEC_HARDBOOT=y
  • CONFIG_ATAGS_PROC=y
All these options must be enabled.

Userspace kexec binary: Use the one compiled by @Tasssadar on http://xdaforums.com/showthread.php?p=46223952

Usage:
I have wrote a simple shell script to automatically set the correct cmdline here:
https://gist.github.com/alvinhochun/7945270

Basically, the most important thing is to make sure the addresses are correct and the cmdline has the proper information in it.
The script requires kernel to be packed with CWM which also provides /boot/busybox. You can use this tool: http://xdaforums.com/showthread.php?t=2481864
Just download the kexec binary and put it in place.

Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices.
My patch is based on the one by @Tasssadar on http://xdaforums.com/showthread.php?p=46223952

can we use this to boot cm10 cm11 on sony Xperia z?
 

nabelar82

Senior Member
Dec 30, 2010
118
4
I guess you are mislead this is a kernel feature and is not at all related to booting of a rom :)

Well I read that but I been looking the way that we can install cm11 on our xperia z with locked bootloader and this seems to help cause we can't flash boot img on locked bootloader
 

dvm84

Senior Member
Jun 16, 2014
156
105
Well I read that but I been looking the way that we can install cm11 on our xperia z with locked bootloader and this seems to help cause we can't flash boot img on locked bootloader
Not really.

But Recognized Developer @Rachit Rawat has explained how the Locked Bootloader CM is booted and I see @Olivier have worked on the same for Xperia S you can try to contact him

Explanation Link: http://xdaforums.com/showthread.php?p=49073506#post49073506
 

aweosomeabhijeet

Senior Member
Oct 4, 2012
886
972
28
Jaipur
next2tech.net
Well I read that but I been looking the way that we can install cm11 on our xperia z with locked bootloader and this seems to help cause we can't flash boot img on locked bootloader
Surely there is a way known as 2nd-init, with which we can change the ramdisk without changing the kernel.

Xperia SP has 3-4 ROMs booted with the same method on locked bootloader. You can search in SP forums and contact the respective persons for porting the feature.
 

nabelar82

Senior Member
Dec 30, 2010
118
4
Surely there is a way known as 2nd-init, with which we can change the ramdisk without changing the kernel.

Xperia SP has 3-4 ROMs booted with the same method on locked bootloader. You can search in SP forums and contact the respective persons for porting the feature.

Well I am very interested on this patch but I am not a developer it will be very interesting if someone apply on a xperia z an we can test can someone try? I can test
 

Top Liked Posts

  • There are no posts matching your filters.
  • 16
    I would like to explain this a little bit:

    What is kexec?
    It is a function which allows you to boot an alternative kernel without needing to flash it or using `fastboot boot`. I am not going to write a thousand words to explain this, so if you want more info, search it yourself.

    What is kexec hardboot?
    It does the same as what kexec aims to do, but instead of booting another kernel directly, it reboots the device before doing so so that the hardware can be reinitialized by the bootloader. Normal kexec boots the kernel with the hardware in an unclean state, which is not very healthy. Kexec hardboot is somehow healthier.

    I know I am not explaining very well, so please refer to the original thread by @Tasssadar

    So what is this post about?
    At this moment, there aren't any non-stock ROM, CAF or CM kernel isn't ported yet, so this is pretty useless actually.
    In the future, if there are any custom ROMs, this will come in handy because it will allow "installing" multiple ROMs without having to flash them to the device memory.
    Basically, this is just to prepare for the future.

    Who should be reading this?
    Well, developers who can properly compile a kernel.

    Patches:
    Kernel patch: https://gist.github.com/alvinhochun/7945428
    Or, if you cloned my github stock kernel tree, check this: https://github.com/alvinhochun/sony-xperia-m-kernel/commit/2e818d81f21f6a627bc629e477052045426b0663
    This is the kernel patch. Only the host kernel needs to be patched.
    Related CONFIG options:
    • CONFIG_KEXEC=y
    • CONFIG_KEXEC_HARDBOOT=y
    • CONFIG_ATAGS_PROC=y
    All these options must be enabled.

    Userspace kexec binary: Use the one compiled by @Tasssadar on http://xdaforums.com/showthread.php?p=46223952

    Usage:
    I have wrote a simple shell script to automatically set the correct cmdline here:
    https://gist.github.com/alvinhochun/7945270

    Basically, the most important thing is to make sure the addresses are correct and the cmdline has the proper information in it.
    The script requires kernel to be packed with CWM which also provides /boot/busybox. You can use this tool: http://xdaforums.com/showthread.php?t=2481864
    Just download the kexec binary and put it in place.

    Authors:
    This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices.
    My patch is based on the one by @Tasssadar on http://xdaforums.com/showthread.php?p=46223952