[Q] Porting HTC linux 3.4.10 kernel to CM10.1 - AT&T, Rogers HTC One X, Telstra One XL

I am trying to figure out how to port the recently released 3.4.10 kernel to CM10.1 for our device (One XL evita). I am able to build CM10.1 from source and I am able to build standalone kernels.
So far I've build CM10.1 with the HTC linux 3.4.10 kernel sources in place of the CM10.1 kernel sources at kernel/htc/msm8960 and the build completed with no errors but the device won't boot. The screen won't even turn on. I knew it obviously wasn't going to be this simple but I am stuck on how to proceed.
The CyanogenMod "porting intro"
http://wiki.cyanogenmod.org/w/Doc:_porting_intro
seems to indicate that you should be able to get CM up and running with any kernel. Can anyone give me some pointers on what the basic requirements are for a kernel to boot?

vanja_z said:
I am trying to figure out how to port the recently released 3.4.10 kernel to CM10.1 for our device (One XL evita). I am able to build CM10.1 from source and I am able to build standalone kernels.
So far I've build CM10.1 with the HTC linux 3.4.10 kernel sources in place of the CM10.1 kernel sources at kernel/htc/msm8960 and the build completed with no errors but the device won't boot. The screen won't even turn on. I knew it obviously wasn't going to be this simple but I am stuck on how to proceed.
The CyanogenMod "porting intro"
http://wiki.cyanogenmod.org/w/Doc:_porting_intro
seems to indicate that you should be able to get CM up and running with any kernel. Can anyone give me some pointers on what the basic requirements are for a kernel to boot?
Click to expand...
Click to collapse
We're already working on it....

h8rift said:
We're already working on it....
Click to expand...
Click to collapse
H8 I know you guys are always hard at work on the ROM but I'm trying to learn about the process by having a go myself. You never know, If I get up to speed I may be able to help you guys out. I'm not expecting to just get a perfect kernel up and running, I'm just hoping to build something that I can boot and play around with.
Do you have any advice? Is there a set pathway to getting a kernel up and running or a checklist of things that need to be in place? Is there any way to debug the kernel when it won't boot?

