logcat 看到错误
I//system/xbin/run-parts( 1205): sh: applet not found 是把sh中的#!/system/xbin/sh写法改成#!/system/bin/sh,虽然ls到它,但是使用which sh命令得到的才是正确的路径.否则就会出现这个提示.
---------------------
/etc/init.d/Androm: line 39: echo: write error: Invalid argument
/etc/init.d/Androm: line 42: echo: write error: Invalid argument
内核不支持某些参数;
二个值之间分隔符是(空格),却用了(,);
解决方案,直接在网上查看要写入值的这个路径的的值允许什么,或是cat一下,出来看 一下默认值,就可以判定当前的内核是否支持,使用它支持的值即可.
也可以直接在adb shell下面,运行类下面命令来测试
echo "smartassV2" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
-------------------
如在init.d/xxx中安装apk,会出现以下提示,意思就是classpath没有指定
D/AndroidRuntime( 1637):
D/AndroidRuntime( 1637): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 1637): CheckJNI is OFF
D/dalvikvm( 1637): creating instr width table
E/dalvikvm( 1637): ERROR: must specify non-'.' bootclasspath
W/dalvikvm( 1637): JNI_CreateJavaVM failed
E/AndroidRuntime( 1637): JNI_CreateJavaVM failed
I/boot ( 1638): 在 /system/etc/init.d/installApks:/sdcard/apks/com.avast.android.mobilesecurity.apk installed TERM=linux
I/boot ( 1638): ANDROID_PROPERTY_WORKSPACE=8,32768
I/boot ( 1638): PATH=/sbin:/system/sbin:/system/bin:/system/xbin
I/boot ( 1638): PWD=/
I/boot ( 1638): HOME=/
I/boot ( 1638): SHLVL=2
I/boot ( 1638): _=/system/xbin/env
如调用libtery.bsh中的方法,,打印env时,会没有cp信息的,所以,目前我的解决方法是在里面设定.
虽然在init.rc中看到已经设定了,且在adb shell中也看到env存在,
但是不清楚为什么在init.d阶段却没有,怀疑在init.rc之前处理的?
做以下处理后,就可以看到可以正常的使用批量安装了
: ' =========================================================
function name: installApks
parameters: $1 - "-r" search all sub directories for apks, or...
path to directory
$2 - path to directory (if recursize)
returns: void
description:
Installs apks to device using package manager
============================================================= '
function installApks()
{
RECURSIZE=0
case $1 in
-r)
RECURSIZE=1
shift;
;;
esac
APKS_DIR=${1:-/mnt/sdcard/}
declare -a APKS
if busybox [ -d $APKS_DIR ]; then
if busybox [ $RECURSIZE -eq 1 ]; then
APKS=(` busybox find $APKS_DIR -type f -name *.apk -print `);
else
APKS=(` ls $APKS_DIR/*.apk `);
fi
# 环境不存在,需要运行时的java环境出错,不清楚为什么环境还没好,临时解决方案是设定
export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
log -p i -t boot "在 $0:`env`"
for apk in ${APKS[*]}; do
log -p i -t boot "在 $0:$apk installed `pm install -s -r $apk` "
done
fi
}
-------------------
卡在第一屏,
有时修改etc/liberty.bsh中的东西,或是init.d中东西,出错导致init挂掉,而不再加载其它东西.
这时logcat还没有出来,所以,看不到任何信息,
目前还不太清楚使用什么方式得到init加载的进度与详情.
如上面的export bootclasspth放的位置不对,就会导致init卡住.
经过研究init.rc语法,发现
/etc/init.d的东西是通过 在init.rc中的写exec /system/bin/sysinit来执行的.
且发现此此进程,在adb shell中使用相同的语法来运行时,环境跟adb shell是一样的.
但是由init.rc发起的,却不是,
怀疑export只影响shell?init发起的不是?在init.rc中没有找到其它语法.只有一个exec.
但是听说exec是block进程直到完成,如果我在init.d里面用到while+sleep之类的思路,就是会卡住,且也会卡在第一屏.
这是非常的不好的.虽然在考虑上,可能需要处理完init.d的文件再进其它进程,但是我看了一下我的init.d,并不需要这个考虑.
于是修改init.rc中的这块的调用成服务形式(经测试非block,是否会运行了不退出就不清楚,目前exec被block住,只改成service就进入桌面说明这点,但是是否init完就exit,得看ps进程才懂.)
修改方式,发现非常的好用.不block呢.
# 运行/etc/init.d中文件,这些文件的环境是独立的,并没有继承这里的环境
# exec /system/bin/sysinit ,这种方式会block 进程,换种方式运行
service sysinitQidizi /system/bin/sh /system/bin/sysinit
#只运行一次
oneshot
user root
卡屏,且adbd还没有起来无法logcat查看时,
可以进入recovery中,mount -a,把所有的分区加载,然后使用
"%adb%" shell dumpstate > "%temp%\androiddumpstate.txt"
explorer "%temp%\androiddumpstate.txt"
读取所有的log
----------------
关于字体.
经过测试,
/system/fonts/Arial.ttf
是系统正常启动时需要的字体,
它使用的引擎就是skia,下面的错误信息中,后面三个字体并不重要.没了,并不会引起skia出错,也就是不会出现debug这节
但是如果这个字体没了,就直接卡在第一屏动画上了,
且可以从dumpstate中看到如下的信息,
尝试发现它可以通过ln 别的字体成同名(大于3m,如直接使用中文那个字体)也没有问题,也能启动.
04-10 03:35:28.182 D/skia ( 1300): ---- failed to open </system/fonts/Arial.ttf> as a font
04-10 03:35:28.182 D/skia ( 1300): ---- failed to open </system/fonts/Arial-Bold.ttf> as a font
04-10 03:35:28.182 D/skia ( 1300): ---- failed to open </system/fonts/Arial-Italic.ttf> as a font
04-10 03:35:28.182 D/skia ( 1300): ---- failed to open </system/fonts/Arial-BoldItalic.ttf> as a font
04-10 03:35:28.294 I/DEBUG ( 1207): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-10 03:35:28.294 I/DEBUG ( 1207): Build fingerprint: 'Android/libra_passion/passion:2.3.7/MIUI/12.12.12:userdebug/test-keys'
04-10 03:35:28.294 I/DEBUG ( 1207): pid: 1300, tid: 1300 >>> zygote <<<
04-10 03:35:28.294 I/DEBUG ( 1207): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000004
04-10 03:35:28.294 I/DEBUG ( 1207): r0 7ef05384 r1 000d7788 r2 00000078 r3 00000000
04-10 03:35:28.294 I/DEBUG ( 1207): r4 00089fe0 r5 00089fe0 r6 6b223e74 r7 6b21f1dc
04-10 03:35:28.294 I/DEBUG ( 1207): r8 6b223e90 r9 6b2152b4 10 00089ff4 fp 0008b598
04-10 03:35:28.294 I/DEBUG ( 1207): ip 6fd475cc sp 7ef05348 lr 6b13291c pc 6b14c6ec cpsr 60000010
04-10 03:35:28.294 I/DEBUG ( 1207): d0 643a64696f72646e d1 6472656767756265
04-10 03:35:28.294 I/DEBUG ( 1207): d2 4600200073006e6b d3 62006c006c00612e
04-10 03:35:28.294 I/DEBUG ( 1207): d4 0029010800280108 d5 00300410002c0410
04-10 03:35:28.294 I/DEBUG ( 1207): d6 0038041000340410 d7 003d0108003c0108
04-10 03:35:28.294 I/DEBUG ( 1207): d8 0000000000000000 d9 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d10 0000000000000000 d11 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d12 0000000000000000 d13 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d14 0000000000000000 d15 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d16 00016f382cc2fe28 d17 3fe999999999999a
04-10 03:35:28.294 I/DEBUG ( 1207): d18 0000000000000000 d19 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d20 0000000000000000 d21 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d22 0000000000000000 d23 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d24 0000000000000000 d25 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d26 0000000000000000 d27 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d28 0000000000000000 d29 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): d30 0000000000000000 d31 0000000000000000
04-10 03:35:28.294 I/DEBUG ( 1207): scr 80000010
04-10 03:35:28.294 I/DEBUG ( 1207):
04-10 03:35:28.372 I/DEBUG ( 1207): #00 pc 0004c6ec /system/lib/libskia.so
04-10 03:35:28.372 I/DEBUG ( 1207): #01 pc 0004c8a8 /system/lib/libskia.so (_ZN10SkFontHost14CreateTypefaceEPK10SkTypefacePKcNS0_5StyleE)
如果只保留上面那个字体,去掉其它,
会卡在第二屏动画上.且每屏动画不重复播放.
提示少掉的字体如下,并没有提及中文
经过测试,
第二屏到桌面需要二个字体
Clockopia.ttf
DroidSans-Bold.ttf
缺少其中一个都会卡在第二屏动画进不去,第二屏动画一直重复播放.
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/Arial-Bold.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/Arial-Italic.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/Arial-BoldItalic.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/DroidSerif-Regular.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/DroidSerif-Bold.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/DroidSerif-Italic.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/DroidSerif-BoldItalic.ttf> as a font
04-10 04:13:51.422 D/skia ( 2416): ---- failed to open </system/fonts/DroidSansMono.ttf> as a font