Saturday, May 02, 2009

How to Create/Modify an RAM disk Image

How to Create/Modify an RAM disk Image
Glomation GESBC-93XX series single board computers use RAM disk as the root file
system in it’s default configuration. Most likely one would want to create/change the
RAM disk to have user applications installed. This Document describes how to mount
and edit files in a RAM disk image, unmount the image and recompress it.
System Requirement
In order to mount a RAM disk image, your development system must have MTD support
compiled in, and have the Loopback Interface available. Most Linux distribution have
these configured in the kernel.
To check the availability of MTD and loopback interface, issue the following command
on the development system
# cat /proc/mtd
or
# ls -l /dev/mtd*
If any information is shown with /proc/mtd, and if you see any files named
mtdblock, mtd, etc that means the system has MTD support.
If not please rebuild the Linux kernel with MTD support. The follow instruction shows
the basic steps to do that.
Go to the kernel source tree directory on your development system and issue...
# make menuconfig
The following options must be enabled to use MTD.
Memory Technology Devices (MTD) --->
<*> Memory Technology Device (MTD) support
[*] Debugging
(0) Debugging verbosity (0 = quiet, 3 = noisy)
[*] MTD partitioning support
<*> Direct char device access to MTD devices
<*> Caching block device access to MTD devices
RAM/ROM/Flash chip drivers --->
<*> Detect flash chips by Common Flash Interface (CFI)
probe
<*> Support for Intel/Sharp flash chips
<*> Support for AMD/Fujitsu flash chips
Self-contained MTD device drivers --->
<*> MTD emulation using block device
GESBC-9315 User’s Manual
Version 0.2 Page 2 of 3 19-Apr-06
As well as....
Block devices --->
<*> RAM disk support
(32768) Default RAM disk size (kbytes)
[*] Initial RAM disk (initrd) support
After the kernel has been reconfigured, re-build the kernel, install the new kernel and
reboot your development system.
Once you have MTD and RAM disk support on your development system, you are ready
to create/modify the RAM disk image.
Create New RAM Disk Image
The Ext2 file system can be created and mounted onto an embedded device using the
concept of RAM disk.
mke2fs -vm0 /dev/ram 16384
mount -t ext2 /dev/ram /mnt
cd /mnt
cp /bin, /sbin, /etc, /dev ... files in mnt
cd ../
umount /mnt
dd if=/dev/ram bs=1k count=16384 of=ramdisk
gzip -9 ramdisk
mke2fs is the utility used to create an ext2 file system -- creating the super block, inodes,
inode table, and etc -- on any device.
In the above usage, /dev/ram is the device on which an ext2 file system of 16384 blocks
is built. Then the device (/dev/ram) is mounted on a temporary directory named /mnt and
all the necessary files are copied. Once these files are copied, the file system is
unmounted and the contents of the device (/dev/ram) is dumped into a file (ramdisk),
which is the required RAM disk (the Ext2 file system). The RAM disk file is then
compressed and ready to be loaded by Redboot.
The above sequence creates a RAM disk of 16 MB and fills it with the necessary file
utilities.
Some of the important directories to include in RAM disk are:
/bin -- Holds most of the binaries like init, busybox, shell, file management utilities, and
etc.
/dev -- Contains all the device nodes used in the device
GESBC-9315 User’s Manual
Version 0.2 Page 3 of 3 19-Apr-06
/etc -- Contains all the configuration files for the system
/lib -- Contains all the necessary libraries like libc, libdl, and so on
Modify Existing RAM Disk Image
1. First uncompress the ramdisk.gz file.
# gunzip ramdisk.gz
2. Make a directory to mount the ramdisk image.
# mkdir ramdisk_dir
3. Mount the ramdisk image as a loop back device
# mount -o loop ramdisk ramdisk_dir
You can then issue the command 'df' to see the new RAM disk partition on you
development system.
4. Edit Files
You can now edit files inside the RAM disk. Depending on how the original RAM disk
is created, you may or may not have enough space on the RAM disk to install your
application. Refer to Create New RAM Disk Image section on how to create a new RAM
disk with more storage space.
5. Unmount the ramdisk and compress it.
# umount ramdisk_dir
# gzip -9 ramdisk
You will then have a new compressed root file system that you can now load with
RedBoot

好屌的引擎模型!!

http://android.cool3c.com/article/7782

好屌的引擎模型!!

Date: 09-04-30 13:36 Author: kun

逛網路時看到,真的可以運轉,來源有影片

Porsche 911 Carrera 引擎 為世上首度配置並為人所熟知的水平對臥六缸引擎 1973 年 911 RS Carrera配置2,687c.c.全鋁合金引擎,最大動力輸出達210匹德制馬力,扭力峰值為26kgm/5100rpm,以當時來說,可說是顛峰之作 Marushin Co. 日本的精密機械廠,傳言應著公司老闆對911的狂愛, 而在生產線上製出了模型界傳頌的絕世精品 此引擎模型發表於1990年代初期,發表後引起模型界一陣震驚! 幾乎完全比照真車引擎縮小的組件,而且全部採用金屬鑄造,開模的精細度到了足堪比擬藝術品的境界,而且此具模型更採用壓縮空氣推動,可讓整具引擎比照實車運轉,在靜態展示之外,更增加了收藏的價值!

想看詳細的組裝過程可以引用來源:http://www.bluegtv.com/2008/05/porsche-911-carrera.html 好好看個仔細

 

Saturday, April 25, 2009

Tutorials & Code Camps Chapter 5 Continued: JNI Example

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html

The following sections walk through all the steps.

import java.util.*;

