yashsingh1/xdaforums huggingface dataset:
[Xperia Z1 Original Android Development] delewer:
I don't know IF... but, kexec tool work..

I have kernel panic at load

<1>[ 264.484778] Unable to handle kernel NULL pointer dereference at virtual address 00000000
<1>[ 264.484796] pgd = da184000
<1>[ 264.484803] [00000000] *pgd=29353831, *pte=00000000, *ppte=00000000
<0>[ 264.484820] Internal error: Oops: 817 [#1] PREEMPT SMP ARM
<4>[ 264.484829] Modules linked in: kexec_load(O) wlan(O) adsprpc adsp_loader cfg80211 texfat(PO) hid_sony(O)
<4>[ 264.484857] CPU: 0 Tainted: P O (3.4.0-perf-g66807d4-02450-g9a218f1 #1)
<4>[ 264.484873] PC is at __copy_from_user+0x70/0x3b8
<4>[ 264.484881] LR is at 0x0
<4>[ 264.484888] pc : [<c0355fd8>] lr : [<00000000>] psr: 20000013
<4>[ 264.484890] sp : df0fff2c ip : 00000000 fp : 00000000
<4>[ 264.484901] r10: 00000000 r9 : df0fe000 r8 : 00000000
<4>[ 264.484909] r7 : 00208000 r6 : 00000002 r5 : 000a8630 r4 : 00000003
<4>[ 264.484917] r3 : 00b29858 r2 : 00000660 r1 : b6139020 r0 : 00000000
<4>[ 264.484927] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
<4>[ 264.484937] Control: 10c5787d Table: 2258406a DAC: 00000015
(...)
<0>[ 264.485704] Kernel panic - not syncing: Fatal exception
<2>[ 264.485715] CPU1: stopping
<4>[ 264.485733] [<c010c12c>] (unwind_backtrace+0x0/0x11c) from [<c010abcc>] (handle_IPI+0x110/0x224)
<4>[ 264.485749] [<c010abcc>] (handle_IPI+0x110/0x224) from [<c0100574>] (gic_handle_irq+0x104/0x110)
<4>[ 264.485768] [<c0100574>] (gic_handle_irq+0x104/0x110) from [<c0857bc0>] (__irq_svc+0x40/0x70)
<4>[ 264.485780] Exception stack(0xe1e35e68 to 0xe1e35eb0)
<4>[ 264.485789] 5e60: e1e35ed4 bf2a047c c0ea6568 00000000 bf2a047c e1e35ed4
<4>[ 264.485802] 5e80: e248d780 e50cdbac 00000001 000001ff bf264bac e2b98360 e248da40 e1e35eb0
<4>[ 264.485813] 5ea0: bf083ba8 bf1cba08 60000013 ffffffff
<4>[ 264.485951] [<c0857bc0>] (__irq_svc+0x40/0x70) from [<bf1cba08>] (wpalIteratorInit+0x98/0xc4 [wlan])
<4>[ 264.486066] [<bf1cba08>] (wpalIteratorInit+0x98/0xc4 [wlan]) from [<bf083ba8>] (dxeTXEventHandler+0x4e4/0x6fc [wlan])
<4>[ 264.486175] [<bf083ba8>] (dxeTXEventHandler+0x4e4/0x6fc [wlan]) from [<bf083c40>] (dxeTXEventHandler+0x57c/0x6fc [wlan])
<4>[ 264.486282] [<bf083c40>] (dxeTXEventHandler+0x57c/0x6fc [wlan]) from [<bf083d3c>] (dxeTXEventHandler+0x678/0x6fc [wlan])
<4>[ 264.486390] [<bf083d3c>] (dxeTXEventHandler+0x678/0x6fc [wlan]) from [<bf08458c>] (dxeChannelAllDescDump+0x138/0x3a8 [wlan])
<4>[ 264.486499] [<bf08458c>] (dxeChannelAllDescDump+0x138/0x3a8 [wlan]) from [<bf084abc>] (dxeRXEventHandler+0x2c0/0x44c [wlan])
<4>[ 264.486617] [<bf084abc>] (dxeRXEventHandler+0x2c0/0x44c [wlan]) from [<bf1977bc>] (VosRXThread+0x344/0x408 [wlan])
<4>[ 264.486693] [<bf1977bc>] (VosRXThread+0x344/0x408 [wlan]) from [<c01a9c70>] (kthread+0x84/0x90)
<4>[ 264.486712] [<c01a9c70>] (kthread+0x84/0x90) from [<c0106908>] (kernel_thread_exit+0x0/0x8)
<3>[ 264.486725] &@running_process@cpu1:*RX_Thread*
<3>[ 265.490223] wcnss crash shutdown 0

I thing i have a desynchr with my custom kernel send, and i have a load adress to "null"
[Xperia Z1 Original Android Development] Knucklessg1:
Great work! There's been progress.
[Xperia Z1 Original Android Development] noryn:
Yes, Great work! Will wait for Z1 MoDaCo Switch...
[Xperia Z1 Original Android Development] bobthecooldad:
Sorry to interupt your thread but how would i get this going on the xperia U.

Is there a guide or any imformation on how to develop it???

Thanks bobthecooldad
[Xperia Z1 Original Android Development] Olivier:
Hi,

I've been monitoring this thread for a few days now and I'm surprised how fast progress is going on. Respect!

One question though: Will this patch make AOSP-based ROMs on LB possible or not?

Gesendet von meinem LT26i mit Tapatalk
[Xperia Z1 Original Android Development] delewer:
It's the purpose !

Install any custom rom (miui, aosp, CM, paranoid, etc..)

Without risk of brick, lost TA, brick if OTA, lost camera.

And perform the only way for a multiboot on LB UL bootloader

It's ambitious, i know...
[Xperia Z1 Original Android Development] Olivier:
Ok, good. :)

But just out of curiosity, what has been done here, here and here? Didn't they just take CM ramdisk and somehow boot it? :confused:
[Xperia Z1 Original Android Development] delewer:
I read the new sources (15/11/2013) deliver by sony (on official site)

14.1.G.2.259

It's a new kernel.

I don't know what sony have added for we (thx to them), but i read a function i don't use yet :

Commands to rdtag : (see

misc/rdtags.c

)

And i can send commands to rdtag entries

have you test theses fonctions ?

It's similar to my driver ?!

# cat /proc/rdtags
Usage: <tag name/command> [tag data]
command may be one of the following:
* clear
* delete <tag name>

if you :

echo tag read >/proc/rdtag

This create a new file in rdtags folder name "tag" and contain "read"

echo clear >/proc/rdtag

delete all files in rdtags folder

If you enter a bad command, you have this in dmesg :

<3>[22105.446841] rdtags rdtags: Incorrect format, please supply a string of format: <tag name> <tag data>

After a crash, you have a lot of information added in rdtags folder

I see what is for... and if it is usefull for our kexec...
[Xperia Z1 Original Android Development] Shaky156:
Hi, youve replaced OP, also rdtags is atags, passes bootoader info, not sure if it is passes the information which we require, but highest priority for it to work on LB is to get it running on the stock kernel
[Xperia Z1 Original Android Development] ZakooZ:
You probably already know about this... But can this help?

Compatibility patch: https://gist.github.com/4458581

This patch only makes the kernel bootable via kexec, ie. it can't be the host kernel. This was made for Ubuntu kernel (and it was accepted), because I did not want to drag the whole patch in there. If your kernel is for Android ROMs, you should use the full patch.​

Original post: http://xdaforums.com/showthread.php?t=2104706
[Xperia Z1 Original Android Development] Knucklessg1:
That article sure looked promising.
[Xperia Z1 Original Android Development] ikenley:
Excellent work Delewer!

So is it currently functional but with bugs or does it still need work before others can start testing it?

Are your tests at the moment with Sony stock kernel (i,e, DooMKernel) or with AOSP kernel (i.e. CM kernel running CM10 or equivalent)?
[Xperia Z1 Original Android Development] delewer:
It's not a fonctionnal kexec ; all i see in my sources say it work, but it is not yet, it's frustating to me to be so close.

I test only with DoomKernel, to be sure when ok, to see it is.

When ok, aosp will be kexeced immediatly after... for sure !!!

Most important for now it's to have log from new kernel to debug the first crash ; if i have a log, we win the battle.
[Xperia Z1 Original Android Development] Shaky156:
Messaged you :) the method ive described/said is a little different, no more dt.img :D
[Xperia Z1 Original Android Development] Galcactus:
Will you document the process you used to create a functional kexec?

Just asking so that I may use the method (with your permission and appropriate credits) to create kexec for Xperia T.

Looking forward to your next update/news flash :D
[Xperia Z1 Original Android Development] olokos:
I just wanted to say that doomkernel is NOT a stock kernel...

Good job :)

Wysyłane z mojego R800i za pomocą Tapatalk 2
[Xperia Z1 Original Android Development] Olivier:
It is a stock kernel, but not a stock boot.img. ;)

Gesendet von meinem LT26i mit Tapatalk
[Xperia Z1 Original Android Development] gregbradley:
When we refer to stock kernels we generally mean kernels with a Sony signature that are untouched. DooMKerneL does not have a Sony signature and has been modified. Therefore it is a stock based kernel but is not a stock kernel
[Xperia Z1 Original Android Development] king960:
Losing Your hopes?
[Xperia Z1 Original Android Development] Knucklessg1:
I sure am, I hope this works with completely stock untouched kernels.
[Xperia Z1 Original Android Development] gregbradley:
why?

You can flash them on locked bootloaders
[Xperia Z1 Original Android Development] Galcactus:
In theory, does kexec work across different android versions?

So for example if I'm on 4.1.2, could this be used to run 4.4?

Or even running something like Ubuntu?

Kind regards,

Galcactus
[Xperia Z1 Original Android Development] mirhl:
Kexec works with whatever version you like

The hardest part is implementing it though, and it seems very difficult
[Xperia Z1 Original Android Development] zeppelinrox:
Relevant?

This was published only a couple of days ago...

Subverting security with kexec
[Xperia Z1 Original Android Development] mirhl:
Yes.. But you need a kernel with that feature implemented

And the stock sony has not

The problem is injecting kexec module and then the custom kernel which is really really hard
[Xperia Z1 Original Android Development] Knucklessg1:
What's the current status of kexec? Any updates on full implementation?
[Xperia Z1 Original Android Development] gregbradley:
Asking for ETAs is not the done thing
[Xperia Z1 Original Android Development] Knucklessg1:
I'm not asking for an eta. I'm asking how the current development is going. I want to see what issues need to be solved before I can attempt porting it to the Z.
[Xperia Z1 Original Android Development] Shaky156:
Kexec will not happen, the ifdef kexec in kernel is modification of assembly... Which gets exectued early in kernel... Stock kernel which we cannot modify...
[Xperia Z1 Original Android Development] king960:
So the hope is lost D:
[Xperia Z1 Original Android Development] delewer:
why ?

I'm trying to stop every kernel interrupts before jump into new kernel.

I have fix few things like stuppid bugs in kexec_module and relocate_kernel.

I have patch from scratch doom kernel with hardboot.

Try to stop everything in a running stock kernel is hard, even from early in boot.

For eg. i need to stop all CPU (X 4)...
[Xperia Z1 Original Android Development] Poesini:
Oh I'm waiting on this really hard because I found out that I had a locked bootloader -_- (Yeah I didn't check but just now)
[Xperia Z1 Original Android Development] Patrick4:
Hi, Im trying to port this to the xperia U but I can't load the modules, when i type in # insmod /system/lib/modules/kexec_load.ko i get insmod: can't open '/system/lib/modules/kexec_load.ko' , is it because of "vermagic", do i need to patch the modules to load them ? :confused:

can anyone help ?

thanks :silly:
[Xperia Z1 Original Android Development] Knucklessg1:
Happy new years!

Hope for a break through this year.
[Xperia Z1 Original Android Development] f(x)THaxxorX:
Is this still on Progress? Cause Im Pretty interested on this Patch or whatsoever.
[Xperia Z1 Original Android Development] munjeni:
Did you reserved and freed memory for kexec? Something like:

Standard kexec not working and allso kexec can boot only kexec patched kernels, so I get them only working using hard kexec, hard worked on them and finaly I had a fully working kexec for Sony Xperia Go, Sola, P and U, maybe this help -> https://github.com/munjeni/android_kernel_xperiago/commits/jb-dev?page=2

I will start working on your work after I get Xperia Z1 Mini! You made a realy interesting thread, I am realy interested in this! Hope we get some progress. :good:

And one more thing, I will backport my Boot Menu to Z1 and Z1S soon as we get kexec working! More info here -> http://xdaforums.com/showthread.php?t=2418241
[Xperia Z1 Original Android Development] munjeni:
Hi, what is a curent status of our things? Is kexec boot kernel? Curent problems is?
[Xperia Z1 Original Android Development] munjeni:
Some info related to kernel. Last time when I played with kexec I found something interesting: seccond kernel (ota kernel - dumped from ota partition) booted with kexec! So that mean - host kernel loaded these stock ota kernel (seems ota kernel is allready kexec patched? But all other kernels which I tried was not abble to load by kexec because was not kexec patched! Only kexec patched kernels was abble to boot in host kernel!). So I think before you try to load an kernel you need to patch these kernel. You can try: try to build stock kernel, than see what is missing in .config, than enable missing defconfig things (things needed for kexec - but try to build them as a module - if something fail to build as a module, try to add missing things (there will be a lot of problems aka duplicate symbols, missing symbols...blabla, but I think we can get them working). I will try soon as I get Z1 Compat.

Another thing which I found in ramdisk init script: there was a service aka kexec.dyn (have no idea whats usage of them since there was no these binary in /system/bin). Maybe you can check them in your ramdisk (probably thats related to the ota kernel ramdsk - I not checked).

Do you have a kernel git? Just want to see reboot code.
[Xperia Z1 Original Android Development] delewer:
Are you sure it's an ota kernel ? Not a part of bootloader you run and launch the stock kernel ? (ota process ??)

If it's really a safe kernel (may be a secured kernel to unbrick device by sony), without sources it's useless... but interresting to see and to test kexec tool ;)

I know that. You have my kexec zip patch for stock kernel attached in zip, into last post.(compatible with Doomkernel, because DooMLoRD use the stock sony kernel, and mod it)

I know that. I have use a lot of sony official sources to adapt kexec module from Sony kexec.

And, of course, i have compil Sony official kernel because you need to build the "dt.img" file.

;)

Outch.. nether see that... really interesting...

No, i don't have official git...

