這星期用了ndk 1.6
首先要改這個script
http://groups.google.com/group/android-ndk/browse_thread/thread/2127fa52b6aa362c?pli=1
比較特別的是
在Application.mk裡
APP_PROJECT_PATH可以指到別的地方 不一定要在ndk/app底下
另外
LOCAL_SHARED_LIBS
跟LOCAL_LDLIBS的usage還不是很清楚
在mydroid裡LOCAL_SHARED_LIBS可以動
但ndk裡LOCAL_LDLIBS才可以
Saturday, November 28, 2009
Wednesday, November 4, 2009
Monday, November 2, 2009
LOCAL_SDK_VERSION
在Android.mk裡
發現了一個
LOCAL_SDK_VERSION
這是在ApiDemos裡的Android.mk看到的
如果加了
LOCAL_SDK_VERSION := current
就會讓你用sdk的android.jar來編
也就是一些hide的api就不能用了
發現了一個
LOCAL_SDK_VERSION
這是在ApiDemos裡的Android.mk看到的
如果加了
LOCAL_SDK_VERSION := current
就會讓你用sdk的android.jar來編
也就是一些hide的api就不能用了
Wednesday, October 28, 2009
mydroid 找不到sdcard
今天發現我從mydroid build出來的emulator一直mount 不到sdcard
最後發現 我的 /etc/沒有 vold.conf這檔案
然後就把 mydroid/development/data/etc/vold.conf copy 到
out/target/product/generic/system/etc下
然後make systemimage
我可以mount到sdcard了!!!
~
~
~
最後發現 我的 /etc/沒有 vold.conf這檔案
然後就把 mydroid/development/data/etc/vold.conf copy 到
out/target/product/generic/system/etc下
然後make systemimage
我可以mount到sdcard了!!!
~
~
~
Tuesday, September 15, 2009
在Android emulator 上改userdata system 的image max size
之前被問到userdata image要如何改大小
花了很多時間才找到XD
首先從Android build system講起
在mydroid/build/core/definitions.mk裡
有個
define assert-max-file-size的 function
原本以為只要指定
BOARD_FLASH_BLOCK_SIZE 跟BOARD_USERDATAIMAGE_MAX_SIZE
就可以了
但發現他這只是作個檢查的動作而已
不過他這有講到 /proc/mtd的東西
然後看了其他的code
也都是去讀 /proc/mtd 來作partition
dev: size erasesize name
mtd0: 04000000 00020000 "system"
mtd1: 04000000 00020000 "userdata"
mtd2: 04000000 00020000 "cache
然後去checkout android linux kernel的code
下載完首先要switch 到有goldfish的branch
不然預設是msm 裡面沒有goldfish的driver 編kernel也會有error
會跳到linux kernel裡面看的原因是有的embedded linux
會把mtd 的size name 等的information寫在 /drivers/mtd/map下
一個叫mtd_parition的struct裡
在drivers/mtd/devices/goldfish_nand.c下 有看到設定size的code
但他也是從memory中讀值出來而已
static int goldfish_nand_init_device(struct goldfish_nand *nand, int id)
看mtd->size
但是其他的地方都找不到設定size的地方
後來又跳到emulator的source裡看(mydroid/external/qemu)
首先發現了qemu可以讓你指定nand
"-nand name[,readonly][,size=size][,pagesize=size][,extrasize=size][,erasepages=pages][,initfile=file][,file=file]"
然後發現
android在emulator的options裡有加讓你設定nand size的option
-partition-size system/data partition size in MBs
所以 結論就是
在emulator後面加上 -partition-size 就可以設定system userdata image的大小了
# cat /proc/mtd
dev: size erasesize name
mtd0: 07c20000 00020000 "system"
mtd1: 07c20000 00020000 "userdata"
mtd2: 04000000 00020000 "cache"
花了很多時間才找到XD
首先從Android build system講起
在mydroid/build/core/definitions.mk裡
有個
define assert-max-file-size的 function
原本以為只要指定
BOARD_FLASH_BLOCK_SIZE 跟BOARD_USERDATAIMAGE_MAX_SIZE
就可以了
但發現他這只是作個檢查的動作而已
不過他這有講到 /proc/mtd的東西
然後看了其他的code
也都是去讀 /proc/mtd 來作partition
dev: size erasesize name
mtd0: 04000000 00020000 "system"
mtd1: 04000000 00020000 "userdata"
mtd2: 04000000 00020000 "cache
然後去checkout android linux kernel的code
下載完首先要switch 到有goldfish的branch
不然預設是msm 裡面沒有goldfish的driver 編kernel也會有error
會跳到linux kernel裡面看的原因是有的embedded linux
會把mtd 的size name 等的information寫在 /drivers/mtd/map下
一個叫mtd_parition的struct裡
在drivers/mtd/devices/goldfish_nand.c下 有看到設定size的code
但他也是從memory中讀值出來而已
static int goldfish_nand_init_device(struct goldfish_nand *nand, int id)
看mtd->size
但是其他的地方都找不到設定size的地方
後來又跳到emulator的source裡看(mydroid/external/qemu)
首先發現了qemu可以讓你指定nand
"-nand name[,readonly][,size=size][,pagesize=size][,extrasize=size][,erasepages=pages][,initfile=file][,file=file]"
然後發現
android在emulator的options裡有加讓你設定nand size的option
-partition-size
所以 結論就是
在emulator後面加上 -partition-size 就可以設定system userdata image的大小了
# cat /proc/mtd
dev: size erasesize name
mtd0: 07c20000 00020000 "system"
mtd1: 07c20000 00020000 "userdata"
mtd2: 04000000 00020000 "cache"
Thursday, September 3, 2009
Gold linker
Linker Part1
http://www.airs.com/blog/archives/38
妙的是 levine有留comment喔
可惜lan回 : I don’t actually have a copy to hand....
Linker Part2
http://www.airs.com/blog/archives/39
有點講歷史的感覺
Linker Part3
http://www.airs.com/blog/archives/40
Linker Part4
http://www.airs.com/blog/archives/41
講到了Procedure Linkage Table, Global Offset Table
ELF spec也有講到這東西
PLT:
GOT:
The program linker will create the dynamic relocations which the dynamic linker will use to initialize the GOT at runtime. Unlike the PLT, the dynamic linker always fully initializes the GOT when the program start
GOT會被存在%ebx裡
Linker Part5
http://www.airs.com/blog/archives/42
有介紹到 ELF symbol visibility
不過..... 在ELF spec 跟System V ABI都沒看到這個
原來 這是在System V ABI的update裡
http://www.sco.com/developers/gabi/2000-07-17/contents.html
Linker Part6
http://www.airs.com/blog/archives/43
講Relocation
in general a relocation has a type, a symbol, an offset into the contents, and an addend.
然後講linker怎麼把他轉成executable
Linker Part7
http://www.airs.com/blog/archives/44
Thread Local Storage
comment裡有提到幾個resource
http://dlc.sun.com/pdf/817-1984/817-1984.pdf
http://people.redhat.com/drepper/tls.pdf
http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt
Linker Part8
http://www.airs.com/blog/archives/45
ELF Segments
Linker Part9
http://www.airs.com/blog/archives/46
Symbol Versions
Linker Part10
http://www.airs.com/blog/archives/47
Parellel Linking
Linker Part11
http://www.airs.com/blog/archives/48
Archives
Linker Part12
http://www.airs.com/blog/archives/49
Symbol Resolution
Linker Part13
http://www.airs.com/blog/archives/50
Symbol Version Redux
Linker Part14
http://www.airs.com/blog/archives/51
Linking Time Optimization
Linker Part15
http://www.airs.com/blog/archives/52
COMDAT sections
Linker Part16
http://www.airs.com/blog/archives/53
C++ template instantiation
Linker Part17
http://www.airs.com/blog/archives/54
Warning Symbols
Linker Part18
http://www.airs.com/blog/archives/55
Incremental Linking
Linker Part19
http://www.airs.com/blog/archives/56
__start and __stop symbols
Linker Part20
http://www.airs.com/blog/archives/57
Gold linker update
http://www.airs.com/blog/archives/38
妙的是 levine有留comment喔
可惜lan回 : I don’t actually have a copy to hand....
Linker Part2
http://www.airs.com/blog/archives/39
有點講歷史的感覺
Linker Part3
http://www.airs.com/blog/archives/40
Linker Part4
http://www.airs.com/blog/archives/41
講到了Procedure Linkage Table, Global Offset Table
ELF spec也有講到這東西
PLT:
GOT:
The program linker will create the dynamic relocations which the dynamic linker will use to initialize the GOT at runtime. Unlike the PLT, the dynamic linker always fully initializes the GOT when the program start
GOT會被存在%ebx裡
Linker Part5
http://www.airs.com/blog/archives/42
有介紹到 ELF symbol visibility
不過..... 在ELF spec 跟System V ABI都沒看到這個
原來 這是在System V ABI的update裡
http://www.sco.com/developers/gabi/2000-07-17/contents.html
Linker Part6
http://www.airs.com/blog/archives/43
講Relocation
in general a relocation has a type, a symbol, an offset into the contents, and an addend.
然後講linker怎麼把他轉成executable
Linker Part7
http://www.airs.com/blog/archives/44
Thread Local Storage
comment裡有提到幾個resource
http://dlc.sun.com/pdf/817-1984/817-1984.pdf
http://people.redhat.com/drepper/tls.pdf
http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt
Linker Part8
http://www.airs.com/blog/archives/45
ELF Segments
Linker Part9
http://www.airs.com/blog/archives/46
Symbol Versions
Linker Part10
http://www.airs.com/blog/archives/47
Parellel Linking
Linker Part11
http://www.airs.com/blog/archives/48
Archives
Linker Part12
http://www.airs.com/blog/archives/49
Symbol Resolution
Linker Part13
http://www.airs.com/blog/archives/50
Symbol Version Redux
Linker Part14
http://www.airs.com/blog/archives/51
Linking Time Optimization
Linker Part15
http://www.airs.com/blog/archives/52
COMDAT sections
Linker Part16
http://www.airs.com/blog/archives/53
C++ template instantiation
Linker Part17
http://www.airs.com/blog/archives/54
Warning Symbols
Linker Part18
http://www.airs.com/blog/archives/55
Incremental Linking
Linker Part19
http://www.airs.com/blog/archives/56
__start and __stop symbols
Linker Part20
http://www.airs.com/blog/archives/57
Gold linker update
Tuesday, August 25, 2009
把Android裡的key 轉成 keystore
update 2011.01.18
之前的link已經不見了 所以重新update一下
http://en.wikipedia.org/wiki/PKCS
java的keystore(jks)算是pkcs12的部分
但由於jks是sun的proprietary的format
所以openssl沒法處理jks 要先把他轉成pkcs12再用keytool來轉
首先要先把 private key (pkcs8) 從DER format轉成PEM format
openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem
然後要把private key 跟public key 轉成pkcs12
openssl pkcs12 -export -in platform.x509.pem -inkey platform.pem -out platform.pkcs12
最後用keytool把他轉成jks
keytool -importkeystore -srckeystore platform.pkcs12 -srcstoretype pkcs12 -srcstorepass android -destkeystore platform.jks -deststoretype jks -deststorepass PASSWORD
之前的link已經不見了 所以重新update一下
http://en.wikipedia.org/wiki/PKCS
java的keystore(jks)算是pkcs12的部分
但由於jks是sun的proprietary的format
所以openssl沒法處理jks 要先把他轉成pkcs12再用keytool來轉
首先要先把 private key (pkcs8) 從DER format轉成PEM format
openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem
然後要把private key 跟public key 轉成pkcs12
openssl pkcs12 -export -in platform.x509.pem -inkey platform.pem -out platform.pkcs12
最後用keytool把他轉成jks
keytool -importkeystore -srckeystore platform.pkcs12 -srcstoretype pkcs12 -srcstorepass android -destkeystore platform.jks -deststoretype jks -deststorepass PASSWORD
注意的是 產生的alias是1 還不知道怎麼改alias就是了.......
keytool -list -keystore platform.jks -storetype jks -storepass PASSWORDKeystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
1, Jan 18, 2011, PrivateKeyEntry,
Certificate fingerprint (MD5): 8D:DB:34:2F:2D:A5:40:84:02:D7:56:8A:F2:1E:29:F9在build.properties 加上key.store=platform.jks
key.alias=1
最後 ant release 再打上PASSWORD就好了
2011.06.13===== java keystore to certificate + private =========keytool -export -alias 1 -keystore platform.jks -file exported-der.crtopenssl x509 -in exported-der.crt -inform der > platform.x509.pem 就變回原來的x509 certificate
至於private key目前查到的結果都是keytool沒辦法export private key都要另外下載個ExportedPriv.java來作export的動作
Reference :http://conshell.net/wiki/index.php/OpenSSL_to_Keytool_Conversion_tipshttp://conshell.net/wiki/index.php/Keytool_to_OpenSSL_Conversion_tips
http://www.herongyang.com/crypto/Key_Formats_PKCS8_PKCS12_4.html
Subscribe to:
Posts (Atom)