class ReadFile {
//Native method declaration
native byte[] loadFile(String name);
//Load the library
static {
System.loadLibrary("nativelib");
}

public static void main(String args[]) {
byte buf[];
//Create class instance
ReadFile mappedFile=new ReadFile();
//Call native method to load ReadFile.java
buf=mappedFile.loadFile("ReadFile.java");
//Print contents of ReadFile.java
for(int i=0;i<buf.length;i++) {
System.out.print((char)buf[i]);
}
}
}


Native Method Declaration

The native declaration provides the bridge to run the native function in the Java1 virtual machine. In this example, the loadFile function maps onto a C function called Java_ReadFile_loadFile. The function implementation accepts a String that represents a file name and returns the contents of that file in the byte array.

native byte[] loadFile(String name);

Load the Library

The library containing the native code implementation is loaded by a call to System.loadLibrary(). Placing this call in a static initializer ensures this library is only loaded once per class. The library can be loaded outside of the static block if your application requires it. You might need to configure your environment so the loadLibrary method can find your native code library.

static {
System.loadLibrary("nativelib");
}

Compile the Program

To compile the program, just run the javac compiler command as you normally would:

javac ReadFile.java

Next, you need to generate a header file with the native method declaration and implement the native method to call the C functions for loading and reading a file.

Generate the Header File

To generate a a header file, run the javah command on the ReadFile class. In this example, the generated header file is named ReadFile.h. It provides a method signature that you have to use when you implement the loadfile native function.

javah -jni ReadFile

Note: When running javah on your own classes, be sure to use the fully-qualified class name.

Method Signature

The ReadFile.h header file defines the interface to map the Java language method to the native C function. It uses a method signature to map the arguments and return value of the Java language mappedfile.loadFile method to the loadFile native method in the nativelib library. Here is the loadFile native method mapping (method signature):

