[Q] Gingerbread on HTC Desire kernel panic - Desire Android Development

I've recently attempted to compile Gingerbread for the HTC Desire with a view to producing a ROM. Although the build completes successfully (I used defer's vendor files), I tried starting the built system up in the emulator but I always get a kernel panic. The last few lines I get are:
802.1Q VLAN Support v1.8 Ben Greear
All bugs added by David S. Miller
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
goldfish_rtc goldfish_rtc: setting system clock to 2010-12-22 22:44:53 UTC (1293057893)
Freeing init memory: 104K
Kernel panic - not syncing: Attempted to kill init!
(I've attached the entire output from the emulator to this post).
I'm struggling to find out what is going wrong. I've tried turning the init loglevel up to 8, but I don't see any messages from init.
I also tried flashing it to the device and trying to boot it with the stock Froyo kernel, which also hung on startup - however, I don't know whether that was hanging at the same point, or if I shouldn't even expect that to work.
Can anyone suggest how I might attempt to work out what is going wrong please?
Many thanks in advance.

Related

[Q] FolioMod 1.4/1.3 Android-side display not working with a self-compiled kernel

(I am an Android newbie but wrote my first Unix Sys V device drivers back in 1980s.)
I have compiled a kernel for Toshiba Folio 100 using nopy's source from git://github.com/nopy/kernel_folio100.git and using the config from /proc/config.gz on the running device. As far as I understand, that is the kernel released by Toshiba in November 2010, with some fixes. I've also tried the Toshiba-provided sources, with the same results.
I'm building boot.img from FolioMod1.4 ramfs & my own kernel.
I'm able to successfully install the resulting boot.img to /dev/block/mmcblk0p5. The kernel boots and I'm able to log in using adb shell. I'm able to write to /dev/graphics/fb0, and the stuff appears on the screen.
However, the Android subsystem does not seem to detect the display. That is, the display stays blank (unless I write directly to /dev/graphics/fb0).
I'm stuck at the moment, and would appreciate hints where to go next. In particular, if anyone knows any posts/wikis/whatever that explain how the Android low level graphics subsystem uses the framebuffer, that might help me to debug the problem.
(I'm stuck to posting to here and not a perhaps more appropriate forum, as I'm a newcomer to xda.)
[Resolved] Using the ramdisk from FolioMod 1.3d resolve the issue
Nevermind.
I took the ramdisk image from FolioMod1.3d (instead of the one from FolioMod1.4), and installed FolioMod1.3d system.img. That resolved the issue, the display works now, even with my own kernel.
(Though I don't understand what is the difference between FolioMod1.4 ramdisk vs. FolioMod1.3d ramdisk. I don't have time to study that now.)

[Q] GT-I9000M kernel compiling

I've got this side project going where I've decided to try to modify the stock kernel for my GT-I9000M.
I'm a Gentoo linux user and have cross-compiled kernels for embedded systems with or without initramfs and modules successfully many times. Rather than just grab and flash the latest mod from the net I want to understand exactly how to create my own.
I already have access via a chroot to a working Gentoo install, however that runs in a sandbox inside android userland, which can be irritating to say the least. I'm already able to create binaries for armv7a on the phone itself, which is a time and power-consuming novelty.
I setup a development environment on my main computer and made sure I could create working binaries for the armv7a.
I backed up all the bml partitions on my phone.
Next, I made sure I could access Download Mode and experimented with Heimdall until I was satisfied I was able to recover from any bad kernel flashes.
I altered the first boot logo in param.lfs with dd, but that's a whole other story.
Next, I downloaded Samsung's source for Froyo and followed the instructions to create a zImage.
aries_eur_defconfig selects the FM radio module and the Samsung TV out driver which are broken. No problem, I figured I could check that out later so I disabled those options for now. it compiles! great! But it didn't boot. I turned to the internet for ways to solve the problem.
There was a lot of conflicting information. I ended up trying a lot of different approaches, modules, firmware, version info, kernel command lines, fbcon... well I messed around.
Some time later, I find myself happily booting with my own kernel. The bootloader displayed my custom logo in param.lfs, but fbcon didn't work and I got a stock samsung gt-i9000 logo before android booted up! The phone worked, wifi worked, bluetooth worked, it was awesome (for 2.6.32.9 that is )!
So, great! Except I got overconfident and cocky. I made a slew of changes trying to get fbcon to work and to top off the evening I overwrote my working zImage with a broken kernel (without a backup of my working custom zImage or .config). I still have backups otherwise of course and haven't lost the functionality of my phone in any way, but now I'm just irritated.
Anybody else working on compiling from source on the GT-I9000M?
I pressed ahead and tried to recreate the conditions that got me a working kernel and as of yet I've been unsuccessful Luckily I've got a kmsg from the kernel when it booted. I can see the kernel command line on the custom kernel that booted was simply "console=ttySAC2,115200" although I do recall trying different values for init= ... The default init in the sources is /linuxrc which doesn't exist in initramfs.
There are also settings for the kernel command line and version information in arch/arm/mach-s5pv210/include/mach/param.h
Is there a known good method to compile from Samsung's sources?
I unpacked a known good zImage, played with it's initramfs, repacked it and it boots just fine.
I've tried again with a fresh copy of the gt-i9000 froyo-samsung branch:
- unpack initramfs from a known good 2.6.32.9 kernel
- make clean
- make aries_eur_defconfig
- make menuconfig, add initramfs, remove Samsung TV driver and FM radio module
- make
the resulting vmlinux is: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped (I know, it's zImage not vmlinux but I'm just doing sanity checks)
I have a custom logo in param.lfs which always displays on boot. A second logo is compiled into the kernel, and I do see a change in the logo when my kernel boots (it shows GT-I9000 instead of GT-I9000M after the first logo). This leads me to believe that the kernel is booting... but the phone powers off after booting.
I've tried the recommended changes to default.prop to use adb to obtain the kmsg of the new kernel. This has not worked however, which could mean that the kernel doesn't get as far as initramfs.
the kernel command line from the kmsg I have from the one time that a custom kernel of mine booted is simply: "console=ttySAC2,115200 loglevel=4" . There's no mention of init, which I think should be init=/init although aries_eur_defconfig seems to think that init=/linuxrc is appropriate (linuxrc doesn't exist?) Regardless, it doesn't seem to matter what I specify for init.
Which leaves proprietary Samsung kernel modules. If they can't load, this could explain everything I'm experiencing. It isn't clear what specific version the proprietary modules are expecting.
Maybe this will help somebody else. I've got it working now.
Attached is my working config.

