[dev][kernel][kexec]

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
Did you compile this kexec yourself? Or did you get this from krapabbel? I issued krapabbel to compile a new debug version have gave him the code but never heard back from him :/
Anywayz so cannot find free memory is the issue
Yep i have compil kexec-tool myself (and kexeced kernel too)...
I try to find another way to load kernel in memory, bc i think the kernel is'nt too large for memory ... lol
may be can we use another load function ?
 

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
Yep i have compil kexec-tool myself (and kexeced kernel too)...
I try to find another way to load kernel in memory, bc i think the kernel is'nt too large for memory ... lol
may be can we use another load function ?
Kexec cannot load if no zImage is being loaded to due not finding free memory, loading isnt the isssue, finding free memory is the issue, as a test to prove this, take off the hardboot option, load the kernel in RAM where there is free space and execute it that way, youll know that kernel load isnt the problem just finding free memory is
 

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
There may be a miscalculation somewhere regarding where to put the kernel in memort hence why we cannot load the kernel, 4.1mb is needed, why dont we compile kernel with lzma if its not already done, thatll help alittle :)
 

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
There may be a miscalculation somewhere regarding where to put the kernel in memort hence why we cannot load the kernel, 4.1mb is needed, why dont we compile kernel with lzma if its not already done, thatll help alittle :)
I compil kernel with :
CONFIG_HAVE_KERNEL_LZMA=y

and see if kexeked kabapel kernel with this option is ok....
 
Last edited:

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
I compil kernel with :
CONFIG_HAVE_KERNEL_LZMA=y

and see if kexeked kabapel kernel with this option his ok....
Errrr I compile lorddooms kernel, his compiles on XZ compression, which i dont think kexec supports, only gzip and lzma? If anyone can double check and confirm, confighavekernellzma, & configkernellzma should = y
 

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
just for information...
compressed kernel with lzma his bigger than no lzma lol
4,1 Vs 4,15

so, i thave try :
kexec --load zImage.lzma --mem-min=0x0f00000000 --command-line="$(cat /proc/cmdline)"
debug: Focus 1 - argc '5' ; argv 'bea96754' ; kernel_buf 'b6bdf008' ; kernel_size '3f5414' ; info 'bea96528' ; i '1' ; file_type.name 'zImage'
debug: malloc - xmalloc mem_range '4511824'
Could not find a free area of memory of 3fd414 bytes...

lol ... if you could find a way to reduced size ?? :p
 

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
just for information...
compressed kernel with lzma his bigger than no lzma lol
4,1 Vs 4,15

so, i thave try :
kexec --load zImage.lzma --mem-min=0x0f00000000 --command-line="$(cat /proc/cmdline)"
debug: Focus 1 - argc '5' ; argv 'bea96754' ; kernel_buf 'b6bdf008' ; kernel_size '3f5414' ; info 'bea96528' ; i '1' ; file_type.name 'zImage'
debug: malloc - xmalloc mem_range '4511824'
Could not find a free area of memory of 3fd414 bytes...

lol ... if you could find a way to reduced size ?? :p


I understand but that is minor as they have compressed with xz, compressing with lzma is the way to go as kexec can read lzma
 

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
I have debug Kexec-tool :

I have found the exact instruction witch cause the segfault

In "kexec-zImage-arm.c" :
(...)
switch (saved_tags->hdr.tag) {
case ATAG_INITRD:
case ATAG_INITRD2:
case ATAG_CMDLINE:
case ATAG_NONE:
(...)

When "saved_tags->hdr.tag" is read => segfault !!

I let you see how to solv this...

good night !
 

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
Work much more with
"const char fn[]= "/proc/rdtags";"
not "const char fn[]= "/proc/rdtag";"

No more segfault

but :
kexec_load failed: Function not implemented
still here...

Kexec Kernel implementation...

I suppr my debug and post the tool
:)


Edit 1 :
with "-mem-min=0x8000"

