put_user(x, ptr)
- Write a simple value into user spacex - Value to copy to user space
ptr - Destination address in user space
get_user(x, ptr)
- Get a simple variable from user spacex - Variable to store result
ptr - Source address in user space
copy_to_user(void __user *to, const void *from, unsigned long n);
- Copy a block of data into user space- copy_from_user(void *to, const void __user *from, unsigned long n);
- Copy a block of data from user space
2014年3月25日 星期二
Linux - data transfer between kernel/user space
2014年3月18日 星期二
Android build instruction
- build
- m - build all modules from the top of the tree
- mm - build all of the modules in current directory
- mmm - build all of the modules in the supplied directory
- make
- make systemimage - system.img
- make ramdisk - ramdisk.img
- make userdataimage - userdata.img
- make snod - build system.img quickly without checking the dependency
- misc
- croot - change directory to the top of the tree
- cgrep - grep on all local c/c++ files
- jgrep - grep on all local java files
- resgrep - grep on all local res/*.xml files
- godir - go to directory containing a file.
- printconfig - print the current build configuraiton
2014年3月17日 星期一
Linux init.rc (android)
Trigger sequence
"early-init" -> "init" -> "early-fs" -> "fs" -> "post-fs" -> "early-boot" -> "boot"
At the end of "boot" trigger, start corresponding services
class_start core
class_start main
Android Zygote
- Linux kernel start the 1st process - init
- init fork a child process - ServiceManager
- init fork a child process - Zygote
- Zygote
- Fork an child process for SystemServer (register to ServiceManager)
- Main process is waiting to fork child processes of user applications from ActivityManagerService via socket
- Linux - fork() function
- return child pid in parent process
- return 0 in child process
2014年3月16日 星期日
Process/Thread in each OS
- MS DOS
- Single-Process
- Single-Thread
- Java VM
- Single Process
- Multi-Thread
- Unix - traditional
- Multi-Process
- Single-Thread
- Linux, Windows, Solaris, ...
- Multi-Process
- Multi-Thread
2014年3月10日 星期一
Android App components
4 types of Android application components.
- Activities - foreground UI handler
- Services - background service routine
- Content Providers - share app data, such as SQLite or data in filesystem.
- Broadcast Receivers - response to system-wide broadcast
Android useful commands
am - Activity Manager
example:
$ am start -n com.android.browser/com.android.browser.BrowserActivity
dumpsys - Dump interesting information about the status of system service.
example:
$ dumpsys | grep "mFocusedApp"
aapt - Android Asset Packaging Tool
usage:
example:
$ am start -n com.android.browser/com.android.browser.BrowserActivity
dumpsys - Dump interesting information about the status of system service.
example:
$ dumpsys | grep "mFocusedApp"
aapt - Android Asset Packaging Tool
usage:
aapt l[ist] [-v] [-a] file.{zip,jar,apk} List contents of Zip-compatible archive. aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]] badging Print the label and icon for the app declared in APK. permissions Print the permissions from the APK. resources Print the resource table from the APK. configurations Print the configurations in the APK. xmltree Print the compiled xmls in the given assets. xmlstrings Print the strings of the given compiled xml assets. aapt p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \ [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \ [--min-sdk-version VAL] [--target-sdk-version VAL] \ [--max-sdk-version VAL] [--app-version VAL] \ [--app-version-name TEXT] [--custom-package VAL] \ [-I base-package [-I base-package ...]] \ [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \ [-S resource-sources [-S resource-sources ...]] [-F apk-file] [-J R-file-dir] \ [raw-files-dir [raw-files-dir] ...] Package the android resources. It will read assets and resources that are supplied with the -M -A -S or raw-files-dir arguments. The -J -P -F and -R options control which files are output. aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 ...] Delete specified files from Zip-compatible archive. aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...] Add specified files to Zip-compatible archive. aapt v[ersion] Print program version.
訂閱:
文章 (Atom)