TWRP 2.8.3.0 Available for Supported Devices

The TeamWin Recovery Project (or TWRP, for short) has quickly become one of the most popular … more

Easily Generate and Export Material Design Palletes

For many people, it can be pretty difficult to create a palette of complementary colors. … more

Android One Expanding to Bangladesh, Nepal, and Sri Lanka

At Google I/O 2013, Google proudly announced that the Android operating system was … more

Android 5.0.2 Fixes 2012 Nexus 7! Sony’s Making a Google Glass Competitor? – XDA TV

Android 5.0.2 Lollipop is available for the … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[DEV] Kexec-hardboot

OP Olivier

8th August 2014, 07:10 PM   |  #1  
Olivier's Avatar
OP Recognized Developer / Recognized Contributor
Flag Linz
Thanks Meter: 4,161
 
2,207 posts
Join Date:Joined: Nov 2011
Donate to Me
More
PREAMBLE
Just to clear things up - I'm definitely not responsible for anything. This patch will not work on devices with locked bootloaders.

Quote:
Originally Posted by Tasssadar

This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
For flo, I've improved the patch a bit - only the host needs to be patched now and I also fixed a bug with /proc/atags not reading all tags.

Thanks to omnirom - I used their kernel as a base.
Special thanks to Tasssadar for his kexec-hardboot patch for the Nexus 4. Also thanks to alvinhochun and krabappel2548. I borrowed some of their code.


WHAT'S KEXEC?
Quote:
Originally Posted by Tasssadar

It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 4. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.


What is the difference between normal and hardboot kexec?
Quote:
Originally Posted by Tasssadar

Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Unlike grouper's kexec-hardboot patch, this one only requires the host kernel to be patched. This is one of the improvements I made, and I think it is pretty significant.
To sumarize the process:

  1. kexec --load-hardboot.... is called and kernel it loaded into RAM.
  2. kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
  3. After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
  4. Kexecd' kernel starts and boots.
For more info, read the original thread.



INSTRUCTIONs
  1. Download kexec-hardboot-yuga.zip and unzip it
  2. Flash my patched host kernel (kexec-kernel-20140808-yuga.zip)
  3. Push initrd.img, kexec, kexec.sh and zImage to /cache
  4. Use a terminal to do the following:
    Code:
    adb shell
    su
    cd cache
    chmod 0755 kexec
    sh ./kexec.sh



SOURCEs
Kexec-hardboot patch
Kernel

XDA:DevDB Information
Kexec-hardboot patch for Sony Xperia Z, Tool/Utility for the Sony Xperia Z

Contributors
Olivier

Version Information
Status: Testing

Created 2014-08-08
Last Updated 2014-08-08
The Following 9 Users Say Thank You to Olivier For This Useful Post: [ View ]
8th August 2014, 08:16 PM   |  #2  
xarive's Avatar
Senior Member
Flag Georgetown, Ayer Itam
Thanks Meter: 114
 
530 posts
Join Date:Joined: Dec 2011
More
I'm sorry I would like to ask a question. If I kexec boot my phone with yuga kernel and cwm, flashes the yuga ROM would it be possible to get dual booting the Yuga ROM?

Source: http://forum.xda-developers.com/show...7&postcount=25
Pretty old source but would it be possible?
8th August 2014, 11:17 PM   |  #3  
Olivier's Avatar
OP Recognized Developer / Recognized Contributor
Flag Linz
Thanks Meter: 4,161
 
2,207 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Quote:
Originally Posted by xarive

I'm sorry I would like to ask a question. If I kexec boot my phone with yuga kernel and cwm, flashes the yuga ROM would it be possible to get dual booting the Yuga ROM?

Source: http://forum.xda-developers.com/show...7&postcount=25
Pretty old source but would it be possible?

Sure thing

Gesendet von meinem Xperia Z mit Tapatalk
The Following User Says Thank You to Olivier For This Useful Post: [ View ]
9th August 2014, 12:14 AM   |  #4  
Tommy-Geenexus's Avatar
Senior Member
Flag Stone Hill
Thanks Meter: 954
 
1,918 posts
Join Date:Joined: Apr 2013
More
Nice to see you got a Z now.
Will try this one out definitly
9th August 2014, 08:36 PM   |  #5  
bbeanss's Avatar
Senior Member
Flag Coventry
Thanks Meter: 121
 
295 posts
Join Date:Joined: May 2011
More
Sweet! Trying this out straight after work!

Beans
10th August 2014, 08:41 AM   |  #6  
xarive's Avatar
Senior Member
Flag Georgetown, Ayer Itam
Thanks Meter: 114
 
530 posts
Join Date:Joined: Dec 2011
More
I am still not quite clear about dual booting with kexec. Did OP done it before?

Sent from my C6603 using Tapatalk 2
10th August 2014, 09:25 AM   |  #7  
siddhesh1609's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 48
 
498 posts
Join Date:Joined: Apr 2009
More
Can we load some other kernal on our devices using kexec without unlocking bootloader??
I had a Motorola atrix 2 which used to do this..
11th August 2014, 07:22 AM   |  #8  
AngelBob's Avatar
Senior Member
Thanks Meter: 385
 
251 posts
Join Date:Joined: Jun 2013
Donate to Me
More
Quote:
Originally Posted by siddhesh1609

Can we load some other kernal on our devices using kexec without unlocking bootloader??
I had a Motorola atrix 2 which used to do this..

No, LB Yuga's are missing kexec, even compiling a external kernel module is not possible as the zimage is missing some required symbols for kexec to work.

The Following User Says Thank You to AngelBob For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes