分类: LINUX
2011-04-28 15:49:58
连接:
http://purerain2002.spaces.live.com/blog/cns!D5D0B8EF1CE02864!1243.entry
1. 修改测试用应用apk,安装位置为auto,internalOnly,用adb install均成功安装到内部存储器上。安装位置设置为preferExternal,安装不成功。
2.修改平台的安装位置,
adb shell pm setInstallLocation [0/auto] [1/internal] [2/external]
0, 1 安装程序成功;2 安装程序成功,但是装在内部区了;
=============
综上,外部安装在frescale平台上是有问题的。
3. 通过setting菜单 move to sdcar ,同样failed。
===============
move的方式也是有问题的。
4. 通过move 错误的log查看
I/PackageHelper( 2557): Size of container 2 MB 14305 bytes
D/VoldCmdListener( 2129): asec create com.tecom.welly.test-1 2 fat {} 10004
E/Vold ( 2129): Error opening devmapper (No such file or directory)
E/Vold ( 2129): ASEC device mapping failed (No such file or directory)
E/PackageHelper( 2557): Failed to create secure container com.tecom.welly.test-1
E/DefContainer( 2557): Failed to create container com.tecom.welly.test-1
I/PackageHelper( 2211): Forcibly destroying container com.tecom.welly.test-1
D/VoldCmdListener( 2129): asec destroy com.tecom.welly.test-1 force
E/Vold ( 2129): Failed to unlink asec ‘/mnt/secure/asec/com.tecom.welly.test)
I/PackageHelper( 2211): Failed to destroy container com.tecom.welly.test-1
I/PackageHelper( 2211): Forcibly destroying container com.tecom.welly.test-1
D/VoldCmdListener( 2129): asec destroy com.tecom.welly.test-1 force
E/Vold ( 2129): Failed to unlink asec ‘/mnt/secure/asec/com.tecom.welly.test)
I/PackageHelper( 2211): Failed to destroy container com.tecom.welly.test-1
I/PackageHelper( 2211): Forcibly destroying container com.tecom.welly.test-1
I/PackageHelper( 2211): Failed to destroy container com.tecom.welly.test-1
D/VoldCmdListener( 2129): asec destroy com.tecom.welly.test-1 force
E/Vold ( 2129): Failed to unlink asec ‘/mnt/secure/asec/com.tecom.welly.test)
I/dalvikvm( 2302): Jit: resizing JitTable from 4096 to 8192
可知 devmapper 没有打开。在freecale的代码中找到相应的code
system/vold/Devmapper.cpp 中
int Devmapper::create(const char *name, const char *loopFile, const char *key,
unsigned int numSectors, char *ubuffer, size_t len) {
char *buffer = (char *) malloc(4096);
if (!buffer) {
SLOGE(“Error allocating memory (%s)”, strerror(errno));
return -1;
}
int fd;
if ((fd = open(“/dev/device-mapper”, O_RDWR)) < 0) {
SLOGE(“Error opening devmapper (%s)”, strerror(errno));
free(buffer);
return -1;
}
出错的代码就在这里。
===============
综上,可以推导fd = open(“/dev/device-mapper”, O_RDWR)) 这句应该open没有成功,为什么呢?
目前的解决方案,通过google open code project中的某个项目和搜索,知道是kernel中有一些modules没有加上。
====================
It looks like your kernel is missing device mapper support:
CONFIG_BLK_DEV_DM, (depends on CONFIG_MD)
Also enable DM_CRYPT, DM_UEVENT and CRYPTO_TWOFISH (needed by asec).
在kernel的config中加上一些项目
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_DEBUG=y
CONFIG_DM_CRYPT=y
CONFIG_DM_UEVENT=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AUTHENC=y
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
编译后,升级kernel。
=============
测试:
1. 通过在sdcard 的app目录中拷贝apk,并修改其属性来安装apk。通过这种方式安装,move to sdcard 失败。
apk本身的属性为sdcard的时候,安装不会失败。(同以前安装失败对比)
2. 通过adb install 安装apk,在apk的属性为auto或者sd card的情况下,move to sdcard 和 move to phone 均告成功。
=========