2010年5月30日 星期日

Manual Installing busybox into android system

Copy busybox into filesystem
#./cp /sdcard/busybox /data/tmp
#./busybox ash

change system read/write
#mount -oremount,rw /dev/block/mmcblk0p2 /system

Enter /system/busybox and copy busybox into /system/busybox
#cd /system/busybox
#cp /data/tmp/busybox .

List all command of busybox
#./busybox > list
# vi list
# for I in `cat list `
> do
> ln bus> ln busybox $I
> done
/system/busybox # ls

Remove list file and change the mount from rw to ro
#rm list
#mount -oremount ,ro /dev/block/mmcblk0p2 /system

Then, you can list busybox command
#cd /system/busybox
#./ash
#export PATH='pwd':$PATH

Modify ramdisk.img on android

open device board and find ramdisk.img location
1. #ls /dev/block
2. #cd /data/tmp
3. #mount -t ext3 /dev/block/mmcblk0p1 mnt/
4. on /data/tmp/mnt
# mdkir cpio
5. cat ../ramdisk.img | gunzip | cpio -idv
Then, we can modify the init.rc
such as
1. mount mtd partition from ext2 to ext3
>>mount ext3 /dev/block/mmcblk0p2 /system
>>mount ext3 /dev/block/mmcblk0p2 /system ro remount
>>mount ext3 /dev/block/mmcblk0p3 /data nosuid nodev
2. global environment
>>export PATH /system/busybox:/sbin:/system/sbin:/system/bin:/system/xbin
>>export HOME /
3. Added other service
>>service otg /data/tmp/otg.sh
>>oneshot

If you change successfully, you can comparess and umount it
1. on /data/tmp/mnt/cpio
#find . | cpio -o -H newc | gzip > ../ramdisk.img
#umount mnt

2010年5月6日 星期四

debug kernel for dump message

We cannot get any information about the issue, since the console cannot be enabled. Now we introduce two ways to get the log info.

1. Using XDB

a) Find the line ” c0574960 b __log_buf” in the file System.map in the build root folder

b) XDB load the log buf from the address c0574960

Note: the address may change after rebuilding the kernel.

2. Using the Low Level debug

a) Enable the Low Level debug in the menuconfig

Kernel hacking --->

[*] Kernel low-level debugging functions

b) Add the code (the red lines) in the file kernel/printk.c

extern void printch(char c);

static void emit_log_char(char c)

{

LOG_BUF(log_end) = c;

log_end++;

if (log_end - log_start > log_buf_len)

log_start = log_end - log_buf_len;

if (log_end - con_start > log_buf_len)

con_start = log_end - log_buf_len;

if (logged_chars <>

logged_chars++;

printch(c);

}

c) Use the new kernel, then you can get the uart info.

Note: if it cannot work, please make sure in the file -- include/asm-arm/arch-pxa/debug-macro.S, there is the right map for UART registers.