补充: zygote(受精卵) –> 图形界面 (普通的linux没有,android有)
解决:
1. android使用的toolbox命令集,使用不方便
答: 使用busybox进行替代
2. 每次开机的时候都会手动去启动androidvncserver(图形界面如:qt)
答: 开机就执行
ubuntu 的启动过程
android源码编译步骤:
1. source build/envsetup.sh //提供命令help, m, croot, mmm, lunch, 都是函数
2. lunch full_fs210-eng // 实际时候设置了几个环境变量
|
TARGET_PRODUCT=full_fs210
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
3. make ---> out/target/product/fs210
add_lunch_combo full-eng 将一个产品的名字加入到用户选择的列表中
- Android启动流程–学会使用init.rc (相当linux 的/etc/inittab,/etc/init.d/rcS,/etc/fstab)
a init.rc的语法(参考 system/core/init/readme.txt)
主要关注:action 、 service
b action是一个命令的 集合
Actions take the form of:
on <trigger> //当某个时间执行以下命令
<command>
<command>
c service表示一个后台服务:
service <name> <pathname> [ <argument> ]*
<option>
<option>
例子:
class_start core
class_start main //批量启动(在service中有添加 class main的)
service zygote /system/bin/app_process -Xzygote
/system/bin --zygote --start-system-server
class main // 将多个服务归类,统一的批量的去启动
socket zygote stream 666 // /dev/socket/zygote
onrestart write /sys/android_power/request_state wake
onrestart write /sys/power/state on
onrestart restart media
onrestart restart netd
d 提供busybox的命令:
1 编译busybox 后将sbin、bin拷贝到 -C /opt/rootfs_dir/system/busybox
2 替换shell
$ vim init.rc
438 #service console /system/bin/sh
service console /system/busybox/bin/ash
console
disabled
group log
3 设置path
17 export PATH system/busybox/bin:/system/busybox/sbin:/sbin:/vendor/bin:\
/system/sbin:/system/bin:/system/xbin
e 开机的就直接启动androidvncserver
$ mv androidvncserver system/bin/
$ vim init.rc
service vncserver /system/bin/androidvncserver
class main