5,598,718 Members 37,475 Now Online
XDA Developers Android and Mobile Development Forum

[DEV] Kexec/Kexec-Tools Bootloader for Multiple Kernels

Tip us?
 
CalcProgrammer1
Old
(Last edited by CalcProgrammer1; 22nd July 2012 at 12:25 AM.)
#1  
Senior Member - OP
Thanks Meter 543
Posts: 570
Join Date: Oct 2007
Location: Illinois
Default [DEV] Kexec/Kexec-Tools Bootloader for Multiple Kernels

I think I have finally got kexec to work on the i717 from Android! Kexec (kernel-execute) is a system call in the Linux kernel that uses the kernel as a bootloader to boot another kernel. What this means is that you should be able to test and use new kernels without having to flash or risking flashing a non-booting kernel. It does not modify your boot.img (main system kernel which is installed with CWM/Odin). How it works is that you pick what kernel you wish to boot into and it copies it to free RAM along with an initramfs and other necessary information. Then, after the new image is ready to run from RAM, it kills execution of the current kernel and boots the new one.

My goal with this is to get native Linux support rolling for the Note. I've done work with the HP TouchPad native Ubuntu build and it is quite usable now. With the Note i717 having almost identical core hardware (APQ8060 vs MSM8660, both are dual-core Snapdragon with Adreno 220) I figure the same should be possible on the Note. While it may take a bit of effort to get touchscreen, WiFi, and other devices operational, it should be possible to get basic boot with a few kernel tweaks. Since our i717 has an external SD slot, we can likely boot custom OS'es from external SD without any worry of touching, corrupting, or otherwise hurting the installed system. This can be accomplished by passing 'root=/dev/mmcblk1pX' at the kernel cmdline.

I am still in the testing process and will edit this post as information becomes available. My current progress is enabling kexec support in h0tkernel (CONFIG_KEXEC) and now building the kexec-tools package with the NDK (thanks to ilikenwf at RootzWiki) and now will be building a test kernel targeted at native Linux builds (enabling framebuffer console, setting root device, etc). I then plan to pull my ARMv7 12.04 system image off my TouchPad and dump it to an SD card to test on the Note.

EDIT: Just tried loading and it rebooted phone. It took enough time that I think it probably booted, found no rootfs, and rebooted. I can't be sure as the screen didn't come up.

Edit 2: Ok, I added everything I could think of that would boot Linux from sdcard, but it doesn't work on either flashing manually or kexec. I guess I'll get an initrd to test kexec with Android to verify it works.

Wish me luck
Samsung Galaxy Note 3 SM-900T 32GB
Samsung Galaxy Note SGH-i717 16GB
HP TouchPad 32GB
Archos 43 Internet Tablet - 16GB + 32GB mSD
Dell Axim X50v - 128MB + 16GB CF
The Following 20 Users Say Thank You to CalcProgrammer1 For This Useful Post: [ Click to Expand ]
 
lactardjosh
Old
(Last edited by lactardjosh; 22nd July 2012 at 06:22 AM.)
#2  
lactardjosh's Avatar
Senior Member
Thanks Meter 302
Posts: 550
Join Date: Dec 2010

 
DONATE TO ME
I'll admit limited understanding of what you're accomplishing here, but seems to me that this could lead to dual booting on the Note. Nice work.

Good luck.
The Following User Says Thank You to lactardjosh For This Useful Post: [ Click to Expand ]
 
Jiggity Janx
Old
#3  
Senior Member
Thanks Meter 323
Posts: 1,341
Join Date: Feb 2010
Nice work! Thanks for the work you've done thus far. Unfortunately I have no way to help you out other than morale support!
2 Verizon One MAX rumrunner.us s-off Galaxy Note 8.0 w/ Terok Nor 3 2 OG Nexus 7 w/ CM11
 
roloracer
Old
#4  
roloracer's Avatar
Senior Member
Thanks Meter 618
Posts: 2,706
Join Date: Jul 2008
Location: Kissimmee
Quote:
Originally Posted by lactardjosh View Post
I'll admit limited understanding of what you're accomplishing here, but seems to me that this could lead to dual booting on the Note. Nice work.

Good luck.
Pretty much what it comes down to, testing kernels and roms without having to flash into nand. I can't wait for dualbooting from Sd on the Note.

I have ORD , please help!!
. Did I help you? Hit the thanks button!


Samsung Galaxy Note 3: Dynamic Kat! NC2 - 4.4.2
Samsung Galaxy Note: [ROM] JBSandwich CM9
Nexus 10: [ROM] ThunderKat 4.4.2

The Following User Says Thank You to roloracer For This Useful Post: [ Click to Expand ]
 
