android接触--新版本编译OK,系统却起不来

http://blog.csdn.net/raining_heart/article/details/8504536

对于一个新版本系统,首先是移植问题。虽然系统是别人修改好的,但我还是花了很大量的时间才跑起来它。

我发了个贴,没人回答,还是自己搞定,靠自己更实在。

1.android系统启动后错误:Unable to open persistent property directory

系统到这里就停止了,屏幕黑屏,有什么解决的办法呢?
    4.714803@0] <--GT msg--><1> /proc/gt82x_dbg created
[    4.720115@0] Warning: unable to open an initial console.
[    4.725317@0] Freeing init memory: 1824K
[    4.730604@1] init: skipping insecure file '/default.prop'
[    4.734521@1] init: skipping insecure file '/init.rc'
[    9.228365@1] init: Timed out waiting for /dev/.coldboot_done
[    9.239168@0] osd0=>x:0 ,y:0,w:1280,h:720
[    9.239173@0]  osd1=> x:0,y:0,w:18,h:18 
[    9.255924@0] init: Unable to open persistent property directory /data/property errno: 2
[    9.258814@0] init: Cannot read /dev/mtd/mtd9: -1.
[    9.263254@0] init: Cannot read /dev/mtd/mtd9: -1.
[    9.268077@0] init: Cannot read /dev/mtd/mtd9: -1.
[    9.272805@0] init: Cannot read /dev/mtd/mtd9: -1.
[    9.277712@0] init: Cannot read /dev/mtd/mtd9: -1.

我注销了init.c里面对文件权限的限制,现在内核启动起来了,进入第二张启动画面,可是又出现错误:
Created socket '/dev/socket/zygote' with mode '660', user '0', group '1000'

root@android:/ # [   53.644805@1] init: starting 'surfaceflinger'
[   53.651853@0] init: 'surfaceflinger' (pid: 3425) started
[   53.871436@1] init: waitpid returned pid 3425, status = 00000000
[   53.871893@1] init: process 'surfaceflinger', pid 3425 exited
[   53.877621@1] init: process 'surfaceflinger' killing any children in process group
[   53.885208@1] init: service 'zygote' (pid: 3394) is being killed
[   53.891566@1] init: starting 'zygote'
[   53.895834@1] init: Created socket '/dev/socket/zygote' with mode '660', user '0', group '1000'
[   53.903660@1] init: 'zygote' (pid: 3427) started
[   53.908380@1] init: waitpid returned pid 3394, status = 00000009
[   53.914120@1] init: untracked pid 3394 exited
[   53.918455@1] init: waitpid returned pid 3403, status = 00000009
[   53.924520@1] init: untracked pid 3403 exited


从logcat分析,怀疑跟显卡驱动有关,在android上 insmod ump.ko ,出现:
version magic xxxxx should be xxxxx 。(exec format error)
网上说是内核版本不一致,但是上面的xxxx版本一模一样,就算手动改了也一样。所以排除版本有问题。
有谁能看到这个帖子并在解决呢?
locat是循环的,这应该就是Zygote的机制。
部分logcat如下:
D/dalvikvm( 4585): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4585): GC_EXPLICIT freed <1K, 1% free 5975K/6019K, paused 1ms+1ms, total 18ms
I/dalvikvm( 4585): System server process 4591 has been created
I/Zygote  ( 4585): Accepting command socket connections
D/dalvikvm( 4591): WAIT_FOR_CONCURRENT_GC blocked 0ms
E/BatteryService( 4591): acOnlinePath not found
E/BatteryService( 4591): usbOnlinePath not found
E/BatteryService( 4591): batteryStatusPath not found
E/BatteryService( 4591): batteryHealthPath not found
E/BatteryService( 4591): batteryPresentPath not found
E/BatteryService( 4591): batteryCapacityPath not found
E/BatteryService( 4591): batteryVoltagePath not found
E/BatteryService( 4591): batteryTemperaturePath not found
E/BatteryService( 4591): batteryTechnologyPath not found
I/sysproc ( 4591): Entered system_init()
I/sysproc ( 4591): ServiceManager: 0x5d004da0
D/SensorService( 4591): nuSensorService starting...
E/SensorService( 4591): couldn't load sensors module (No such file or directory)
I/sysproc ( 4591): System server: starting Android runtime.
I/sysproc ( 4591): System server: starting Android services.
I/sysproc ( 4591): System server: entering thread pool.
I/SystemServer( 4591): Entered the Android system server!
I/SystemServer( 4591): Entropy Mixer
I/SystemServer( 4591): Power Manager
I/SystemServer( 4591): Activity Manager
I/ActivityManager( 4591): Memory class: 128
W/UsageStats( 4591): Usage stats version changed; dropping
D/dalvikvm( 4591): GC_CONCURRENT freed 328K, 6% free 6101K/6471K, paused 12ms+11ms, total 44ms
I/ServiceManager( 4591): Waiting for service SurfaceFlinger...
I/ServiceManager( 4591): Waiting for service SurfaceFlinger...
I/ServiceManager( 4591): Waiting for service SurfaceFlinger...
I/SurfaceFlinger( 4608): amsysfs_set_sysfs_str /sys/class/graphics/fb0/blank= 0
I/SurfaceFlinger( 4608): SurfaceFlinger is starting
I/SurfaceFlinger( 4608): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...
E/[Gralloc-ERROR]( 4608): int alloc_device_open(const hw_module_t*, char const*, hw_device_t**):441 UMP open failed with 1
E/FramebufferNativeWindow( 4608): couldn't open framebuffer HAL (Operation not permitted)
E/[Gralloc-ERROR]( 4608): int alloc_device_open(const hw_module_t*, char const*, hw_device_t**):441 UMP open failed with 1
E/FramebufferNativeWindow( 4608): couldn't open gralloc HAL (Operation not permitted)
E/SurfaceFlinger( 4608): Display subsystem failed to initialize. check logs. exiting...
I/ServiceManager( 2248): service 'entropy' died
I/ServiceManager( 2248): service 'power' died
I/ServiceManager( 2248): service 'sensorservice' died
D/AndroidRuntime( 4610): 
D/AndroidRuntime( 4610): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
D/AndroidRuntime( 4610): CheckJNI is ON
D/dalvikvm( 4610): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 4610): Added shared lib libjavacore.so 0x0
D/dalvikvm( 4610): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 4610): Added shared lib libnativehelper.so 0x0
I/ethernet( 4610): Loading ethernet jni class
I/SamplingProfilerIntegration( 4610): Profiling disabled.
I/Zygote  ( 4610): Preloading classes...
D/dalvikvm( 4610): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4610): GC_EXPLICIT freed 37K, 84% free 414K/2560K, paused 1ms+1ms, total 3ms
D/dalvikvm( 4610): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4610): GC_EXPLICIT freed 4K, 82% free 480K/2560K, paused 0ms+0ms, total 2ms
W/Zygote  ( 4610): Class not found for preloading: android.animation.ValueAnimator$2
W/Zygote  ( 4610): Class not found for preloading: android.animation.ValueAnimator$3
W/Zygote  ( 4610): Class not found for preloading: android.animation.ValueAnimator$4
W/Zygote  ( 4610): Class not found for preloading: android.animation.ValueAnimator$5
D/dalvikvm( 4610): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4610): GC_EXPLICIT freed 25K, 80% free 516K/2560K, paused 0ms+0ms, total 3ms
D/dalvikvm( 4610): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4610): GC_EXPLICIT freed 26K, 79% free 544K/2560K, paused 0ms+0ms, total 3ms
D/dalvikvm( 4610): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4610): GC_EXPLICIT freed 14K, 78% free 584K/2560K, paused 0ms+0ms, total 3ms
W/Zygote  ( 4610): Class not found for preloading: android.content.res.Resources$1
W/Zygote  ( 4610): Class not found for preloading: android.database.sqlite.SQLiteCompiledSql
D/dalvikvm( 4610): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 4610): GC_EXPLICIT freed 28K, 77% free 611K/2560K, paused 0ms+0ms, total 3ms
W/Zygote  ( 4610): Class not found for preloading: android.database.sqlite.SQLiteDatabase$DatabaseReentrantLock

