Archive

Archive for the ‘Kernel’ Category

buildroot编译出错信息

December 20th, 2011 No comments

1. PATH环境变量有当前目录
错误信息:

border@b0rder:/work/tss/src/lichee/buildroot$ ./build.sh -p sun4i -m buildroot

You seem to have the current working directory in your PATH environment variable. This doesn’t work.

make: *** [dependencies] 错误 1

解决方法,

border@b0rder:/work/tss/src/lichee/buildroot$ echo $PATH .:/home/border/bin/jdk1.6.0_26/bin:.:.:/home/border/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/arm-2010.09/bin:/home/border/go/bin://home/border/bin:/usr/local/arm/arm-2009q3/bin:/home/border/bin:/work/vc1000/src/android-vc1000/out/host/linux-x86/bin:/home/border/bin:/home/border/work/depot_tools:/home/border/work/app/google_appengine:/work/vc1000/src/android-vc1000/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:/home/border/work/android/eclipse-x64:/home/border/work/ai/python/:/home/border/work/ai/python/tools

上面的.表示当前目录信息, 去掉. 后才能正常编译。

border@b0rder:/work/tss/src/lichee/buildroot$ export PATH=/home/border/bin/jdk1.6.0_26/bin:/home/border/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/arm-2010.09/bin:/home/border/go/bin://home/border/bin:/usr/local/arm/arm-2009q3/bin:/home/border/bin:/work/vc1000/src/android-vc1000/out/host/linux-x86/bin:/home/border/bin:/home/border/work/depot_tools:/home/border/work/app/google_appengine:/work/vc1000/src/android-vc1000/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:/home/border/work/android/eclipse-x64:/home/border/work/ai/python/:/home/border/work/ai/python/tools border@b0rder:/work/tss/src/lichee/buildroot$ echo $PATH /home/border/bin/jdk1.6.0_26/bin:/home/border/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/arm-2010.09/bin:/home/border/go/bin://home/border/bin:/usr/local/arm/arm-2009q3/bin:/home/border/bin:/work/vc1000/src/android-vc1000/out/host/linux-x86/bin:/home/border/bin:/home/border/work/depot_tools:/home/border/work/app/google_appengine:/work/vc1000/src/android-vc1000/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:/home/border/work/android/eclipse-x64:/home/border/work/ai/python/:/home/border/work/ai/python/tools

2. makeinfo
错误信息:

border@b0rder:/mnt/ubuntu32/work/tss/src/lichee$ ./build.sh -p sun4i -m buildroot

You must install ‘makeinfo’ on your build machine makeinfo is usually part of the texinfo package in your distribution

make: *** [dependencies] 错误 1

解决方法:

sudo apt-get install texinfo

–EOF–

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

AOSP source code back online

October 21st, 2011 No comments
Hi!
As you know, like many other projects the Android Open-Source Project was affected by the recent kernel.org downtime. So, we’re pleased to let you know that the Gingerbread source code is now available again, and AOSP git servers are back online.
Even before the kernel.org downtime, it was clear that AOSP was sometimes taxing kernel.org’s git infrastructure. When we did the Gingerbread source release, for example, load due to AOSP made part of kernel.org unusable for several days. This isn’t fair to kernel.org’s staff or the community, so for some time we’ve been preparing our own git hosting on Google servers.
We were finishing up just as kernel.org experienced their downtime, so the Gingerbread source is now available on Google’s servers. Accordingly, the git URLs have changed.
Here are the instructions to access the new git servers:
There are a few limitations to be aware of:
  • Our priority has been getting the main source code mirrors back online, so for the moment gitweb source browsing and Gerrit Code Review are still unavailable.
  • We are now working on bringing AOSP’s Gerrit Code Review site back up, and hope to be able to say something here soon.
  • It might be a little while longer before gitweb comes back, unfortunately, since Gerrit Code Review is the next priority.
  • To reiterate, these servers contain only the ‘gingerbread’ and ‘master’ branches from the old AOSP servers. We plan to release the source for the recently-announced Ice Cream Sandwich soon, once it’s available on devices.
  • As these new servers are, well, new, there may be hiccups if we encounter unexpected issues. However we’re keeping a close eye on them and will respond to any issues as quickly as possible.
Finally, we’d like to send a huge “thank-you” to the kernel.org community and Oregon State University Open-Source Lab staff. They’ve done an incredible job hosting the AOSP source code mirror and Gerrit Code Review for nearly 3 years. Without them, it’s safe to say that AOSP would not be where we are today.
Thanks, and happy coding!
- Dan
– EOF –

libusb must be mounted usbfs

July 20th, 2011 2 comments

今天通过libusb访问一个HID的设备,一调用USBDEVFSCLAIMINTERFACE ioctl就返回-1设备忙, 找了一下午原因也没有找到, 快到下班的时候, 发现了一篇文章Porting Libusb for Android on the Beagleboard in 5 steps 提到 需要把设备加载到usbfs上,结果加载了usbfs设备就能正常访问了。

在网上搜了一圈,发现libusb就是通过usbfs或usbdevfs来链接USB设备,所以在使用之前 必须加载usbfs到/dev/bus/usb或/proc/bus/usb目录. 原文如下:

libusb uses a pseudo-filesystem known as ‘usbdevfs` or ‘usbfs` to access
the USB devices connected to your machine. This filesystem must be mounted
under /proc/bus/usb for libusb to work.

libusb移植到Android具体可以参考Porting Libusb for Android on the Beagleboard in 5 steps

需要注意的是:

  • 在命令行加载sysfs需要执行:
    • mount -t usbfs -o devmode=666 none /proc/bus/usb
  • 在init.rc中需要使用:
    • mount usbfs none /proc/bus/usb -o devmode=0666

参考

Categories: Android, Kernel, Tech.Notes Tags: , , , , ,

修改Linux Kernel启动画面

June 3rd, 2011 No comments

linux kernel的启动logo存放于KERNEL_PATH/drivers/video/logo/logo_linux_cult224.ppm

是被编译到内核的,所以不能简单的替换就改变原有的logo,按以下命令制作logo_linux_cult224.ppm:


pngtopnm logo.png > logo_linux_cult224.pnm       /*格式转换*/
pnmquant 224 logo_linux_cult224.pnm > logo_linux_cult224.pnm /*将图像改为224色*/
pnmtopnm logo_linux_cult224.pnm > logo_linux_cult224.ppm /*将图像转存为ppm格式*/

替换新内核中原有的logo_linux_cult224.ppm,注意备份原有的企鹅logo_linux_cult224.ppm。

内核编译后,且以framebuffer方式启动新内核,此时企鹅图标就变成了自定义的LOGO(注意LOGO图像的尺寸不能大于framebuffer的尺寸)

但是在启动中,logo上会有光标在闪烁,如果需要将光标去除(提示console的光标也会消失),将内核中的KERNEL_PATH/drivers/video/console/fbcon.c中的fb_flashcursor和fbcon_sursor函数体置空。重新编译安装内核即可。

参考: http://www.cnblogs.com/semo/archive/2011/01/05/1926295.html

–EOF–