So the kernel is booting but not turning the screen on. I've attached the last_kmsg.
This is a summary of the errors that I've found.
Code:
pm8xxx-regulator pm8xxx-regulator.5: Failed to find supply ext_5v
Failed to create debugfs directory
pm8xxx_vreg_probe: regulator_register failed: 8921_usb_otg, rc=-517
pm8xxx_vreg_probe: error for 8921_usb_otg, rc=-517
pm8xxx_vreg_probe: regulator_register failed: 8921_hdmi_mvs, rc=-517
pm8xxx_vreg_probe: error for 8921_hdmi_mvs, rc=-517
LED trigger bkl_trigger failed to register (-17)
fail to get slimbus logical address -6
pm_qos_param: network_latency setup failed
[BATT][BMS] r_sense=10,i_test=0,v[failure=2000
[SMD][PKT] smd_pkt_open: DATA5_CNTL open failed -19
smem_alloc failed ch=34
smem_alloc failed ch=35
...
binder: t->buffer binder_alloc_buf fail
binder: 157:544 transaction failed 29201, size 80-4
mdp4_mixer_blend_setup: Error: no bg_pipe at mixer=0
Warning: unable to open an initial console.
Code:
WARNING: at /scr1/cm/system/kernel/htã/msm8960/fs/proc/generic.c:493 proc_register+0x148/0x1a8()
proc_dir_entry '/proc/emmc' already rdgistered
WARNING: at /scr1/cm/system/kernel/htc/msm8960/arch/arm/mach-msm/clock.c:185 clk_enable+0x58/0x210()
dsi1_s_p_clk: Don't call enable on unprepared clocks
WARNING: at /scr1/cm/system/kernel/htc/msm8960/arch/arm/mach-msm/clock-local.c:313 __branch_disable_reg+0x120/0x138()
dsi1_byte_clk status stuck at 'on'
WARNING: at /scr1/cm/system/kernel/htc/msm8960/fs/sysfs/dir.c:368 sysfs_add_one+0x7c/0x9c()
sysfs: cannot create duplicate filename '/dev/char/10:1'
WARNING: at /scr1/cm/system/kernel/htc/msm8960/arch/arm/mach-msm/clock-local.c:313 __branch_disable_reg+0x120/0x138()
dsi1_byte_clk status stuck at 'on'

Related

Kexec-hardboot patch

In this post, I would like to explain what kexec-hardboot patch is and also bring it to light a bit more since until now, it was only burried in MultiROM thread.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
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 7. 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 exec?
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.
Another difference is that both kernels must be patched. The "host" kernel requires a full patch, the one which is being kexecd' requires only two small compatibility patches.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
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.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Full kernel patch: https://gist.github.com/4558647, 4.1 kernel repo, cm 10.1 kernel repo
This is the full kernel patch. Kernels with this patch can be both "host" and "guest" kernels.
Related CONFIG options:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
CONFIG_GROUPER_HARDBOOT_RECOVERY=n
First three options must be enabled. Last one, GROUPER_HARDBOOT_RECOVERY, specifies if the kexec call should reboot to normal mode or to recovery. This can be useful if you don't have the kernel in boot partition but only as kernel in recovery partition. You usualy want to disable this option.​
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.​
Userspace kexec binary: View attachment kexec-tools.zip
That ZIP file contains kexec source, patches and README. It is from the original patch from Mike Kasick. It also contains precompiled, statically linked kexec binary, so you probably just want to use that.​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x85000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Currently used by:
MultiROM - I use it to boot different kernels (eg. Ubuntu).
MOSLO - Part of Plasma Active for Nexus 7, also usefull tool for every N7 developer - read more: http://ruedigergad.com/2012/12/09/nexus-7-easily-flashaccess-entire-userdata-partition/
Authors:
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.
Hi Tasssadar,
im trying to get this to work on the HOX in order to have a shot at multiboot,
the patched applied with no problem... however on compiling i gett this error
"Adress for kexec hardboot page not defined"
ask this error naturely defined to kick in with every device beside N7 i that comment completely....
and that ended up giving me an error about KEXEC_HB_PAGE_ADDR not defined,
so i readded it, but i removed the "#if defined(CONFIG_MACH_GROUPER)"
now trying to compile it, its gets pretty close to the end... but failed with unexpected string error at line OUTPUT_ARCH(arm) in file linux/arch/arm/boot/compressed/vmlinux.lds
Code:
/*
* linux/arch/arm/boot/compressed/vmlinux.lds.in
*
* Copyright (C) 2000 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
/DISCARD/ : {
*(.ARM.exidx*)
*(.ARM.extab*)
/*
* Discard any r/w data - this produces a link error if we have any,
* which is required for PIC decompression. Local data generates
* GOTOFF relocations, which prevents it being relocated independently
* of the text/got segments.
*/
*(.data)
}
. = 0;
_text = .;
.text : {
_start = .;
*(.start)
*(.text)
*(.text.*)
*(.fixup)
*(.gnu.warning)
*(.glue_7t)
*(.glue_7)
}
.rodata : {
*(.rodata)
*(.rodata.*)
}
.piggydata : {
*(.piggydata)
}
. = ALIGN(4);
_etext = .;
.got.plt : { *(.got.plt) }
_got_start = .;
.got : { *(.got) }
_got_end = .;
_edata = .;
. = ALIGN(8);
__bss_start = .;
.bss : { *(.bss) }
_end = .;
. = ALIGN(8); /* the stack must be 64-bit aligned */
.stack : { *(.stack) }
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
}
also, im booted into windows now... so i can't provide the exact error.
I'm afraid "comment everything which doesn't work" won't work here. The KEXEC_HB_PAGE_ADDR and END_MEM is device-specific, it will most likely be different for HTC One X. You can find out what address is it supposed to be by examining /proc/iomem on your device. For example, here's memory map from grouper:
Code:
...
80000000-be9fffff : System RAM
80008000-808faba7 : Kernel text
80940000-80b8228f : Kernel data
beb00000-bebfffff : ram_console
...
So, for grouper, END_MEM is 0xbe9fffff + 1 = 0xbea00000.
KEXEC_HB_PAGE_ADDR is located 1MB before console RAM, which is in this case also immediatelly after System RAM, so for grouper, it is also 0xbea00000.
but failed with unexpected string error at line OUTPUT_ARCH(arm) in file linux/arch/arm/boot/compressed/vmlinux.lds
Click to expand...
Click to collapse
That doesn't seem to be related to this patch. Are you using correct cross-compiler?
Tasssadar said:
I'm afraid "comment everything which doesn't work" won't work here. The KEXEC_HB_PAGE_ADDR and END_MEM is device-specific, it will most likely be different for HTC One X.
Click to expand...
Click to collapse
i figured
but im walking you through what i did.
You can find out what address is it supposed to be by examining /proc/iomem on your device. For example, here's memory map from grouper:
Code:
...
80000000-be9fffff : System RAM
80008000-808faba7 : Kernel text
80940000-80b8228f : Kernel data
beb00000-bebfffff : ram_console
...
So, for grouper, END_MEM is 0xbe9fffff + 1 = 0xbea00000.
KEXEC_HB_PAGE_ADDR is located 1MB before console RAM, which is in this case also immediatelly after System RAM, so for grouper, it is also 0xbea00000.
Click to expand...
Click to collapse
Code:
7d000000-7d003fff : tegra-udc.0
7d000000-7d003fff : tegra-otg
7d000000-7d003fff : tegra-udc
7d004000-7d007fff : tegra-ehci.1
80000000-beafffff : System RAM
80008000-8094000f : Kernel text
809a8000-810b940f : Kernel data
beb00000-bebfffff : ram_console
bec00000-beffffff : fbmem
bf000000-bf7fffff : fbmem
0xbeafffff + 1 = 0xbeb00000
grrr that would put me inside the ram_console...
aaaa would it wok if i used the address before??
7d00800
Edit:
or did your ram RAM end earlier because you set you END_MEM 0xbea00000
in that case, it works out just the same with the HOX
That doesn't seem to be related to this patch. Are you using correct cross-compiler?
Click to expand...
Click to collapse
i would have guessed so, but the kernel compiled and is working before the patch.
im using the one provided by google (Android NDK r9) while it contains booth gcc 4.6/4.8 im using 4.6 (arm-linux-androideabi-)
The patch will move ram_console 1MB further, see https://gist.github.com/Tasssadar/4558647#file-n7_hardboot-diff-L387 . You'll have to modify this part of the patch, it will be in different file for your device.
Tasssadar said:
The patch will move ram_console 1MB further, see https://gist.github.com/Tasssadar/4558647#file-n7_hardboot-diff-L387 . You'll have to modify this part of the patch, it will be in different file for your device.
Click to expand...
Click to collapse
HOX is also a Tegra 3 device... so im guessing i wont need to touch a thing?
also note... that iomem provided is from an unpatched kernel (as i cant compile a patched one)
also,
im currently on freenode #htc-one-x
if you dont mind joining.
I've been looking through the kexec-hardboot patch these last few days, trying to actually understand it instead of just blindly porting it and after several hours of messing with assembler with no means to debug it, I've managed to remove the need for guest kernel to be patched. This is not really useful for grouper, since thanks to multirom and accepting kernel devs, nearly every third-party kernel has the proper patches. But, if I'll port multirom to some other device (hello, flo), it will be very useful
To know more see the changes in this commit, but you'll probably need to understand how the patch does things: https://github.com/Tasssadar/androi...mmit/2ce4130061f72430a8ddfde25346c4e528c5c30b
@mkasick: Could you please look over this? I'm afraid there's some good reason why you didn't do this in the first place, like rewriting some part of memory which shouldn't be rewritten or something like that. Thank you.
Tasssadar said:
I've been looking through the kexec-hardboot patch these last few days, trying to actually understand it instead of just blindly porting it and after several hours of messing with assembler with no means to debug it, I've managed to remove the need for guest kernel to be patched. This is not really useful for grouper, since thanks to multirom and accepting kernel devs, nearly every third-party kernel has the proper patches. But, if I'll port multirom to some other device (hello, flo), it will be very useful
To know more see the changes in this commit, but you'll probably need to understand how the patch does things: https://github.com/Tasssadar/androi...mmit/2ce4130061f72430a8ddfde25346c4e528c5c30b
@mkasick: Could you please look over this? I'm afraid there's some good reason why you didn't do this in the first place, like rewriting some part of memory which shouldn't be rewritten or something like that. Thank you.
Click to expand...
Click to collapse
Perfect timing, just finished my last exam
Edit:
Also, this applies on top of the original patch right??
Edit2:
i can't seem to get it to kexec boot, but i didn't do much testing, maybe 2morrow night!
Edit3:
fixed, it was a problem with min-addr,
changed it to 0x82000000 and it worked
One more question...
TEGRA_PMC_BASE is also device specific, ain't it???
So, for a Qualcomm device, what should I be using? I am guessing it is MSM_RPM_BASE, which I got from here: http://forum.xda-developers.com/showpost.php?p=31127486&postcount=7
Yes, it is SoC-specific. This is using some special register to reset the chip, I'm not sure if that is available on msm chips - probably yes, but in some different form. Your best chance is to examine restart sequence in arch/arm/mach-msm/restart.c and port it to assembler.
Tasssadar said:
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0xA0000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Click to expand...
Click to collapse
The address of 0xA0000000 is not necessarily the best choice going forward. It originally made perfect sense, as it is well above everything else. But now that we can boot unpatched guest kernels, we can hit the interesting situation where the guest decompression may take a full minute. At least it's when I've seen on the Ouya game console that's running the next chip after Grouper.
When I realized what's going on, I changed to 0x8E000000, as it gets me just below the 256 MB limit of cache-enabled memory that's present on a typical guest at that early decompression stage. It's enough to hold a typical 8 MB boot image kernel/ramdisk. Now the guest kernel startup is fast in all cases.
Thank you Tasssadar for continuing your work in this area, especially with finding that way to allow unpatched guests.
Indeed, that's actually what I'm using in MultiROM for flo and mako (and grouper, but it is useless 'cause not all 3rd-party kernels have been updated), I just kinda "forgot" to update these threads.
Would it work on devices with locked bootloaders (Xperias). I mean :does the idea of this patch would also work on bootloader unlock allowed :no devices?
Sent from my LT22i using xda app-developers app
I am trying to build a kexec patched kernel integrated into a ROM. I make sure that the following code is there in the defconfig:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
The ROM works well, except that it does not boot my secondary ROMs - kexec hardboot patch missing. I have multi ROM and TWRP recovery installed
What am I missing?
Logs or it didn't happen.
Show me dmesg from normal boot into android, with MultiROM and your kernel installed.
Code:
adb shell
su
dmesg > /data/local/tmp/dmesg.txt
exit
exit
adb pull /data/local/tmp/dmesg.txt
Porting?
Tassadar which things do I need to boot kexec kernel on my device (Motorola Electrify 2) .
@Tasssadar, Sorry for picking up this kinda "old topic" but I'm sadly experiencing some problems while trying to port kexec-hardboot to the Sony Xperia Z2 (aka sirius). I applyed all needed commits (cherry-picked from a apparently working Z1 repo for stock kernel) to my CM based custom kernel (https://github.com/Myself5/android_kernel_sony_msm8974/tree/kexec-cm-12.0) and it does not boot at all. It's stuck on the Sony Logo, and it seems like I can't get any log either. I also tryed the stock cm kernel with the patch (https://github.com/Myself5/android_kernel_sony_msm8974-kexec) cause I tought it might be some incompatibility, but sadly it wasn't. Hope you have any ideas to solve my problems, cause I'm out of ideas ATM. I also checked the kexec commits for other devices (namely the One Plus One) and it seems like I got everything needed.
Thanks in Advance
Tasssadar said:
In this post, I would like to explain what kexec-hardboot patch is and also bring it to light a bit more since until now, it was only burried in MultiROM thread.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
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 7. 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 exec?
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.
Another difference is that both kernels must be patched. The "host" kernel requires a full patch, the one which is being kexecd' requires only two small compatibility patches.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
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.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Full kernel patch: https://gist.github.com/4558647, 4.1 kernel repo, cm 10.1 kernel repo
This is the full kernel patch. Kernels with this patch can be both "host" and "guest" kernels.
Related CONFIG options:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_ATAGS_PROC=y
CONFIG_GROUPER_HARDBOOT_RECOVERY=n
First three options must be enabled. Last one, GROUPER_HARDBOOT_RECOVERY, specifies if the kexec call should reboot to normal mode or to recovery. This can be useful if you don't have the kernel in boot partition but only as kernel in recovery partition. You usualy want to disable this option.​
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.​
Userspace kexec binary: View attachment 1653562
That ZIP file contains kexec source, patches and README. It is from the original patch from Mike Kasick. It also contains precompiled, statically linked kexec binary, so you probably just want to use that.​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x85000000 --command-line="$(cat /proc/cmdline)"
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Currently used by:
MultiROM - I use it to boot different kernels (eg. Ubuntu).
MOSLO - Part of Plasma Active for Nexus 7, also usefull tool for every N7 developer - read more: http://ruedigergad.com/2012/12/09/nexus-7-easily-flashaccess-entire-userdata-partition/
Authors:
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.
Click to expand...
Click to collapse
I'm sorry for picking up this older topic as well, but I always played with the thought of merging kexec support into a kernel and I'm doing one right now.. But my secondary device is a LG G2 and since the era of Lollipop began, somehow MultiBoot just stopped working and nobody can figure out why. I think they even started to build some new concept now.. So before I spark a heated debated by Note 4 users I'd love to know if you have any idea if this patch is still applicable? Altough the only way to find out is to probably just try it lol.
Tasssadar said:
In this post, ....
Click to expand...
Click to collapse
Bro can you please mention on your wiki that kexec isnt supported for x64 devices? It will be great help and save developers hours! I was porting for oneplus 2 when a dev told me that kexec isnt there for x64. I was shocked
Is any alternative available for that? Please reply! Thanks.
All other devs, who cant make multirom to work (lollipop is the x64 era) stop working. Kexec isnt supported for x64. Find an alternative for it.
Can Anyone help me to port this? Here is my patched kernel (ignore arch/arm64) and this is /proc/iomem.
Code:
80000000-854fffff : System RAM
80008000-80fa43ef : Kernel code
81112000-817bf797 : Kernel data
8cb00000-9fefffff : System RAM
9ff00000-9ff3ffff : persistent_ram
9ff40000-9ff7ffff : persistent_ram
9ff80000-9fffffff : persistent_ram
a0000000-ffffefff : System RAM
For kexec_hb_page_addr the value i inseted is 85500000 coz as tasssadar said 884fffff + 1 = 85500000, but I don't know what value add for
Code:
#elif defined(CONFIG_ARCH_MSM8916)
/* Restart using the PMIC chip, see mach-msm/restart.c */
ldr r0, =MSM8916_HARDBOOT
mov r1, #0
str r1, [r0, #0]
loop: b loop
MSM8916_HARDBOOT, and if I compile the kernel it stucks on samsung logo.

[DEVELOPMENT and DISCUSSION][KEXEC] ISSUES DISCUSSION

Original thread by hashcode for RAZR http://forum.xda-developers.com/showthread.php?t=2181971
Here is a copy paste.
Hashcode said:
** WARNING: THIS THREAD SHOULD BE FOR KERNEL DEVELOPERS OR ROM DEVS.
Users please post questions in your ROM's support threads. **
** DEVS: If you choose to use a kexec kernel in your ROM add a "KERNEL CREDIT" for the first 4 people in the "WHO HAS WORKED ON THIS?" section below. This has been spectacular development and credit is due. **
TESTING ROMS FOR KEXEC KERNEL PROGRESS:
Droid RAZR:
[2013-03-12] cm-10.1 on v3.0.8 JB kernel:link removed for safety
GSM RAZR:
cm-10.1 on v3.0.8: link removed for safety
MAPPHONE 3.0.x KEXEC KERNEL:
For use on Motorola devices; Droid RAZR, GSM RAZR, RAZR MAXX, Bionic and Droid 4. (1 GB OMAP4 devices for now, 512MB support coming).
WHAT IS A KERNEL?
Also from Wikipedia: http://en.wikipedia.org/wiki/Kernel_%28computing%29
Summary: If you had to choose 1 binary file which connects the hardware components of your device to the OS layer whether it be Android or some other software, it would be the kernel.
WHAT IS KEXEC?
The best description is found here on Wikipedia: http://en.wikipedia.org/wiki/Kexec
Summary: kexec is a process for hot reloading a new kernel while a device is running.
WHERE DID THIS KERNEL COME FROM?
Initially the source came from Motorola. All GPL components of Android are posted on Sourceforge.net for Motorola devices:
http://sourceforge.net/motorola/
After that it's been worked on (see below) to support kexec function and work for our needs.
WHO HAS WORKED ON THIS?
Several people played a large role in making this happen:
Kholk & [MBM]: Initial development work done on the RAZR/Bionic under Gingerbread to setup kexec modules + booting kexec kernel (no 2nd cpu)
jonpry: Ported and improved Kholk/MBM's work for use on the Droid 3. Brought up 2nd CPU, fixes for audio and more.
Hashcode (myself): On going development of this kernel for flawless function on our devices.
A full kernel source history on github starting with omapzoom sources and migrating Motorola source in commit by commit
Fixes for clocks, local timers, GPMC setup, race conditions in irq's due to kexec and more.
On going development towards full support for current Android / Ubuntu Phone OS requirements (including 512MB and Droid 3 support).
Other's have also contributed code (and hopefully more will as well): kfazz(D4), jarveson(D3) and more.
WHERE IS THE SOURCE?
KERNEL SOURCES (ALL DEVICES):
https://github.com/STS-Dev-Team/kernel_mapphone_kexec
BRANCH: stock-ics-kexec
DESCRIPTION: This is a perfect copy of the ICS kernel running as kexec. For use with stock-based ROM's etc.
STATUS: Ready for use
BRANCH: jb-mr1
DESCRIPTION: Ongoing kernel branch for support of newer Android OS (Jellybean MR1 currently).
STATUS: Work-in-progress. Heavy development
KEXEC KERNEL-MODULE SOURCES FOR ICS/JB BASED DEVICES:
https://github.com/STS-Dev-Team/kernel_kexec_modules/tree/3.0.8-ics-spyder
Branch: 3.0.8-ics-spyder
Defconfig: mapphone_kexec_defconfig
KEXEC KERNEL-MODULE SOURCES FOR GB BASED DEVICES (Droid 3):
https://github.com/STS-Dev-Team/kernel_kexec_modules/tree/2.6.35-solana/
Branch: 2.6.35-solana
Defconfig: mapphone_defconfig
HOW TO KEXEC A DEVICE
1. Download kexec kernel modules + kexec binary for your base kernel version
(Most devices found here):
https://github.com/STS-Dev-Team/android_device_motorola_omap4-kexec-common/tree/cm-10.1/kexec
(Droid 3 Users need GB based modules here):
https://github.com/STS-Dev-Team/android_device_motorola_solana/tree/jb-mr1/kexec
2. Download the devtree for your device:
Droid RAZR: https://github.com/STS-Dev-Team/android_device_motorola_spyder/tree/jb-mr1/kexec
GSM RAZR: https://github.com/STS-Dev-Team/android_device_motorola_umts_spyder/tree/jb-mr1/kexec
Bionic: https://github.com/STS-Dev-Team/android_device_motorola_targa/tree/jb-mr1/kexec
Droid 4: https://github.com/STS-Dev-Team/android_device_motorola_maserati/tree/jb-mr1/kexec
Droid 3: Droid 4: https://github.com/STS-Dev-Team/android_device_motorola_solana/tree/jb-mr1/kexec
3. Need a kexec kernel binary from the above sources: renamed the zImage as "kernel".
4. Need a .gz cpio ramdisk named: ramdisk.img
**RAMDISK needs to take care of mounting related filesystems for your ROM.
Ususally Safestrap/BMM handles this in some way for rom-slots.
For easy kexec tests you can build a CWM ramdisk and use that.
Now boot up into a safe kexec point on the device be it BMM or Safestrap where you can use adb.
5. Move all of the above files onto the rootfs
6. Execute the following as a script:
Code:
# run this from a "safe" boot point (safestrap / bootmanager) where no mounts are active
cd /
chmod 755 /kexec
# you will lose USB function here till the new kernel boots -- hence the script
insmod /uart.ko
insmod /arm_kexec.ko
insmod /kexec.ko
/kexec -l /kernel --devtree=/devtree --ramdisk=/ramdisk.img
sleep 1
/kexec -e
CURRENT DEVELOPMENT ROAD MAP
Merge up to Linux Mainline v3.0.21 + Google kernel/common commits (where applicable)
Cherry-pick from TI's kernel tag 4AI.1.5 to 4.AI.1.6
Merge up to Linux Mainline v3.0.31 + Google kernel/common commits (where applicable)
Cherry-pick from TI's kernel tag 4AI.1.6 to 4.AI.1.7
Also pick up any p-android-omap-3.0 and p-android-omap-3.0-dev commits where needed
Merge up to current Linux Mainline + Google kernel/common commits (where applicable)
Click to expand...
Click to collapse
Currently, there is one kexec based rom for Atrix 2 CM10.1 by wanggjghost here.
Source Code for Atrix 2 http://sourceforge.net/projects/atrix2.motorola/files/
and http://sourceforge.net/projects/me865.motorola/files/ME865/
Other source code that can help you wanggjghost's github https://github.com/SunRain/android_device_motorola_edison
ISSUES TO BE SOLVED
The current major issue regarding Kexec is that some devices get a black screen once kexec is executed.
This thread to discuss and develop a solution for it. And once that is solved, to discuss custom kernels.
Here are a few things that might help.
kmsg when kexec boot up failed: http://www.mediafire.com/download.php?95raby988dvch74 (just open it with a text editor. It is corrupt but you can make out quite a lot.)
The dmesg for stock ics: http://www.mediafire.com/view/?z4pibf2at3u4i7e (Going through this will give you better idea as how things should be.)
And the panic msg after I soft reset it after a black screen: http://www.mediafire.com/view/?z4pibf2at3u4i7e (When I get a black sscreen, I hold vol up+ vol down+ pow for about 10 secs. that soft resets my phone and a panic msg is generated which I retrieve.)
From the kmsg, here is something interesting that appears to be the cause. (Note: I have made some edits to make it readable, not completely readable though.)
Code:
[ 2.745880,0] cannot apply mgr(lcd) on inactive device
[ 2.745971, ] omapfb omapfb: failed to apply dispc config
[ ².·46893¬0] cannot apply mgr(tv) on inactive device
[ 2.746154,0] omapfb omapfb: failed to apply dispc config
[ 2.746307,0] cannot aplly mgr(lcd2) on inactive(device
[ 2.7463¶8,0\ omapfb omapfb: failed to apply dispc config
[ 2.746520,0] DSI: dsi_fc_kmd = 0, dói_vc_video 9 1
[ 2®746582,0] DT: x_res=540 y_res=960 phy_w_mm=54 phy_h_mm=95
[ 2.·46673,0](ÄT: hfp=0 hsw=² hbp-2 vnp=0 ösw=1 vbp=1
[ 2®746795,0] DTº cìk_lanå=1 clk_pos90 d1_line=2 d1_pos=0 d2_lane=3 d2_pos=0
[ 2.746948,0](DT: d3_lane=0 d3_pos=0 d4_lane=0 d4_pos=0
[ ².747009,0] DT: panel_id= x1a000² type= 0
[ 2.747102,0] DT: regn=13 regm=230 regm3=6 regm4=6 lp_clk_div=9 lck_div=1 pck_div=4
[ 2.747222,0] DT: te_support=1, te_type=0
[ 2.747283,0] DT: number of power suppljes-±
[ 2.747436,0] DT: Supply #°, beg name=sw4, gpin=96,*gpio_en_val=1
[ 2.(43¸57,0] mmc2: card claims to support voltages below the defined range. These will be ignored.
[ 2.860656,0] omapdss DSI error: Failed to receive BTA
[ *2.861816,0] mmc2: quduing unknïwn CIS tupìe 0x99 (3 jytms)*[( 2.862792¬0] mmc2: .%w high speeä RDIG kard at address 0001
[ 2.962280,0] omapdss DSI error: Failed to receive BTA
[ 3.063781,0] omapdss DSI error: Failed to receive BTA
[ "3®091705,0] mmc0: host doås(not cupport reiding re!d-onlù switch. assuminç write-enable.
[ 3.0)5336,0] míc0: new hkgh speed SDHC cabd at address aaaa
[ 3.896496,0] mmcblk0:(mmc0:aaaa SU16G 14.8 GiB
[ 3®101·76,0] mmcblk : p1
[" 3.165374,0] omapdss DS (error: Fa)led to receire BTA
[ 3.26693',0] omapnss DSI error: Failed to rekeivm(BTA*[ ¨ 3®368538,0] kmapdss DS) ebror: Failed to receivm BTA
[ 3.<78062¬0Y omapdss DSI error: Failed to receive BTI
[ "3.571624,0] omapdss DSI error:(Failed to receive BTA
[ 3*673217,0](oma0dss DSI ezror: Failed to receive BTA
[ ³.774749,0] omapdss DSI error: Fâile` to rekeive BTA
[ 3.¸76312,0\ om!pdss SI erro2: Failed to receive BTA
[ 3.876556,0] check_mapxjone_panel_present: Faineä to recmive BTA ACK foz 10 times.
[ 3.877014,0] marphone_xanel_power_on:Paneì és not attached nò failed ðo send BTA.*[ 3.8772¸8,0] omapfb omapfb: Fáile$ to enable display 'lcd'
[ 3.¸77746,0] kmapfb omapfb: failed to inkpialize default display
[ 3.¸79821,0] omarfb omapfb: failed |o se4up omapf"Š[ 3.¸80279,0] omapfb: probe of omapfb fa)led with error -22
[ 3.882019,0] regulator_init_complete: vwlan1: disibling
[ " 3.882873,0] begulat/r_inét_complete: vrfref: dhsabling
[ 3.883544,0] renulator_init_coíphete: vbf²: disabling
Z 3.8:7145,0] regulator_check_voltage: v5sb: operation not allowed
[ 3.:91937,0] lm3532_bl_work: Display backlight(disable)
The issue appers to be regarding omapfb (frame buffers). might be an issue with the command line. wang's kernel uses
Code:
root=/dev/ram0 rw [email protected] console=null vram=10300K omapfb.vram=0:8256K,1:4K,2:2040K init=/init ip=off mmcparts=mmcblk1:p7(pds),p15(boot),p16(recovery),p17(cdrom),p18(misc),p19(cid),p20(kpanic),p21(system),p22(cache),p23(preinstall),p24(webtop),p25(userdata),p26(emstorage) mot_sst=1 androidboot.bootloader=0x0A74
However, using
Code:
root=/dev/ram0 rw [email protected] console=ttyO2,115200n8 init=/init ip=off mmcparts=mmcblk1:p7(pds),p15(boot),p16(recovery),p17(cdrom),p18(misc),p19(cid),p20(kpanic),p21(system),p22(cache),p23(preinstall),p24(webtop),p25(userdata) mot_sst=1 androidboot.bootloader=0x0A73
might solve.
Also, the following keeps repeating
Code:
PVR_K:(error):BridgedDispatchKM: Initialisation failed. Driver unusable
but PVR_K is related to display (I guess) and that again takes us back to omapfb.
Put in your thoughts as well but try to keep the thread clean.
Here's another panic log: http://pastebin.com/TdU31ERU
Regarding the "PVR_K: (Error): BridgedDispatchKM: Initialisation failed. Driver unusable." error that Ravi pointed out... and for my curiosity..
Can someone who has the kexec build running run these from a command line, please? (and post the output here):
Code:
adb shell
cat /proc/pvr/version
strings vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so | grep build
$ adb shell
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found
$ cat /proc/pvr/version
Version SGX_DDK_Android sgxddk 19 [email protected] (release) omap4430_android
System Version String: SGX revision = 1.2.0
_POWERVR_SGX540_120.so | grep build <
OpenGL ES GLSL ES 1.00 build [email protected]
OpenGL ES 2.0 build [email protected]
$
Sent from my MB865 using xda app-developers app
---------- Post added at 04:41 PM ---------- Previous post was at 04:35 PM ----------
Is that what u need?
Sent from my MB865 using xda app-developers app
jaymccoubrey said:
$ adb shell
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found
$ cat /proc/pvr/version
Version SGX_DDK_Android sgxddk 19 [email protected] (release) omap4430_android
System Version String: SGX revision = 1.2.0
_POWERVR_SGX540_120.so | grep build <
OpenGL ES GLSL ES 1.00 build [email protected]
OpenGL ES 2.0 build [email protected]
$
Sent from my MB865 using xda app-developers app
---------- Post added at 04:41 PM ---------- Previous post was at 04:35 PM ----------
Is that what u need?
Sent from my MB865 using xda app-developers app
Click to expand...
Click to collapse
Yup, thanks.. I was just chasing wild geese again..
[Edited to reduce clutter, etc.. ]
So, yea, wild goose chase...
--------------------------
Also, @Ravi - this is my current device BoardConfig:
Code:
# inherit from common
-include device/motorola/omap4-kexec-common/BoardConfigCommon.mk
# inherit from the proprietary version
-include vendor/motorola/edison/BoardConfigVendor.mk
# Processor
TARGET_BOOTLOADER_BOARD_NAME := edison
# Kernel
BOARD_KERNEL_CMDLINE := root=/dev/ram0 rw [email protected] console=null vram=10300K omapfb.vram=0:8256K,1:4K,2:2040K init=/init ip=off mmcparts=mmcblk1:p7(pds),p15(boot),p16(recovery),p17(cdrom),p18(misc),p19(cid),p20(kpanic),p21(system),p22(cache),p23(preinstall),p24(webtop),p25(userdata),p26(emstorage) mot_sst=1 androidboot.bootloader=0x0A72
BOARD_KERNEL_BASE := 0x80000000
BOARD_PAGE_SIZE := 0x4096
# Kernel Build
TARGET_KERNEL_SOURCE := kernel/motorola/omap4-kexec-common
TARGET_KERNEL_CONFIG := mapphone_1GB_defconfig
And I have the same BOARD_KERNEL_CMDLINE in the mapphone_1GB_defconfig.. but pretty sure I have other issues as well. Here's a kmsg from an attempt at booting mine: http://pastebin.com/VZzg0ALD - containing my favorite debug message ever: Bad BP 0[ID: 0x0], Is this a Phone ??
One more thing, take a look at the atags with a hex editor...
Im kimda limited on what i no how to do.. Tell me what to do and how ill do it.
Sent from my MB865 using xda app-developers app
---------- Post added at 06:32 PM ---------- Previous post was at 06:26 PM ----------
I download a hex Editor. Where do i look?
Sent from my MB865 using xda app-developers app
jaymccoubrey said:
Im kimda limited on what i no how to do.. Tell me what to do and how ill do it.
Sent from my MB865 using xda app-developers app
---------- Post added at 06:32 PM ---------- Previous post was at 06:26 PM ----------
I download a hex Editor. Where do i look?
Sent from my MB865 using xda app-developers app
Click to expand...
Click to collapse
Lol.. My ramblings weren't directed at you specifically.. It's just for general (possibly cluttered and useless) info.. And that last note was for Ravi actually - on the topic of board kernel command lines..
Sent from my MB865 using xda app-developers app
So do u need anything else. Ill help cause ur roms kick ass
Sent from my MB865 using xda app-developers app
jaymccoubrey said:
So do u need anything else. Ill help cause ur roms kick ass
Sent from my MB865 using xda app-developers app
Click to expand...
Click to collapse
Thanks.. But I'll post if I need/want to see something else from kexec running..
And this kexec and kernel stuff is new territory for me (well, android is relatively new to me still also..) - so I am just trying to learn/do what I can.. The more getting involved, the merrier.
Sent from my MB865 using xda app-developers app
I just received my dev Atrix 2 today thanks to rvalentin913.
My goal with the device is to get it running alongside our other devices (Droid3, Bionic, RAZR's and Droid 4) so that it can be merged into CM's official devices.
However there does seem to be some missing pieces so to speak in the kernel that I'll be looking to fix over the next few weeks.
I'll try and comment on what I'm seeing in the posts above:
1. "omapdss DSI error: Failed to receive BTA" This indicates that the LCD on some of the devices isn't directly supported by the kernel and/or not being setup correctly by the devtree. Also very likely the cause of a blank screen (obviously).
2. "PVR_Kerror):BridgedDispatchKM: Initialisation failed. Driver unusable" indicates that pvrsrvinit didn't complete the initialization of the SGX libs for 1 reason or another. This could many things here and possibly related to #1. I'll have to run a strace or other tests to see where it's failing.
3. I'm reverting the mem= param back to 1023M in the kexec kernels due to a bug in the way Motorola has the kernel setup. They set the SMC driver memory to 2M, but the driver itself will expand to a minimum of 3M. The way the kernel is setup this area is designated right at the very top of memory. So Motorola probably didn't understand why they were getting odd memory issues when using the 1024 setting (this effectively pushes the SMC area out of the 1GB RAM limit). So they dropped the mem= parameter to 1023 where the SMC driver would set the start of SMC memory to 1021M and drift up to 1024.
4. Also the ATAGS which point to the devtree memory location have a tendancy to be cleared out at the drop of a hat for some reason. And that causes an empty devtree to be read into memory. (IE: Bad BP 0[ID: 0x0], Is this a Phone). I'm also chasing this down to see what clears out this memory area. The first time it was an early cache setup by the SMC driver, but there's somewhere else now as well.
What makes this complicated is that the memory location for the devtree and atags is decided at the point of kexec. So it can be a bit random causing this issue to only occasionally show up.
Anyway, I'll try and post a full thread w/ full support once I get my end up and running on the Atrix 2.
I haven't decided yet how I want to boot the device into a 2nd ROM. Currently Safestrap doesn't use external SD cards for rom-slots and to use the internal area, I would need to play some tricks on the OS using the fuse daemon (treat it like an internal SD card). Personally, I think the internal area gives the best performance and I'm leaning towards this route.
But, I won't make anyone flash over their stock system. Ever.
EDIT: I just read through some of the bootlogs and I'm confused about the end of the one here:
http://www.mediafire.com/view/?z4pibf2at3u4i7e
- "init: cannot execve('/system/bin/debuggerd'): No such file or directory" This looks like an obvious missing file, but I wonder why it's being called in the first place.
- procfs_write: version magic '2.6.35.7 SMP preempt mod_unload ARMv7 ' should be '3.0.8 SMP preempt mod_unload ARMv7 '
- dirty_arm_kexec: version magic '2.6.35.7 SMP preempt mod_unload ARMv7 ' should be '3.0.8 SMP preempt mod_unload ARMv7 '
- dirty_kexec: version magic '2.6.35.7 SMP preempt mod_unload ARMv7 ' should be '3.0.8 SMP preempt mod_unload ARMv7 '
These are GB-based kernel modules built for kexec trying to execute at the end of the log? *boggle*
Hashcode said:
I just received my dev Atrix 2 today thanks to rvalentin913.
Click to expand...
Click to collapse
Nice (I was kinda hoping/guessing it was you).
Will be very glad to see you digging into this phone also. Let me (or any of us) know if you need any assistance..
And thanks again for your major efforts and contributions in general.
Sent from my MB865 using xda app-developers app
Hashcode said:
I haven't decided yet how I want to boot the device into a 2nd ROM. Currently Safestrap doesn't use external SD cards for rom-slots and to use the internal area, I would need to play some tricks on the OS using the fuse daemon (treat it like an internal SD card). Personally, I think the internal area gives the best performance and I'm leaning towards this route.
But, I won't make anyone flash over their stock system. Ever.
Click to expand...
Click to collapse
Sir, the moto guys at China have done that. They mount /data/media as internal sd. i.e., the stock me865 roms have it. I will upload the ramdisk, vold.fstab, vold.fstab.swap and the build.prop when I get to my comp. I tried using 2nd init with the changes in ramdisk, included the fstab files and made the changes in build.prop but that did help me.. let me know if anything else is required.. for bmm, we just mount data for int and the virtual systems are stored there.
And thanks again for all the work you have done..
Sent from my MB865 using Tapatalk 2
Ravikirancg said:
Sir, the moto guys at China have done that. They mount /data/media as internal sd. i.e., the stock me865 roms have it. I will upload the ramdisk, vold.fstab, vold.fstab.swap and the build.prop when I get to my comp. I tried using 2nd init with the changes in ramdisk, included the fstab files and made the changes in build.prop but that did help me.. let me know if anything else is required.. for bmm, we just mount data for int and the virtual systems are stored there.
And thanks again for all the work you have done..
Sent from my MB865 using Tapatalk 2
Click to expand...
Click to collapse
Ah, yep, the /data/media mount is managed via the fuse daemon as a simulated VFAT partition, and needs to have FUSE support in the kernel (easily done in kexec).
Any idea why there are GB kexec modules trying to execute in that log?
Hashcode said:
Ah, yep, the /data/media mount is managed via the fuse daemon as a simulated VFAT partition, and needs to have FUSE support in the kernel (easily done in kexec).
Any idea why there are GB kexec modules trying to execute in that log?
Click to expand...
Click to collapse
ah! It requires a modified kernel as well! Thank you. That was the missing piece when I tried it some months ago. Well any way, the good news is that I have managed to emulate internal sdcard on stock searet. I just need to make out all the necessary changes that need to be made in the build.prop. For now, I just used miui build.prop. So that issue is more or less solved except for att users may have to erase cid to flash the hktw boot.img
EDIT: Well a little more work needs to be done I guess.. just some fc..
regarding the GB modules, maybe I was just experimenting.. since its happening after phone is overclocked, its my doing I guess. I will try loading on stock rom again and will let you know..
and take a look at this. defy having kinda the same issue. http://mcbawse177.appspot.com/pastebin.com/31VLSvyJ
quarx might have an idea on how to solve this.. look at line 1046
alteredlikeness said:
One more thing, take a look at the atags with a hex editor...
Click to expand...
Click to collapse
that was interesting.. well, among the currently supported phones, all have that partition table except XT875. Only that has lbl and lbl_backup like our phone but it has an emstorage at p26 and p27 is sgpt. here (also take a look at the other models listed there.) I was once just trying kexec with all the devtrees and there was one devtree using which, my keypad got lighted up after kexec was executed. with all others, the keypad would turn off and stay as such. I will try them again. Oh and just for fun (if you have moto drivers software installed on comp), download the devtrees for all the devices, replace one of them, turn off phone, turn it back on with kexec enabled, connect the phone to comp and take a look at the drivers that windows install. change the devtree and do it again..
Ravikirancg said:
that was interesting.. well, among the currently supported phones, all have that partition table except XT875. Only that has lbl and lbl_backup like our phone but it has an emstorage at p26 and p27 is sgpt. here (also take a look at the other models listed there.) I was once just trying kexec with all the devtrees and there was one devtree using which, my keypad got lighted up after kexec was executed. with all others, the keypad would turn off and stay as such. I will try them again. Oh and just for fun (if you have moto drivers software installed on comp), download the devtrees for all the devices, replace one of them, turn off phone, turn it back on with kexec enabled, connect the phone to comp and take a look at the drivers that windows install. change the devtree and do it again..
Click to expand...
Click to collapse
Well, about the devtree - I found that wang added this to the finalize_release script that initializes the cmdefy bootmenu recovery (courtesy of Hashcode, apparently):
Code:
#!/sbin/sh
PATH="/system/xbin:/system/bin:/sbin:${PATH}"
DEVTREE_PARTITION=/dev/block/mmcblk1p12
KEXEC_DEVTREE=/system/etc/kexec/devtree
#For kexec boot, we need a special devtree from each phone model
#So dump a devtree
#Note /dev/block/mmcblk1p12 is the devtree partition for edison
#And 65K is enough
#Credits for Hashcode for this info
[ -f $KEXEC_DEVTREE ] && rm -r $KEXEC_DEVTREE
busybox dd if=$DEVTREE_PARTITION of=$KEXEC_DEVTREE bs=1 count=65000
I made it as a stand-alone script that I was running with my attempts at booting my kexec builds with BMM... no luck - but like I said, my current kexec build has other issues as well I think..
alteredlikeness said:
Nice (I was kinda hoping/guessing it was you).
Will be very glad to see you digging into this phone also. Let me (or any of us) know if you need any assistance..
And thanks again for your major efforts and contributions in general.
Sent from my MB865 using xda app-developers app
Click to expand...
Click to collapse
Ditto hash, great to see you grabbing a seat on A2train.
ALL ABOARD. NEXT STOP KEXEC. Please raise your trays. Lock your seat back to comfortable position, and enjoy the ride!
Any help I can bring, I am but a humble servant.
Sent from my MB865 using xda app-developers app
Hmm.. take a look at the tombstone.
http://pastebin.com/4jrTaAbF
Its just an issue with graphics driver? But it did boot up a couple of times.. and how does it boot up on some a2s?
Sent from my MB865 using Tapatalk 2
alteredlikeness said:
Well, about the devtree - I found that wang added this to the finalize_release script that initializes the cmdefy bootmenu recovery (courtesy of Hashcode, apparently):
Code:
#!/sbin/sh
PATH="/system/xbin:/system/bin:/sbin:${PATH}"
DEVTREE_PARTITION=/dev/block/mmcblk1p12
KEXEC_DEVTREE=/system/etc/kexec/devtree
#For kexec boot, we need a special devtree from each phone model
#So dump a devtree
#Note /dev/block/mmcblk1p12 is the devtree partition for edison
#And 65K is enough
#Credits for Hashcode for this info
[ -f $KEXEC_DEVTREE ] && rm -r $KEXEC_DEVTREE
busybox dd if=$DEVTREE_PARTITION of=$KEXEC_DEVTREE bs=1 count=65000
I made it as a stand-alone script that I was running with my attempts at booting my kexec builds with BMM... no luck - but like I said, my current kexec build has other issues as well I think..
Click to expand...
Click to collapse
Actually we were talking about this and it doesn't work. The devtree needs to be chopped off right at the last null in the file (where it starts turning to all "FF" in a hex editor.
I think it would be a great idea to modify this tho so that it does work.
Ravikirancg said:
Hmm.. take a look at the tombstone.
http://pastebin.com/4jrTaAbF
Its just an issue with graphics driver? But it did boot up a couple of times.. and how does it boot up on some a2s?
Sent from my MB865 using Tapatalk 2
Click to expand...
Click to collapse
This error reminds me more of when there is no gralloc.omap4.so symlink in /system/vendor/lib/hw. Doesn't look exactly kexec related.

make kexec guestable kernels

hi all,
i'm going to support multiple android roms loading in my kernel_chooser + root_chooser project.
in few words it will be a powerful bootloader for android.
this is what it will be able to do ( many points are yet working ):
kernel loading thought kexec
boot from external devices
boot from subfolders
custom background
change android /sytem partition
change android /data partition
wipe android /cache partition
what i'm asking to you it's to make your android rom's kernel kexec-ready, applying them a kexec guest patch.
thus to make them ready to load for me.
if not i have to patch your kernel every time you modify it.
kernel_chooser and root_chooser are hosted here: https://github.com/tux-mind/tf201-dev
they are made for the asus transformer prime ( TF201 ), but they can run on any android device with your help.
i will add you to the github collaborators if you want to help.
now we are working on multiple android roms support.
thanks in advance for your time.
-- tux_mind
@tux_mind sounds like an interesting idea. So this works for all device's kernels? Once I apply the patch to my kernel source, what happens after that? I'll make sure to follow your progress, good work
HTCDreamOn said:
@tux_mind sounds like an interesting idea. So this works for all device's kernels? Once I apply the patch to my kernel source, what happens after that? I'll make sure to follow your progress, good work
Click to expand...
Click to collapse
thanks
yes, this should work for all devices, except for a little tuning of the partition with the configuration data ( /data ).
i have to make it to self-detect the /data partition.
let's say for example that you want to use it on your HTC Vision.
i have to build an host kernel by the stock one applying the host kexec patch.
than i have to build an android boot image which contains kernel_chooser as initrd and the above kernel.
this android boot image will be written to your current one though fastboot.
after that kernel_chooser will be able to load any kernel patched with the guest patch.
obviously the loaded kernel must be made for that device
it can also load a custom initrd and use a custom kernel CMDLINE.
so, after i made a HTC Vision kernel_chooser, your rom it's ready to load if you applied the guest patch to you kernel.
i can't explain well how to make you rom "bootable" because we are developing this
but if your kernel is kexec-loadable it will be supported by kernel_chooser.
i will update you in the next days
bye!
Really great idea! As it support other devices I can throw in my kernel which is a kexec one for the Motorola RAZR, because of our locked bootloader. The question is: how different are the methods to use kexec?
M.o.t.o.r.o.l.a.R.a.z.r - JBX-Kernel 0.5a - Tapatalk4
@tux_mind this'll sound really stupid but how do actually patch our kernels for this? Do I have to build kexec from here or something?
dtrail1 said:
how different are the methods to use kexec?
Click to expand...
Click to collapse
kexec it's a syscall, so it's the same on every arm device.
HTCDreamOn said:
@tux_mind this'll sound really stupid but how do actually patch our kernels for this? Do I have to build kexec from here or something?
Click to expand...
Click to collapse
there is a good explaination here:
http://forum.xda-developers.com/showthread.php?t=2104706
look at the "Compatibility patch".
for my tf201 the guest patch is this: http://git.lilstevie.geek.nz/?p=ubu...ch;h=54c2e480682afb0629f3854dfea4154f528421e5
which is almost the same...
i hope that almost all kernels have the same host/guest patch, in order to save us a lot of work.
the patch isn't need for kexec, but for hardboot kexec, thus to physically shutdown and restart the device with your kernel, from 0.
the standard kexec it's a assembly jump to 0 ( jmp 0x0 ) with the new kernel loaded in the .text section.
but the standard method don't reinitialize the devices and many other things that could rest in a undefined state.
btw, i have almost done my work.....i'm fighting the android udev which is overwriting my symlinks..
see you!
i got it!
my initial target was to remove devices created by ueventd and replace them with symlink to loop devices.
but android respawn ueventd and replaces my symlinks...
i tried to start the android ueventd, leave it running, and replace the /sbin/ueventd with a infinite sleep static program
but android dont' start at all..i can't even access via adb.
so, the "final" solution is to edit the /fstab.$hardware, which should be in any andoird boot image ( right ? ).
please feel free to suggest any other way to hack the mount process.
you can find the sources here: https://github.com/tux-mind/tf201-dev/tree/master/android_chooser
the program read the paths from kernel cmdline.
the syntax is that:
Code:
newandroid=blkdev:initrd_path:fstab_path
where
blkdev is the linux name of the blockdevice containing the next args ( e.g. /dev/mmcblk0p8 )
initrd_path is the path on the previous blockdevice of the android initrd ( gzipped or not )
fstab_path is the path on the previous blockdevice of the fstab file
the fstab file have this syntax:
Code:
/android/mountpoint /path/to/image/file
where
/android/mountpoint is the android mountpoint to overwrite ( e.g. /system )
/path/to/image/file is the path to the filesystem image file ( on blkdev ) ( e.g. /boot/unrooted.img )
i don't make any documentation until i will be sure that there is no better way to do this.
thanks in advance for your testing
ah, some other useful info.
because we are in testing the program write a log file with some debug info in the root of your blkdev.
so you will find /android_chooser.log on your blkdev with these info in case of errors.
tux_mind
Please
dtrail1 said:
Really great idea! As it support other devices I can throw in my kernel which is a kexec one for the Motorola RAZR, because of our locked bootloader. The question is: how different are the methods to use kexec?
M.o.t.o.r.o.l.a.R.a.z.r - JBX-Kernel 0.5a - Tapatalk4
Click to expand...
Click to collapse
Dtrail could you explain me kexec and its components required for loading new kernel because my device(electrify 2) is similar to droid razr. Using bmm kexec is boot able because I had checked by flashing droid razr's kernel which gave a boot loop.
I would be pleased and thankful to you if you help me.

[Q] Compiling perf tool for arm

I am trying to compile perf tool for arm. I have followed the instructions provided in the tool (tools/perf in the linux kernel and also tried compiling it in external/linux-tools-perf). I am getting errors like:
make ARCH=arm CROSS_COMPILE=${NDK_TOOLCHAIN} CFLAGS="--sysroot=${NDK_SYSROOT}"
Makefile:409: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile:424: *** No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static. Stop.
But, when I try to compile it for x86 in linux kernel, there are no issues for x86. Why is that it is very hard for building this tool for arm ?
If anybody has successfully built it, please provide me tips of how to built perf tool for arm.
Thanks,
Malarand
I am also having the same problem
i tried to follow the instructions showed in perf/documentation/android.txt
but i failed with a error saying
Android NDK: NDK_TOOLCHAIN is defined to the unsupported value android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
Android NDK: Please use one of the following values: arm-linux-androideabi-4.6 arm-linux-androideabi-4.8 arm-linux-androideabi-clang3.2 arm-linux-androideabi-clang3.3 mipsel-linux-android-4.6 mipsel-linux-android-4.8 mipsel-linux-android-clang3.2 mipsel-linux-android-clang3.3 x86-4.6 x86-4.8 x86-clang3.2 x86-clang3.3
build/core/init.mk:555: * Android NDK: Aborting . Stop.
Click to expand...
Click to collapse
then later i though this is not gona work like this, as the perf is part of kernel the perf should be built while the kernel source is being compiled so i tried to go to kernel directory there i have run
make -C tools/ perf_install ARCH=arm CROSS_COMPILE=arm-eabi-
Click to expand...
Click to collapse
which again resulted an error saying like yours
Makefile:592: *** No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static. Stop.
Click to expand...
Click to collapse
my kernel version 3.10.65
i am struggling with this error from days not able build perf for android, i am urgently in need of it
Any solutions?
Any solutions?
shyam.sunder91 said:
i tried to follow the instructions showed in perf/documentation/android.txt
but i failed with a error saying
then later i though this is not gona work like this, as the perf is part of kernel the perf should be built while the kernel source is being compiled so i tried to go to kernel directory there i have run
which again resulted an error saying like yours
my kernel version 3.10.65
i am struggling with this error from days not able build perf for android, i am urgently in need of it
Click to expand...
Click to collapse

Matching a kernel's config for compatible kernel modules

I have:
Downloaded the exact kernel version running on my device from an AOSP mirror (4.9.170) (https://github.com/aosp-mirror/kernel_common.git)
Downloaded the exact compiler used to compile the kernel from my device:
Ran `cat /proc/version`, which returns "Linaro GCC 5.3-2016.05", which I downloaded from https://releases.linaro.org/components/toolchain/binaries/5.3-2016.05/aarch64-linux-gnu/
Took the kernel configuration from `/proc/config.gz`, copied it to the kernel source directory `kernel_common` as `.config`
Ran `make ARCH=arm64 CROSS_COMPILE=xxx oldconfig`
What I'm seeing:
First, the downloaded kernel source for 4.9.170 seems to think that my `config` is incomplete, since it will prompt me to answer ~15 extra configuration questions.
Second, this old Linaro compiled doesn't appear to support `-fstack-protector-strong` despite it being explicitly enabled in the `/proc/config.gz` file. So I end up disabling it with `./scripts/config --disable CONFIG_CC_STACKPROTECTOR_STRONG`
Finally, after successfully compiling, I take `net/ipv4/tcp_westwood.ko`, just as a test module, and try to load it on my Android device, and it fails:
`insmod: failed to load tcp_westwood_5.ko: Exec format error`
And in dmesg output: `tcp_westwood: disagrees about version of symbol module_layout`
My questions:
Can I assume that the `/proc/config.gz` file is not the actual file used to compile the running kernel, considering it doesn't completely configure the 4.9.170 kernel?
Am I on the right path to getting a kernel module that my kernel will load?
Background information:
I'm hoping this isn't very relevant, but just to head off some questions
This is a T95 Android TV device running what appears to be, to this newbie's eyes, a very Frankenstein'd Android 10 install (See https://www.cnx-software.com/2020/0...-comes-with-mali-g31-gpu-supports-android-10/)
I can't find any official - or unofficial - source for this device, which is why I'm going to all the trouble above.
I really appreciate any help, thank you!

Categories

Resources