Mittwoch, 11. August 2010

How To Patch Google's Android 2.6.32 Kernel

Just a short write-up for anyone who is interested in porting/playing with the current android kernel on their GW620/eve.

DISCLAIMER:
This patch only contains the bare minimum to get the kernel booted.
Only serial console and usb/adb works.
No (and i really mean _NO_) additional hardware beside board/cpu/serial/usb is supported (yet).
This is only useful for developers try to help porting!

you have been warned ;-)
  • First of all, get the sources:
    # mkdir android-msm-2.6.32 && cd android-msm-2.6.32
    # git clone git://android.git.kernel.org/kernel/msm.git .
  • Now get my patch:
    # wget http://github.com/maldn/eve/raw/master/google-32-eve-minimal.patch
  • And apply the patch:
    # cat google-32-eve-minimal.patch | patch -p1
  • Configure kernel:
    add CONFIG_MACH_EVE to your kernel-config (or if you use menuconfig, select System Type -> [*] eve)
  • Build:
    i use ccache, so my cmd-line looks like this:
    # make -j3 ARCH=arm CROSS_COMPILE="ccache /home/maldn/android/eclair/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-"
... that's it. How to get this running is subject to another post, so stay tuned :-)


maldn

Mittwoch, 4. August 2010

got 2.6.32 booting!

although this is a few weeks old ( i posted over at xda-developers about this already), i wanted to post it here too.

Booting Linux....
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.32.9-27239-g8097ca0-dirty (maldn@g550) (gcc version 4.4.0 (GCC) ) #12 PREEMPT Thu Jul 29 16:40:09 CEST 2010
[ 0.000000] CPU: ARMv6-compatible processor [4117b362] revision 2 (ARMv6TEJ), cr=00c5387f
[ 0.000000] CPU: VIPT aliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine: eve-google-32
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] On node 0 totalpages: 57344
[ 0.000000] free_area_init_node: node 0, pgdat c03ed090, node_mem_map c04a5000
[ 0.000000] Normal zone: 448 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 56896 pages, LIFO batch:15
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 56896
[ 0.000000] Kernel command line: no_console_suspend=1 console=null

.. and so on.

thats a big step forward to get android 2.2 aka froyo working on the eve.

here is how i did it:
the first goal was to understand in which way the LG-supplied sources for 2.6.29 differed to "official" android kernel sources.
besides the google-kernel (http://android.git.kernel.org/) there is kernel code at codeaurora.org. LG forked their tree off of the codeaurora code.
so... forward port the LG specific code to the 2.6.32 branch of codeaurora and we're done, right?
well... the codeaurora forum is run by qualcomm, the company that builds the chipsets used in most (all?) android smartphones. and they want to sell new/more chipsets/phones, so their 2.6.32 code doesnt support the msm7201a chipset we use anymore. :-(
the google code does.
but it took me some time to figure that out.

first of all, i was looking at what LG changed to the kernel they forked from.
... and i was amused and shocked at the same time. i am pretty sure i have a better grasp of the kernel code than the lg engineers have, after i played with the code for about 3 weeks.
so much useless (as in dead) code, their own strange error-handling/displaying and whatnot... seriously, their code is mostly a mess. at least they marked all their changes within the code.
after a few days i had ripped most of the changes from lg out of their 2.6.29 tree. everything still working.

then i went on to port the minimal changes needed to get the kernel booting over to the 2.6.32 kernel from google. and .... it worked almost instantly! usb/adb took me another hour or so.
thats it for now. next big problem is the difference between codeaurora and google implementation of the drivers for the chipset. especially the mddi (google that) interface for the display drivers is completely different. that will take some time. maybe i will rant about that in another post ;-)


maldn

Dienstag, 13. Juli 2010

Access the serial port of your LG GW620

first real post!

i am currently working on porting android 2.2 / linux kernel 2.6.32 to my new phone, the GW620 ( also known as EVE or KH5200).

when you are developing on this kind of embedded hardware, it is very useful to have some sort of feedback from the device as early as possible (e.g right from the bootloader) . normally this is done through a JTAG or serial port. almost every embedded device has those ports. key is to find those :)

since i don't own a jtag-debugger, i went for the serial console.
if we look at the device closely, we find 5 little pads under the sim-card slot. looks a lot like some sort of debugging-/test-pads.
the chance of 2 of these pads being a serial port is fairly high. you could now go ahead and test all of those pads and look for common voltages used for serial communication. tedious.
but luckily we have the service manual from LG.
so we study that pdf. and we find...



... and we found our serial pins!


now we need to connect those 2 pins to our development box. if you have a 3.3volts serial adapter, fine. i don't.
but i own an arduino microcontroller board. if you remove the uC you get a simple serial-to-usb converter. sweet!

now go on to connecting the cables. i am no fan of soldering on my precious phone.. but since the pads are under the sim card slot, i used a very simple and non-intrusive method.
i took a piece of transparent plastic, cut it to the shape (well almost) of a simcard, and used a hot needle to cut 2 holes in it at the right positions. stick your rx/tx cables through that and insert your new "debugcard". very hacky, but it works.

now you can use a terminal program to connect to your phone. the serial console works at 115200 baud. i use the arduino serial-monitor.

if you boot your phone you should see something like this:

[KEY] is_qwerty_keypad_pressed()
ptn 0 name='usd' start=285 len=4
ptn 1 name='pkg' start=289 len=44
ptn 2 name='boot' start=400 len=55
ptn 3 name='system' start=455 len=1600
ptn 4 name='userdata' start=2589 len=1506
ptn 5 name='lgdrm' start=2055 len=22
ptn 6 name='cache' start=2077 len=512
nandcfg: aa5400c0 0004745e (initial)
nandcfg: e85408c0 0004745e (used)
nandid: 5510bcad maker ad device bc
LGE: changed to CFG0 = e85408c0, CFG1 = 0004745e
block 160 is bad
block 1120 is bad
[BATT] Battery is charging? 0
[BATT] Smart Battery Percentage : 0%
[BATT] valid = 0. Charging = 0
[BATT] Level = 0%. Volt = 0mV. Temp = -37C
[BATT] Battery is not charging!!
[IMG] Displaying image #16
[BATT] No Charging!! or Battery is Dummy!!
[KEY] is_qwerty_keypad_pressed()
[KEY] is_key_pressed() ret : 0x00000000
[BATT] Power_on_Status : 0x00000020
[BATT]


bingo!

that's it for now. if you are not that familiar with the internals of this particular phone, go check out my next post where i will shed some light on the inner workings of that device.

i hope this is helpful ;-)

maldn

update: a picture of my test-setup