:(

I use Doomlord Git to have a custom kernel to test (may be i can try with CM11 kernel too, but not now)

I use Sony Zip to install official kernel. I have .257 kernel, and not the last, because i wait for succes before update my stock kernel (i don't want to brick something by accident)

My rebbot code is in the patch (in one of 3 zips).

My patch is not a diff... it's the sources you replace into directories. It's better i thinks to work.
[Xperia Z1 Original Android Development] DooMLoRD:
Bootloader won't allow booting of kernels off FOTAKernel partition... Though you should be able.to use that space other wise...
[Xperia Z1 Original Android Development] munjeni:
Yes I booted ota kernel! Steps was: dumped ota kernel partition, extracted only kernel from dump, created ramdisk image using ramdisk from "stock kernel", separated ota kernel + ramdisk into new directory - for kexec boot, booted these ramdisk and these ota kernel using kexec, got them booted!
[Xperia Z1 Original Android Development] munjeni:
Just for info I have erased these partition and I can create new partition there! So allso I think these partition can be mounted for something, for example you can store there recovery ramdisk and an kernel for booting them with kexec! If you realy need more info please search in xperia go forum (sorry, I forgot where I posted them, maybe in general section?!) where I created a thread related to custom partitioning on xperia go (changed userdata, cache...etc size, merged 2 unused partitons, increased data, created custom one...blabla!).

Edit:

found my post -> http://xdaforums.com/showthread.php?t=2418241&page=8
[Xperia Z1 Original Android Development] bulanula:
So what does this mean ?

Is it possible to use this for kexec on other phones like Xperia P ?

I also saw this in my dmesg from Xperia P :

[ 5.787506] init: cannot find '/system/xbin/kexec.dyn', disabling 'kexec'

Maybe we can put something at that location so the init finds the file and does not disable kexec for kernel ?
[Xperia Z1 Original Android Development] munjeni:
My kernel already support sola,go,p,u and kexec allready working on these phones! Please find a proper thread to post any question since our thread is for Z1 only! Search in P forum for kexec thread!
[Xperia Z1 Original Android Development] DooMLoRD:
Nice
[Xperia Z1 Original Android Development] mirhl:
You could come to an arrangement to open a common [DEV] thread in the Cross-Device Development Projects for Sony Devices section

so that EVERY helpful developer could help
[Xperia Z1 Original Android Development] bulanula:
Exactly.

I did not find any thread discussing the possibility of Xperia P stock kernel working with kexec on locked bootloader devices to allow locked bootloader devices to run a custom kernel and thus, CM 11, on locked bootloaders.

My previous post was to give a hint to the developers here that maybe they can put back the missing file "/system/xbin/kexec.dyn" on stock kernel devices with locked bootloader so that init will find that file and NOT disable kexec for stock kernels.

Then maybe we can use the kexec and the OTA kernel to port CM 11 to locked bootloaders with custom kernel allowed through kexec and OTA exploits.

I am not a developer but I can give contribution through my ideas, since I really want to take this and make it possible to boot custom kernel on locked bootloader.
[Xperia Z1 Original Android Development] krabappel2548:
I am working on a custom kernel for kexec, so modified stock kernel. I know this will only work on unlocked bootloader, but I have one. I am trying a port in my kernel sources from N5 (private repo for now, don't want anyone to brick his device or whatever before I tested myself)

There is only 1 thing I'm wondering about and those are these addresses for kexec:

#define KEXEC_HB_PAGE_ADDR UL(0x10100000)
#define KEXEC_HB_KERNEL_LOC UL(0x3208000)

[MENTION=4225567]delewer[/MENTION], any idea which ones I should use here?

EDIT: I haven't found much info about those, but I'll try some things out.
[Xperia Z1 Original Android Development] delewer:
Sorry, I have a very difficult problem to solve in real life. I have to take time for myself.

Do your tests with "fastboot boot" before any flash.

Boot your kexed kernel with your custom ramdisk wich boot your second kernel.

if work, you will be ready to kexec boot any custom aosp (on unlocked bootloader)
[Xperia Z1 Original Android Development] krabappel2548:
No problem mate, had to deal with issues too lately, take your time! I hope you can solve them. I'm working on it for unlocked bootloader for now, if that works I can make a multiboot solution.
[Xperia Z1 Original Android Development] krabappel2548:
ok, so I've done some test runs with a custom kernel with kexec hardboot patch inside. It seems the kexec hardboot works, but it doesn't boot a custom kernel yet.

I've ported it from N5; so it has dtb support, which we also need. The status at the moment is:

- Device reboots

- 1 second red LED (normal because of unlocked bl)

- 1 second LED goes out (also normal)

- Then LED goes RED again and stays red with a black screen

It's the last thing that isn't ok, if everything would be ok, it should have booted the kernel with kexec hardboot. Anyone who can help? [MENTION=4120742]munjeni[/MENTION] maybe?

EDIT: my kernel repo is private for now, but I can make it public if necessary :p
[Xperia Z1 Original Android Development] krabappel2548:
Edit: patch working released in new thread
[Xperia Z1 Original Android Development] munjeni:
Probably you no need KEXEC_HB_KERNEL_LOC since it was for bootloader on hammerhead, but allso probably you not defined-reserved right memory region (you have wrong defined memory offset?), allso maybe you have no defined end of phys ram (ram previously decreased + reseved 1mb space for kexec gardboot + kexec_hardboot_reserve in board config) ...you can look here for more info -> https://github.com/munjeni/android_kernel_xperiago/commits/jb-dev?page=2

I think better idea to all you is to make kexec working on unlocked bootloaders, than you can start porting them to locked bootloaders!

Any one have idea when z1 compat will come to EU in markets ?
[Xperia Z1 Original Android Development] king960:
Can I ask you, dear devs, how do you rate the possibility of achieving a bypass or kexec or smth like that for locked bootloaders? It'd be nice to have that opportunity of installing for instance cm11. Thanks in advance, and I am terribly sorry to disturb You.

Sent from my LT22i permanently (so-said) locked by Orange
[Xperia Z1 Original Android Development] aweosomeabhijeet:
Something!

This thing tells to boot android from SDcard. It won't be bad if we can boot boot.img from sdcard.

My old device was MOTOROLA XT530 ith locked BL. I would surely like to have custom ROMS on my legacy :)
[Xperia Z1 Original Android Development] olokos:
I think that the main problem is how to actually boot the phone from custom boot.img and where to store it AFTER it has booted (which address is free). Storing the kernel before booting isn't a problem at all since we have both internal and external memory ;)

Wysłane z mojego C6903 przy użyciu Tapatalka
[Xperia Z1 Original Android Development] krabappel2548:
Finding a kexex address isn't the problem I think. At least not on unlocked bootloadera. But for locked bootloaders it could be.
[Xperia Z1 Original Android Development] olokos:
Well I think there's no point for doing kexec for unlocked bootloader TBH and people were struggling with it on locked.

Wysłane z mojego C6903 przy użyciu Tapatalka
[Xperia Z1 Original Android Development] krabappel2548:
Multiboot ;) I'm working on it now, got the loader ready, now I gotta get the modified twrp working to install multiple roms :)

So it has a point :D
[Xperia Z1 Original Android Development] olokos:
IMO it's not that important as the possibility of running aosp roms on locked bootloader. Either way, tremendous job, thumbs up and I'm glad that you came back to us. Z1 boards were quite boring without you. :)

Sorry for off-topic as this is dev thread, but I couldn't resist answering now. :)

Hopefully you will try to get it working on locked bootloader. :)

Thank you.

Wysłane z mojego C6903 przy użyciu Tapatalk

[MENTION=309187]edit[/MENTION]

Where multiboot roms will be stored? /data? /sdcard1?
[Xperia Z1 Original Android Development] mirhl:
is the boot partition too small to handle something like the Xperia s bootmanager solution?
[Xperia Z1 Original Android Development] krabappel2548:
I think it is yes, kernels for Z1 are bigger and not even 2 would fit in boot partition. But I'm working on multirom, only the modified twrp needs some updates and fixes which I am working on ;)
[Xperia Z1 Original Android Development] aweosomeabhijeet:
Upon searching I found that 2nd-boot was a tool created by developers to boot custom kernels on unlockable bootloaders. The method is used on many Motorola devices.

Upon searching a little I found this guide on how to build 2ndboot.

Maybe it could help :)
[Xperia Z1 Original Android Development] krabappel2548:
I got modified twrp almost completely functional for Xperia devices ;) I'll test very good today before I release anything :)
[Xperia Z1 Original Android Development] aweosomeabhijeet:
Alvin has ported MultiBoot to Xperia M and it's perfectly working ;)

He is working on modified TWRP as per now. :)

Well, you are a great dev ;)
[Xperia Z1 Original Android Development] krakkhor:
Cool dude,, i dont know your other priorities but it would be nice if you continued some of the roms you started,, omni maybe ;) or paranoid would be nice too.. But only if it is something you wanna do

Gesendet von meinem Xperia Z1 mit Tapatalk
[Xperia Z1 Original Android Development] krabappel2548:
I'm using his multirom with some additions I need for rhine boards :p

I know he's working on twrp we are communicating via hangouts ;) my twrp works, only ramdisk extraction to install multiple roms isn't good yet, so almost finished :D
[Xperia Z1 Original Android Development] rootdefyxt320:
I found out that 2nd-boot was for Motorola TI WRIGLEY 3G BP, Motorola Qualcomm BP's can be reinitiated after booting into the custom kernel. The problem with Motorola OMAP 3 UMTS BP's was that it panicked after it tried to boot the 2nd-boot custom kernel so the phone would just reboot itself. czechop made a patch to keep the TI WRIGLEY 3G Modem turned on while it booted 2nd-boot. I wonder if mbmloader even exists in a Motorola Qualcomm device.
[Xperia Z1 Original Android Development] munjeni:
Probably you need this -> http://xdaforums.com/showthread.php?t=2418241 ?? :)