kernel: 0xb6b67008 kernel_size: 3e9340
kexec_load: entry = 0x10000 flags = 280004
nr_segments = 3
segment[0].buf = 0x18f4850
segment[0].bufsz = 208
segment[0].mem = 0x9000
segment[0].memsz = 1000
segment[1].buf = 0xb6b67008
segment[1].bufsz = 3e9340
segment[1].mem = 0x10000
segment[1].memsz = 3ea000
segment[2].buf = 0xb64bf008
segment[2].bufsz = 6a7500
segment[2].mem = 0xfad000
segment[2].memsz = 6a8000
kexec_load failed: Function not implemented
entry = 0x10000 flags = 280004
nr_segments = 3
segment[0].buf = 0x18f4850
segment[0].bufsz = 208
segment[0].mem = 0x9000
segment[0].memsz = 1000
segment[1].buf = 0xb6b67008
segment[1].bufsz = 3e9340
segment[1].mem = 0x10000
segment[1].memsz = 3ea000
segment[2].buf = 0xb64bf008
segment[2].bufsz = 6a7500
segment[2].mem = 0xfad000
segment[2].memsz = 6a8000

=> # lsmod
wlan 2758343 0 - Live 0x00000000 (O)
texfat 129349 1 - Live 0x00000000 (PO)
adsprpc 16639 0 - Live 0x00000000
adsp_loader 12473 0 - Live 0x00000000
cfg80211 160899 1 wlan, Live 0x00000000
hid_sony 12525 0 - Live 0x00000000 (O)

(kernel not loaded)

Here, the tool : http://forum.xda-developers.com/attachment.php?attachmentid=2353177&stc=1&d=1382877631
 

Attachments

Last edited:
  • Like
Reactions: mirhl and Shaky156

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
Work much more with
"const char fn[]= "/proc/rdtags";"
not "const char fn[]= "/proc/rdtag";"

No more segfault

but :
kexec_load failed: Function not implemented
still here...

Kexec Kernel implementation...

I suppr my debug and post the tool
:)


Edit 1 :
with "-mem-min=0x8000"

kernel: 0xb6b67008 kernel_size: 3e9340
kexec_load: entry = 0x10000 flags = 280004
nr_segments = 3
segment[0].buf = 0x18f4850
segment[0].bufsz = 208
segment[0].mem = 0x9000
segment[0].memsz = 1000
segment[1].buf = 0xb6b67008
segment[1].bufsz = 3e9340
segment[1].mem = 0x10000
segment[1].memsz = 3ea000
segment[2].buf = 0xb64bf008
segment[2].bufsz = 6a7500
segment[2].mem = 0xfad000
segment[2].memsz = 6a8000
kexec_load failed: Function not implemented
entry = 0x10000 flags = 280004
nr_segments = 3
segment[0].buf = 0x18f4850
segment[0].bufsz = 208
segment[0].mem = 0x9000
segment[0].memsz = 1000
segment[1].buf = 0xb6b67008
segment[1].bufsz = 3e9340
segment[1].mem = 0x10000
segment[1].memsz = 3ea000
segment[2].buf = 0xb64bf008
segment[2].bufsz = 6a7500
segment[2].mem = 0xfad000
segment[2].memsz = 6a8000

=> # lsmod
wlan 2758343 0 - Live 0x00000000 (O)
texfat 129349 1 - Live 0x00000000 (PO)
adsprpc 16639 0 - Live 0x00000000
adsp_loader 12473 0 - Live 0x00000000
cfg80211 160899 1 wlan, Live 0x00000000
hid_sony 12525 0 - Live 0x00000000 (O)

(kernel not loaded)

Here, the tool : http://forum.xda-developers.com/attachment.php?attachmentid=2353177&stc=1&d=1382877631
Woops nice find, btw is that with hardboot option enabled? Attempt to load without hardboot option enabled
 

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
Woops nice find, btw is that with hardboot option enabled? Attempt to load without hardboot option enabled
hey guy, test yourself ! lol
:)

Yes, i have test with all combinations possibles
...without succes

