01
02 umask 0027
03 export TMPDIR=/data/local/tmp <===tmpフォルダ
04 mkdir -p $TMPDIR
05 chmod 1777 $TMPDIR
06
07 if [ ! -d /system/b2g ]; then
08
09 log -p W "No /system/b2g directory. Attempting recovery."
10 if [ -d /system/b2g.bak ]; then
11 if ! mount -w -o remount /system; then
12 log -p E "Failed to remount /system read-write"
13 fi
14 if ! mv /system/b2g.bak /system/b2g; then
15 log -p E "Failed to rename /system/b2g.bak to /system/b2g"
16 fi
17 mount -r -o remount /system
18 if [ -d /system/b2g ]; then
19 log "Recovery successful."
20 else
21 log -p E "Recovery failed."
22 fi
23 else
24 log -p E "Recovery failed: no /system/b2g.bak directory."
25 fi
26 fi
27
28 LD_PRELOAD="/system/b2g/libmozglue.so"
29 if [ -f "/system/b2g/libdmd.so" ]; then
30 echo "Running with DMD."
31 LD_PRELOAD="/system/b2g/libdmd.so $LD_PRELOAD"
32 export DMD="1"
33 fi
34 export LD_PRELOAD
35
36 export LD_LIBRARY_PATH=/vendor/lib:/system/lib:/system/b2g
37 export GRE_HOME=/system/b2g
38 exec /system/b2g/b2g
logcat(Android Debug Monitor)へ出力する
root@android:/ # log
USAGE: log [-p priorityChar] [-t tag] message
priorityChar should be one of:
v,d,i,w,e
b2gはサービスなんだ。
init.b2g.rc
service fakeperm /system/bin/fakeperm
class main
user root
service b2g /system/bin/b2g.sh
class main
onrestart restart media
service rilproxy /system/bin/rilproxy
class main
socket rilproxy stream 660 root system
user root
group radio
on boot
exec /system/bin/rm -r /data/local/tmp
$ adb shell
root@android:/ # b2g-ps
APPLICATION USER PID PPID VSIZE RSS WCHAN PC NAME
b2g root 115 1 237556 113740 ffffffff 400b6cb0 R /system/b2g/b2g
Usage app_236 236 115 97084 38940 ffffffff 400ae140 S /system/b2g/plugin-container
Homescreen app_250 250 115 109800 52572 ffffffff 40075140 S /system/b2g/plugin-container
root@android:/ # stop b2g
root@android:/ # b2g-ps
APPLICATION USER PID PPID VSIZE RSS WCHAN PC NAME
root@android:/ # start b2g
root@android:/ # b2g-ps
APPLICATION USER PID PPID VSIZE RSS WCHAN PC NAME
b2g root 1036 1 241884 116180 ffffffff 40117140 S /system/b2g/b2g
Usage app_1131 1131 1036 98108 38848 ffffffff 400cf140 S /system/b2g/plugin-container
Homescreen app_1148 1148 1036 114392 59560 ffffffff 400c1c40 R /system/b2g/plugin-container
Customizing the b2g.sh script - Mozilla | MDN