CalcProgrammer1
Old
#5  
Senior Member - OP
Thanks Meter 543
Posts: 570
Join Date: Oct 2007
Location: Illinois
My main goal here is native Linux, but if kexec works then you can boot custom Android dev kernels, native Linux kernels, other mobile OS'es, etc. The SGSIII team seems to have found some interesting kexec solutions for the Verizon SGSIII due to its locked bootloader. They've posted a good deal of kexec patches which I'm trying to bring to the Note, including a custom kexec-hardboot option that fully reboots the device into the new kernel (apparently to make sure the radio and such are working).
Samsung Galaxy Note 3 SM-900T 32GB
Samsung Galaxy Note SGH-i717 16GB
HP TouchPad 32GB
Archos 43 Internet Tablet - 16GB + 32GB mSD
Dell Axim X50v - 128MB + 16GB CF
The Following 2 Users Say Thank You to CalcProgrammer1 For This Useful Post: [ Click to Expand ]
 
jwt0044
Old
#6  
jwt0044's Avatar
Senior Member
Thanks Meter 495
Posts: 829
Join Date: May 2012
Quote:
Originally Posted by CalcProgrammer1 View Post
My main goal here is native Linux, but if kexec works then you can boot custom Android dev kernels, native Linux kernels, other mobile OS'es, etc. The SGSIII team seems to have found some interesting kexec solutions for the Verizon SGSIII due to its locked bootloader. They've posted a good deal of kexec patches which I'm trying to bring to the Note, including a custom kexec-hardboot option that fully reboots the device into the new kernel (apparently to make sure the radio and such are working).
Wonderful, wonderful work!!! :thumbup::thumbup::thumbup:

Sent from my SAMSUNG-SGH-I717 using xda premium
 
gregsarg
Old
#7  
gregsarg's Avatar
Senior Member
Thanks Meter 2869
Posts: 3,763
Join Date: Apr 2011
Location: B.F.E.
Uh...It all sounded like this:
dual kernel (i'm gonna brick) kexec will allow (me to brick my phone).....with native linux applications ('im gonna brick my phone cause i'm stupid)....LOL

while i know what your doing, that in no way means i will ever understand it...LOL
But i will thank you in advance for what sounds like a sick mod for our notes...

Many thanks Dev !!!!
" There are Givers, and there are Takers. Be a Giver, and these things will come back to you. "......................g

And please, donate to your favorite developer...
Without them, we'd be writing on rocks with a stick...g
 
CalcProgrammer1
Old
#8  
Senior Member - OP
Thanks Meter 543
Posts: 570
Join Date: Oct 2007
Location: Illinois
Kexec is actually (if done right) a good way *not* to brick your phone. To run kernels, you usually have to flash them to a restricted boot section of the memory, and if you flash all non-working kernels (to download, recovery, and main) then you have no way to use your phone, as it won't boot up. If you use kexec, your working kernel is safely stored on the boot partition and your development kernels can be wherever, and if it doesn't boot you can just hold down POWER to hard reboot into your good kernel.

The problem is that it doesn't seem to be working, I think I have the kexec support built properly but haven't been able to boot any kernels without it crashing.
Samsung Galaxy Note 3 SM-900T 32GB
Samsung Galaxy Note SGH-i717 16GB
HP TouchPad 32GB
Archos 43 Internet Tablet - 16GB + 32GB mSD
Dell Axim X50v - 128MB + 16GB CF
The Following 4 Users Say Thank You to CalcProgrammer1 For This Useful Post: [ Click to Expand ]
 
gregsarg
Old
#9  
gregsarg's Avatar
Senior Member
Thanks Meter 2869
Posts: 3,763
Join Date: Apr 2011
Location: B.F.E.
Quote:
Originally Posted by CalcProgrammer1 View Post
Kexec is actually (if done right) a good way *not* to brick your phone. To run kernels, you usually have to flash them to a restricted boot section of the memory, and if you flash all non-working kernels (to download, recovery, and main) then you have no way to use your phone, as it won't boot up. If you use kexec, your working kernel is safely stored on the boot partition and your development kernels can be wherever, and if it doesn't boot you can just hold down POWER to hard reboot into your good kernel.

The problem is that it doesn't seem to be working, I think I have the kexec support built properly but haven't been able to boot any kernels without it crashing.
I know you'll crack it ....
And when you do ....you'll be the galaxy note GOD !!!....LOL
your effort is much appreciated Sir ....even if I'm scared to use it , but will anyway ...lol
" There are Givers, and there are Takers. Be a Giver, and these things will come back to you. "......................g

And please, donate to your favorite developer...
Without them, we'd be writing on rocks with a stick...g
 
CalcProgrammer1
Old
#10  
Senior Member - OP
Thanks Meter 543
Posts: 570
Join Date: Oct 2007
Location: Illinois
So I'm still confused as to why my kexec didn't work. I'm going to build a TouchPad kernel with it enabled and repeat the test on it, since I have a known-good kernel to boot against. I'll let you know how that goes.

Sent from my SAMSUNG-SGH-I717
Samsung Galaxy Note 3 SM-900T 32GB
Samsung Galaxy Note SGH-i717 16GB
HP TouchPad 32GB
Archos 43 Internet Tablet - 16GB + 32GB mSD
Dell Axim X50v - 128MB + 16GB CF

The Following 4 Users Say Thank You to CalcProgrammer1 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes