ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2011年10月28日 星期五

NetlinkEvent - uevent

原來 NetlinkEvent 是在處理 netlink 的 message。
parsing netlink messaag: bool NetlinkEvent::decode(char *buffer, int size) { char *s = buffer; char *end; int param_idx = 0; int i; int first = 1; end = s + size; while (s < end) { if (first) { char *p; for (p = s; *p != '@'; p++); p++; mPath = strdup(p); first = 0; } else { if (!strncmp(s, "ACTION=", strlen("ACTION="))) { char *a = s + strlen("ACTION="); if (!strcmp(a, "add")) mAction = NlActionAdd; else if (!strcmp(a, "remove")) mAction = NlActionRemove; else if (!strcmp(a, "change")) mAction = NlActionChange; } else if (!strncmp(s, "SEQNUM=", strlen("SEQNUM="))) mSeq = atoi(s + strlen("SEQNUM=")); else if (!strncmp(s, "SUBSYSTEM=", strlen("SUBSYSTEM="))) mSubsystem = strdup(s + strlen("SUBSYSTEM=")); else mParams[param_idx++] = strdup(s); } s+= strlen(s) + 1; } return true; } 可以順便知道kobject, uevent 的 message 內容。
在 Documentation/device-mapper/dm-uevent.txt 有例子:
UEVENT[1192521009.711215] change@/block/dm-3
ACTION=change
DEVPATH=/block/dm-3
SUBSYSTEM=block
DM_TARGET=multipath
DM_ACTION=PATH_FAILED
DM_SEQNUM=1
DM_PATH=8:32
DM_NR_VALID_PATHS=0
DM_NAME=mpath2
DM_UUID=mpath-35333333000002328
MINOR=3
MAJOR=253
SEQNUM=1130

2011年10月27日 星期四

Run native executable in Android App

Gwanline 給的 link:
Run native executable in Android App
github:
https://github.com/gimite/android-native-exe-demo

基本上是用 Process process = Runtime.getRuntime().exec(command);
不知道為什麼要用 getBroadcaster( ) ,
現在 所有用到 getBroadcaster 的code,都是拿來 call sendBroadcast( )
mVm->getBroadcaster()->sendBroadcast(); 那幹麼還做出 getBroadcast( ) 這個 function?
直接 implement 一個 sendBroadcast( ) 像: mVm->sendBroadcast( ); 不就好?


push_back 是 stl . list 的操作 function,就是 insert。
是 android 的 stl : /framework/base/include/utils/ -- 奇怪,bionic 也有 implement 一份 stl 呀...為什麼要再作一份?

2011年10月26日 星期三

SocketListener, FrameworkListener & CommandListener

SocketListener | FrameworkListener | CommandListener Vold, Netd 各自implement 自己的 CommandListener.
filename 還都叫一樣的 CommandListener.cpp,h
但是在不同的 project (bin) ,所以同名沒關係。
像 interface 的東西.. FrameworkCommand | VoldCommand | DumpCmd, VolumeCmd, ShareCmd, AsecCmd, ObbCmd, StorageCmd, XwarpCmd
一樣,從 netd 來看
FrameworkCommand | NetdCommand | UsbCmd, SoftapCmd, InterfaceCmd, IpFwdCmd, TetherCmd, NatCmd, ListTtysCmd, PppdCmd, PanCmd 很有趣的是...這裡,各自 implement VoldCommand, NetCommand,結果內容是完全一樣的....
為甚摩不省略這一層,直接 繼承 FrameworkCommand 就好?


