Archive

Archive for November, 2011

Android 4.0 (Ice Cream Sandwich) 源码发布了

November 15th, 2011 No comments

From: http://groups.google.com/group/android-building/browse_thread/thread/4f85d9242667a85f?pli=1

Hi! We just released a bit of code we thought this group might be interested in.
Over at our Android Open-Source Project git servers, the source code
for Android version 4.0 (Ice Cream Sandwich) is now available.
Here’s how to get it:Follow the instructions at
http://source.android.com/source/downloading.html Check out the
‘ics-release’ branch:repo init -u
https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
That’s it! However since this is a large push, please be aware that it
will take some time to complete. If you sync before it’s done, you’ll
get an incomplete copy that you won’t be able to use, so please wait
for us to give the all-clear before you sync.
This is actually the source code for version 4.0.1 of Android, which
is the specific version that will ship on the Galaxy Nexus, the first
Android 4.0 device. In the source tree, you will find a device build
target named “full_maguro” that you can use to build a system image
for Galaxy Nexus. Build configurations for other devices will come
later.
Unfortunately we still don’t have our Gerrit code review servers back
online. That remains our top priority though, and we hope to have them
back soon.
This release includes the full history of the Android source code
tree, which naturally includes all the source code for the Honeycomb
releases. However, since Honeycomb was a little incomplete, we want
everyone to focus on Ice Cream Sandwich. So, we haven’t created any
tags that correspond to the Honeycomb releases (even though the
changes are present in the history.)

JBQ, on behalf of the AOSP team.

Jean-Baptiste M. “JBQ” Queru
Software Engineer, Android Open-Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

Kernel debug with kgtp on android

November 1st, 2011 No comments

KGTP is a realtime and lightweight Linux Kernel GDB debugger and tracer. It makes Linux Kernel supply a GDB remote debug interface. Then GDB in current machine or remote machine can debug and trace Linux through GDB tracepoint without stopping the Linux Kernel. And even if the board doesn’t have GDB on it and doesn’t have interface for remote debug. It can debug the Linux Kernel using offline debug. Now, it supports X86-32, X86-64, MIPS and ARM.

This article describes how to use kgtp debug linux kernel on android.

Kernel Building

 General setup  --->
     [ * ] Prompt for development and/or incomplete code/drivers
     [ * ] Kprobe
Kernel hacking  --->
     [ * ] Compile the kernel with debug info
     [ * ] Compile the kernel with frame pointers

Building KGTP

Config KGTP Makefile

KERNELDIR := /work/vc1000/src/kernel-vc1000-2.3
ARCH=arm
CROSS_COMPILE=/usr/local/arm/arm-2009q3/bin/arm-none-linux-gnueabi-

error: ‘GTP_VAR_RDTSC_ID’ undeclared(latest version fixed By: teawater )

  CC [M]  /home/border/work/kernel/kgtp/trunk/gtp.o
/home/border/work/kernel/kgtp/trunk/gtp.c: In function 'gtp_gdbrsp_qtv':
/home/border/work/kernel/kgtp/trunk/gtp.c:6318: error: 'GTP_VAR_RDTSC_ID' undeclared (first use in this function)
/home/border/work/kernel/kgtp/trunk/gtp.c:6318: error: (Each undeclared identifier is reported only once
/home/border/work/kernel/kgtp/trunk/gtp.c:6318: error: for each function it appears in.)
/home/border/work/kernel/kgtp/trunk/gtp.c:6320: error: implicit declaration of function 'rdtscll'

* solution:

diff --git a/trunk/gtp.c b/trunk/gtp.c
index 4d0c9a2..75c145e 100644
--- a/trunk/gtp.c
+++ b/trunk/gtp.c
@@ -6315,11 +6315,13 @@ gtp_gdbrsp_qtv(char *pkg)
                if (num == GTP_VAR_CLOCK_ID) {
                        val = (uint64_t)GTP_LOCAL_CLOCK;
                        goto output_value;
+#ifdef CONFIG_X86
                } else if (num == GTP_VAR_RDTSC_ID) {
                        unsigned long long a;
                        rdtscll(a);
                        val = (uint64_t)a;
                        goto output_value;
+#endif
                } else if (num == GTP_VAR_XTIME_SEC_ID
                           || num == GTP_VAR_XTIME_NSEC_ID) {
                        struct timespec time

Complie and Install KGTP

make
sudo su
adb push gtp.ko /system/vendor/lib
exit

KGTP Running On Android

#Open the KGTP interface in current machine.
su
cd /system/vendor/lib
insmod gtp.ko
lsmod
nc -l -p 1234 < /sys/kernel/debug/gtp > /sys/kernel/debug/gtp

Host PC

cd /work/vc1000/src/kernel-vc1000-2.3
make -j8

Network connect to gtp

# symbian use "set gnutarget elf32-littlearm-symbian"
# vxworks use "set gnutarget elf32-littlearm-vxworks"
gdb-release -ex "set gnutarget elf32-littlearm" -ex "file ./vmlinux"

# if you want see the debug info
(gdb) set debug remote 1

# connection your remote device
(gdb) target remote 192.168.2.213:1234

USB connect to gtp

sudo su
# forward socket(adb forward <local> <remote>)
adb forward tcp:1234 tcp:1234
exit
gdb-release -ex "set gnutarget elf32-littlearm" -ex "file ./vmlinux"
# connection your remote device
(gdb) target remote 127.0.0.1:1234

Debugging with gtp

(gdb) trace vfs_readdir
Tracepoint 1 at 0xc02289f0: file /build/buildd/linux-2.6.35/fs/readdir.c, line 23.
(gdb) actions
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
>collect $reg
>end
(gdb) tstart

Change To Android Device Shell And Run ls Command * Android Device

$ ls

Back To Host PC GDB Shell * Host PC

(gdb) shell ls
vmlinux-2.6.35-30-generic
(gdb) tstop
(gdb) tfind
Found trace frame 0, tracepoint 1
#0  vfs_readdir (file=0x0, filler=0x163d8ae3, buf=0x18c0) at /build/buildd/linux-2.6.35/fs/readdir.c:23
23      {

Good luck, Happy Hacking…

 

Very grateful for teawater

References

kgtp Linux Kernel GDB Tracepoint module

kgtp Quick start

kgtp How to

How To Use KGTP In Android

GDB Tracepoints