/*
* Class: ReadFile
* Method: loadFile
* Signature: (Ljava/lang/String;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_ReadFile_loadFile
(JNIEnv *, jobject, jstring);


The method signature parameters function as follows:

* JNIEnv *: A pointer to the JNI environment. This pointer is a handle to the current thread in the Java virtual machine, and contains mapping and other hosuekeeping information.

* jobject: A reference to the method that called this native code. If the calling method is static, this parameter would be type jclass instead of jobject.

* jstring: The parameter supplied to the native method. In this example, it is the name of the file to be read.

Implement the Native Method

In this native C source file, the loadFile definition is a copy and paste of the C declaration contained in ReadFile.h. The definition is followed by the native method implementation. JNI provides a mapping for both C and C++ by default.

#include <jni.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

JNIEXPORT jbyteArray JNICALL Java_ReadFile_loadFile
(JNIEnv * env, jobject jobj, jstring name) {
caddr_t m;
jbyteArray jb;
jboolean iscopy;
struct stat finfo;
const char *mfile = (*env)->GetStringUTFChars(
env, name, &iscopy);
int fd = open(mfile, O_RDONLY);

if (fd == -1) {
printf("Could not open %s\n", mfile);
}
lstat(mfile, &finfo);
m = mmap((caddr_t) 0, finfo.st_size,
PROT_READ, MAP_PRIVATE, fd, 0);
if (m == (caddr_t)-1) {
printf("Could not mmap %s\n", mfile);
return(0);
}
jb=(*env)->NewByteArray(env, finfo.st_size);
(*env)->SetByteArrayRegion(env, jb, 0,
finfo.st_size, (jbyte *)m);
close(fd);
(*env)->ReleaseStringUTFChars(env, name, mfile);
return (jb);
}


You can approach calling an existing C function instead of implementing one, in one of two ways:

1. Map the name generated by JNI to the existing C function name. The Language Issues section shows how to map between Xbase database functions and Java language code

2. Use the shared stubs code available from the JNI page on the java.sun.com web site.

Compile the Dynamic or Shared Object Library

The library needs to be compiled as a dynamic or shared object library so it can be loaded at runtime. Static or archive libraries are compiled into an executable and cannot be loaded at runtime. The shared object or dynamic library for the loadFile example is compiled as follows:

Gnu C/Linux:

gcc -o libnativelib.so -shared -Wl,-soname,libnative.so
-I/export/home/jdk1.2/include
-I/export/home/jdk1.2/include/linux nativelib.c
-static -lc

Gnu C++/Linux with Xbase

g++ -o libdbmaplib.so -shared -Wl,-soname,libdbmap.so
-I/export/home/jdk1.2/include
-I/export/home/jdk1.2/include/linux
dbmaplib.cc -static -lc -lxbase


Win32/WinNT/Win2000

cl -Ic:/jdk1.2/include
-Ic:/jdk1.2/include/win32
-LD nativelib.c -Felibnative.dll


Run the Example

To run the example, the Java virtual machine needs to be able to find the native library. To do this, set the library path to the current directory as follows:

Unix or Linux:
LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH


Windows NT/2000/95:
set PATH=%path%;.


With the library path properly specified for your platform, invoke the program as you normally would with the interpreter command:

java ReadFile

Tuesday, April 21, 2009

Android 編譯環境 - 手工編譯C模塊

http://www.wretch.cc/blog/ppbblin/15161523


# make clean-helloworld

上面的「make clean-$(LOCAL_MODULE)」Android編譯環境提供的make clean的方式。

# make helloworld showcommands

Android編譯環境提供了」showcommands」選項來顯示編譯命令行,我們可以通過打開這個選項來查看一些編譯時的細節。

Friday, April 17, 2009

Google Android Emulator Skins

http://www.android.encke.net/

Hello Android fans and developers. I'd like to share with you some emulator skins I created for the Google Android SDK. They are tested to work with the latest Android SDK version 1.0r1.

For more information on installation and usage of these skins and the Android Emulator please consult my Android Emulator Tutorial.


android-vnc-viewer

http://code.google.com/p/android-vnc-viewer/
androidVNC_build090307.apk

android-vnc

http://code.google.com/p/android-vnc/

Quick Start

Download the kernel image and fbvncserver binary and invoke the following:

emulator -kernel zImage -noskin

Wait some time for the emulator to start and then install the binary:

adb push fbvncserver /data
adb shell
/data/fbvncserver

Then redirect the port so the local machine can access the server:

telnet localhost 5554
redir add tcp
:5900:5901

And finally:

xvncviewer -noauto localhost

Further tunneling is required to connect from a Smartphone over the Internet or LAN, but it is pretty trivial. The redirection added through Android's telnet interface only listens on the local interface.


busybox及bash在android中的安装

http://hi.baidu.com/yyt981/blog/item/b81c215493cdeb50574e0066.html

1. ramdisk的制作
2.6内核开始,initrd.img采用cpio压缩,ramdisk.img也一样,使用gunzip解压缩,然后再使用 cpio解包。

1)将ramdisk.img复制其他目录,名称改为ramdisk.img.gz,解压
#gunzip ramdisk.img.gz

//新建一个文件夹ramdisk,进入
#cpio -i -F ../ramdisk.img
这时,可到ramdisk中看看去~

2)修改init.rc,在PATH中加上busybox 路径
//busybox安装在 /data/busybox
## Global environment setup
##
env {
#其中, /data/busybox 为busybox安装路径,bash也是放在其中

PATH /data/busybox:/sbin:/system/sbin:/system/bin
LD_LIBRARY_PATH /system/lib
ANDROID_BOOTLOGO 1
ANDROID_ROOT /system
ANDROID_ASSETS / system/app
ANDROID_DATA /data
EXTERNAL_STORAGE /sdcard
DRM_CONTENT /data/drm/content
HOME / #这个也是新添加环境变量
}

3)重新打包成镜像,并使用新镜像启动emulator
#cpio -i -t -F ../ramdisk.img > list
#cpio -o -H newc -O rd_busybox.img <>

//使用 -ramdisk 参数,指定所使用的镜像文件
#emulator -noskin -ramdisk rd_ramdisk.img

2. 安装busybox及bash
下载地址:
http://www.billrocks.org/android_libs/bin/
注:也可自行交叉编译,不过需静态编译。

#adb shell mkdir /data/busybox
#adb push busybox /data/busyobx
#adb push bash /data/busybox

//adb shell,进入android
#cd /data/busyobx
#chmod +x busybox bash
#./busybox --install //将程序安装在当前目录下

//重启emulator,进入bash
bash-3.2# export
declare -x ANDROID_ASSETS="/system/app"
declare -x ANDROID_BOOTLOGO="1"
declare -x ANDROID_DATA="/data"
declare -x ANDROID_ROOT="/system"
declare -x DRM_CONTENT="/data/drm/content"
declare -x EXTERNAL_STORAGE="/sdcard"
declare -x HOME="/"
declare -x LD_LIBRARY_PATH="/system/lib"
declare -x OLDPWD
declare -x PATH="/data/busybox:/sbin:/system/sbin:/system/bin"
declare -x PWD="/data/bin/tst"
declare -x SHLVL="1"

注:在1中修改 init.rc 增加的环境变量及路径已经生效。

Tuesday, April 07, 2009

CRC16 - IBM

http://www.codeguru.com/forum/showthread.php?referrerid=177422&t=433491
ushort ComputeCRC16(const uchar* buf, uint len)

{
ushort crc = 0;
for (uint j = 0; j < len; j++)
{
uchar b = buf[j];
for (uchar i = 0; i < 8; i++)
{
crc = ((b ^ (uchar)crc) & 1) ? ((crc >> 1) ^ 0xA001) : (crc >> 1);
b >>= 1;
}
}
return crc;

}

CRC16 - CCITT

http://delphi.ktop.com.tw/board.php?cid=168&fid=917&tid=19517

CRC-16範例

// Update the CRC for transmitted and received data using
// the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1).

unsigned char ser_data;
static unsigned int crc;

crc = (unsigned char)(crc >> 8) | (crc <<>> 4;
crc ^= (crc << color="red">Note: It is best not to alter this code. For example, (crc<<8)<<4>

Monday, April 06, 2009

Android HAL - 如何連接 OS 與底層OS

Android OS定了許多 Manager 去管理各種 device ,但 OS 是無法直接控制device的,所以需要實作符合OS定義的 HAL,透過HAL 去access底層的 device driver。

Sensor/Overlay 請參考:android/hardware/libhardware

Power/LED/Flashlight/gps/Wifi/Vibrator 請參考:android/hardware/libhardware_legacy

產生的會是 lib的so 檔,被放置在機器上 OS 的 /system/lib 內

如果透過使用 ioctl 去控制 device file,必須注意檔案權限問題,可以在 android/system/core/rootdir/init.rc 裡面chown/chmod

Google Code Lab 發現許多新玩意

http://funp.com/t844680?via=tools#p=844680

Google API數量之多,已難以用手指數得出來,但在這些API長大成人之前,Google都把他們放在Code Lab中,讓愛好程式開發的人可以發揮想像力,好好玩弄這些API一番,看能激盪初那些火花,同時Google也能進一步改進這些API的功能。

有許多相當出名的API當初就是從這裡畢業,包含Google Maps、Google Earth、YouTube等等,而目前在實驗室中的幾個未來明星,筆者認為有picasa APIsThemes APIsWebmaster Tool Data APIs以及Social Graph API

對於其中兩個筆者很有興趣。先來談談Webmaster Tool Data APIs,相信只要是負責網站經營的朋友,都會有種經驗,就是要注意網站有那些死連結(dead link)、錯誤頁面、上傳sitemap等等,若剛好貴公司是個跨國集團,那網站數量更有可能達到二位數之多,管理上的確有些麻煩。在現有Google webmaster tool網站上,雖然都能處理這些事情,卻有些麻煩的地方,可能網路速度很慢,無法批次上傳sitemap等等,著實降低站長的工作效率,筆者目前深受其害。所以,若能有用戶端的webmaster tool軟體可供安裝,能清楚的瀏覽webmaster tool裡的資料,應可解決效率不彰的問題。

另一個就是Social Graph API,尤其是現在社群網站逐漸成形,幾個大的網站都已站穩腳步,也正是可以發展標準的時候,Social Graph API就是架構在這些標準之上所提供的一些功能,主要的構想是在既有的社群網絡中,抽絲剝繭地找出各個連接間的關係,然後加以連接,下面這張圖就是從Social Graph API中節錄下來的示意圖,底下還有他們官方介紹影片,對於社群有興趣的程式設計師可別錯過喔,概念相當簡單易懂,只看我們如何應用囉。

Google Social Graph API concept

從上面幾個例子看來,Google Code Lab真的是程式設計師的天堂,在這裡可以找到許多新的創意與可能,若是網友有使用他們API做出其他應用,也歡迎與cipper tech分享喔。

Android系统文件夹结构解析

http://www.chinaeda.cn/show.aspx?id=16306&cid=10
看看Android系统文件夹都隐藏了什么秘密,下面是简单的结构解析。

  \system\app

  这个里面主要存放的是常规下载的应用程序,可以看到都是以APK格式结尾的文件。在这个文件夹下的程序为系统默认的组件,自己安装的软件将不会出现在这里,而是\data\文件夹中。下面是详细的介绍:

\system\app\AlARMClock.apk 闹钟
\system\app\AlARMClock.odex
\system\app\Browser.apk 浏览器
\system\app\Browser.odex
\system\app\Bugreport.apk Bug报告
\system\app\Bugreport.odex
\system\app\Calculator.apk 计算器
\system\app\Calculator.odex
\system\app\Calendar.apk 日历
\system\app\Calendar.odex
\system\app\CalendarProvider.apk 日历提供
\system\app\CalendarProvider.odex
\system\app\Camera.apk 照相机
\system\app\Camera.odex
\system\app\com.amazon.mp3.apk 亚马逊音乐
\system\app\Contacts.apk 联系人
\system\app\Contacts.odex
\system\app\DownloadProvider.apk 下载提供
\system\app\DownloadProvider.odex
\system\app\DrmProvider.apk DRM数字版权提供
\system\app\DrmProvider.odex
\system\app\Email.apk 电子邮件客户端
\system\app\Email.odex
\system\app\FieldTest.apk 测试程序
\system\app\FieldTest.odex
\system\app\GDataFeedsprovider.apk GoogleData提供
\system\app\GDataFeedsprovider.odex
\system\app\Gmail.apk Gmail电子邮件
\system\app\Gmail.odex
\system\app\GmailProvider.apk Gmail提供
\system\app\GmailProvider.odex
\system\app\GoogleApps.apk 谷歌程序包
\system\app\GoogleApps.odex
\system\app\GoogleSearch.apk 搜索工具
\system\app\GoogleSearch.odex
\system\app\gtalkservice.apk GTalk服务
\system\app\gtalkservice.odex
\system\app\HTMLViewer.apk HTML查看器
\system\app\HTMLViewer.odex
\system\app\IM.apk 即使通讯组件包含MSN、yahoo通
\system\app\ImCredentialProvider.apk
\system\app\ImProvider.apk
\system\app\ImProvider.odex
\system\app\Launcher.apk 启动加载器
\system\app\Launcher.odex
\system\app\Maps.apk 电子地图
\system\app\Maps.odex
\system\app\MediaProvider.apk 多媒体播放提供
\system\app\MediaProvider.odex
\system\app\Mms.apk 短信、彩信
\system\app\Mms.odex
\system\app\Music.apk 音乐播放器
\system\app\Music.odex
\system\app\MyFaves.apk T-Mobile MyFaves程序
\system\app\MyFaves.odex
\system\app\PackageInstaller.apk apk安装程序
\system\app\PackageInstaller.odex
\system\app\Phone.apk 电话拨号器
\system\app\Phone.odex
\system\app\Settings.apk 系统设置
\system\app\Settings.odex
\system\app\SettingsProvider.apk 设置提供
\system\app\SettingsProvider.odex
\system\app\SetupWizard.apk 设置向导
\system\app\SetupWizard.odex
\system\app\SoundRecorder.apk 录音工具
\system\app\SoundRecorder.odex
\system\app\Street.apk 街景地图
\system\app\Street.odex
\system\app\Sync.apk 同步程序
\system\app\Sync.odex
\system\app\Talk.apk 语音程序
\system\app\Talk.odex
\system\app\TelephonyProvider.apk 电话提供
\system\app\TelephonyProvider.odex
\system\app\Updater.apk 更新程序
\system\app\Updater.odex
\system\app\Vending.apk 制造商信息
\system\app\Vending.odex
\system\app\VoiceDialer.apk 语音拨号器
\system\app\VoiceDialer.odex
\system\app\YouTube.apk Youtube视频
\system\app\YouTube.odex

\system\bin

这个目录下的文件都是系统的本地程序,从bin文件夹名称可以看出是binary二进制的程序,里面主要是Linux系统自带的组件,Android手机网就主要文件做下简单的分析介绍:

\system\bin\akmd
\system\bin\am
\system\bin\app_process 系统进程
\system\bin\dalvikvm Dalvik虚拟机宿主
\system\bin\dbus-daemon 系统BUS总线监控
\system\bin\debuggerd 调试器
\system\bin\debug_tool 调试工具
\system\bin\dexopt DEX选项
\system\bin\dhcpcd DHCP服务器
\system\bin\dumpstate 状态抓取器
\system\bin\dumpsys 系统抓取器
\system\bin\dvz
\system\bin\fillup
\system\bin\flash_image 闪存映像
\system\bin\hciattach
\system\bin\hcid HCID内核
\system\bin\hostapd
\system\bin\hostapd_cli
\system\bin\htclogkernel
\system\bin\input
\system\bin\installd
\system\bin\itr
\system\bin\linker
\system\bin\logcat Logcat日志打印
\system\bin\logwrapper
\system\bin\mediaserver
\system\bin\monkey
\system\bin\mountd 存储挂载器
\system\bin\netcfg 网络设置
\system\bin\ping Ping程序
\system\bin\playmp3 MP3播放器
\system\bin\pm 包管理器
\system\bin\qemud QEMU虚拟机
\system\bin\radiooptions 无线选项
\system\bin\rild RIL组件
\system\bin\sdptool
\system\bin\sdutil
\system\bin\service 
\system\bin\servicemanager 服务管理器
\system\bin\sh
\system\bin\ssltest SSL测试
\system\bin\surfaceflinger 触摸感应驱动
\system\bin\svc 服务
\system\bin\system_server
\system\bin\telnetd Telnet组件
\system\bin\toolbox
\system\bin\wlan_loader
\system\bin\wpa_cli
\system\bin\wpa_supplicant

\system\etc

  从文件夹名称来看保存的都是系统的配置文件,比如APN接入点设置等核心配置。

\system\etc\apns-conf.xml APN接入点配置文件
\system\etc\AudioFilter.csv 音频过滤器配置文件
\system\etc\AudioPara4.csv
\system\etc\bookmarks.xml 书签数据库
\system\etc\dbus.conf 总线监视配置文件
\system\etc\dhcpcd
\system\etc\event-log-tags
\system\etc\favorites.xml 收藏夹
\system\etc\firmware 固件信息
\system\etc\gps.conf GPS设置文件
\system\etc\hcid.conf  内核HCID配置文件
\system\etc\hosts 网络DNS缓存
\system\etc\init.goldfish.sh
\system\etc\location 定位相关
\system\etc\mountd.conf 存储挂载配置文件
\system\etc\NOTICE.html 提示网页
\system\etc\permissions.xml 权限许可
\system\etc\pvplayer.conf 
\system\etc\security 
\system\etc\wifi WLAN相关组件
\system\etc\dhcpcd\dhcpcd-hooks
\system\etc\dhcpcd\dhcpcd-run-hooks
\system\etc\dhcpcd\dhcpcd.conf
\system\etc\dhcpcd\dhcpcd-hooks\01-test
\system\etc\dhcpcd\dhcpcd-hooks\20-dns.conf
\system\etc\dhcpcd\dhcpcd-hooks\95-configured
\system\etc\firmware\brf6300.bin
\system\etc\location\gps
\system\etc\location\gps\location 定位相关
\system\etc\location\gps\nmea GPS数据解析
\system\etc\location\gps\properties
\system\etc\security\cacerts.bks
\system\etc\security\otacerts.zip OTA下载验证
\system\etc\wifi\Fw1251r1c.bin
\system\etc\wifi\tiwlan.ini
\system\etc\wifi\wpa_supplicant.conf WPA验证组件

\system\fonts

字体文件夹,除了标准字体和粗体、斜体外可以看到文件体积最大的可能是中文字库,或一些unicode字库,从T-Mobile G1上可以清楚的看到显示简体中文正常,其中DroidSansFallback.ttf文件大小

\system\fonts\DroidSans-Bold.ttf
\system\fonts\DroidSans.ttf
\system\fonts\DroidSansFallback.ttf
\system\fonts\DroidSansMono.ttf
\system\fonts\DroidSerif-Bold.ttf
\system\fonts\DroidSerif-BoldItalic.ttf
\system\fonts\DroidSerif-Italic.ttf
\system\fonts\DroidSerif-Regular.ttf


\system\framework

framework主要是一些核心的文件,从后缀名为jar可以看出是是系统平台框架。

\system\framework\am.jar
\system\framework\am.odex
\system\framework\android.awt.jar AWT库
\system\framework\android.awt.odex
\system\framework\android.policy.jar 
\system\framework\android.policy.odex
\system\framework\android.test.runner.jar
\system\framework\android.test.runner.odex
\system\framework\com.google.android.gtalkservice.jar GTalk服务
\system\framework\com.google.android.gtalkservice.odex
\system\framework\com.google.android.maps.jar 电子地图库
\system\framework\com.google.android.maps.odex
\system\framework\core.jar 核心库,启动桌面时首先加载这个
\system\framework\core.odex
\system\framework\ext.jar
\system\framework\ext.odex
\system\framework\framework-res.apk
\system\framework\framework-tests.jar
\system\framework\framework-tests.odex
\system\framework\framework.jar
\system\framework\framework.odex
\system\framework\input.jar 输入库
\system\framework\input.odex
\system\framework\itr.jar
\system\framework\itr.odex
\system\framework\monkey.jar
\system\framework\monkey.odex
\system\framework\pm.jar 包管理库
\system\framework\pm.odex
\system\framework\services.jar
\system\framework\services.odex
\system\framework\ssltest.jar
\system\framework\ssltest.odex
\system\framework\svc.jar 系统服务
\system\framework\svc.odex

\system\lib

lib目录中存放的主要是系统底层库,如平台运行时库。

\system\lib\libaes.so 
\system\lib\libagl.so
\system\lib\libandroid_runtime.so Android运行时库
\system\lib\libandroid_servers.so 系统服务组件
\system\lib\libaudio.so 音频处理
\system\lib\libaudioeq.so EQ均衡器
\system\lib\libaudioflinger.so 音频过滤器
\system\lib\libbluetooth.so 蓝牙组件
\system\lib\libc.so
\system\lib\libcamera.so 超相机组件
\system\lib\libcameraservice.so
\system\lib\libcorecg.so
\system\lib\libcrypto.so 加密组件
\system\lib\libctest.so
\system\lib\libcutils.so
\system\lib\libdbus.so
\system\lib\libdl.so
\system\lib\libdrm1.so DRM解析库
\system\lib\libdrm1_jni.so
\system\lib\libdvm.so
\system\lib\libexif.so
\system\lib\libexpat.so
\system\lib\libFFTEm.so
\system\lib\libGLES_CM.so
\system\lib\libgps.so
\system\lib\libhardware.so
\system\lib\libhgl.so
\system\lib\libhtc_ril.so
\system\lib\libicudata.so
\system\lib\libicui18n.so
\system\lib\libicuuc.so
\system\lib\liblog.so
\system\lib\libm.so
\system\lib\libmedia.so
\system\lib\libmediaplayerservice.so
\system\lib\libmedia_jni.so
\system\lib\libnativehelper.so
\system\lib\libnetutils.so
\system\lib\libOmxCore.so
\system\lib\libOmxH264Dec.so
\system\lib\libpixelflinger.so
\system\lib\libpvasf.so
\system\lib\libpvasfreg.so
\system\lib\libpvauthor.so
\system\lib\libpvcommon.so
\system\lib\libpvdownload.so
\system\lib\libpvdownloadreg.so
\system\lib\libpvmp4.so
\system\lib\libpvmp4reg.so
\system\lib\libpvnet_support.so
\system\lib\libpvplayer.so
\system\lib\libpvrtsp.so
\system\lib\libpvrtspreg.so
\system\lib\libqcamera.so
\system\lib\libreference-ril.so
\system\lib\libril.so
\system\lib\librpc.so
\system\lib\libsgl.so
\system\lib\libsonivox.so
\system\lib\libsoundpool.so
\system\lib\libsqlite.so
\system\lib\libssl.so
\system\lib\libstdc++.so
\system\lib\libsurfaceflinger.so
\system\lib\libsystem_server.so
\system\lib\libthread_db.so
\system\lib\libUAPI_jni.so
\system\lib\libui.so
\system\lib\libutils.so
\system\lib\libvorbisidec.so
\system\lib\libwbxml.so
\system\lib\libwbxml_jni.so
\system\lib\libwebcore.so
\system\lib\libwpa_client.so
\system\lib\libxml2wbxml.so
\system\lib\libz.so
\system\lib\modules
\system\lib\modules\wlan.ko


android - sqlite command in adb

http://bradchow.wordpress.com/2009/02/26/sqlite-command-in-adb/

Connect to a database:

adb shell

 

# sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db

sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db

SQLite version 3.5.0

Enter “.help” for instructions

List tables:

.table

Print some of the information from the tables:

.header on

.mode column

sqlite> .header on

.header on

sqlite> .mode column

.mode column

sqlite> select * from phones;

select * from phones;

_id         person      type        number        number_key    label

———-  ———-  ———-  ————  ————  ———-

1           1           1           +15085551212  21215558051+

2           1           0           +17815551212  21215551871+

3           1           2           +16175551212  21215557161+

.help can tell you more useful command.


Friday, April 03, 2009

軟件測試術語-名詞解釋

“不懂測試行話”是不少軟件測試新人經常面臨的一個普遍問題。

“行有行規”,不懂行話危害極大。 各位可能對《林海雪原》中楊子榮與座山雕見面時講的“江湖黑話”印像比較深刻吧。 座山雕說“天王蓋地虎”,楊子榮對“寶塔鎮河妖”,如果楊子榮不懂行話,肯定性命難保,難以完成剷除土匪的重任。

軟件測試也有很多“行話”。 這裡的“行話”就是指各種測試術語。 對於軟件測試的新手而言,特別對於進行軟件國際化/本地化測試,由於測試文檔都是英語的,而且不少經常使用這些術語的縮寫形式,所以經常令初學者感到困惑。

不懂這些測試專業術語,當然不會“掉腦袋”,但是將會影響測試的正確理解,產生測試錯誤,影響測試質量和效率,也影響與測試團隊的交流。

現代軟件測試屬於比較新興的學科,測試的類型眾多,測試技術和理論還在不斷發展,更多的新名詞、新術語將會不斷出現。 即使對於多年測試經驗的“老江湖”,也需要不斷跟踪和學習。

如何跨越軟件測試術語這只“攔路虎”,是擺在測試人員面前的一大難題。

筆者根據以往的測試經驗和對測試知識的學習,結合軟件國際化/本地化軟件測試的實際需要,對最常見的軟件測試術語進行了歸納和整理,按照字母順序排序,進行了英文和中文的對照,並進行了簡短介紹。 希望這有助於測試新手快速理解術語,早日跨進軟件測試大門。


Acceptance testing(驗收測試) ,系統開發生命週期方法論的一個階段,這時相關的用戶和/或獨立測試人員根據測試計劃和結果對系統進行測試和接收。 它讓系統用戶決定是否接收系統。 它是一項確定產品是否能夠滿足合同或用戶所規定需求的測試。 這是管理性和防禦性控制。

Ad hoc testing (隨機測試),沒有書面測試用例、記錄期望結果、檢查列表、腳本或指令的測試。 主要是根據測試者的經驗對軟件進行功能和性能抽查。 隨機測試是根據測試說明書執行用例測試的重要補充手段,是保證測試覆蓋完整性的有效方式和過程。

Alpha testing (α測試),是由一個用戶在開發環境下進行的測試,也可以是公司內部的用戶在模擬實際操作環境下進行的受控測試,Alpha測試不能由程序員或測試員完成。

Automated Testing(自動化測試),使用自動化測試工具來進行測試,這類測試一般不需要人干預,通常在GUI、性能等測試中用得較多。

Beta testing(β測試),測試是軟件的多個用戶在一個或多個用戶的實際使用環境下進行的測試。 開發者通常不在測試現場,Beta測試不能由程序員或測試員完成。

Black box testing(黑盒測試) ,指測試人員不關心程序具體如何實現的一種測試方法。 根據軟件的規格對軟件進行各種輸入和觀察軟件的各種輸出結果來發現軟件的缺陷的測試,這類測試不考慮軟件內部的運作原理,因此軟件對用戶來說就像一個黑盒子。

Bug (錯誤),有時稱作defect(缺陷)或error(錯誤),軟件程序中存在的編程錯誤,可能會帶來不必要的副作用,軟件的功能和特性與設計規格說明書或用戶需求不一致的方面。 軟件缺陷表現特徵為:軟件未達到產品說明書標明的功能;軟件出現產品說明書指明不會出現的錯誤;軟件功能超出產品說明書指明的範圍;雖然產品說明書未指出但是軟件應達到的目標;軟件測試人員或用戶認為軟件難以理解,不易使用,運行速度緩慢等問題。

Bug report(錯誤報告) ,也稱為“Bug record(錯誤記錄)”,記錄發現的軟件錯誤信息的文檔,通常包括錯誤描述、復現步驟、抓取的錯誤圖像和註釋等。

Bug tracking system(錯誤跟踪系統,BTS) ,也稱為“Defect tracking system,DTS”,管理軟件測試缺陷的專用數據庫系統,可以高效率地完成軟件缺陷的報告、驗證、修改、查詢、統計、存儲等任務。 尤其適用於大型多語言軟件的測試管理。

Build(工作版本),軟件開發過程中用於內部測試的功能和性能等不完善的軟件版本。 工作版本既可以是系統的可操作版本,也可以是展示要在最終產品中提供的部分功能的部分系統。

Compatibility Testing(兼容性測試),也稱“Configuration testing(配置測試)”,測試軟件是否和系統的其它與之交互的元素之間兼容,如:瀏覽器、操作系統、硬件等。 驗證測試對像在不同的軟件和硬件配置中的運行情況。

Capture/Replay Tool (捕獲/回放工具),一種測試工具,能夠捕獲在測試過程中傳遞給軟件的輸入,並且能夠在以後的時間中,重複這個執行的過程。 這類工具一般在GUI測試中用的較多。

Crash(崩潰),計算機系統或組件突然並完全的喪失功能,例如軟件或系統突然退出或沒有任何反應(死機)。

Debug(調試),開發人員確定引起錯誤的根本原因和確定可能的修復措施的過程。 一般發生在子系統或單元模塊編碼完成時,或者根據測試錯誤報告指出錯誤以後,開發人員需要執行調試過程來解決已存在的錯誤。

Deployment(部署),也稱為shipment(發布),對內部IT系統而言,指它的第一個版本通過徹底的測試、形成產品、交付給付款客戶的階段。

Dynamic testing(動態測試) ,通過執行軟件的手段來測試軟件。

Exception(異常/例外) ,一個引起正常程序執行掛起的事件。

Functional testing (功能測試),也稱為behavioral testing(行為測試),根據產品特徵、操作描述和用戶方案,測試一個產品的特性和可操作行為以確定它們滿足設計需求。 本地化軟件的功能測試,用於驗證應用程序或網站對目標用戶能正確工作。 使用適當的平台、瀏覽器和測試腳本,以保證目標用戶的體驗將足夠好,就像應用程序是專門為該市場開發的一樣。

Garbage characters(亂碼字符) ,程序界面中顯示的無意義的字符,例如,程序對雙字節字符集的字符不支持時,這些字符不能正確顯示。

GB 18030 testing(GB 18030測試),軟件支持GB 18030字符集標準能力的測試,包括GB 18030字符的輸入、輸出、顯示、存儲的支持程度。

Installing testing(安裝測試),確保該軟件在正常情況和異常情況的不同條件下,例如,進行首次安裝、升級、完整的或自定義的安裝都能進行安裝。 異常情況包括磁盤空間不足、缺少目錄創建權限等。 核實軟件在安裝後可立即正常運行。安裝測試包括測試安裝代碼以及安裝手冊。 安裝手冊提供如何進行安裝,安裝代碼提供安裝一些程序能夠運行的基礎數據。

Integration testing(集成測試),被測試系統的所有組件都集成在一起,找出被測試系統組件之間關係和接口中的錯誤。 該測試一般在單元測試之後進行。

International testing(國際化測試) ,國際化測試的目的是測試軟件的國際化支持能力,發現軟件的國際化的潛在問題,保證軟件在世界不同區域中都能正常運行。 國際化測試使用每種可能的國際輸入類型,針對任何區域性或區域設置檢查產品的功能是否正常,軟件國際化測試的重點在於執行國際字符串的輸入/輸出功能。 國際化測試數據必須包含東亞語言、德語、複雜腳本字符和英語(可選)的混合字符。

Localizability testing(本地化能力測試),本地化能力是指不需要重新設計或修改代碼,將程序的用戶界面翻譯成任何目標語言的能力。 為了降低本地化能力測試的成本,提高測試效率,本地化能力側是通常在軟件的偽本地化版本上進行。 本地化能力測試中發現的典型錯誤包括:字符的硬編碼(即軟件中需要本地化的字符寫在了代碼內部),對需要本地化的字符長度設置了國定值,在軟件運行時以控件位置定位,圖標和位圖中包含了需要本地化的文本,軟件的用戶界面與文檔術語不一致等。

Load testing(負載測試),通過測試系統在資源超負荷情況下的表現,以發現設計上的錯誤或驗證系統的負載能力。 在這種測試中,將使測試對象承擔不同的工作量,以評測和評估測試對像在不同工作量條件下的性能行為,以及持續正常運行的能力。 負載測試的目標是確定並確保系統在超出最大預期工作量的情況下仍能正常運行。 此外,負載測試還要評估性能特徵,例如,響應時間、事務處理速率和其他與時間相關的方面。

Localization testing(本地化測試),本地化測試的對像是軟件的本地化版本。 本地化測試的目的是測試特定目標區域設置的軟件本地化質量。 本地化測試的環境是在本地化的操作系統上安裝本地化的軟件。 從測試方法上可以分為基本功能測試,安裝/卸載測試,當地區域的軟硬件兼容性測試。 測試的內容主要包括軟件本地化後的界面佈局和軟件翻譯的語言質量,包含軟件、文檔和聯機幫助等部分。

Performance testing(性能測試),評價一個產品或組件與性能需求是否符合的測試。 包括負載測試、強度測試、數據庫容量測試、基準測試等類型。

Pilot testing(引導測試),軟件開發中,驗證系統在真實硬件和客戶基礎上處理典型操作的能力。 在軟件外包測試中,引導測試通常是客戶檢查軟件測試公司測試能力的一種形式,只有通過了客戶特定的引導測試,軟件測試公司才能接受客戶真實軟件項目的軟件測試。

Portability testing(可移植性測試),測試瞄準於證明軟件可以被移植到指定的硬件或軟件平台上。 
Priority(優先權),從商業角度出發是指錯誤的重要性,尤其是從客戶和用戶的角度出發,是指錯誤對於系統的可行性和可接受性的影響。 與“Severity(嚴重性)”相對照。

Quality assurance(質量保證QA),採取的所有活動以保證一個開發組織交付的產品滿足性能需求和已確立的標準和過程。

Regression testing(回歸測試),在發生修改之後重新測試先前的測試以保證修改的正確性。 理論上,對軟件的任何新版本,都需要進行回歸測試,驗證以前發現和修復的錯誤是否在新軟件版本上再現。

Review(評審) ,在產品開發過程中,把產品提交給項目成員、用戶、管理者或其它相關人員評價或批准的過程。

Sanity testing(健全測試) ,軟件主要功能成分的簡單測試以保證它是否能進行基本的測試。 參考“Smoke testing(冒煙測試)”。

Screen shot(抓屏、截圖),軟件測試中,將軟件界面中的錯誤(窗口、菜單、對話框等)的全部或一部分,使用專用工具存儲成圖像文件,以便於後續處理。

Severity(嚴重性),錯誤對被測系統的影響程度,在終端用戶條件下發生的可能性,軟件錯誤妨礙系統使用的程度。與“Priority(優先權)”相對照。

Smoke testing(冒煙測試),冒煙測試的對像是每一個新編譯的需要正式測試的軟件版本,目的是確認軟件基本功能正常,可以進行後續的正式測試工作。 冒煙測試的執行者是版本編譯人員。 參考“Sanity testing(健全測試)”。

Software life cycle(軟件生命週期),開始於一個軟件產品的構思,結束於該產品不再被使用的這段期間。

Static testing(靜態測試),不通過執行來測試一個系統。 如代碼檢查,文檔檢查和評審等。

Structured query language(結構化查詢語句,SQL) ,在一個關係數據庫中查詢和處理數據的一種語言。

TBD(To be determined,待定),在測試文檔中標是一項進行中的尚未最終確定的工作。

Test(測試),執行軟件以驗證其滿足指定的需求並檢測錯誤的過程。 檢測已有條件之間的不同,並評價軟件項的特性軟件項的分析過程。 軟件工程過程的一個活動,它將軟件在預定的條件下運行以判斷軟件是否符合預期結果。

Test case(測試用例) ,為特定目標而開發的一組測試輸入、執行條件和預期結果,其目標可以是測試某個程序路徑或核實是否滿足某個特定的需求。

Testing coverage(測試覆蓋),指測試系統覆蓋被測試系統的程度,一項給定測試或一組測試對某個給定係統或構件的所有指定測試用例進行處理所達到的程度。

Testing environment(測試環境) ,進行測試的環境,包括測試平台、測試基礎設施、測試實驗室和其他設施。

Testing item(測試項),作為測試對象的工作版本。

Testing plan(測試計劃),描述了要進行的測試活動的範圍、方法、資源和進度的文檔。 它確定測試項、被測特性、測試任務、誰執行任務,並且任何風險都要衝突計劃。

Testing procedure(測試過程),指設置、執行給定測試用例並對測試結果進行評估的一系列詳細步驟。

Testing script(測試腳本),一般指的是一個特定測試的一系列指令,這些指令可以被自動化測試工具執行。

Testing suite(測試包) ,一組測試用裡的執行框架;一種組織測試用例的方法。 在測試包裡,測試用例可以組合起來創造出獨特的測試條件。

Unit testing(單元測試),指一段代碼的基本測試,其實際大小是未定的,通常是一個函數或子程序,一般由開發者執行。

User interface(用戶界面,UI),廣義是指使用戶可以和計算機進行交互的硬件和/或軟件。 狹義是指軟件中的可見外觀及其底層與用戶交互的部分(菜單、對話框、窗口和其它控件)。

User interface testing (用戶界面測試),指測試用戶界面的風格是否滿足客戶要求,文字是否正確,頁面是否美觀,文字,圖片組合是否完美,操作是否友好等等。 UI測試的目標是確保用戶界面會通過測試對象的功能來為用戶提供相應的訪問或瀏覽功能。 確保用戶界面符合公司或行業的標準。 包括用戶友好性、人性化、易操作性測試。

White box testing(白盒測試),根據軟件內部的工作原理分析來進行測試,基於代碼的測試,測試人員通過閱讀程序代碼或者通過使用開發工具中的單步調試來判斷軟件的質量,一般黑盒測試由項目經理在程序員開發中來實現。