還有用到 Netlink SocketListener | NetlinkListener | NetlinkHandler 也是一樣,vold, netd 各自 implement 自己的 NetlinkHandler
這要的flow 寫在 SocketListener.
thread create, thread start,thread run.
runListener while(1) { FD_SET select( ) if( FD_IISSET( ) { c = accept( ) } do { for( i = clients->begin ~ end) { if(FD_ISSET(client(fd))) onDataAvailable(i) 就是標準的 FD_SET, select 動作,當有monitor 到 fd 變更,在一一check client 的 fd,把對應的 client 的 onDataAvailable( ) 執行一次

Bookmark : why GNU grep is fast

這一篇超不錯: 為什麼 gun grep 這麼快 http://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310.html
為了防止不見,我整篇 copy 下來...
why GNU grep is fast

Mike Haertel mike at ducky.net 
Sat Aug 21 03:00:30 UTC 2010
Previous message: Latest intr problems
Next message: why GNU grep is fast
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Gabor,

I am the original author of GNU grep.  I am also a FreeBSD user,
although I live on -stable (and older) and rarely pay attention
to -current.

However, while searching the -current mailing list for an unrelated
reason, I stumbled across some flamage regarding BSD grep vs GNU grep
performance.  You may have noticed that discussion too...

Anyway, just FYI, here's a quick summary of where GNU grep gets
its speed.  Hopefully you can carry these ideas over to BSD grep.

#1 trick: GNU grep is fast because it AVOIDS LOOKING AT
EVERY INPUT BYTE.

#2 trick: GNU grep is fast because it EXECUTES VERY FEW
INSTRUCTIONS FOR EACH BYTE that it *does* look at.

GNU grep uses the well-known Boyer-Moore algorithm, which looks
first for the final letter of the target string, and uses a lookup
table to tell it how far ahead it can skip in the input whenever
it finds a non-matching character.

GNU grep also unrolls the inner loop of Boyer-Moore, and sets up
the Boyer-Moore delta table entries in such a way that it doesn't
need to do the loop exit test at every unrolled step.  The result
of this is that, in the limit, GNU grep averages fewer than 3 x86
instructions executed for each input byte it actually looks at
(and it skips many bytes entirely).

See "Fast String Searching", by Andrew Hume and Daniel Sunday,
in the November 1991 issue of Software Practice & Experience, for
a good discussion of Boyer-Moore implementation tricks.  It's
available as a free PDF online.

Once you have fast search, you'll find you also need fast input.

GNU grep uses raw Unix input system calls and avoids copying data
after reading it.

Moreover, GNU grep AVOIDS BREAKING THE INPUT INTO LINES.  Looking
for newlines would slow grep down by a factor of several times,
because to find the newlines it would have to look at every byte!

So instead of using line-oriented input, GNU grep reads raw data into
a large buffer, searches the buffer using Boyer-Moore, and only when
it finds a match does it go and look for the bounding newlines.
(Certain command line options like -n disable this optimization.)

Finally, when I was last the maintainer of GNU grep (15+ years ago...),
GNU grep also tried very hard to set things up so that the *kernel*
could ALSO avoid handling every byte of the input, by using mmap()
instead of read() for file input.  At the time, using read() caused
most Unix versions to do extra copying.  Since GNU grep passed out
of my hands, it appears that use of mmap became non-default, but you
can still get it via --mmap.  And at least in cases where the data
is already file system buffer caches, mmap is still faster:

  $ time sh -c 'find . -type f -print | xargs grep -l 123456789abcdef'
  real 0m1.530s
  user 0m0.230s
  sys 0m1.357s
  $ time sh -c 'find . -type f -print | xargs grep --mmap -l 123456789abcdef'
  real 0m1.201s
  user 0m0.330s
  sys 0m0.929s

[workload was a 648 megabyte MH mail folder containing 41000 messages]
So even nowadays, using --mmap can be worth a >20% speedup.

Summary:

- Use Boyer-Moore (and unroll its inner loop a few times).

- Roll your own unbuffered input using raw system calls.  Avoid copying
  the input bytes before searching them.  (Do, however, use buffered
  *output*.  The normal grep scenario is that the amount of output is
  small compared to the amount of input, so the overhead of output
  buffer copying is small, while savings due to avoiding many small
  unbuffered writes can be large.)

- Don't look for newlines in the input until after you've found a match.

- Try to set things up (page-aligned buffers, page-sized read chunks,
  optionally use mmap) so the kernel can ALSO avoid copying the bytes.

The key to making programs fast is to make them do practically nothing. ;-)

Regards,

 Mike

2011年10月25日 星期二

http://www.vogella.de/articles/Andrpid/article.html

  1. Android Dalvik VM 和 java vm 不樣,google 提供 "dx" 這個tool,把 java Class file 轉成 Dalvik file (dex).
  2. Android 系統的執行檔格式是 apk,google 提供 "aapt" 這個 tool,把application 包裝成 apk。
  3. ADT plugin for Eclipse 提供整個服務:把 java class 轉成 dex,再包裝成 apk
  4. 支援 2D, 3D 的opengl function
  5. 使用 Sqlite 作data storage
  6. 每一個 android 程式在 deployment 的時候,都會被賦予一個 userid,藉此區隔每個 application 的空間和權限。
Important Android Component
  1. Activity -- Applaction 的展現,將資料展現在螢幕上,並且負責與 user 的互動。
    一個 application 可以有很多個 activity,然後在執行時切換。
  2. Views -- Activitity 用來畫圖的class。都是繼承字 android.view.View。view 的layout 事由 android.view.ViewGroupe負責。
  3. Servuce -- 負責背景動作,可以經由 android 的 notification framwork,提供 user 資訊。
  4. Content Provider -- 負責提供資料給 application,經由 Content Provider,application 可以互相share 資料。-- Android 包含一個 SQlite db,作為 data provider。
  5. Intents --

2011年10月21日 星期五

原來, honeycomb 的 GPL code 已經 release:
http://source.android.com/source/build-numbers.html

... GPL code 只佔 Android Source 的一小部份... ICS 的 GPL code 也release,但是是在google groupe 中說得,以 tar download 的方式。
所以不知道有沒有在 git branch 中..

2011年10月19日 星期三

bookmark for quick boot

  1. http://www.linuxjournal.com/magazine/reducing-boot-time-embedded-linux-systems?page=0,0
  2. http://free-electrons.com/services/boot-time/
  3. http://free-electrons.com/pub/conferences/2011/genivi/boot-time.pdf
  4. http://free-electrons.com/blog/lzo-kernel-compression/

bookmarks : browse android sources in eclipse

android 官方說明如何用 eclipse build android framework code: http://source.android.com/source/using-eclipse.html
這邊是對應的中文:
http://cheng-min-i-taiwan.blogspot.com/2011/02/android-source-core-eclipse.html

這有兩篇:
  1. http://blog.csdn.net/wufenglong/article/category/687662
  2. http://www.cnblogs.com/keis/archive/2011/05/13/2045690.html
  3. http://tw.myblog.yahoo.com/jw!0.HxipORGB7SANBka8A2GVI-/archive?l=f&id=13
build 得時候會遇到的問題:
http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error


英文

  1. http://stuffthathappens.com/blog/2008/11/01/browsing-android-source-in-eclipse/
  2. http://achorniy.wordpress.com/2010/05/26/how-to-view-android-sources-in-eclipse/
  3. http://stackoverflow.com/questions/5233640/best-way-to-attach-android-source-to-eclipse
  4. http://johnsenf.blogspot.com/2011/04/android-sources-in-eclipse.html
  5. http://www.devfrustrated.com/devBlog/browsing-android-source-code-in-eclipse/
  6. http://www.bigbluebrains.com/index.php/2010/08/08/browsing-android-2-2-froyo-source-code-in-eclipse/
  7. http://www.androidzz.com/2011/08/browsing-android-source-in-eclipse/
  8. http://blog.michael-forster.de/2008/12/view-android-source-code-in-eclipse.html
  9. http://android.opensourceror.org/2010/01/18/android-source/
  10. http://stuffthathappens.com/blog/2008/11/01/browsing-android-source-in-eclipse/

get android source -- when android.kernel.org is down

Update :
google 換了 android source server
http://source.android.com/source/downloading.html

配合的新版 repo: curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo server address: $ repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1 所以應該不用下面的方法了...



kernel.org 死了好久, www.kernel.org 恢復了。
但是 android.kernel.org 還沒。

這篇 有說改從 codeaurora download 的方法:
http://php.webtutor.pl/en/2011/09/05/kernel-org-hacked-how-to-get-android-repo/

我照著 copy 一下:


1. 先抓 repo: curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo chmod a+x ~/bin/repo PATH=~/bin:$PATH
2. download code from codeaurora mkdir WORKING_DIRECTORY cd WORKING_DIRECTORY repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread repo sync


雖然 android mirror 很多,但是大多沒有改 manifest,不然就是沒辦法support 像 android.kernel.org 這樣多目錄下的project,
codeaurora 比較接近。


另外這一篇也是一樣,是中文的,所以就不 copy 了:
http://joybo.blogspot.com/2011/10/android-source-23.html

2011年10月14日 星期五

從 adb reboot 開始
  1. 未改 : 28 sec
  2. 改 kernel : 27.2 sec
  3. 改 framework - preload & remove battery, vibrator serer : 25 sec
  4. 拿掉 bootanimation/ 或改靜態圖 : 22.7 sec

開機有一些 sensor 可以拿掉:看 log..
使用自己的 launchre 和一堆 ap 後..
  1. 未改: 30.6sec
  2. 改 kernel : 29.6sec
  3. 改 framework/base + static bootanimation : 24.8 sec

2011年10月13日 星期四

在 framework/base/services/java/com/android/server/am/ActivityManagerService.java: public static final Context main(int factoryTest) { ........ ActivityManagerService m = thr.mService; mSelf = m; ........ m.startRunning(null, null, null, null); return context; } startRunning( ) 的最後是 call systemReady(): public final void startRunning(String pkg, String cls, String action, ........ systemReady(null); }

2011年10月12日 星期三

bootchart png s on target

1. 沒修改:


measured time:
  1. poweron - load kernel & root : 4.5 sec
  2. boot kernel unitll shell prompt : 10.0 sec
  3. unitl 2nd splash show up :13.1 sec
  4. until launcher show up : 14.2 sec
total : 42sec



2. preloaded-classes = empty

從 bootchart 看,雖然 zygote 到 start system server 的時間縮短了,
但是 launcher 啟動的時間一樣維持在 29 sec。



3. 改 internal eMMC, preloaded-classes 只有 java, dalvik 部份 (大約是原來的一半)


可以看到,啟動 launcher 的時間縮短很多,前面的 30 sec,由原來的 IO bound 變成 cpu bound...



4. 跟 3 一樣,但是 preloaded-classes 是空的


原來7 sec 的 preloading 時間變成 3 sec。


亂改一通後....
雖然好像很快...

2011年10月11日 星期二

bootchart & preloaded-classes

  1. preloaded-class
  2. package scan

修改 preloaded-classes 就是修改 /framework/base/preloaded-classed
然後重 build。

下面是 原來的 和 0 -preload 的 bootchart :

use bootchart on android

squeeze 竟然沒有 bootchart...
到 bootcharg.org download source - 0.9.? 版
follow 說明,用 ant 來 build
所以要先 install ant: $aptitude install ant 解開 bootchart source,然後到目錄去 run ant...
出現 error。
說 javac 找不到,找 com.sun..... 然後 path 指的卻是 openjdk。
所以 run $update-alternatives --all 所有 java 的部份,都由 openjdk 改為 sun-java。
再 run ant --> OK.



android 的部份,follow README.BOOTCHART
在 system/core/init

先把 INIT_BOOTCHART 打開build 出一個有 bootchart 的 init.. 到 system/core/init $ mm INIT_BOOTCHART=true dd 到 板子上後,啟動。

然後手動做出 /data/bootchart-start: $ echo 60 > bootchart-start $adb push bootchart-start /data/ $adb shell sync 然後就可以reboot..
這樣開機後,在 /data 下就會多一個 bootchart 的 folder。
/data/bootchart-start 裡面寫得就是 bootchart 要紀錄的秒數。
--- 現在是 60 sec。

等 60 sec 後,就可以 run /system/core/init/grabe-bootchart.sh
會透過 adb 把 /data/bootchart/ 的資料 copy 回 pc,壓成 bootchart.tgz。



然後 pc 端 run 剛剛裝好的 bootchart。從 bootchart.tgz 產生 png: java -jar bootchart.jar bootchart.tgz

Disable screen off timeout

一陣子沒動作,就會把lcd 關掉,同時進 suspend。
在 framework/base/services/java/com/android/server/PowerManagerService.java: private class SettingsObserver implements Observer { ........ public void update(Observable o, Object arg) { synchronized (mLocks) { ...... // SCREEN_OFF_TIMEOUT, default to 15 seconds mScreenOffTimeoutSetting = -1;//getInt(SCREEN_OFF_TIMEOUT, DEFAULT_SCREEN_OFF_TIMEOUT); mScreenOffTimeoutSetting = -1;
就可以disable 掉這個 function。

2011年10月7日 星期五

以P公司藍色測試 2G SD 為基準:

uImage : 3267264
uramdisk : 293568

  1. uboot load kernel and root : 7.5 sec
  2. kernel boot : 7.0 sec
  3. init to show splash : 27.4 sec
  4. splash to show launcher : 45.6
第二次開機:
  1. uboot load kernel and root : 7,5 sec
  2. kernel boot : 7.8 sec
  3. init to show splash : 12.7 sec
  4. splash to show launcher : 10.6

刪掉一堆
uImage : 2502056
kernel boot L 6.4 sec

2011年10月6日 星期四

mxc_uart.c 的 mxcuart_console_init ( ) 屬於 console_init 階段執行的 function. struct console mxc_consol register_console(&mxc_console);
mxc_reg 跟 mxc_console 各自包含對方: struct uart_console mxc_reg = { .con = (&mxc_sonsole); }; struct console mxc_console = { .data = &mxc_reg; }

另外一個是 module_init 階段執行的 mxcuart_init uart_register(&mxc_reg); platform_driver_register(&mxcuart_driver); mxcuart_driver 是 platform_driver 結構,name 是 mxcintuart (internal uart ?)

platform_driver 的 mxcuart_resume(struct platform_device *pdev) 只是..
取出 platform_device 的 data : (uart_mxc_port)。參照裡面的 port.flag,決定要不要call uart_resume_port( ): uart_mxc_port *umxc = platform_get_drvdata(pdev); if (umxc && umxc->port.flags & ASYNC_SUSPENDED) { umxc->port.state->port.tty->hw_stopped = 0; uart_resume_port(&mxc_reg, &umxc->port); } 這裡的 uart_resume_port 在 serial_core.c 裡。

uart_resume_port 也是取出 argument :uart_driver 裡的tty_port 結構資料 : port。
依照 port-> flags 的內容決定要不要對 hardware 動作。

所以 mxcuart_resume --- uart_resume_port 裡面都有對 port 動作,但是兩個的 port 並不一樣。

mxcuart_resume 是: platform_device --> (uart_mxc_port) --> port.flags uart_resume_port 是: uart_driver --> uart_state -->tty_port --> flags 好像不相關.


mxcuart_resume 的參數: platform_device 是宣告在另一個 source : arch: static struct platform_device mxc_uart_device1 = { .name = "mxcintuart", .id = 0, .num_resources = ARRAY_SIZE(mxc_uart_resources1), .resource = mxc_uart_resources1, .dev = { .platform_data = &mxc_ports[0], }, };
mxc_port 是: static uart_mxc_port mxc_ports[] = { [0] = { .port = { .iotype = SERIAL_IO_MEM, .fifosize = 32, .flags = ASYNC_BOOT_AUTOCONF , .line = 0, }, .ints_muxed = 1, .mode = MODE_DCE, .ir_mode = NO_IRDA, .enabled = 1, .cts_threshold = UART1_UCR4_CTSTL, .dma_enabled = UART1_DMA_ENABLE, .dma_rxbuf_size = UART1_DMA_RXBUFSIZE, .rx_threshold = UART1_UFCR_RXTL, .tx_threshold = UART1_UFCR_TXTL, .dma_tx_id = MXC_DMA_UART1_TX, .dma_rx_id = MXC_DMA_UART1_RX, .rxd_mux = MXC_UART_RXDMUX, }, 看到那個 flags 欄位。
這個欄位好像沒有改變。

uart_resume_port( ) 的參數是mxc_uart_resume 呼叫時傳進去的。 uart_resume_port(&mxc_reg, &umxc->port); 所以就是

Bookmark : install AMD APP SDK on Debian - OpenCL

http://wiki.cchtml.com/index.php/Debian

2011年10月5日 星期三

mxc_uart.c 的 mxcuart_init( ) 被放在 module_init(mxcuart_init),所以在 kernel 啟動時,會自動被呼叫。

mxcuart_init 負責:
  1. uart_register_driver
  2. platform_driver_register
mxc_uart 的 platform driver name 是 mxcintuart。
對應的 platform device 在 arch/arm serial.c 李,一共宣告了 5 個 (因為有 5 個 serial port, -- 51 只有 3 個)
platform_device 的資料: platform_data 是 uart_mxc_port 其中包含有 .port 這個 property。
裡面有 flags 這個 field。

這個flag 是給 driver 用的(?),因為 serial_core.c 的 suspend/resume function 會依照 consoel_suspend_enabled 來動作,並且 update port->flag 的 ASYNC_SUSPEND 這個 flag。



看來是 uart_open 沒有被 call 到,所以 resume 狀態和 suspend 狀態不一致。

看一下 uart_open 對那些 hardware register 有動作: uart_change_pm(state,0); uart_startup(state,0); uart_update_termios(state)
mxcuart_startup ( ) 變更的 register 有:
  1. MXC_UARTUSR1, MXC_UARTUSR2
  2. UARTUCR3
  3. MXC_UARTUCR2
  4. MXC_UARTUFCR
  5. MXC_UARTUCR1



還是認真看一下..

整個就只有mxc_uart_early, mxc_uart, serial_core 三個。
要是要用 uart 當作 console ,就要加上 mxc_uart_early,否則不僅 kernel msg show 不出來,shell 也沒有動作。

mxc_uart_early 的 init 被藏在很不清楚的地方 (why not follow DEBUG_LL & EARLY_CONSOL ?)
在MACHINE_START( ) 的 timer .init : mx51_babbage_timer_init ( ) 中。
clock_init 完後,就 call early_console_setup(UART1_BASE_ADDR, uart_clk);

實際上就是call mxc_early_serial_console_init(base, clk);

early_console_setup( ) 傳進去的 UART1_BASE_ADDR, uart_clk 會填在 static 變數 mxc_early_device 的 port.mapbase 和 clk 裡。
雖然 mxc_early_device 的 structure mxc_early_uart_device 宣告了內含一個很大的 structure : uart_port,實際上只有用到裡面的 membase 這個 field 而已.........

比較有用的變數是 static struct console mxc_early_uart_console __initdata = { .name = "ttymxc", .write = early_mxcuart_console_write, .setup = mxc_early_uart_setup, .flags = CON_PRINTBUFFER | CON_BOOT, .index = -1, }; 這被用來 register_console(&mxc_early_uart_console);

*** -- 這個 early_driver 只有實做 write,沒有 read 喔...
*** 沒有看到設 baudrate..

register_console 在 kernel/printk.c

可以看到 呼叫 early_setup( ),還有把 cmdline option 傳進setup( ).. 執行的 code。

還可以看到當真正的 console register 時,bootconsole 會自動 unregister..

printk 用來紀錄所有register 的 console 是 struct console { char name[16]; void (*write)(struct console *, const char *, unsigned); int (*read)(struct console *, char *, unsigned); struct tty_driver *(*device)(struct console *, int *); void (*unblank)(void); int (*setup)(struct console *, char *); int (*early_setup)(void); short flags; short index; int cflag; void *data; struct console *next; }; 其中 next 是用來做出 linking list


整個 printk.c 包含register_console ,還有 prtintk,就是把message 從所有 console 的 write( ) 送出去。

printk.c : 中的 release_console_sem( ) 就會把 buffer 內容從所有 registered console 送出去..



---- 所以整個只有 write,,,,,

2011年10月4日 星期二

sysfs:
/sys/devices/system
suspend/hibernate 時: Suspending System Devices Suspending type 'vfp': vfp0 Suspending type 'clocksource': clocksource0 Suspending type 'timekeeping': timekeeping0 Suspending type 'timer': timer0 Suspending type 'mxc_gpio': mxc_gpio0 Suspending type 'cpu': cpu0 跟 /sys/device/system 下的目錄一致。


hibernate fail 時,是 cpu0 fail。
所以把 function address 印出來,到 System.mp 就可以查到 function name。
結果 vfp0, clocksource0,.. mxc_gpio0 都沒有 suspend function。
只有 cpu0 有,是 cpufreq_suspend。


driver/cpufreq/cpufreq.c 中的 printk 是用 cpufreq_debug_printk( ) 作動態控制。
控制的參數有 debug, debug_ratelimit

這兩個參數被宣告成 module_param,所以都會在 /sys/module/cpufreq 裡出現。

還有要開啟這個功能,要define CONFIG_CPU_FREQ_DEBUG。
這在 menuconfig 打開:
CPU Power Management --> Enable CPUfreq debugging

另外,看 cpufreq_debug_printk( ) 的 code,是 KERN_INFO,所以不會直接 output 到 console。
要直接輸出(不經 dmesg),就把他刪掉。


這樣 build 好kernel 啟動後,還要: echo 7 > /sys/module/cpufreq/debug echo 0 > /sys/module/cpufreq/debug_ratelimit 改一下 cpufreq 的debug 參數,讓他output message。
然後作 hibernate ,就可以看到 cpufreq-core 的 message 了。

bookmark: boot time optimize done by TI

Ti 也很好心的寫了 boot time optimize procedure:
  1. http://processors.wiki.ti.com/index.php/Android_Boot_Time_Optimization
  2. http://processors.wiki.ti.com/index.php/Optimize_Linux_Boot_Time
屬於 "盡力" 的方式,沒有用 hibernate 功能。
比較特殊的大概是 deffered module,讓某些不急著load 的 module 晚點再 load.

順便 link 一下 TI 的 Gingerbread sdk user guide:
http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_UserGuide

FAQ 有提到, bracn -qb 就是 quickboot 的 branch


  1. kernel + root only : suspend , resume OK, but shell no response after reumse, and takes long time to resume
  2. remove unnecessary option in kernel : failed : Class driver suspend failed for cpu0

2011年10月3日 星期一

bookmark : proc & sysfs

因為Z的 bsp 還有一堆 driver 用 proc 作 device/userspace 溝通的管道。
所以想看一下 proc, sysfs 介面的差異。

剛好這一篇有簡單的 proc , sysfs interface example:
http://www.coding.com.br/kernel/adding-procfs-and-sysfs-interface-in-your-lkml/
**sysfs只有 create node,沒有 interface。

但是 sysfs 很有趣的是,可以用 module_param 把module 的參數開放出來。
用 module_param 宣告的參數,都會列在 /sys/module/ 目錄中。
可以read /write (如果你有給權限的話)

到 /sys/module 去看,會列出所有的 module。
ref: http://nano-chicken.blogspot.com/2011/01/linux-modules11module-parameters.html

標籤

網誌存檔