[PROJECT] Kernel 3.x For Galaxy SL

This thread to collaborate all efforts towards porting kernel 3.x on to the Galaxy SL. If any developers wish to help then please let me know and I will add you to the repo on Github.
Do not ask for an ETA. If you do or try to cleverly disguise it by asking how long it takes on average or anything along these lines, your post will be reported to a moderator.
Changelog
https://github.com/hillbeast/android_kernel_samsung_latona/commits/ics-latona-3.0
I chose the Github commit system to be the changelog as there are so many things going on at once it would be impossible to keep up with, and I cannot be assed explaining it. If you don't understand then ask, but please don't ask EVERYTHING. Most of the answers will be 'It just does'.
Discussion Thread
This thread is for DEVELOPMENT ONLY. I know you all wish to praise the developers and give your support, but it really clutters things up when there is like 20 posts of 'thanks' and then one post of an update in progress for the project. So let's keep this thread for development, discussion on fixing bugs and such and you can discuss it all over at this thread kindly made over here:
http://forum.xda-developers.com/showthread.php?t=1712224
Source Code
Source: https://github.com/hillbeast/android_kernel_samsung_latona
Members
hillbeast
dhiru1602
crackerizer
If anyone else who has a keen knowledge of the Linux kernel can help, then let me know. Fork the repository, make some changes and send me a pull request. If you don't know how to do that or can't figure out how to do it then you won't be able to help me.
Why Do We Need Kernel 3.
Easier updating the kernel to add security and performance boosts from mainline Linux kernels
More support for new versions of Android
Android 4.0 was built upon Linux Kernel 3.0.x and therefore expects kernel 3.0s APIs
Faster, more secure system
NO SAMSUNG MORONIC CODE
Because it's just better
Please let me know if you are interested (able to) in helping this cause. Please don't put your hand up if you can't dedicate your phone to this. This will result in your phone being out of action quite a lot while we are testing, and if you need your phone 24/7 then you're going to need to keep flashing back. You will also NEED ODIN. Flashing from CWM is not an option.
Status
UART dump:
Code:
Uncompressing Linux... done, booting the kernel.
<6>Initializing cgroup subsys cpu
<5>Linux version 3.0.8+ ([email protected]) (gcc version 4.4.3 (GCC) ) #Test PREEMPT Mon Sep 24 11:09:01 NZST 2012
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: LGE Hub board
<6>Reserving 4194304 bytes SDRAM for VRAM
Memory policy: ECC disabled, Data cache writeback
<6>OMAP3630 ES1.2 (l2cache iva sgx neon isp 192mhz_clk )
<6>SRAM: Mapped pa 0x40208000 to va 0xfe408000 size: 0x7000
<7>On node 0 totalpages: 62976
<7>free_area_init_node: node 0, pgdat c06cbb8c, node_mem_map c083f000
<7> Normal zone: 512 pages used for memmap
<7> Normal zone: 0 pages reserved
<7> Normal zone: 62464 pages, LIFO batch:15
<6>Clocking rate (Crystal/Core/MPU): 26.0/400/800 MHz
<6>Reprogramming SDRC clock to 400000000 Hz
<7>pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
<7>pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 62464
<5>Kernel command line: console=ttyS2,115200 videoout=omap_vout omap_vout.video1_numbuffers=6 omap_vout.vid1_static_vrfb_alloc=y omapfb.vram="0:4M" version=Sbl(1.0.0) 2011-03-21 10:46:47 androidboot.mode=jig bootmode=0 androidboot.current_panel=0
<6>PID hash table entries: 1024 (order: 0, 4096 bytes)
<6>Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
<6>Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
<6>Memory: 246MB = 246MB total
<5>Memory: 238620k/238620k available, 23524k reserved, 0K highmem
<5>Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xd0800000 - 0xf8000000 ( 632 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.init : 0xc0008000 - 0xc003d000 ( 212 kB)
.text : 0xc003d000 - 0xc0674d5c (6368 kB)
.data : 0xc0676000 - 0xc06cc500 ( 346 kB)
.bss : 0xc06cc524 - 0xc083ed88 (1483 kB)
<6>Preemptible hierarchical RCU implementation.
<6>NR_IRQS:410
<6>IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts
<6>Total of 96 interrupts on 1 active controller
<6>OMAP clockevent source: GPTIMER1 at 32768 Hz
<6>sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
<6>Console: colour dummy device 80x30
<6>Calibrating delay loop... <c>798.24 BogoMIPS (lpj=3117056)
<6>pid_max: default: 32768 minimum: 301
<6>Mount-cache hash table entries: 512
<6>Initializing cgroup subsys debug
<6>Initializing cgroup subsys cpuacct
<6>Initializing cgroup subsys freezer
<6>CPU: Testing write buffer coherency: ok
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for l4_core
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for l4_per
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for l4_wkup
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for usbhs_ohci
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for usbhs_ehci
<4>omap_hwmod: gpt12_fck: missing clockdomain for gpt12_fck.
What needs to be done
Everything
mach code (board-latona)
plat code
drivers
How To Build
git clone git://github.com/hillbeast/android_kernel_samsung_latona -b android-latona-3.0
cd android_kernel_latona
make latona_defconfig ARCH=arm
./build.sh config
./build.sh
Things to be aware of
I feel these things should be mentioned as they are important changes that may disrupt peoples user experience on the phone.
Odin will not work anymore for flashing ROMs. It's as simple as that. We will no longer be using STL/BML/TFSR for interfacing with the NAND, and that is what ODIN expects to be working with: partitions in STL format. We simply will not support STL when this kernel is complete as it is closed source and will not function on kernel 3.x. We will be moving over to MTD which is mainline, and regularly gets updates to improve performance, reliability and in general to make it better.
Kernels will however be flashable from ODIN. This WILL NOT change. Kernels, modems and bootloaders will all still work from Odin. Data, system and cache will not.
I know this will annoy a few people, as it will disrupt me too as a developer and a Windows user, it's nice to be able to flash a ROM this way, but we're going to have to move towards distributing ROMs in update.zips only.
There will be no support for Samsung Froyo/Gingerbread ROMs in kernel 3.x. The reasoning behind this is because Samsung ROMs want Samsung drivers and we won't be using any of them. We will be aiming to support CM7 and CM9, or generally any AOSP ROM, but not Samsungs proprietary ROM. You may think 'well why not make the drivers work for both', but the problem is not with making the drivers work, the problem is with the fact that a lot of these drivers were written for a kernel almost 10 major versions out of date by now, and will not function on the new kernels APIs. If we try to make them work, it will make the kernel unstable and it's going to degrade the experience for the end user. As well as that, we don't know how half these drivers actually work because they are either coded so badly it's impossible to make heads or tails of it, or it's closed source and we can't find sources for it.
Kernel 3.x will not allow us to work magic with the phone. Having a newer kernel won't allow us to make the CPU itself faster, we can't give it more RAM (or find more RAM in there). We won't be able to unlock more performance from x part. This is not a magical rebirth of the phone, this is just a major fix up of all the current issues we face with AOSP based ROMs on the phone. It will most likely make the phone faster, but we can't magically make it into a dual core or something like that. It just isn't possible.
Did you see it? Could have been anyone. Could you spot him in a crowd? Probably not. It's just a reserved post.
And I think this should do it for reserved posts. You may now post.
i will be glad to help
sachin sharma said:
u using lenaro toolchain? wow
that will make the kernel go zoooom
Click to expand...
Click to collapse
For the Galaxy 3 I use Codesourcery 4.5.2 as Linaro doesn't work on it. I will see what works best for this phone. I have to learn the whole device.
Sent from my GT-I9100 using XDA
hillbeast said:
For the Galaxy 3 I use Codesourcery 4.5.2 as Linaro doesn't work on it. I will see what works best for this phone. I have to learn the whole device.
Sent from my GT-I9100 using XDA
Click to expand...
Click to collapse
m connfused??????
in ur build.sh u have used
TOOLCHAIN=/usr/linaro/bin/arm-linux-gnueabi-?????
y is this lenaro toolchain for?
r u going to edit it n use sum other toolchain???
---------- Post added at 12:18 PM ---------- Previous post was at 12:03 PM ----------
hillbeast said:
For the Galaxy 3 I use Codesourcery 4.5.2 as Linaro doesn't work on it. I will see what works best for this phone. I have to learn the whole device.
Sent from my GT-I9100 using XDA
Click to expand...
Click to collapse
i m going to fork ur repostory!!!
downloading vmware now as i dont have linux environment due to hard disk issues
sachin sharma said:
m connfused??????
in ur build.sh u have used
TOOLCHAIN=/usr/linaro/bin/arm-linux-gnueabi-?????
y is this lenaro toolchain for?
r u going to edit it n use sum other toolchain???
---------- Post added at 12:18 PM ---------- Previous post was at 12:03 PM ----------
i m going to fork ur repostory!!!
downloading vmware now as i dont have linux environment due to hard disk issues
Click to expand...
Click to collapse
Oh perhaps I am using Linaro. I was at work when I wrote that so I wasn't really thinking.
I have a build server that I use for my development, but I used to use VMware for my Linux devving so that will work fine for you too.
Also update on the USB issue I was having, it must have been the condensation because it's working fine now after leaving it to dry out while I was at work. I'm flashing Gingerbread on it so I have a stable platform while I learn the device.
Right so first priority is to get UART output. My current UART cable with a 612K resistor (I think it was 612K) doesn't give me any output. I'd say that is the wrong resistor for this device, so I need to find out which one it is. However the cable does JIG the phone to start up.
hillbeast said:
Right so first priority is to get UART output. My current UART cable with a 612K resistor (I think it was 612K) doesn't give me any output. I'd say that is the wrong resistor for this device, so I need to find out which one it is. However the cable does JIG the phone to start up.
Click to expand...
Click to collapse
Update to this: got this output:
Code:
AST_POWERON
BOOTING COMPLETED
That's the modem speaking to me over UART. Gotta change the UART mode to PDA instead of MODEM. Will do that once I root the phone.
hillbeast said:
Update to this: got this output:
Code:
AST_POWERON
BOOTING COMPLETED
That's the modem speaking to me over UART. Gotta change the UART mode to PDA instead of MODEM. Will do that once I root the phone.
Click to expand...
Click to collapse
Another update, I did this in adb shell:
Code:
echo PDA > /sys/devices/platform/switch-sio/uart_sel
Then rebooted the phone with my UART cable attached and now I get this:
Code:
Uncompressing Linux... done, booting the kernel.
So it's giving me output up until the kernel boots which told me the console attribute in the cmdline isn't set. I looked and that confirmed it that it wasn't. I will get the sourcecode for a kernel and compile it with the console attribute.
So yes, this phone will do UART. I just have to do it a bit weirdly.
I made a discussion thread here, post only developement related things in here, and everything else goes there
loneagl said:
@hillbeast
Sorry to interrupt dude
Linux is Greek to many of us......
so does this mean kernel 3.x is possible???
Sent from my GT-I9003 using XDA
Click to expand...
Click to collapse
It means I will be able to debug the kernel while I am developing it.
Skander1998 said:
I made a discussion thread here, post only developement related things in here, and everything else goes there
Click to expand...
Click to collapse
Thanks. I will subscribe to it.
Sent from my GT-I9100 using XDA
Right so I just had to figure out how to compile kernels on this phone. It's completely different to doing it on the Galaxy 3. On the G3, we just use zImages, whereas here it's using boot.imgs which is quite different. I've updated my build.sh to account for this. I'm still not actually working on Kernel 3.x. I'm still learning the device and getting it set up so I can develop on it.
hillbeast said:
Right so I just had to figure out how to compile kernels on this phone. It's completely different to doing it on the Galaxy 3. On the G3, we just use zImages, whereas here it's using boot.imgs which is quite different. I've updated my build.sh to account for this. I'm still not actually working on Kernel 3.x. I'm still learning the device and getting it set up so I can develop on it.
Click to expand...
Click to collapse
Maybe this help
hillbeast said:
Right so I just had to figure out how to compile kernels on this phone. It's completely different to doing it on the Galaxy 3. On the G3, we just use zImages, whereas here it's using boot.imgs which is quite different. I've updated my build.sh to account for this. I'm still not actually working on Kernel 3.x. I'm still learning the device and getting it set up so I can develop on it.
Click to expand...
Click to collapse
Yup.... the boot.img contains both the zImage and ramdisk ...
Sent from my GT-I9003 using XDA
TheFrankenstain said:
Maybe this help
Click to expand...
Click to collapse
Already figured it out, but thanks anyway.
arindammanidas said:
Yup.... the boot.img contains both the zImage and ramdisk ...
Sent from my GT-I9003 using XDA
Click to expand...
Click to collapse
zImages can contain ramdisks too. Been using it like that on the G3 for long time. We used LZMA compression and managed to cram a hell of a lot into the boot partition.
hillbeast said:
Right so I just had to figure out how to compile kernels on this phone. It's completely different to doing it on the Galaxy 3. On the G3, we just use zImages, whereas here it's using boot.imgs which is quite different. I've updated my build.sh to account for this. I'm still not actually working on Kernel 3.x. I'm still learning the device and getting it set up so I can develop on it.
Click to expand...
Click to collapse
i can make boot.img for u
if u want

[Q/A] Kernel 3.x Discussion thread

Kernel 3.x is now having progress again, updating the thread!​
Hey guys, i noticed that the new thread for Kernel 3.x developement is getting spammed a little, so please post anything not related to development here.
I will also include latest updates including a small faq (i will add more when you guys ask questions).
Current members working on the project:
hillbeast
dhiru1602
crackerizer
Latest News: (First is newest)
Current issue: Kernel is booting but crashing, still in stage 1.
hillbeast said:
Isn't patience a virtue...?
Code:
Uncompressing Linux... done, booting the kernel.
<6>Initializing cgroup subsys cpu
<5>Linux version 3.0.8+ ([email protected]) (gcc version 4.4.3 (GCC) ) #Test PREEMPT Mon Sep 24 11:09:01 NZST 2012
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: LGE Hub board
<6>Reserving 4194304 bytes SDRAM for VRAM
Memory policy: ECC disabled, Data cache writeback
<6>OMAP3630 ES1.2 (l2cache iva sgx neon isp 192mhz_clk )
<6>SRAM: Mapped pa 0x40208000 to va 0xfe408000 size: 0x7000
<7>On node 0 totalpages: 62976
<7>free_area_init_node: node 0, pgdat c06cbb8c, node_mem_map c083f000
<7> *Normal zone: 512 pages used for memmap
<7> *Normal zone: 0 pages reserved
<7> *Normal zone: 62464 pages, LIFO batch:15
<6>Clocking rate (Crystal/Core/MPU): 26.0/400/800 MHz
<6>Reprogramming SDRC clock to 400000000 Hz
<7>pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
<7>pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. *Total pages: 62464
<5>Kernel command line: console=ttyS2,115200 videoout=omap_vout omap_vout.video1_numbuffers=6 omap_vout.vid1_static_vrfb_alloc=y omapfb.vram="0:4M" version=Sbl(1.0.0) 2011-03-21 10:46:47 androidboot.mode=jig bootmode=0 androidboot.current_panel=0
<6>PID hash table entries: 1024 (order: 0, 4096 bytes)
<6>Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
<6>Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
<6>Memory: 246MB = 246MB total
<5>Memory: 238620k/238620k available, 23524k reserved, 0K highmem
<5>Virtual kernel memory layout:
* * vector *: 0xffff0000 - 0xffff1000 * ( * 4 kB)
* * fixmap *: 0xfff00000 - 0xfffe0000 * ( 896 kB)
* * DMA * * : 0xffc00000 - 0xffe00000 * ( * 2 MB)
* * vmalloc : 0xd0800000 - 0xf8000000 * ( 632 MB)
* * lowmem *: 0xc0000000 - 0xd0000000 * ( 256 MB)
* * pkmap * : 0xbfe00000 - 0xc0000000 * ( * 2 MB)
* * modules : 0xbf000000 - 0xbfe00000 * ( *14 MB)
* * * .init : 0xc0008000 - 0xc003d000 * ( 212 kB)
* * * .text : 0xc003d000 - 0xc0674d5c * (6368 kB)
* * * .data : 0xc0676000 - 0xc06cc500 * ( 346 kB)
* * * *.bss : 0xc06cc524 - 0xc083ed88 * (1483 kB)
<6>Preemptible hierarchical RCU implementation.
<6>NR_IRQS:410
<6>IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts
<6>Total of 96 interrupts on 1 active controller
<6>OMAP clockevent source: GPTIMER1 at 32768 Hz
<6>sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
<6>Console: colour dummy device 80x30
<6>Calibrating delay loop... <c>798.24 BogoMIPS (lpj=3117056)
<6>pid_max: default: 32768 minimum: 301
<6>Mount-cache hash table entries: 512
<6>Initializing cgroup subsys debug
<6>Initializing cgroup subsys cpuacct
<6>Initializing cgroup subsys freezer
<6>CPU: Testing write buffer coherency: ok
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for l4_core
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for l4_per
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for l4_wkup
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for usbhs_ohci
<4>omap_hwmod: _populate_mpu_rt_base found no _mpu_rt_va for usbhs_ehci
<4>omap_hwmod: gpt12_fck: missing clockdomain for gpt12_fck.
Click to expand...
Click to collapse
hillbeast said:
Further Information About 'Blind SBL'
As I can't see the SBL, it does limit things until I figure out why it won't display anything, however I won't let Samsung beat me like that, and I progressed by hex viewing the SBL partition on the OneNAND, and I found something interesting:
Code:
andr_load_normal..Load Android Normal-boot image from the flash device..andr_load_recovery..Load Android Recovery-boot image from the flash device..andr_load_kernel..Load Android Kernel and Ramdisk using the current boot-up reason
hillbeast said:
Oh wow I didn't expect it to be that easy. I just took another kernel (I used BCK seeing it works on GB), renamed normalboot.img to recovery.img, put it back in a tar and flashed it with Odin, then went into the blind Sbl, typed andr_load_recovery [enter] boot [enter] and away it went. Obviously I had no UART apart from decompression seeing BCK doesn't support UART, but going into Settings > About Phone > and seeing XDA_BAM in there when I hadn't touched the normal kernel was quite cool. So that's how you dual-boot on a GSL.
Click to expand...
Click to collapse
Trying to decipher it, this seems to be the output of the help command, and these three commands seem interesting, as they seem to allow booting the normal kernel (.img), or the recovery kernel. I'll try flashing something different in the recovery partition and see what it does. I'll try flashing something like the CM9 kernel. If I can get this figured out then perhaps if someone is daring enough to mod the SBL, we could get a working recovery partition. The functionality appears to be there, so I can't see why not.
Click to expand...
Click to collapse
hillbeast said:
Okay so I backported the new CMDLINE functions from kernel 3.x and it works sweet. Great to FINALLY see a proper UART output on this device. I need to make a few touch-ups, namely to giving UART console root access. And I need to charge the phone up... I haven't charged it all weekend and the battery is really flat.
Click to expand...
Click to collapse
hillbeast said:
YES! SUCCESS! By forcing the boot command line to 'console=ttyS2,115200' I managed to get to the UART console. This is much more useful than just like 20 lines of output then nothing. However, there is a problem with this: with this change, I don't have the normal commands coming through and they are important. They set stuff like the framebuffer RAM, what bootmode to be using, etc. Without that, the phone is kind of a rock.
I will see if I can backport the function from newer kernels that allows you to combine the provided commands from the bootloader with your own commands.
Click to expand...
Click to collapse
hillbeast said:
Right so after a bit of poking around, I've been trying to figure out what the exact device is that external UART uses. It's really frustrating not knowing this because it means I can't figure out why there is no output (or at least legible output after the UART drivers start), so I tried sending 'hi' to ttyS0, S1 and S2, and nothing came up, so I assumed that they must be locked or something. I then noticed after doing that, nothing was coming up on the UART at all. Before, I would get all sorts of garbage, but after that, I got nothing. I then tried one by one to see which device did this, and I found it was ttyS2: after sending 'hi' to ttyS2, it would stop showing stuff on the UART. This told me that external UART must be connected to ttyS2.
Now I then tan stty -F /dev/ttyS2 (to find the tty settings for this port), and got this output:
Code:
speed 9600 baud;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 1; time = 0;
-brkint -imaxbel
That first line, speed 9600 baud is a problem for me, as it should be 115200. I'm going to do more testing and see if it is outputting at 9600.
EDIT: Nope. Changing PuTTY to baud 9600 still shows garbage:
Code:
¨Ôþ°üýxÍùøXýñ±¥õÔþýMþ屡ÈÙÑ°ÑéÀÙi
ÐuÑÕ´üÔôÐÜ´ÀôÜ©Ñ ùªô(üÌù,Äü ÜÅuðÜå
øà°ù¡ùý ùåñ¤@è*EÐiáÅüÑôÐ&ôåå¤Ì ÝðØ*ñÿÄÿÁÀÐÀøüù
-Å©E*ÅùÔqÄÿYÕÀÁý±ÿ±ØôÀôÑôÑðÀôÑüÀøÑøÀøÑüÀøÀøÑøµÐø©ð¹ÌùÝôåþé°ÀñÜÑø½è*ÐÅ
ÿùøýõÈðýñÑØá*µÙñð´¦ÑÐØá°aÕáÑýÉØÐuÁÑ_´)Ôô
Üù¬üýÑØåýáÁØñ*¡Éññ¡_ÑÐÑÉÍÐ
ؾàyÐõ
Ø
ùµþ(,¨ý`
Click to expand...
Click to collapse
hillbeast said:
Another update, I did this in adb shell:
Code:
echo PDA > /sys/devices/platform/switch-sio/uart_sel
Then rebooted the phone with my UART cable attached and now I get this:
Code:
Uncompressing Linux... done, booting the kernel.
So it's giving me output up until the kernel boots which told me the console attribute in the cmdline isn't set. I looked and that confirmed it that it wasn't. I will get the sourcecode for a kernel and compile it with the console attribute.
So yes, this phone will do UART. I just have to do it a bit weirdly.
Click to expand...
Click to collapse
hillbeast said:
Update to this: got this output:
Code:
AST_POWERON
BOOTING COMPLETED
That's the modem speaking to me over UART. Gotta change the UART mode to PDA instead of MODEM. Will do that once I root the phone.
Click to expand...
Click to collapse
What needs to be done: (Updated 6/19/2012)
Everything
mach code (board-latona)
plat code
drivers
FAQ:
(Please read this before asking questions, if you ask an already answered question your post will be reported, and you won't get an answer.. because it's already here!)
*Is This using Linaro? (?)
-Yes(?)
*What's this Linaro thing all about? (?)
-It (could) make your android device twice as fast, no one is sure if it will really make a difference. (?)
*What's UART?
-This will basically allow hillbeast to debug the kernel while he is developing it.
*I heard about some changes to using ODIN..
With kernel 3.x you can still flash new kernels on ODIN.
With kernel 3.x you will not be able to use ODIN to flash a ROM which is designed for kernel 3.x (these will be highlighted when they are released) as these ROMs will be in a filesystem/block device structure that is compatible with ODIN (technical mumbo jumbo that I intentionally used to say that it's not going to work)
With kernel 3.x you can still flash an old 2.6.35 kernel back onto the phone.
With kernel 3.x you can still flash an old ROM that uses kernel 2.6.25 back onto the phone (Gingerbread/Froyo) to go back to stock versions, you just have to install the stock kernel as well at the same time
*When the 3.x kernel is released, can i use it with Samsung stock ROMs?
-No, this kernel will not include any samsung code, samsung ROMs expect samsung drivers.
Quote of the year from hillbeast : "NO SAMSUNG MORONIC CODE "
*When is da kenral gowin to beh released you no god man why no relse any tim me wunt kernal 3.x?!?!!!11!!1
-No ETA's!
*The LG optimus black has same board and configuration. will this help with the development of any ROM/kernel for the i9003?
-Looking at the board of the optimus, no its certainly not the same. Not even close. Where we have a OneNAND and an eMMC, the Black has a NAND, perhaps an eMMC. The layout of the board may not even be the same. Sure the components may be similar, but so are the specs of a Toyota Celica and a Lotus Exige.
*Can you add X and X feature in the new kernel ?
-Don't request new feature additions yet, devs are focusing on getting the kernel booting first.
*I think i can help!
-Go to the development thread here and apply to help!
Note, quote from hillbeast: Please don't put your hand up if you can't dedicate your phone to this. This will result in your phone being out of action quite a lot while we are testing, and if you need your phone 24/7 then you're going to need to keep flashing back. You will also NEED ODIN. Flashing from CWM is not an option.
Hello, I am actually not new around xda but never join any discussion and conversation. Got so many phone from Moto Milestone, HTC HD2, and latest was SGSII. Unfortunately got robbed by someone who broke my house and stole my SGSII, Galaxy Tab 10.1, and iPad2. So now just support my girlfriend phone to be more awesome and fast. hehe
So from what I understand is that UART is a debug tools that constantly tells us what happen when we are try to running any kernel? It will tells us whats wrong that the kernel cannot start?
It seems awesome. I cannot wait to see it in our mobile phones, it will be terrific. I believe you are doing great job with our phone an I think that Dhiru, and you now are the great developers of our mobile Phone; the unwanted brother of the SGS.
ajis90 said:
Hello, I am actually not new around xda but never join any discussion and conversation. Got so many phone from Moto Milestone, HTC HD2, and latest was SGSII. Unfortunately got robbed by someone who broke my house and stole my SGSII, Galaxy Tab 10.1, and iPad2. So now just support my girlfriend phone to be more awesome and fast. hehe
So from what I understand is that UART is a debug tools that constantly tells us what happen when we are try to running any kernel? It will tells us whats wrong that the kernel cannot start?
Click to expand...
Click to collapse
It will basically let him debug the kernel when he is developing it
juanfpo96 said:
It seems awesome. I cannot wait to see it in our mobile phones, it will be terrific. I believe you are doing great job with our phone an I think that Dhiru, and you now are the great developers of our mobile Phone; the unwanted brother of the SGS.
Click to expand...
Click to collapse
All thanks go to hillbeast and dhiru, i just made this discussion thread
Very nice work!
FAQ:
*Is This using Linaro?
-Yes.
Click to expand...
Click to collapse
Wow, I am pretty sure this kernel will make our phone fly!
can someone tell what is linaro ??
m hoping kernel 3.0 will finally make the gpu overclock work ! after that we wont have any lags at all n like hillbeast said no samsung moronic code i couldnt agree more with him
anuraagkochar said:
can someone tell what is linaro ??
Click to expand...
Click to collapse
Basically, it improves the state of Linux on the ARM platform, and also it optimizes up a stock Android twice as fast as stock Android.
http://arstechnica.com/gadgets/2012...e-boosted-30-100-percent-by-linaro-toolchain/
will kernel 3 ever improve our battery life in our dearest cm9?
marshygeek said:
will kernel 3 ever improve our battery life in our dearest cm9?
Click to expand...
Click to collapse
Not sure about that, but the current battery performance on the CM9 is awesome already, lasts 2 days with moderate use, if you get less there are different factors:
-You use your phone too much.
-You are overclocking.
-You have an app preventing the phone from deep sleeping.
-You didn't do full charge cycles yet so the battery is not calibrated..
Mine lasts bout 18 hours.. So also theres a factor on how old the device is.. My battery backup is 1/2 of original so if ppl are experiencing this they should change their batteries .. U can find oit by display usage tym.. My battery dies after the display usage goes above 2 hours while on a normal battrery phone its 4 hours
Sent from my GT-I9003 using xda premium
shriomman said:
Mine lasts bout 18 hours.. So also theres a factor on how old the device is.. My battery backup is 1/2 of original so if ppl are experiencing this they should change their batteries .. U can find oit by display usage tym.. My battery dies after the display usage goes above 2 hours while on a normal battrery phone its 4 hours
Sent from my GT-I9003 using xda premium
Click to expand...
Click to collapse
That's true, just like laptop batteries, they degrade with time.
Also, i noticed that you need to recalibrate the battery by doing at least 2/3 full cycles without using the phone (Charge it 100%, let it drain until it shutdowns by itself 'don't use it for the best results', and do that 2 times, should calibrate perfectly now)..
Skander1998 said:
That's true, just like laptop batteries, they degrade with time.
Also, i noticed that you need to recalibrate the battery by doing at least 2/3 full cycles without using the phone (Charge it 100%, let it drain until it shutdowns by itself 'don't use it for the best results', and do that 2 times, should calibrate perfectly now)..
Click to expand...
Click to collapse
Calibrating shouldnt b done to much ill say.. Just do it once a new rom is installes thats irt to much of charging and drainin to 100-0 is nt gud for l-ion batteries . Its actually bad.. I read.. So since then i charge my battery after its at 20%
Sent from my GT-I9003 using xda premium
i have trouble using Battery calibrator. After doing the cycle i cant get the charging up to 100% only 99%.
shriomman said:
Calibrating shouldnt b done to much ill say.. Just do it once a new rom is installes thats irt to much of charging and drainin to 100-0 is nt gud for l-ion batteries . Its actually bad.. I read.. So since then i charge my battery after its at 20%
Sent from my GT-I9003 using xda premium
Click to expand...
Click to collapse
But you'll do it two times only, so it shouldn't harm the battery.
marshygeek said:
i have trouble using Battery calibrator. After doing the cycle i cant get the charging up to 100% only 99%.
Click to expand...
Click to collapse
Don't use apps, do it yourself, after calibrating start recharging as usual from the 10%-20% and not 0%.
Let's keep this related to kernel 3.x
Really nice news!
Enviado desde mi GT-I9003 usando Tapatalk 2
cant wait to see the result, hope they can make it soon
Look at this good news. Hillbeast compiled a kernel based on BCK. Check it out... I think it has linaro compiled if i am not wrong...
crazbanditz said:
Look at this good news. Hillbeast compiled a kernel based on BCK. Check it out... I think it has linaro compiled if i am not wrong...
Click to expand...
Click to collapse
Yes it is using Linaro.
Also what are peoples AnTuTu scores on this phone? I just ran it with my compiled BCK and it got 2312 (CPU: 496, GPU: 1007, RAM: 214, IO: 595). Good or bad? I don't have anything I can compare it against (at least not fairly...)
Its pretty bad cos cant use odin anymore...? For kernel 3.x

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.

Categories

Resources