2010年12月31日 星期五

imx51 make clean

build/core/envsetup.mk

root下的Makefile
include build/core/main.mk
會展開main.mk位於build/core

build/core/main.mk
內有clean

下make clean 就會呼叫到這裡


.PHONY: clean
dirs_to_clean := \
        $(PRODUCT_OUT) \
        $(TARGET_COMMON_OUT_ROOT) \
        $(HOST_OUT) \
        $(HOST_COMMON_OUT_ROOT)
clean:
        @for dir in $(dirs_to_clean) ; do \
            echo "Cleaning $$dir..."; \
            rm -rf $$dir; \
        done
        @echo "Clean."; \

所以要知道會刪除哪些資料就要知道這些參數的定義

        $(PRODUCT_OUT) 
        $(TARGET_COMMON_OUT_ROOT) 
        $(HOST_OUT) 
        $(HOST_COMMON_OUT_ROOT)

可以從envsetup.mk知道

以下是結果
TARGET_COMMON_OUT_ROOT = out/target/common
PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)  = out/target/product/imx51_bbg
HOST_OUT = out/host/linux-x86
HOST_COMMON_OUT_ROOT = out/host/common

怎麼知道envsetup.mk有跟main.mk有關系呢

main.mk會include config.mk
./main.mk:55:include $(BUILD_SYSTEM)/config.mk

config.mk會include envsetup.mk
./config.mk:122:include $(BUILD_SYSTEM)/envsetup.mk

而BUILD_SYSTEM就是build/core

透過Facebook分享

2010年12月30日 星期四

build e2fsprogs for mkfs under arm platform

download source : http://sourceforge.net/projects/e2fsprogs/

設定環境變數
執行arm-setupenv.sh
內容為

#!/bin/bash
export ARCH=arm
export CROSS_COMPILE=/home/nelsonchung/Develop/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
export PATH=/home/nelsonchung/Develop/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin:$PATH

follow

mkfs.ext4 for ARM (Android)

LDFLAGS=-static ./configure --host=arm-none-linux-gnueabi

make

可以build成功

查看一下版本 - 4.1.2
nelsonchung@ubuntu:~/Develop$ arm-none-linux-gnueabi-gcc -v
Reading specs from /home/nelsonchung/Develop/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2/specs
Target: arm-none-linux-gnueabi
Configured with: /usr/src/redhat/BUILD/cross-mlib/source/gcc-4.1.2/configure --target=arm-none-linux-gnueabi --host=i686-host_pc-linux-gnu --prefix=/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi --with-sysroot=/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/arm-none-linux-gnueabi/sysroot --enable-threads --enable-shared --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c,c++ --enable-__cxa_atexit --disable-nls
Thread model: posix
gcc version 4.1.2

可以在misc找到mke2fs

--
使用buildroot-2010.11產生出來的cross-compile

. arm-buildroot-setupenv.sh

內容為
#!/bin/bash
export ARCH=arm
export CROSS_COMPILE=/home/nelsonchung/Develop/buildroot-2010.11/output/staging/usr/bin/arm-linux-
export PATH=/home/nelsonchung/Develop/buildroot-2010.11/output/staging/usr/bin:$PATH

LDFLAGS=-static ./configure --host=arm-linux

make

產生以下error
CC llseek.c
llseek.c: In function '_llseek':
llseek.c:65: error: expected declaration specifiers or '...' before '_llseek'
llseek.c:65: error: expected declaration specifiers or '...' before 'fd'
llseek.c:65: error: expected declaration specifiers or '...' before 'offset_high'
llseek.c:66: error: expected declaration specifiers or '...' before 'offset_low'
llseek.c:66: error: expected declaration specifiers or '...' before 'result'
llseek.c:67: error: expected declaration specifiers or '...' before 'origin'
llseek.c:67: error: storage class specified for parameter '_syscall5'
llseek.c:71: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
llseek.c:91: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
llseek.c:138: error: old-style parameter declarations in prototyped function definition
llseek.c:62: error: parameter name omitted
llseek.c:62: error: parameter name omitted
llseek.c:63: error: parameter name omitted
llseek.c:63: error: parameter name omitted
llseek.c:63: error: parameter name omitted
llseek.c:114: error: expected '{' at end of input
make[2]: *** [llseek.o] Error 1
make[2]: Leaving directory `/home/nelsonchung/Develop/e2fsprogs-1.41.14/lib/ext2fs'
make[1]: *** [all-libs-recursive] Error 1
make[1]: Leaving directory `/home/nelsonchung/Develop/e2fsprogs-1.41.14'
make: *** [all] Error 2

查一下版本-4.3.5
nelsonchung@ubuntu:~/Develop/buildroot-2010.11/output/staging/usr/bin$ arm-linux-gcc -v
Using built-in specs.
Target: arm-unknown-linux-uclibcgnueabi
Configured with: /home/nelsonchung/Develop/buildroot-2010.11/output/toolchain/gcc-4.3.5/configure --prefix=/home/nelsonchung/Develop/buildroot-2010.11/output/staging/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-unknown-linux-uclibcgnueabi --enable-languages=c --with-sysroot=/home/nelsonchung/Develop/buildroot-2010.11/output/staging --with-build-time-tools=/home/nelsonchung/Develop/buildroot-2010.11/output/staging/usr/arm-unknown-linux-uclibcgnueabi/bin --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-libssp --disable-multilib --disable-tls --enable-shared --with-gmp=/home/nelsonchung/Develop/buildroot-2010.11/output/toolchain/gmp --with-mpfr=/home/nelsonchung/Develop/buildroot-2010.11/output/toolchain/mpfr --disable-nls --enable-threads --disable-decimal-float --with-float=soft --with-abi=aapcs-linux --with-arch=armv4t --with-tune=arm920t --disable-largefile --with-pkgversion='Buildroot 2010.11' --with-bugurl=http://bugs.buildroot.net/
Thread model: posix
gcc version 4.3.5 (Buildroot 2010.11)


修改位於
./lib/blkid/llseek.c
./lib/ext2fs/llseek.c

(改天寫完記得要出patch)

make

error message

