Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,805,161 Members 52,143 Now Online
XDA Developers Android and Mobile Development Forum

[DEV] Kexec-hardboot

Tip us?
 
Olivier
Old
#1  
Olivier's Avatar
Recognized Contributor - OP
Thanks Meter 3,411
Posts: 2,013
Join Date: Nov 2011
Location: Linz

 
DONATE TO ME
Default [DEV] Kexec-hardboot

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 View Post
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 View Post
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 View Post
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: [ Click to Expand ]
 
xarive
Old
#2  
xarive's Avatar
Senior Member
Thanks Meter 109
Posts: 504
Join Date: Dec 2011
Location: Georgetown, Ayer Itam
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?
 
Olivier
Old
#3  
Olivier's Avatar
Recognized Contributor - OP
Thanks Meter 3,411
Posts: 2,013
Join Date: Nov 2011
Location: Linz

 
DONATE TO ME
Quote:
Originally Posted by xarive View Post
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
OmniROM/androidarmv6/PAC-ROM Maintainer

Devices I use(d): Orange Boston - HTC Wildfire S - Sony Xperia S -Sony Xperia Z
The Following User Says Thank You to Olivier For This Useful Post: [ Click to Expand ]
 
Tommy-Geenexus
Old
#4  
Tommy-Geenexus's Avatar
Senior Member
Thanks Meter 737
Posts: 1,738
Join Date: Apr 2013
Location: Stone Hill
Nice to see you got a Z now.
Will try this one out definitly
2011 - Sony Ericsson Xperia Neo
2013 - Asus Nexus 7
2013 - Sony Xperia Z
2014 - LG Nexus 5
2014 - Sony Xperia Tablet Z3 Compact
 
bbeanss
Old
#5  
bbeanss's Avatar
Senior Member
Thanks Meter 120
Posts: 285
Join Date: May 2011
Location: Coventry
Sweet! Trying this out straight after work!

Beans
Device & Accessories


Sony Xperia Z (C6603)

Rom: Unofficial AOSB (Latest)
Kernel: Unofficial AOSB (Latest)
Case: Spigen Ultra Capsule (Black)

Screen Protector for both devices: XtremeGuard
 
xarive
Old
#6  
xarive's Avatar
Senior Member
Thanks Meter 109
Posts: 504
Join Date: Dec 2011
Location: Georgetown, Ayer Itam
I am still not quite clear about dual booting with kexec. Did OP done it before?

Sent from my C6603 using Tapatalk 2
 
siddhesh1609
Old
#7  
siddhesh1609's Avatar
Senior Member
Thanks Meter 47
Posts: 493
Join Date: Apr 2009
Location: Mumbai
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..
___________________

Xperia Z
 
AngelBob
Old
#8  
AngelBob's Avatar
Senior Member
Thanks Meter 267
Posts: 205
Join Date: Jun 2013

 
DONATE TO ME
Quote:
Originally Posted by siddhesh1609 View Post
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.
Xperia Z
Carbon Rom 4.4.4 .283 Blobs & KMA kexec kernel

The Following User Says Thank You to AngelBob For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA Forums Added for the First Batch of Android One Devices!

Just yesterday, we talked about the highly anticipated launch of the first batch … more

XDA Xposed Tuesday: DonkeyGuard, Don’t Be a Donkey, Control Your Device – XDA Developer TV

Some applications ask for the world … more

Use Facebook Pictures as a LWP with Facebook View

One of the best things that Android has always offeredits users is the ability to tailor … more

Share Your Thoughts Anonymously with A Minimalist Social Network

Nowadays, almost everyone has a second life onthe Internet. Among the best … more