android 成功启动。
根本原因还在于驱动。由于系统编译时的驱动版本原因,模块上有modversions选项的约束,所以导致系统自动加载失败。
解决原因,通过logcat或serial找出问题驱动,尝试手动加载。
如果手动加载原因是内核版本不同,找出内核版本区别。修改驱动版本或内核版本。
如果是因为多了modversions,则可以重新编译模块,去掉modversions。如果是第三方驱动,则配置内核属性,make menuconfig,加上modversions选项。
下面引用网上的一段话:
当你的内核在编译时使能了CONFIG_MODVERSIONS选项,那么你插入的模块可以是一下两种情况:
1,编译时没有带CONFIG_MODVERSIONS选项,但版本必须与内核的版本一致;
2,编译时如果带有CONFIG_MODVERSIONS选项,那么模块的版本将没有限制;
而通常内核在编译是带有CONFIG_MODVERSIONS选项的,所以就出现了文章开头出现的情况:内核和模块的版本不一致。同时我们也就找到了相应的解决办法--在模块编译时选择CONFIG_MODVERSIONS选项,这样我们就可以解决版本不匹配的问题了

总结:

在开始,系统起不来,内核都初始化不成功,从串口的提示信息发现问题:

init: skipping insecure file '/default.prop'

init: skipping insecure file '/init.rc'

上面这两个信息意思是跳过那两个初始化文件。因为init.rc和default.rc都是android启动的关键文件。于是此时找到android启动分析(网上资料大把,中国就是这样,同一个问题的资料都是重复性的复制)。android启动分析可以知道android依赖于linux内核,linux内核启动油init进程开始,init进程会读取init.rc来做一些初始和启动一些服务。default.prop保存着android的一些环境设置,具体生成跟system.prop和build.prop有关。

可见,这两个文件非常重要。于是根据提示,找到错误的代码。

在源码目录/system/core/init下分别有init.c和util.c,init.c调用util的void *read_file(const char *fn, unsigned *_sz)函数,仔细看就发现启动过程对启动文件权限有限制。

166     if ((sb.st_mode & (S_IWGRP | S_IWOTH)) != 0) {
167         ERROR("skipping insecure file '%s'\n", fn);
168         goto oops;
169     }
文件必须不拥有”用户写“和”其他用户写“权限。根据网上说法,这是4.1为安全做的改动,这个我不理,直接注释掉这四句。重新编译,linux内核起来了。

当然注释不是根本做法,后面老老实实在源码找到那些文件,具体用find命令找,然后修改,去掉”用户写“和”其他用户写“权限。内核启动后查看log发现会不只一两个这样的文件被跳过,都同样方法改。

接下来就是真实的android起不来了。

当然最后解决了。能发现问题的方法是通过logcat。因为刚开始内核启动不了只能通过串口的错误提示,但是,内核起来了,adb也开了,logcat里包含了真实的系统错误提示。

这算了阶段问题把,linux的问题找底层,底层是串口,android的问题找logcat,logcat是google的。

根据logcat就能发现问题了。

最后整个系统就起来了。哎,唯一遗憾的是花费的时间太长了,中间有一大部分时间是走在错误的方向上,只因为没人指导,我这实习生够蛋疼的,旁边高手众多啊,自己摸索吧。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译Filament的Android版本程序需要以下步骤: 1. 下载并安装Android Studio:访问Android开发者网站(developer.android.com),下载并安装最新版本Android Studio。这是一个集成开发环境(IDE),提供了丰富的工具和库编译Android应用程序。 2. 克隆Filament仓库:在命令行或Git Bash中,使用命令`git clone https://github.com/google/filament.git`克隆Filament的Git仓库到本地。 3. 打开Android Studio并导入项目:启动Android Studio,点击“File”菜单,选择“Open”选项,然后导航到刚刚克隆的Filament目录并选择“build.gradle”文件。点击“OK”来导入项目。 4. 配置编译选项:等待Android Studio完成导入过程后,点击“File”菜单,选择“Project Structure”选项。在弹出的对话框中,选择“SDK Location”并确认已正确设置Android SDK的路径。 5. 构建项目:在Android Studio的工具栏上找到“Sync Project with Gradle Files”的按钮,并点击它来同步Gradle构造文件。然后再点击工具栏上的“Build”按钮,选择“Build Bundle(s) / APK(s)”选项。这将编译并构建Filament应用程序。 6. 安装和运行:编译成功后,在构建输出目录中找到生成的APK文件。将手机通过USB连接到计算机,并在开发者选项中启用USB调试模式。使用ADB(Android Debug Bridge)命令,将APK文件安装到手机上。运行应用程序并验证其正常工作。 以上是在Windows系统编译Filament的Android版本程序的基本步骤。尽管这里提供了一个大致的指南,但具体的操作可能会因为系统配置和软件版本的不同而有所不同。为了更好地理解和完成这个过程,建议查阅Filament的官方文档和与Android开发相关的文档。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值