May be a missing Tag in rdtags ?
May be a bad "struct tag" ?
Code:
struct tag {
	struct tag_header hdr;
	union {
		struct tag_core	 core;
		struct tag_mem32	mem;
		struct tag_initrd       initrd;
		struct tag_cmdline      cmdline;
	} u;
May be a bad things in kexec Doom kenel ?

I don't know...

If somebody have a idea ? Please tell us

DoomLord, you're welcomes !

Edit :
Shaky156 please, change then Ramdisk link in the first post, it is the same than kexec-tool
And please, replace link with the new kexec-tool.. Thx.
 
Last edited:

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
If you want to compil yourself the kexec-tools, do this :

Download the toolchain (if you don't have it)
Code:
 sudo apt-get install gcc-arm-linux-gnueabi
Download the "kexec-tools" linked in first post of thread.

Download my configurator : http://forum.xda-developers.com/attachment.php?attachmentid=2353367&stc=1&d=1382883687
and run with
Code:
  . ./setup-cross
Yes, the first dot is needed.
Compils will be "Static" with this conf.

Go in "kexec-tools" folder, and :
Code:
./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi
In "purgatory/Makefile" file, delete
Code:
  --no-undefined
Save Makefile

Code:
make clean
make
Result in "build/sbin" folder
kexec and kdump file to install in device Z1 (or ZU)

Enjoy.:D
 

Attachments

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
hey guy, test yourself ! lol
:)

Yes, i have test with all combinations possibles
...without succes

May be a missing Tag in rdtags ?
May be a bad "struct tag" ?
Code:
struct tag {
struct tag_header hdr;
union {
struct tag_core core;
struct tag_mem32mem;
struct tag_initrd       initrd;
struct tag_cmdline      cmdline;
} u;
May be a bad things in kexec Doom kenel ?

I don't know...

If somebody have a idea ? Please tell us

DoomLord, you're welcomes !

Edit :
Shaky156 please, change then Ramdisk link in the first post, it is the same than kexec-tool
And please, replace link with the new kexec-tool.. Thx.



If you want to compil yourself the kexec-tools, do this :

Download the toolchain (if you don't have it)
Code:
 sudo apt-get install gcc-arm-linux-gnueabi
Download the "kexec-tools" linked in first post of thread.

Download my configurator : http://forum.xda-developers.com/attachment.php?attachmentid=2353367&stc=1&d=1382883687
and run with
Code:
  . ./setup-cross
Yes, the first dot is needed.
Compils will be "Static" with this conf.

Go in "kexec-tools" folder, and :
Code:
./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi
In "purgatory/Makefile" file, delete
Code:
  --no-undefined
Save Makefile

Code:
make clean
make
Result in "build/sbin" folder
kexec and kdump file to install in device Z1 (or ZU)

Enjoy.:D
Dude youre a legend haha, ill update OP as soon as my computers fixed, got a important report to do so will try n be active on her too, was doing some research heres what i found out.

If you unlock your bootloader, it sets a tamper fuse in trustzone, ill be backing up tz partition if/when unlocking device.
 
Last edited:
  • Like
Reactions: olokos

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
Could be missing tag in rdtag, I have a feeling something isnt right in kernel, ill have a look @ the kernel again to make sure/double check everything was implemented correctly
 

Shaky156

Senior Member
Aug 19, 2012
1,201
2,234
143
EDIT: double checked the atag defines, they are perfectly fine so now kexec-tools is fine, need to double check kernel now, which can only be done once my computer boots up :/

EDIT2: I GOT IT!! :D We are missing atags!
 
Last edited:

delewer

Senior Member
Aug 20, 2011
186
233
0
Paris
False alarm, btw watchdog is causing reboot on the dual recovery, from what i see, is dual recovery fixed?
I look here for rdtag, in kernel :"board-rdtag.c"
Code:
struct rdtags_tag_const {
	const char const key[16];
	const char const value[32];
};

struct rdtags_build_tags {
	const unsigned int magic;
	const unsigned int size;
	const struct rdtags_tag_const tag_array[NBR_OF_ELEMENTS];
};

And here, in kexec-tools : "kexec-zImage-arm.c"
Code:
(...)
struct tag *saved_tags = atag_read_tags();
(...)
I'll debug later zImage-arm (no computer here), to see what are results by procedure call in this module.
May be rdtag is complely false, and must be recodded