Archive

Posts Tagged ‘Kernel’

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 –

修改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–

 

[Kernel] Debian-ubuntu-kernel-install

November 18th, 2009 No comments

第一步 安装必要的工具

首先要安装必要的包。
包有:libncurses5-devmenuconfig需要的)和essential

sudo apt-get install build-essential kernel-package
sudo apt-get install make
sudo apt-get install gcc

另外,查看系统是否有这样的两个命令

mkinitramfs mkisofs

这两个工具在编译内核时用来生成 *.img文件的。如果没有就需安装。

第二步 下载内核

www.kernel.org下载新内核到/usr/src

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.5.tar.bz2

我下载的是linux-2.6.30.5.tar.bz2(原来的内核是2.6.24-24-generic)

第三步 编译前的准备

察看当前内核的版本

border@ubuntu:/usr/src$ uname -a
Linux ubuntu 2.6.24-24-generic #1 SMP Tue Jun 30 20:28:53 UTC 2009 i686 GNU/Linux

建议最好下载比当前已安装版本高的内核

解压linux-2.6.30.5.tar.gzlinux-2.6.30.5

cd /usr/src
sudo tar xjvf linux-2.6.30.5.tar.bz2
cd linux-2.6.30.5/


第四步 开始编译

cd /usr/src/linux-2.6.30.5/ //以下所有的工作都在/usr/src/linux-2.6.30.5/下完成

sudo make menuconfig  //menuconfig的话还需要Ncurses,或者用
sudo make xconfig
sudo make menuconfig  //一般是用menuconfig

配置完以后保存(系统中保存的一份内核配置文件是在/usr/src/linux-2.6.30.5下名为.config,你也可以自己在别的地方另存一份)
也可以cp原来在/boot目录下的config-2.6.xx 到当前目录下,在make menuconfig是使用这个配置文件。

sudo make clean //清除旧数据 ,新解压的内核源码就不需要这一步了
sudo make –j4 可以分四个线程来进行编译工作
sudo make bzImage //编译内核,将保存到/usr/src/linux-2.6.30.5/arch/i386/boot/
sudo make modules //编译模块
sudo make modules_install //安装模块,执行完后会显示DEPMOD 2.6.30.5
sudo mkinitramfs -o /boot/initrd.img-2.6.30.5 2.6.30.5      // 2.6.30.5为modules_install 执行完成后显示的DEPMOD 2.6.30.5, 注意: 2.6.30.5 前面有空格
sudo make install //安装内核

如果你想把编译的结果打包为Deb包,可以参考这里 和 这里 .

sudo make-kpkg clean
sudo make-kpkg –revision eee701 kernel_image
sudo dpkg -i linux-image-2.6.30_eee701_i386.deb

安装完后/boot下将增加以下几个文件(用ls -l *30*查看)

border@ubuntu:/boot$ ls -l *30*
-rw-r–r– 1 root root   96237 2009-08-25 17:41 config-2.6.30.5
-rw-r–r– 1 root root 7896051 2009-08-25 17:38 initrd.img-2.6.30.5
-rw-r–r– 1 root root 1095789 2009-08-25 17:41 System.map-2.6.30.5
-rw-r–r– 1 root root 2324720 2009-08-25 17:41 vmlinuz-2.6.30.5

/boot/grub/menu.lst中添加一个新的启动项,如我的menu.lst增加了如下一段文字

title           Ubuntu kernel 2.6.30.5
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.30.5 vga=794 root=/dev/sda1 ro
initrd          /boot/initrd.img-2.6.30.5
quiet


ps: 上面在kernel一行后面的 “
vga=794 root=/dev/sda1 ro” 是从你之前的启动项取得的。
重新启动即可。

参考:
1.   http://ubuntuforums.org/showthread.php?t=311158
2.   “creating a kernel 2.6.30 deb file” http://www.naumann.cc/?p=107


Bian Jiang
Blog:  http://www.wifihack.net/

Categories: Kernel Tags: , , ,