2011年8月7日 星期日

linux find command

find command:
;find string in current folder all files
#find . -exec grep 'test' {} \;
*{}: this list all files
*\ : this is ending word

The -exec action takes a Unix command (along with its options) as an argument.
The arguments should contain {} (usually quoted), which is replaced in the command with the name of the currently found file.
The command is terminated by a semicolon, which must be quoted ("escaped") so the shell will pass it literally to the find command.


;rm file in current folder all files
#find . -name oo.txt -print -exec rm -f {} \;

;find 00.txt file only looking for file under this folder
#find . -name oo.txt -type f

;find 00.txt file only looking for folder type under this folder
#find . -name 00.txt -type d


using xargs command in find command
#find whatever....| args commnad

xargs is command to execute commnd line from standard input.

;list file
#find . -name xx.txt -print | xargs ls -l

;rmmove files from test folder
#find ./test -type f -print0 | xargs -0 rm

more information in "http://en.wikipedia.org/wiki/Xargs"

Android Makefile follow

reference:http://tw.myblog.yahoo.com/blue-comic/article?mid=676

Android Makefile follow:

Makefile -> build/core/main.mk -> build/core/config.mk -> build/core/envsetup.mk -> build/core/product_config.mk

由 build/core/config.mk 所進行。
build/core/envsetup.mk 檢查 developer 的設定 (buildspec.mk) ,並檢查執行環境,以決定輸出目錄、項目。
build/core/config.mk 本身還依據參數,決定解譯時的相關參數。像是 compiler 的路徑、flags, lex 、yacc 的路徑參數等。
關於 product 的相關設定,則是由 build/core/product_config.mk 所處理,使用 build/core/product.mk 提供之 macro 載入。根據 AndroidProduct.mk 的內容, product_config.mk 決定了

android keycode

android keycode :
reference:
http://wadefs.blogspot.com/2010/12/android-remote-control-keyevent.html
http://blog.yam.com/hansonlin211/article/19171413


input keyevent xx
input text "xxx"

2011年8月4日 星期四

android boot process

reference:
Android boot process :
reference:

http://www.androidenea.com/2009/06/android-boot-process-from-power-on.html
http://huenlil.pixnet.net/blog/post/23862982

android boot img

reference : http://huenlil.pixnet.net/blog/post/23862982

*boot.img = zImage + ramdisk.img
zImage = kernel image
ramdisk.img = out/target/product/blaze/root/
%./out/host/linux-x86/bin/mkbootimg
--kernel zImage
--ramdisk ramdisk.img
--base 0x80000000
--cmdline "console=ttyO2,115200n8 mem=456M@0x80000000 mem=512M@0xA0000000 init=/init androidboot.console=ttyO2"
--board xxxx
-o boot.img.new
Output: boot.img.new
**Note: bootarg is passed to kernel via --cmdline option above



How to unpack/pack ramdisk.img
unpack:
#gunzip -c ../your-ramdisk-file | cpio -i
pack:
#find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz


+-----------------+
| boot header | 1 page
+-----------------+
| kernel | n pages
+-----------------+
| ramdisk | m pages
+-----------------+
| second stage | o pages
+-----------------+

n = (kernel_size + page_size - 1) / page_size
m = (ramdisk_size + page_size - 1) / page_size
o = (second_size + page_size - 1) / page_size

0. all entities are page_size aligned in flash
1. kernel and ramdisk are required (size != 0)
2. second is optional (second_size == 0 -> no second)

usage: mkbootimg
--kernel
--ramdisk
[ --second <2ndbootloader-filename> ]
[ --cmdline ]
[ --board ]
[ --base
]
[ --pagesize ]
-o|--output


bootimg:
mkdir -p $(IMAGES_PATH)
cd $(IMAGES_PATH) && $(MKIMAGE) --kernel $(KDIR)/arch/arm/boot/zImage \
--ramdisk $(OUT_TARGET_DIR)/ramdisk.img \
--base 0x80000000 --cmdline "$(KERNEL_BOOTPARAMS)" \
--board omap4 -o boot.img && cd -

ex: mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel your-kernel-file --ramdisk newramdisk.cpio.gz -o mynewimage.img


==========================================================================================================================================
* system.img
#uncompress
%./out/host/linux-x86/bin/simg2img system.img system.img.raw
#mount to directory mnt-point/
%mkdir mnt-point
%sudo mount -t ext4 -o loop system.img.raw mnt-point/
#modify any .so or apk in the mnt-point/ directory
#rezip
%sudo out/host/linux-x86/bin/make_ext4fs -s -l 512M -a system system.img.new mnt-point/
%sudo umount mnt-point/
Output: system.img.new
=====================================================================================

2011年8月3日 星期三

Android Build Number

reference: http://blog.roodo.com/thinkingmore/archives/14594619.html
http://blog.csdn.net/yrj/article/details/5785894


I only setting : mydroid/build/core/build_id.mk
BUILD_NUMBER := test-2011

2011年8月2日 星期二

vim 整段註解

‧執行 vim 某個 文字檔,進入vim:

1. 先按 Esc 離開 insert mode
2. 再按 ctrl+v 將要註解的這幾行選取(使用上下左右鍵 or + shift )
3. 再按大寫的 I (指的是進入Insert mode)
4. 再輸入 #
5. 最後按 Esc 就會看到選取的這幾行都被 # 註解掉了