make[2]: Entering directory `/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck'
LD e2fsck
../lib/libext2fs.a(tdb.o): In function `ext2fs_tdb_transaction_commit':
/home/nelsonchung/Develop/e2fsprogs-1.41.14/lib/ext2fs/tdb.c:2119: warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'
profile.o: In function `profile_create_node':
/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck/profile.c:1088: undefined reference to `__strdup'
/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck/profile.c:1094: undefined reference to `__strdup'
profile.o: In function `skip_over_nonblanks':
/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck/profile.c:639: undefined reference to `__ctype_b_loc'
profile.o: In function `skip_over_blanks':
/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck/profile.c:626: undefined reference to `__ctype_b_loc'
profile.o: In function `parse_line':
/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck/profile.c:681: undefined reference to `__ctype_b_loc'
profile.o: In function `strtoul':
/home/nelsonchung/Develop/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/sysroot/usr/include/stdlib.h:342: undefined reference to `__strtoul_internal'
profile.o: In function `strtol':
/home/nelsonchung/Develop/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/sysroot/usr/include/stdlib.h:336: undefined reference to `__strtol_internal'
profile.o: In function `get_dirlist':
/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck/profile.c:300: undefined reference to `__ctype_b_loc'
profile.o: In function `stat':
/home/nelsonchung/Develop/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../arm-none-linux-gnueabi/sysroot/usr/include/sys/stat.h:436: undefined reference to `__xstat'
collect2: ld returned 1 exit status
make[2]: *** [e2fsck] Error 1
make[2]: Leaving directory `/home/nelsonchung/Develop/e2fsprogs-1.41.14/e2fsck'
make[1]: *** [all-progs-recursive] Error 1
make[1]: Leaving directory `/home/nelsonchung/Develop/e2fsprogs-1.41.14'
make: *** [all] Error 2


透過Facebook分享

找尋含有A字串在B檔案的目錄路徑並顯示出來

  • 找尋當目錄下所有Android.mk含有BOARD_HAVE_BLUETOOTH字串


find . -type f -name "Android.mk" -print0 | xargs -0 grep "BOARD_HAVE_BLUETOOTH"


./system/netd/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./system/bluetooth/brcm_patchram_plus/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH_BCM),true)
./system/bluetooth/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./frameworks/base/libs/audioflinger/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./frameworks/base/libs/audioflinger/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./frameworks/base/libs/audioflinger/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./frameworks/base/core/jni/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./hardware/msm7k/libaudio-qsd8k/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./hardware/msm7k/libaudio-qsd8k/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./hardware/msm7k/libaudio/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./hardware/msm7k/libaudio/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./hardware/alsa_sound/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./hardware/alsa_sound/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./external/bluetooth/glib/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./external/bluetooth/hcidump/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./external/bluetooth/bluez/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH),true)
./external/bluetooth/bluez/common/Android.mk:ifeq ($(BOARD_HAVE_BLUETOOTH_BCM),true)
./external/bluetooth/bluez/common/Android.mk: -DBOARD_HAVE_BLUETOOTH_BCM


  • 找尋當目錄下所有Android.mk含有BOARD_HAVE_BLUETOOTH字串的目錄路徑



find . -type f -name "Android.mk" -print0 | xargs -0 grep "BOARD_HAVE_BLUETOOTH" | sed -e 's/\/[^/]*$//'


./system/netd
./system/bluetooth/brcm_patchram_plus
./system/bluetooth
./frameworks/base/libs/audioflinger
./frameworks/base/libs/audioflinger
./frameworks/base/libs/audioflinger
./frameworks/base/core/jni
./hardware/msm7k/libaudio-qsd8k
./hardware/msm7k/libaudio-qsd8k
./hardware/msm7k/libaudio
./hardware/msm7k/libaudio
./hardware/alsa_sound
./hardware/alsa_sound
./external/bluetooth/glib
./external/bluetooth/hcidump
./external/bluetooth/bluez
./external/bluetooth/bluez/common
./external/bluetooth/bluez/common


  • 找尋當目錄下所有Android.mk含有BOARD_HAVE_BLUETOOTH字串的目錄路徑



find . -type f -name "Android.mk" -print0 | xargs -0 grep "BOARD_HAVE_BLUETOOTH" | sed -e 's/\/[^/]*$//' | uniq


./system/netd
./system/bluetooth/brcm_patchram_plus
./system/bluetooth
./frameworks/base/libs/audioflinger
./frameworks/base/core/jni
./hardware/msm7k/libaudio-qsd8k
./hardware/msm7k/libaudio
./hardware/alsa_sound
./external/bluetooth/glib
./external/bluetooth/hcidump
./external/bluetooth/bluez
./external/bluetooth/bluez/common


透過Facebook分享

Gnu make: $< and $@的用法

Follow 

4.12.1 Syntax of Static Pattern Rules

我們可以簡化makefile的內容

一個makefile的內容如下

objects = main.o Eye.o Nose.o Ear.o Mouse.o Face.o

all: $(objects)
gcc $(objects) -o main

$(objects): %.o: %.c
gcc -c $< -o $@

clean:
rm main.o Eye.o Nose.o Ear.o Mouse.o Face.o main

藍色部份第一行中, %稱為stem
gnu make會替我們match出符合的.o檔的file name
然後交給gcc去作compile
$<: 能夠找出prerequisites的name
$@: 則能夠找出target的name

make之後你可以得到以下結果
gcc -c main.c -o main.o
gcc -c Eye.c -o Eye.o
gcc -c Nose.c -o Nose.o
gcc -c Ear.c -o Ear.o
gcc -c Mouse.c -o Mouse.o
gcc -c Face.c -o Face.o
gcc main.o Eye.o Nose.o Ear.o Mouse.o Face.o -o main


是使用git作source control
你也可以使用git log -p來查看差異


透過Facebook分享

2010年12月29日 星期三

刪除由git建出的branch

請使用git branch -D branchname

ex.
git branch
列出有三個分支A, B, C
假設你位於A要刪除C
git branch -D C

如果你位於A又要刪掉A呢
git branch -D A
這時候會出現error message
error: Cannot delete the branch 'C' which you are currently on.
所以你需要先切換到B
git checkout B
在刪除A
git branch -D A

透過Facebook分享

整合branch A上的改變到branch B by using git merge

man git-merge手冊上說明

有兩個branch:master and topic

想要把topic上3次的commit - A, B, C都commit到master上?該怎麼辦呢

原本狀況

                        A---B---C topic
                       /
               D---E---F---G master

想要的結果
                        A---B---C topic
                        /               \
               D---E---F---G---H master

1. 將所在的branch切換到master
git checkout master

2. 進行merge
git merge topic

就ok嚕


透過Facebook分享

The Introduction of Android GPS Interface from Zerget

架構
上層 <-> 底層
AP -> GpsStatus-> LocationManager->IGpsStatusListener

AP level透過Listener得知底層GPS的status

IGpsStatusListener透過Binder會跟底層作溝通 - 就是所謂的callback function實做方式

JNI定義與上層溝通的function並透過signal的方式通知

接下來底層的作法
就是要負責開gps com port, parse gps nmea並且設定到gps.h所定義的data structure. 
ex. GpsSvStatus or GpsStauts

所以你是系統開發商
你需要實做底層
也就是上述藍色的部份

透過Facebook分享

Android GPS porting HAL code - Fix GPSStatus and GPSSvStatus issue. 可以看到衛星訊號強度與收訊狀況

AP透過GpsStatus.Listener()監聽底層的資訊
接到GpsStatus.GPS_EVENT_FIRST_FIX後
透過getTimeToFirstFix function抓取資訊
這個資訊會透過LocationManager.getGpsStauts

GPS_EVENT_FIRST_FIX是LocationManager.java會送出,  在OnFirstFix實做

GpsLocationProvider.java告知reportLocation會負責更新getTimeToFirstFix的參數內容
reportLocation: called from native code to update our position.

在jni/android_location_GpsLocationProvider.cpp找到會將init_native 對應到reportLocation

這邊說
上層AP呼叫addGpsStatusListener就會call onSvStatusChanged (會更新mGpsStatus)

看到jni/android_location_GpsLocationProvider.cpp
GpsCallbacks sGpsCallbacks = {
    location_callback,
    status_callback,
    sv_status_callback,
    nmea_callback
};
實際上glgps.cpp只有implement location_callback
其他都沒有implment.
需要自行implement 這兩個function



status_callback,
sv_status_callback

--


在GPS中定義

/** Represents SV information. */
typedef struct {
    /** Pseudo-random number for the SV. */
    int     prn;
    /** Signal to noise ratio. */
    float   snr;
    /** Elevation of SV in degrees. */
    float   elevation;
    /** Azimuth of SV in degrees. */
    float   azimuth;
} GpsSvInfo;


/** Represents SV status. */
typedef struct {
        /** Number of SVs currently visible. */
        int         num_svs;


        /** Contains an array of SV information. */
        GpsSvInfo   sv_list[GPS_MAX_SVS];


        /** Represents a bit mask indicating which SVs
         * have ephemeris data.
         */
        uint32_t    ephemeris_mask;


        /** Represents a bit mask indicating which SVs
         * have almanac data.
         */
        uint32_t    almanac_mask;


        /**
         * Represents a bit mask indicating which SVs
         * were used for computing the most recent position fix.
         */
        uint32_t    used_in_fix_mask;
} GpsSvStatus;

需要填寫GpsSvStatus

最後透過sv_status_callback回傳資料給android gps interface


接下來要解釋一下上述結構的定義
以及跟GPGSA and GPGSV的關係


在GpsSvStatus中
num_svs:實收的衛星數目. 這個會影響android gps interface要收集多少資料
used_in_fix_mask:填寫目前fix的衛星id. 此部份可以經由GPGSA的第3到14個位置中取得.
ephemeris_mask and almanac_mask: 沒有特別設定
據Tommy and Richard的說法, 這個是衛星所發出的訊號, 會經由gps firmware解析之後output出nmea data.
會定義這兩個, 我猜測android給予一般系統廠或是gps module廠有不同的實做內容而做的開關.


sv_list是一個GpsSvInfo的structure.
有下列四個資訊
prn:衛星id編號
snr:衛星訊號
elevation:仰角
azimuth:方位角
以上資訊可以透過GPGSV取得




參考文章有說明 nmea format - GPGSA and GPGSV

GPS nmea - GPGSA and GPGSV


填完GpsSvStatus之後

你需要根據目前GPS的狀態設定GpsStatus

gps.h內定義
/** GPS status event values. */
typedef uint16_t GpsStatusValue;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
/** GPS status unknown. */
#define GPS_STATUS_NONE             0
/** GPS has begun navigating. */
#define     1
/** GPS has stopped navigating. */
#define GPS_STATUS_SESSION_END      2
/** GPS has powered on but is not navigating. */
#define GPS_STATUS_ENGINE_ON        3
/** GPS is powered off. */
#define GPS_STATUS_ENGINE_OFF       4

所以我在成功開com port後 將status設成GPS_STATUS_ENGINE_ON, 透過callback回傳
讀取到gps nmea後送出GPS_STATUS_SESSION_BEGIN. 

最後感謝Zerget分享的資訊


透過Facebook分享

vimdiff 比較檔案之間的差異

使用vimdiff 可以比較兩到四個檔案之間的差異

vimdiff file1 file2 file3 file4
依照這種方式可以比對到四個檔案之多

預設使用垂直的方式比對
如果有些字會被遮到
可以使用-o更換成水平方式

vimdiff -o file1 file2

default顏色比對效果不明顯
可以參考

Change vimdiff color

修改比對顏色


比對時需要切換到不同的檔案
可以使用
ctrl+w w
ctrl先按住 w按兩次


Reference:
http://man.chinaunix.net/newsoft/vi/doc/diff.html

透過Facebook分享

2010年12月27日 星期一

GPS nmea - GPGSA and GPGSV

$GPGSA
第三到第十四負責紀錄已經鎖定的衛星訊號ID.
用來畫綠色(已鎖定)及藍色(未鎖定)的衛星.

$GPGSV


$GPGSV,3,1,11,03,03,111,00,04,15,270,00,06,01,010,00,13,06,292,00*74
$GPGSV,3,2,11,14,25,170,00,16,57,208,39,18,67,296,40,19,40,246,00*74
$GPGSV,3,3,11,22,42,067,42,24,14,311,43,27,05,244,00,,,,*4D

ex. 傳送的nmea - GPGSV總共有3
之後代表現在是第幾個nmea,
接下來分別為
衛星ID, 高度, 方位, 強度 (第一個總共有四顆衛星, 編號為03, 04, 06, and 13
(第二個總共有四顆衛星, 編號為14, 16, 18, and19)
(第三個總共有三顆衛星, 編號為22, 24, and 27)
*之後接的是checksum

Reference:
http://aprs.gids.nl/nmea/

透過Facebook分享

How to get the source code of alacarte

Ubuntu Gnome
可以用"主選單"這套工具輕易的加入或移除應用程式

ex
新安裝eclipse
想要在"軟體開發"的區域看到就可以使用"主選單"做到

主選單的英文叫做alacarte

如果可以抓到source code不就知道怎麼做到上述的事情

使用 sudo apt-get source alacarte

nelsonchung@ubuntu:~/Develop$ sudo apt-get source alacarte
[sudo] password for nelsonchung:
正在讀取套件清單... 完成
正在重建相依關係        
正在讀取狀態資料... 完成
請注意:'alacarte' 套件是在下列位置被 'Svn' 版本控制系統所維護的:
svn://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/alacarte/
需要下載 240kB 的原始套件檔。
下載:1 http://tw.archive.ubuntu.com/ubuntu/ lucid/main alacarte 0.13.1-0ubuntu1 (dsc) [1,676B]
下載:2 http://tw.archive.ubuntu.com/ubuntu/ lucid/main alacarte 0.13.1-0ubuntu1 (tar) [230kB]
下載:3 http://tw.archive.ubuntu.com/ubuntu/ lucid/main alacarte 0.13.1-0ubuntu1 (diff) [7,830B]
取得 240kB 用了 2s (98.3kB/s)
gpgv: 由 2010年03月29日 (週一) 17時36分14秒 CST 建立的簽章, 使用 DSA 金鑰 ID E4AC208E
gpgv: 無法檢查簽章: 找不到公鑰
dpkg-source: warning: failed to verify signature on ./alacarte_0.13.1-0ubuntu1.dsc
dpkg-source: info: extracting alacarte in alacarte-0.13.1
dpkg-source: info: unpacking alacarte_0.13.1.orig.tar.gz
dpkg-source: info: applying alacarte_0.13.1-0ubuntu1.diff.gz

就可以抓到source嚕

Reference:
http://ubuntuforums.org/showthread.php?t=361962


透過Facebook分享

SL410 安裝Ubuntu 10.04 - 運行時 畫面會有閃動

原本安裝windows xp不會
安裝Ubuntu 10.04卻會有類似更新畫面的閃動
頻率挺頻繁的十幾分鐘一次 (估計值)

後來把電池移除
只用Ac adapter供電
就很少發生
一天一次(估計值)

透過Facebook分享

Android GPS porting HAL code - try to fix GPSStatus.nmea issue

AP declared nmeaListener = new GpsStatus.NmeaListener() to read the information of callback from JNI( Android GPS Interface Level, or called HAL)

HAL need to follow gps.h to implement callback function - gps_nmea_callback

You can follow this information from gps.h

/** Callback for reporting NMEA sentences. */
typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);

/** GPS callback structure. */
typedef struct {
        gps_location_callback location_cb;
        gps_status_callback status_cb;
        gps_sv_status_callback sv_status_cb;
        gps_nmea_callback nmea_cb;
} GpsCallbacks;

First one is timestamp.
Second on is nmea that you open gps com port and read that information.
Third is the length of nmea.

mm
and 
make snod
generate new system.img

Run GPSDemo application then I can see the nmea on GPSDemo.

I post the information on android group developers.
http://groups.google.com/group/android-developers/browse_thread/thread/3bb4dd9070451df2?pli=1

透過Facebook分享

Gnu make - implicit rule 概念

預設你在makefile內不編輯rule的話
gnu make會根據你所定義的target and prerequisites作自動編輯

source code download 

以此範例說明
解壓縮完
下make

nelsonchung@nelsonchung-aspireone:~/ebooks/gnumake/DoTest$ make
gcc -c main.c
gcc -c Eye.c
gcc -c Nose.c
gcc -c Ear.c
gcc -c Mouse.c
cc    -c -o Face.o Face.c
gcc main.o Eye.o Nose.o Ear.o Mouse.o -o main
nelsonchung@nelsonchung-aspireone:~/ebooks/gnumake/DoTest$

藍色部份


因為在makefile裡面沒有特地去寫rule

nelsonchung@nelsonchung-aspireone:~/ebooks/gnumake/DoTest$ cat makefile
all: main.o Eye.o Nose.o Ear.o Mouse.o Face.o
gcc main.o Eye.o Nose.o Ear.o Mouse.o -o main

main.o: main.c
gcc -c main.c
Eye.o: Eye.h
gcc -c Eye.c
Nose.o: Nose.h
gcc -c Nose.c
Ear.o: Ear.h
gcc -c Ear.c
Mouse.o: Mouse.h
gcc -c Mouse.c
Face.o: Face.c

clean:
rm main.o Eye.o Nose.o Ear.o Mouse.o Face.o main

所以gnu make會根據你現在要編譯的是.c, .cpp, .p or other files去啟動相對應的compiler


Reference:
Gnu make 文件第十章
10 Using Implicit Rules


透過Facebook分享

2010年12月24日 星期五

Android GPS porting HAL code

http://kb.cnblogs.com/a/1682913/
and
http://source.android.com/porting/gps.html
說要根據gps.h去implement gps driver (libgps.so)


http://blog.chinaunix.net/u3/118873/showart_2339574.html
有解釋GPS底層檔案分佈, JNI以及Android提供service的部份

http://www.douban.com/note/80170485/
提供Application開啟GPS呼叫到底層回覆的過程

有人回應說需要implement HAL
http://groups.google.com/group/android-developers/browse_thread/thread/3bb4dd9070451df2#

http://blog.chinaunix.net/u1/56680/showart_2143187.html
android gps 需要實做HAL(hardware abstruct layer)

該怎麼作呢

參考glgps.c
用mm來buidl libhardware_legacy.so
所以要想辦法讓mm可以build出libhardware_legacy.so


Modify
/device/fsl/imx51_bbg/BoardConfig.mk

add BOARD_GPS_LIBRARIES := libgps

switch  /hardware/libhardware_legacy

choosecombo設定一下平台


Build for the simulator or the device?
     1. Device
     2. Simulator

Which would you like? [1]


Build type choices are:
     1. release
     2. debug

Which would you like? [1]


Which product would you like? [imx51_bbg]


Variant choices are:
     1. user
     2. userdebug
     3. eng
Which would you like? [eng]

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2
TARGET_PRODUCT=imx51_bbg
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRF85B
============================================

build:

elsonchung@gps1004:~/myandroid9.1/hardware/libhardware_legacy$ mm 
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2
TARGET_PRODUCT=imx51_bbg
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRF85B
============================================
No private recovery resources for TARGET_DEVICE imx51_bbg
make: Entering directory `/home/nelsonchung/myandroid9.1'
Copy: out/target/product/imx51_bbg/root/init.rc
target thumb C: libhardware_legacy <= hardware/libhardware_legacy/gps/glgps.c
target SharedLib: libhardware_legacy (out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/LINKED/libhardware_legacy.so)
target Prelink: libhardware_legacy (out/target/product/imx51_bbg/symbols/system/lib/libhardware_legacy.so)
libelfcopy: Warning: Range lists in .debug_info section aren't in ascending order!
libelfcopy: Warning: Range lists in .debug_ranges section start at 0x5a8
target Strip: libhardware_legacy (out/target/product/imx51_bbg/obj/lib/libhardware_legacy.so)
Install: out/target/product/imx51_bbg/system/lib/libhardware_legacy.so
make: Leaving directory `/home/nelsonchung/myandroid9.1'

如果用mm showcommands
可以看到
glgps.c 編譯成glgps.o 並放到out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/gps/

message:
out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/gps/glgps.o hardware/libhardware_legacy/gps/glgps.c

最後編譯好的libhardware_legacy.so就會放到以下路徑
out/target/product/imx51_bbg/system/lib/libhardware_legacy.so

croot
make snod
去產生system.img

這之間為了讓Android能夠正常起來
follow http://nelsonchunglife.blogspot.com/2010/12/disable-original-audio-driver-and.html
重新編譯了system.img

使用Denny寫好的GPSDemo
利用adb install X.apk裝到機器上

操作Panel
Settings-->Applications-->Manage applications-->Downloaded
就會看到剛剛install的程式
點擊執行
能夠看到在glgps.c裡面加上的message

D/gps_BRCM( 2106): *****20101216: gps_init *****
AP還沒看到gps相關訊息
底層有些訊息值得參考
E/ThrottleService( 2102): Could not open GPS configuration file /etc/gps.conf

W/GpsLocationProvider( 2102): Could not open GPS configuration file /etc/gps.conf

D/gps_BRCM( 2102): *****20101216: gps_init *****
D/gps_BRCM( 2102): gps state initialized
D/gps_BRCM( 2102): gps thread running

Could not open GPS configuration file /etc/gps.conf的訊息只是warning not error.
follow this information.
http://groups.google.com/group/android-framework/browse_thread/thread/9c2a9b8b7c7fb394

發現卡住epoll_wait

恢復預設值 /cache/gpspipe
執行GPSDemo 出現
E/GpsLocationProvider( 2107): native_start failed in startNavigating()
設成 /dev/ttymxc1
看一下會不會
E/GpsLocationProvider( 2107): native_start failed in startNavigating()
一樣

此錯誤訊息發生在GpsLocationProvider.java的startNavigating()

因為將gps mode設成 GPS_POSITION_MODE_MS_BASED
造成HAL(glgps.c)判斷gps mode非 GPS_POSITION_MODE_STANDALONE回傳false
而出現的錯誤訊息

誰應該設定gps mode為 GPS_POSITION_MODE_STANDALONE呢?

是根據這行判斷而來的

           if (Settings.Secure.getInt(mContext.getContentResolver(),
                    Settings.Secure.ASSISTED_GPS_ENABLED, 1) != 0) {
                positionMode = GPS_POSITION_MODE_MS_BASED;
            } else {
                positionMode = GPS_POSITION_MODE_STANDALONE;
            }

Denny 說 ASSISTED_GPS_ENABLED 就是所謂的AGPS.
Android 2.2版已經建議移除

上面code的意思是 如果ASSISTEND_GPS_ENABLED沒有定義
會回傳第三個參數值(1)
1 != 0
所以設定成GPS_POSITION_MODE_MS_BASED

參考
http://developer.android.com/reference/android/provider/Settings.Secure.html#getInt(android.content.ContentResolver, java.lang.String, int)

compare /hardware/qcom/gps/loc_api/libloc_api/loc_eng.cpp with /hardware/libhardware_legacy/gps/glgps.c

loc_eng_set_position_mode and gps_set_position_mode


            if (!native_start(positionMode, false, 1)) {
                mStarted = false;
                Log.e(TAG, "native_start failed in startNavigating()");
                return;
            }



nelsonchung@gps1004:~/myandroid9.1$ cgrep native_start
./frameworks/base/core/jni/android_location_GpsLocationProvider.cpp:519:    {"native_start", "(IZI)Z", (void*)android_location_GpsLocationProvider_start},

native_start會對應到 android_location_GpsLocationProvider_start

--

建立軟連結的方式
modify the content on /device/fsl/imx5x/init.rc
symlink /dev/ttymxc1 /pipe
在將glgps.c GPS_PIPE 由原先的 /cache/gpspipe 改成 /gpspipe
就不會發生open com port fail的問題
猜測是權限的問題
叫glgps.c檔案起來的process權限可能不足
--

之後open後回傳fd去作註冊的動作epoll_register
就不會一直卡在epoll_wait

epoll是linux為了改善poll的機制
透過發送event的方式改善performance

註冊完之後如果該com port有送出訊息的話
linux就會送出event出來
就可以繼續往後執行

之後用read方式讀取gps nmea
透過nmea_reader_addc丟給Android structure - NmeaReader
之後透過nmea_reader_set_callback回應給Android gps interface.

這樣子之後用Denny GPSDemo程式可以讀到經緯度的資料

另外
GPS status and nmea還沒辦法完整呈現

透過Facebook分享

解壓縮rar under Ubuntu

在Ubuntu下解壓縮rar

使用壓縮檔管理員
卻發現無法開啟
需要安裝rar 套件


nelsonchung@ubuntu:~/Tools/Src$ sudo apt-get install rar
[sudo] password for nelsonchung:
正在讀取套件清單... 完成
正在重建相依關係        
正在讀取狀態資料... 完成
建議套件:
  unrar
下列【新】套件將會被安裝:
  rar
升級 0 個,新安裝 1 個,移除 0 個,有 26 個未被升級。
需要下載 556kB 的套件檔。
此操作完成之後,會多佔用 1,192kB 的磁碟空間。
下載:1 http://tw.archive.ubuntu.com/ubuntu/ lucid/multiverse rar 1:3.9.b2-1 [556kB]
取得 556kB 用了 3s (162kB/s)
選取了原先未被選取的套件 rar。
(正在讀取資料庫 ... 系統目前共安裝了 168478 個檔案和目錄。)
正在解開 rar (從 .../rar_1%3a3.9.b2-1_i386.deb)...
正在進行 man-db 的觸發程式 ...
正在設定 rar (1:3.9.b2-1) ...

安裝完

找到該檔案
按下滑鼠右鍵
選擇"在此解壓縮"
就可以嚕

or 
rar x A.rar

如果不想產生一個folder (the directory name is depended on your file name)
而是直接解壓縮檔案出來
可以使用
rar e A.rar

透過Facebook分享

2010年12月23日 星期四

run shell script when system init

需要修改init.rc

service ServiceName Pathshell Pathshellscript
    oneshot

ServiceName: 填寫service名稱
Pathshell:  sh的路徑
Pathshellscript:  shellscript的路徑

ex.
執行lnset.sh

service lnset /system/bin/sh /system/etc/lnset.sh
    oneshot

cat lnset.sh
ln -s /dev/ttymxc1 /pipecfromsh
ln -s /dev/ttymxc1 /cache/pipecfromsh

透過Facebook分享

2010年12月22日 星期三

mkfifo - 實現GPS virtual com port的概念

開啟終端機A
mkdir temp
cd temp

mkfifo pipe1
mkfifo pipe2

ls

prw-r--r--  1 nelsonchung nelsonchung        0 2010-12-22 11:21 pipe1|
prw-r--r--  1 nelsonchung nelsonchung        0 2010-12-22 11:21 pipe2|

開啟終端機B
nelsonchung@ubuntu:~$ echo "This is test mkfifo from nelson 1" > ~/temp/pipe1 &
[1] 2914
nelsonchung@ubuntu:~$ echo "This is test mkfifo from nelson 2" > ~/temp/pipe2 &
[2] 2915

回到終端機A
nelsonchung@ubuntu:~/temp$ cat pipe1
This is test mkfifo from nelson 1
nelsonchung@ubuntu:~/temp$ cat pipe2
This is test mkfifo from nelson 2

所以可以把同一個來源
同時導向不同的pipe

可以實現GPS virtual com port的概念



透過Facebook分享

Acer aspire one 風扇噪音問題解決 under Ubuntu

  • 安裝dmidecode

sudo apt-get install dmidecode





  • 解壓縮tools

tar zxvf AcerFanTool.tar.gz


  • 修改權限

chmod 755 acerfand

  • 複製到系統/usr/local/bin

sudo cp acerfand acer_ec.pl /usr/local/bin


  • 執行

sudo acerfand

馬上沒聲音

Reference:
http://ithelp.ithome.com.tw/question/10012052d
https://help.ubuntu.com/community/AspireOne

透過Facebook分享

2010年12月21日 星期二

3.7 How make Reads a Makefile

GNU make does its work in two distinct phases. During the first phase it reads all the makefiles, included makefiles, etc. and internalizes all the variables
   and their values, implicit and explicit rules, and constructs a dependency graph of all the targets and their prerequisites. During the second phase, make
   uses these internal structures to determine what targets will need to be rebuilt and to invoke the rules necessary to do so.

原來make在做事情的時候會有兩個階段
1. 先把所有makefile讀入, include相關makefile, 載入所有相關變數
最後建立一個 相關連的dependency

2. 根據makefile條件來決定哪些target需要被更新

Reference


透過Facebook分享

修改sl410 trackpoint 小紅點的靈敏度 under 10.04

Follow在ubuntu 10.4中調整trackpoint的sensitivity作設定


發現my系統的speed and sensitivity跟作者的不同

nelsonchung@ubuntu:/sys/devices/platform/i8042$ find . -type f -name speed
./serio4/serio5/speed
nelsonchung@ubuntu:/sys/devices/platform/i8042$ find . -type f -name sensitivity
./serio4/serio5/sensitivity

以下是我的修改內容
將以下內容修改到/etc/udev/rules.d/10-trackpoint.rules

SUBSYSTEM=="serio", DRIVERS=="psmouse"

WAIT_FOR="/sys/devices/platform/i8042/serio4/serio5/speed", ATTR{speed}="120"
WAIT_FOR="/sys/devices/platform/i8042/serio4/serio5/sensitivity", ATTR{sensitivity}="245"


ps:
http://zh.wikipedia.org/zh/Udev


透過Facebook分享

如何得知修改某個檔案會被放到root or system folder

使用showcommands

這裡修改了/system/core/init/devices

showcommands告訴你

會被編譯成init檔案
然後安裝到root下

nelsonchung@gps1004:~/myandroid9.1/system/core/init$ mm showcommands
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2
TARGET_PRODUCT=imx51_bbg
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRF85B
============================================
No private recovery resources for TARGET_DEVICE imx51_bbg
make: Entering directory `/home/nelsonchung/myandroid9.1'
target thumb C: init <= system/core/init/devices.c
prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc  -I system/core/init   -I out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates   -I system/core/include   -I hardware/libhardware/include   -I hardware/libhardware_legacy/include   -I hardware/ril/include   -I dalvik/libnativehelper/include   -I frameworks/base/include   -I frameworks/base/opengl/include   -I external/skia/include   -I out/target/product/imx51_bbg/obj/include   -I bionic/libc/arch-arm/include   -I bionic/libc/include   -I bionic/libstdc++/include   -I bionic/libc/kernel/common   -I bionic/libc/kernel/arch-arm   -I bionic/libm/include   -I bionic/libm/include/arch/arm   -I bionic/libthread_db/include  -c  -fno-exceptions -Wno-multichar -msoft-float -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -march=armv7-a -mfloat-abi=softfp -mfpu=neon -include system/core/include/arch/linux-arm/AndroidConfig.h -I system/core/include/arch/linux-arm/ -mthumb-interwork -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -DNDEBUG -g -Wstrict-aliasing=2 -finline-functions -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -DNDEBUG -UDEBUG -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64       -MD -o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/devices.o system/core/init/devices.c
target StaticExecutable: init (out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/LINKED/init)
prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-g++ -nostdlib -Bstatic -Wl,-T,build/core/armelf.x -Wl,--gc-sections -o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/LINKED/init -Lout/target/product/imx51_bbg/obj/lib out/target/product/imx51_bbg/obj/lib/crtbegin_static.o   -Wl,--no-undefined  -Wl,--fix-cortex-a8         out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/builtins.o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/init.o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/devices.o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/property_service.o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/util.o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/parser.o out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/logo.o      out/target/product/imx51_bbg/obj/STATIC_LIBRARIES/liblog_intermediates/liblog.a out/target/product/imx51_bbg/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a out/target/product/imx51_bbg/obj/STATIC_LIBRARIES/libc_intermediates/libc.a  /home/nelsonchung/myandroid9.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a out/target/product/imx51_bbg/obj/lib/crtend_android.o
target Non-prelinked: init (out/target/product/imx51_bbg/symbols/init)
out/host/linux-x86/bin/acp -fpt out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/LINKED/init out/target/product/imx51_bbg/symbols/init
target Strip: init (out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/init)
out/host/linux-x86/bin/soslim --strip --shady --quiet out/target/product/imx51_bbg/symbols/init --outfile out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/init
Install: out/target/product/imx51_bbg/root/init
out/host/linux-x86/bin/acp -fpt out/target/product/imx51_bbg/obj/EXECUTABLES/init_intermediates/init out/target/product/imx51_bbg/root/init
Copy: out/target/product/imx51_bbg/root/init.rc
out/host/linux-x86/bin/acp -fpt device/fsl/imx5x/init.rc out/target/product/imx51_bbg/root/init.rc
make: Leaving directory `/home/nelsonchung/myandroid9.1'


透過Facebook分享

找出最近修改過哪些檔案

Linux下你可以使用find

找尋當目錄下, 60分鐘內修改過的檔案
ex.
find . -mmin -60

透過Facebook分享

屬於我們家的第一顆耶誕樹 - 2010



屬於我們家的第一顆耶誕樹
有巧禎的心思佈置在裡面
也有她的歌聲在裡面

透過Facebook分享

Pair and unpair bt phone on android

點選Setting
 點選 Wireless &networks
 點 Bluetooth settings
 點 Scan for devices
然後選擇你要連線的裝置
 填入input pin code
點輸入框
 填入數字 (方便手機輸入)

ex.
0000
點Done
 點OK
 此時手機端需要輸入0000
進行pair

接下來進行unpair
長按前bt連線裝置

點選Unpair
 就成功嚕

Reference:

透過Facebook分享

擷取android螢幕資訊

可以使用android所提供的ddms工具
Linux下在/android-sdk-linux_86/tools下

cd /android-sdk-linux_86_tools
. ddms

開啟之後
Device->Screen capture



參考網頁有說明需要解鎖

有Application可以直接放到device上的嗎?
Reference:
http://www.sogi.com.tw/newforum/article_list.aspx?Topic_id=6081894

透過Facebook分享

2010年12月20日 星期一

計算某目錄大小 - du

du -s 列出該目錄總占大小 以KB為單位

du -h 列出該目錄所有子目錄所占大小 (--human-readable)

Reference:
http://www.weithenn.org/cgi-bin/wiki.pl?du-%E8%A8%88%E7%AE%97%E6%AA%94%E6%A1%88%E3%80%81%E8%B3%87%E6%96%99%E5%A4%BE%E5%A4%A7%E5%B0%8F
and
man du

透過Facebook分享
nelsonchung@gps1004:~/myandroid9.1$ du -sh kernel_imx_usbh3/
1.9G kernel_imx_usbh3/
nelsonchung@gps1004:~/myandroid9.1$ find kernel_imx_usbh3/ -type f -name "*.o" -print0 | xargs -0 rm
nelsonchung@gps1004:~/myandroid9.1$ du -sh kernel_imx_usbh3/
1.8G kernel_imx_usbh3/
nelsonchung@gps1004:~/myandroid9.1$ find kernel_imx_usbh3/ -type d -name "\.git" -print0 | xargs -0 rm -rf
nelsonchung@gps1004:~/myandroid9.1$ du -sh kernel_imx_usbh3/
1.4G kernel_imx_usbh3/

刪掉*.o 少100MB
刪掉.git 少400MB
刪掉一些怪怪的folder  (原來是我使用kscope軟體做的備份檔)
myandroid9.1
myandroid9.1-kernel_imx

剩526MB

nelsonchung@gps1004:~/myandroid9.1$ du -sh kernel_imx_usbh3
526M kernel_imx_usbh3

壓縮一下

剩一百多MB
nelsonchung@gps1004:~/myandroid9.1$ ls -al kernel_imx_usbh3.tar.gz 
-rw-r--r-- 1 nelsonchung nelsonchung 114827571 2010-12-20 15:31 kernel_imx_usbh3.tar.gz


透過Facebook分享

建立跨目錄的連結

follow http://nelsonchunglife.blogspot.com/2010/12/blog-post_16.html
卻發現建立跨目錄的連結會出現以下error

太多層級的符號連結檔
or
沒有此一檔案或目錄

根據你建立目錄的位置而定

Solution
使用絕對路徑
ln -s BBB aaa

BBB的部份請使用絕對路徑

這樣子產生的aaa就能夠任意的放置到其他目錄下也可以透過aaa切換到BBB去

ex.

ln -s /media/BE60E19860E15823/Ubuntu/myandroid9.1/ ~/myandroid9.1

透過Facebook分享

Install VirtualBox under Ubuntu lucid 10.04

官方網站

VirtualBox 3.2.12 for Linux hosts


Ubuntu 10.04 LTS ("Lucid Lynx") i386 | AMD64


選擇i386


我直接使用套件安裝軟體安裝




透過Facebook分享

2010年12月19日 星期日

Ubuntu系統支援4G以上的ram - PAE(physical address extension)

請安裝以下套件
sudo apt-get install linux-headers-server linux-image-server linux-server


可以使用free -m看memory

升級過程

nelsonchung@ubuntu:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          2863       2179        684          0        757        967
-/+ buffers/cache:        455       2408
Swap:          254          0        254
nelsonchung@ubuntu:~$ sudo apt-get update
[sudo] password for nelsonchung:
下載:1 http://dl.google.com stable Release.gpg [197B]
略過 http://dl.google.com/linux/chrome/deb/ stable/main Translation-zh_TW    
已有 http://tw.archive.ubuntu.com lucid Release.gpg                          
下載:2 http://tw.archive.ubuntu.com/ubuntu/ lucid/main Translation-zh_TW [56.4kB]
已有 http://security.ubuntu.com lucid-security Release.gpg                  
略過 http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-zh_TW
已有 http://archive.canonical.com lucid Release.gpg                          
略過 http://archive.canonical.com/ lucid/partner Translation-zh_TW          
已有 http://ppa.launchpad.net lucid Release.gpg                              
略過 http://ppa.launchpad.net/globalmenu-team/ppa/ubuntu/ lucid/main Translation-zh_TW
已有 http://ppa.launchpad.net lucid Release.gpg                            
略過 http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-zh_TW
略過 http://security.ubuntu.com/ubuntu/ lucid-security/universe Translation-zh_TW
略過 http://security.ubuntu.com/ubuntu/ lucid-security/multiverse Translation-zh_TW
已有 http://security.ubuntu.com lucid-security Release                      
已有 http://archive.canonical.com lucid Release                            
略過 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/ lucid/main Translation-zh_TW
已有 http://ppa.launchpad.net lucid Release                        
下載:3 http://dl.google.com stable Release [1,347B]                
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-zh_TW
已有 http://ppa.launchpad.net lucid Release                                  
已有 http://security.ubuntu.com lucid-security/main Packages                
已有 http://archive.canonical.com lucid/partner Packages                    
下載:4 http://tw.archive.ubuntu.com/ubuntu/ lucid/universe Translation-zh_TW [29.7kB]
已有 http://ppa.launchpad.net lucid/main Packages                            
已有 http://security.ubuntu.com lucid-security/restricted Packages    
已有 http://security.ubuntu.com lucid-security/main Sources          
已有 http://security.ubuntu.com lucid-security/restricted Sources    
已有 http://security.ubuntu.com lucid-security/universe Packages      
已有 http://security.ubuntu.com lucid-security/universe Sources      
下載:5 http://dl.google.com stable/main Packages [1,076B]            
已有 http://ppa.launchpad.net lucid/main Packages                            
已有 http://security.ubuntu.com lucid-security/multiverse Packages
已有 http://security.ubuntu.com lucid-security/multiverse Sources
下載:6 http://tw.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-zh_TW [3,024B]
下載:7 http://tw.archive.ubuntu.com lucid-updates Release.gpg [198B]
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main Translation-zh_TW
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Translation-zh_TW
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/universe Translation-zh_TW
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse Translation-zh_TW
已有 http://tw.archive.ubuntu.com lucid Release
下載:8 http://tw.archive.ubuntu.com lucid-updates Release [44.7kB]
已有 http://tw.archive.ubuntu.com lucid/main Packages
已有 http://tw.archive.ubuntu.com lucid/restricted Packages
已有 http://tw.archive.ubuntu.com lucid/main Sources
已有 http://tw.archive.ubuntu.com lucid/restricted Sources                  
已有 http://tw.archive.ubuntu.com lucid/universe Packages                    
已有 http://tw.archive.ubuntu.com lucid/universe Sources                    
已有 http://tw.archive.ubuntu.com lucid/multiverse Packages                  
已有 http://tw.archive.ubuntu.com lucid/multiverse Sources                  
下載:9 http://tw.archive.ubuntu.com lucid-updates/main Packages [370kB]      
下載:10 http://tw.archive.ubuntu.com lucid-updates/restricted Packages [3,240B]
下載:11 http://tw.archive.ubuntu.com lucid-updates/main Sources [141kB]      
下載:12 http://tw.archive.ubuntu.com lucid-updates/restricted Sources [1,443B]
下載:13 http://tw.archive.ubuntu.com lucid-updates/universe Packages [159kB]
下載:14 http://tw.archive.ubuntu.com lucid-updates/universe Sources [61.3kB]
下載:15 http://tw.archive.ubuntu.com lucid-updates/multiverse Packages [7,366B]
下載:16 http://tw.archive.ubuntu.com lucid-updates/multiverse Sources [3,677B]
取得 884kB 用了 11s (78.9kB/s)                                              
正在讀取套件清單... 完成
nelsonchung@ubuntu:~$ sudo apt-get install linux-headers-server linux-image-server linux-server
正在讀取套件清單... 完成
正在重建相依關係        
正在讀取狀態資料... 完成
下列的額外套件將被安裝:
  linux-generic-pae linux-headers-2.6.32-26-generic-pae
  linux-headers-generic-pae linux-image-2.6.32-26-generic-pae
  linux-image-generic-pae
建議套件:
  fdutils linux-doc-2.6.32 linux-source-2.6.32 linux-tools
下列【新】套件將會被安裝:
  linux-generic-pae linux-headers-2.6.32-26-generic-pae
  linux-headers-generic-pae linux-headers-server
  linux-image-2.6.32-26-generic-pae linux-image-generic-pae linux-image-server
  linux-server
升級 0 個,新安裝 8 個,移除 0 個,有 12 個未被升級。
需要下載 32.4MB 的套件檔。
此操作完成之後,會多佔用 109MB 的磁碟空間。
是否繼續進行 [Y/n]?y
下載:1 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-2.6.32-26-generic-pae 2.6.32-26.48 [31.6MB]
下載:2 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-generic-pae 2.6.32.26.28 [4,160B]
下載:3 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-generic-pae 2.6.32.26.28 [4,148B]
下載:4 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-26-generic-pae 2.6.32-26.48 [763kB]
下載:5 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-generic-pae 2.6.32.26.28 [4,148B]
下載:6 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-server 2.6.32.26.28 [4,158B]
下載:7 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-server 2.6.32.26.28 [4,156B]
下載:8 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-server 2.6.32.26.28 [4,150B]
取得 32.4MB 用了 34s (942kB/s)                                              
選取了原先未被選取的套件 linux-image-2.6.32-26-generic-pae。
(正在讀取資料庫 ... 系統目前共安裝了 156551 個檔案和目錄。)
正在解開 linux-image-2.6.32-26-generic-pae (從 .../linux-image-2.6.32-26-generic-pae_2.6.32-26.48_i386.deb)...
Done.
選取了原先未被選取的套件 linux-image-generic-pae。
正在解開 linux-image-generic-pae (從 .../linux-image-generic-pae_2.6.32.26.28_i386.deb)...
選取了原先未被選取的套件 linux-generic-pae。
正在解開 linux-generic-pae (從 .../linux-generic-pae_2.6.32.26.28_i386.deb)...
選取了原先未被選取的套件 linux-headers-2.6.32-26-generic-pae。
正在解開 linux-headers-2.6.32-26-generic-pae (從 .../linux-headers-2.6.32-26-generic-pae_2.6.32-26.48_i386.deb)...
選取了原先未被選取的套件 linux-headers-generic-pae。
正在解開 linux-headers-generic-pae (從 .../linux-headers-generic-pae_2.6.32.26.28_i386.deb)...
選取了原先未被選取的套件 linux-headers-server。
正在解開 linux-headers-server (從 .../linux-headers-server_2.6.32.26.28_i386.deb)...
選取了原先未被選取的套件 linux-image-server。
正在解開 linux-image-server (從 .../linux-image-server_2.6.32.26.28_i386.deb)...
選取了原先未被選取的套件 linux-server。
正在解開 linux-server (從 .../linux-server_2.6.32.26.28_i386.deb)...
正在設定 linux-image-2.6.32-26-generic-pae (2.6.32-26.48) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-26-generic-pae
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-26-generic-pae
Found initrd image: /boot/initrd.img-2.6.32-26-generic-pae
Found linux image: /boot/vmlinuz-2.6.32-26-generic
Found initrd image: /boot/initrd.img-2.6.32-26-generic
Found linux image: /boot/vmlinuz-2.6.32-24-generic
Found initrd image: /boot/initrd.img-2.6.32-24-generic
Found Windows NT/2000/XP on /dev/sda1
done
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/nvidia-common 2.6.32-26-generic-pae /boot/vmlinuz-2.6.32-26-generic-pae
run-parts: executing /etc/kernel/postinst.d/pm-utils 2.6.32-26-generic-pae /boot/vmlinuz-2.6.32-26-generic-pae

正在設定 linux-image-generic-pae (2.6.32.26.28) ...
正在設定 linux-generic-pae (2.6.32.26.28) ...
正在設定 linux-headers-2.6.32-26-generic-pae (2.6.32-26.48) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/nvidia-common 2.6.32-26-generic-pae /boot/vmlinuz-2.6.32-26-generic-pae

正在設定 linux-headers-generic-pae (2.6.32.26.28) ...
正在設定 linux-headers-server (2.6.32.26.28) ...
正在設定 linux-image-server (2.6.32.26.28) ...
正在設定 linux-server (2.6.32.26.28) ...

sudo reboot now
重新開機後

nelsonchung@ubuntu:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          5881       1346       4534          0        543        595
-/+ buffers/cache:        207       5674
Swap:          254          0        254



Reference:

透過Facebook分享

2010年12月16日 星期四

disable original audio driver and create virtual audio driver

上了charles patch
目的要將原本的audio driver disable
弄一個假的audio driver

nelsonchung@gps100make PRODUCT-imx51_bbg-eng 2>&1 | tee build_imx51_bbg_android.log4:~/myandroid9.1/frameworks/base/libs/audioflinger$ mm showcommands
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.2
TARGET_PRODUCT=imx51_bbg
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=FRF85B
============================================
No private recovery resources for TARGET_DEVICE imx51_bbg
make: Entering directory `/home/nelsonchung/myandroid9.1'
Copy: out/target/product/imx51_bbg/root/init.rc
out/host/linux-x86/bin/acp -fpt device/fsl/imx5x/init.rc out/target/product/imx51_bbg/root/init.rc
target SharedLib: libaudioflinger (out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/LINKED/libaudioflinger.so)
prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-g++ -nostdlib -Wl,-soname,libaudioflinger.so -Wl,-T,build/core/armelf.xsc -Wl,--gc-sections -Wl,-shared,-Bsymbolic -Lout/target/product/imx51_bbg/obj/lib   out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioMixer.o out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioResampler.o out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioResamplerSinc.o out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioResamplerCubic.o out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioFlinger.o out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioPolicyService.o          -Wl,--whole-archive   -Wl,--no-whole-archive  out/target/product/imx51_bbg/obj/STATIC_LIBRARIES/libaudiointerface_intermediates/libaudiointerface.a out/target/product/imx51_bbg/obj/STATIC_LIBRARIES/libaudiopolicybase_intermediates/libaudiopolicybase.a -llog -lcutils -lutils -lbinder -lmedia -lhardware_legacy -ldl -lc -lstdc++ -lm  -o out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/LINKED/libaudioflinger.so   -Wl,--no-undefined  -Wl,--fix-cortex-a8  /home/nelsonchung/myandroid9.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/interwork/libgcc.a
out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioPolicyService.o: In function `android::AudioPolicyService::AudioPolicyService()':
AudioPolicyService.cpp:(.text._ZN7android18AudioPolicyServiceC1Ev+0x13a): undefined reference to `createAudioPolicyManager'
out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/AudioPolicyService.o: In function `android::AudioPolicyService::AudioPolicyService()':
AudioPolicyService.cpp:(.text._ZN7android18AudioPolicyServiceC2Ev+0x12e): undefined reference to `createAudioPolicyManager'
collect2: ld returned 1 exit status
make: *** [out/target/product/imx51_bbg/obj/SHARED_LIBRARIES/libaudioflinger_intermediates/LINKED/libaudioflinger.so] Error 1
make: Leaving directory `/home/nelsonchung/myandroid9.1'

出現error

因為修改BoardConfigCommon.mk
所以建議make clean
重新編譯新的system.img

cd ~/myandroid9.1
make clean
make PRODUCT-imx51_bbg-eng 2>&1 | tee build_imx51_bbg_android.log

請等2~3個小時

ok

透過Facebook分享