motafoca

froyo init

Jul 11th, 2011
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.47 KB | None | 0 0
  1.  
  2. on emmc
  3.  
  4. mkdir /system
  5. mkdir /data 0771 system system
  6. mkdir /persist 0771 system system
  7. mkdir /cache 0770 system cache
  8. devwait /dev/block/mmcblk0p12
  9. mount ext4 /dev/block/mmcblk0p12 /system ro barrier=0
  10. devwait /dev/block/mmcblk0p13
  11. exec /system/bin/e2fsck -p /dev/block/mmcblk0p13
  12. mount ext4 /dev/block/mmcblk0p13 /data nosuid nodev barrier=0
  13. mount ext4 /dev/block/mmcblk0p14 /persist nosuid nodev barrier=0
  14.  
  15. on nand
  16.  
  17. mkdir /system
  18. mkdir /data 0771 system system
  19. mkdir /persist 0771 system system
  20. mkdir /cache 0770 system cache
  21. # Mount /system rw first to give the filesystem a chance to save a checkpoint
  22. mount yaffs2 mtd@system /system
  23. #mount yaffs2 mtd@system /system ro remount
  24. mount yaffs2 mtd@userdata /data nosuid nodev
  25. mount yaffs2 mtd@persist /persist nosuid nodev
  26. mount yaffs2 mtd@cache /cache nosuid nodev
  27.  
  28.  
  29. on init
  30.  
  31. sysclktz 0
  32.  
  33. loglevel 3
  34.  
  35. # setup the global environment
  36. export PATH /sbin:/system/sbin:/system/bin:/system/xbin
  37. export LD_LIBRARY_PATH /system/lib
  38. export ANDROID_BOOTLOGO 1
  39. export ANDROID_ROOT /system
  40. export ANDROID_ASSETS /system/app
  41. export ANDROID_DATA /data
  42. export EXTERNAL_STORAGE /mnt/sdcard
  43. export ASEC_MOUNTPOINT /mnt/asec
  44. export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
  45.  
  46. # Backward compatibility
  47. symlink /system/etc /etc
  48. symlink /sys/kernel/debug /d
  49.  
  50. # create mountpoints
  51. mkdir /mnt 0775 root system
  52. mkdir /mnt/sdcard 0000 system system
  53.  
  54. # Create cgroup mount point for cpu accounting
  55. mkdir /acct
  56. mount cgroup none /acct cpuacct
  57. mkdir /acct/uid
  58.  
  59. # Backwards Compat - XXX: Going away in G*
  60. symlink /mnt/sdcard /sdcard
  61.  
  62. mkdir /config 0500 root root
  63.  
  64. # Directory for putting things only root should see.
  65. mkdir /mnt/secure 0700 root root
  66.  
  67. # Directory for staging bindmounts
  68. mkdir /mnt/secure/staging 0700 root root
  69.  
  70. # Directory-target for where the secure container
  71. # imagefile directory will be bind-mounted
  72. mkdir /mnt/secure/asec 0700 root root
  73.  
  74. # Secure container public mount points.
  75. mkdir /mnt/asec 0700 root system
  76. mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
  77.  
  78. mount rootfs rootfs / ro remount
  79.  
  80. write /proc/sys/kernel/panic_on_oops 1
  81. write /proc/sys/kernel/hung_task_timeout_secs 0
  82. write /proc/cpu/alignment 4
  83. write /proc/sys/kernel/sched_latency_ns 10000000
  84. write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
  85. write /proc/sys/kernel/sched_compat_yield 1
  86. write /proc/sys/kernel/sched_child_runs_first 0
  87.  
  88. # Create cgroup mount points for process groups
  89. mkdir /dev/cpuctl
  90. mount cgroup none /dev/cpuctl cpu
  91. chown system system /dev/cpuctl
  92. chown system system /dev/cpuctl/tasks
  93. chmod 0777 /dev/cpuctl/tasks
  94. write /dev/cpuctl/cpu.shares 1024
  95.  
  96. mkdir /dev/cpuctl/fg_boost
  97. chown system system /dev/cpuctl/fg_boost/tasks
  98. chmod 0777 /dev/cpuctl/fg_boost/tasks
  99. write /dev/cpuctl/fg_boost/cpu.shares 1024
  100.  
  101. mkdir /dev/cpuctl/bg_non_interactive
  102. chown system system /dev/cpuctl/bg_non_interactive/tasks
  103. chmod 0777 /dev/cpuctl/bg_non_interactive/tasks
  104. # 5.0 %
  105. write /dev/cpuctl/bg_non_interactive/cpu.shares 52
  106.  
  107. # mount mtd partitions
  108. # Mounting of system/userdata is moved to 'on emmc' and 'on nand' sections
  109. # We chown/chmod /data again so because mount is run as root + defaults
  110. chown system system /data
  111. chmod 0771 /data
  112.  
  113. # Mounting of persist is moved to 'on emmc' and 'on nand' sections
  114. # We chown/chmod /persist again so because mount is run as root + defaults
  115. chown system system /persist
  116. chmod 0771 /persist
  117.  
  118. # Create dump dir and collect dumps.
  119. # Do this before we mount cache so eventually we can use cache for
  120. # storing dumps on platforms which do not have a dedicated dump partition.
  121.  
  122. mkdir /data/dontpanic
  123. chown root log /data/dontpanic
  124. chmod 0750 /data/dontpanic
  125.  
  126. # Collect apanic data, free resources and re-arm trigger
  127. copy /proc/apanic_console /data/dontpanic/apanic_console
  128. chown root log /data/dontpanic/apanic_console
  129. chmod 0640 /data/dontpanic/apanic_console
  130.  
  131. copy /proc/apanic_threads /data/dontpanic/apanic_threads
  132. chown root log /data/dontpanic/apanic_threads
  133. chmod 0640 /data/dontpanic/apanic_threads
  134.  
  135. write /proc/apanic_console 1
  136.  
  137. # Same reason as /data above
  138. chown system cache /cache
  139. chmod 0770 /cache
  140.  
  141. # This may have been created by the recovery system with odd permissions
  142. chown system cache /cache/recovery
  143. chmod 0770 /cache/recovery
  144.  
  145. #change permissions on vmallocinfo so we can grab it from bugreports
  146. chown root log /proc/vmallocinfo
  147. chmod 0440 /proc/vmallocinfo
  148.  
  149. #change permissions on kmsg & sysrq-trigger so bugreports can grab kthread stacks
  150. chown root system /proc/kmsg
  151. chmod 0440 /proc/kmsg
  152. chown root system /proc/sysrq-trigger
  153. chmod 0220 /proc/sysrq-trigger
  154.  
  155. # create basic filesystem structure
  156. mkdir /data/misc 01771 system misc
  157. mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
  158. mkdir /data/misc/bluetooth 0770 system system
  159. mkdir /data/misc/keystore 0700 keystore keystore
  160. mkdir /data/misc/vpn 0770 system system
  161. mkdir /data/misc/systemkeys 0700 system system
  162. mkdir /data/misc/vpn/profiles 0770 system system
  163. # give system access to wpa_supplicant.conf for backup and restore
  164. # ATHENV +++
  165. mkdir /data/misc/wifi 0770 wifi system
  166. mkdir /data/misc/wifi/wapi_certificate 0770 wifi system
  167. chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
  168. chmod 0660 /system/etc/wifi/wpa_supplicant.conf
  169. chmod 0550 /system/etc/init.athwlan.sh
  170. chmod 0550 /system/wifi/wpa_supplicant.sh
  171. chmod 0550 /system/wifi/dhcpcd.sh
  172. chmod 0777 /system/wifi/softmac
  173. chown wifi system /system/wifi/wpa_supplicant.sh
  174. chown wifi system /system/etc/init.athwlan.sh
  175. chown wifi system /system/wifi/dhcpcd.sh
  176. mkdir /data/misc/dhcp 0777 system system
  177. mkdir /data/misc/wifi/sockets 0777 system system
  178. mkdir /data/system 0777 system system
  179. mkdir /data/system/wpa_supplicant 0777 wifi wifi
  180. # ATHENV ---
  181.  
  182. chmod 0777 /system/etc/calibration
  183.  
  184. mkdir /data/local 0771 shell shell
  185. mkdir /data/local/tmp 0771 shell shell
  186. mkdir /data/data 0771 system system
  187. mkdir /data/app-private 0771 system system
  188. mkdir /data/app 0771 system system
  189. mkdir /data/property 0700 root root
  190. mkdir /data/radio 0770 radio radio
  191.  
  192. # create dalvik-cache and double-check the perms
  193. mkdir /data/dalvik-cache 0771 system system
  194. chown system system /data/dalvik-cache
  195. chmod 0771 /data/dalvik-cache
  196.  
  197. # create the lost+found directories, so as to enforce our permissions
  198. mkdir /data/lost+found 0770
  199. mkdir /cache/lost+found 0770
  200.  
  201. # double check the perms, in case lost+found already exists, and set owner
  202. chown root root /data/lost+found
  203. chmod 0770 /data/lost+found
  204. chown root root /cache/lost+found
  205. chmod 0770 /cache/lost+found
  206.  
  207. on boot
  208. # basic network init
  209. ifup lo
  210. hostname localhost
  211. domainname localdomain
  212.  
  213. # set RLIMIT_NICE to allow priorities from 19 to -20
  214. setrlimit 13 40 40
  215.  
  216. # Define the oom_adj values for the classes of processes that can be
  217. # killed by the kernel. These are used in ActivityManagerService.
  218. setprop ro.FOREGROUND_APP_ADJ 0
  219. setprop ro.VISIBLE_APP_ADJ 1
  220. setprop ro.SECONDARY_SERVER_ADJ 2
  221. setprop ro.BACKUP_APP_ADJ 2
  222. setprop ro.HOME_APP_ADJ 4
  223. setprop ro.HIDDEN_APP_MIN_ADJ 7
  224. setprop ro.CONTENT_PROVIDER_ADJ 14
  225. setprop ro.EMPTY_APP_ADJ 15
  226.  
  227. # Define the memory thresholds at which the above process classes will
  228. # be killed. These numbers are in pages (4k).
  229. setprop ro.FOREGROUND_APP_MEM 1536
  230. setprop ro.VISIBLE_APP_MEM 2048
  231. setprop ro.SECONDARY_SERVER_MEM 4096
  232. setprop ro.BACKUP_APP_MEM 4096
  233. setprop ro.HOME_APP_MEM 4096
  234. setprop ro.HIDDEN_APP_MEM 5120
  235. setprop ro.CONTENT_PROVIDER_MEM 5632
  236. setprop ro.EMPTY_APP_MEM 6144
  237.  
  238. # Write value must be consistent with the above properties.
  239. # Note that the driver only supports 6 slots, so we have HOME_APP at the
  240. # same memory level as services.
  241. write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
  242.  
  243. write /proc/sys/vm/overcommit_memory 1
  244. write /proc/sys/vm/min_free_order_shift 4
  245. write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
  246.  
  247. # Set init its forked children's oom_adj.
  248. write /proc/1/oom_adj -16
  249.  
  250. # Tweak background writeout
  251. write /proc/sys/vm/dirty_expire_centisecs 200
  252. write /proc/sys/vm/dirty_background_ratio 5
  253.  
  254. # Adjust socket buffer to enlarge TCP receive window for high bandwidth
  255. write /proc/sys/net/ipv4/tcp_adv_win_scale 1
  256. # Permissions for System Server and daemons.
  257. chown radio system /sys/android_power/state
  258. chown radio system /sys/android_power/request_state
  259. chown radio system /sys/android_power/acquire_full_wake_lock
  260. chown radio system /sys/android_power/acquire_partial_wake_lock
  261. chown radio system /sys/android_power/release_wake_lock
  262. chown radio system /sys/power/state
  263. chown radio system /sys/power/wake_lock
  264. chown radio system /sys/power/wake_unlock
  265. chmod 0660 /sys/power/state
  266. chmod 0660 /sys/power/wake_lock
  267. chmod 0660 /sys/power/wake_unlock
  268. chown system system /sys/class/timed_output/vibrator/enable
  269. chown system system /sys/class/leds/keyboard-backlight/brightness
  270. chown system system /sys/class/leds/lcd-backlight/brightness
  271. chown system system /sys/class/leds/button-backlight/brightness
  272. chown system system /sys/class/leds/jogball-backlight/brightness
  273. chown system system /sys/class/leds/amber/brightness
  274. chown system system /sys/class/leds/amber/device/blink
  275. chown system system /sys/class/leds/red/brightness
  276. chown system system /sys/class/leds/green/brightness
  277. chown system system /sys/class/leds/blue/brightness
  278. chown system system /sys/class/leds/red/device/grpfreq
  279. chown system system /sys/class/leds/red/device/grppwm
  280. chown system system /sys/class/leds/red/device/blink
  281. chown system system /sys/class/leds/red/brightness
  282. chown system system /sys/class/leds/green/brightness
  283. chown system system /sys/class/leds/blue/brightness
  284. chown system system /sys/class/leds/red/device/grpfreq
  285. chown system system /sys/class/leds/red/device/grppwm
  286. chown system system /sys/class/leds/red/device/blink
  287. chown system system /sys/module/sco/parameters/disable_esco
  288. chown system system /sys/kernel/ipv4/tcp_wmem_min
  289. chown system system /sys/kernel/ipv4/tcp_wmem_def
  290. chown system system /sys/kernel/ipv4/tcp_wmem_max
  291. chown system system /sys/kernel/ipv4/tcp_rmem_min
  292. chown system system /sys/kernel/ipv4/tcp_rmem_def
  293. chown system system /sys/kernel/ipv4/tcp_rmem_max
  294. chown root radio /proc/cmdline
  295.  
  296. chown system system /sys/module/g_android/parameters/product_id
  297. chown system system /sys/devices/platform/msm_sdcc.1/polling
  298. chown system system /sys/devices/platform/msm_sdcc.2/polling
  299. chown system system /sys/devices/platform/msm_sdcc.3/polling
  300. chown system system /sys/devices/platform/msm_sdcc.4/polling
  301. chown system system /sys/devices/platform/android_usb/composition
  302. chown system system /sys/devices/platform/android_usb/remote_wakeup
  303.  
  304. # Define TCP buffer sizes for various networks
  305. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  306. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  307. setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
  308. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  309. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  310. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  311. setprop net.tcp.buffersize.lte 4094,87380,196608,4096,16384,196608
  312. setprop net.tcp.buffersize.evdo_b 4094,87380,262144,4096,16384,262144
  313.  
  314. # Assign TCP buffer thresholds to be ceiling value of technology maximums
  315. # Increased technology maximums should be reflected here.
  316. write /proc/sys/net/core/rmem_max 262144
  317. write /proc/sys/net/core/wmem_max 262144
  318.  
  319. ## Add for WAPI Certificate
  320. ## setprop persist.sampling_profiler 1
  321.  
  322. class_start default
  323.  
  324. ## Daemon processes to be run by init.
  325. ##
  326. service console /system/bin/sh
  327. console
  328.  
  329. # adbd is controlled by the persist.service.adb.enable system property
  330. service adbd /sbin/adbd
  331. disabled
  332.  
  333. # adbd on at boot in emulator
  334. on property:ro.kernel.qemu=1
  335. start adbd
  336.  
  337. on property:persist.service.adb.enable=1
  338. start adbd
  339.  
  340. on property:persist.service.adb.enable=0
  341. stop adbd
  342.  
  343. service servicemanager /system/bin/servicemanager
  344. user system
  345. critical
  346. onrestart restart zygote
  347. onrestart restart media
  348.  
  349. service vold /system/bin/vold
  350. socket vold stream 0660 root mount
  351. ioprio be 2
  352.  
  353. service netd /system/bin/netd
  354. socket netd stream 0660 root system
  355.  
  356. service debuggerd /system/bin/debuggerd
  357.  
  358. service ril-daemon /system/bin/rild
  359. socket rild stream 660 root radio
  360. socket rild-debug stream 660 radio system
  361. user root
  362. group radio cache inet misc audio qcom_oncrpc diag
  363.  
  364. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  365. socket zygote stream 666
  366. onrestart write /sys/android_power/request_state wake
  367. onrestart write /sys/power/state on
  368. onrestart restart media
  369.  
  370. service media /system/bin/mediaserver
  371. user media
  372. group system audio camera graphics inet net_bt net_bt_admin net_raw qcom_oncrpc
  373. ioprio rt 4
  374.  
  375. service bootanim /system/bin/bootanimation
  376. user graphics
  377. group graphics
  378. disabled
  379. oneshot
  380.  
  381. #yangyb 20110514 Add shutdown animation.
  382. service downanim /system/bin/downanimation
  383. user graphics
  384. group graphics
  385. disabled
  386. oneshot
  387.  
  388. service dbus /system/bin/dbus-daemon --system --nofork
  389. socket dbus stream 660 bluetooth bluetooth
  390. user bluetooth
  391. group bluetooth net_bt_admin
  392.  
  393. service bluetoothd /system/bin/bluetoothd -n
  394. socket bluetooth stream 660 bluetooth bluetooth
  395. socket dbus_bluetooth stream 660 bluetooth bluetooth
  396. # init.rc does not yet support applying capabilities, so run as root and
  397. # let bluetoothd drop uid to bluetooth with the right linux capabilities
  398. group bluetooth net_bt_admin misc wireless
  399. disabled
  400.  
  401. service hfag /system/bin/sdptool add --channel=10 HFAG
  402. user bluetooth
  403. group bluetooth net_bt_admin
  404. disabled
  405. oneshot
  406.  
  407. service hsag /system/bin/sdptool add --channel=11 HSAG
  408. user bluetooth
  409. group bluetooth net_bt_admin
  410. disabled
  411. oneshot
  412.  
  413. service opush /system/bin/sdptool add --channel=12 OPUSH
  414. user bluetooth
  415. group bluetooth net_bt_admin
  416. disabled
  417. oneshot
  418.  
  419. service pbap /system/bin/sdptool add --channel=19 PBAP
  420. user bluetooth
  421. group bluetooth net_bt_admin
  422. disabled
  423. oneshot
  424.  
  425. service installd /system/bin/installd
  426. socket installd stream 600 system system
  427.  
  428. service flash_recovery /system/etc/install-recovery.sh
  429. oneshot
  430.  
  431. service racoon /system/bin/racoon
  432. socket racoon stream 600 system system
  433. # racoon will setuid to vpn after getting necessary resources.
  434. group net_admin
  435. disabled
  436. oneshot
  437.  
  438. service mtpd /system/bin/mtpd
  439. socket mtpd stream 600 system system
  440. user vpn
  441. group vpn net_admin net_raw
  442. disabled
  443. oneshot
  444.  
  445. service keystore /system/bin/keystore /data/misc/keystore
  446. user keystore
  447. group keystore
  448. socket keystore stream 666
  449.  
  450. service dumpstate /system/bin/dumpstate -s
  451. socket dumpstate stream 0660 shell log
  452. disabled
  453. oneshot
  454.  
  455. # Atheros +++
  456. service atheros-setup /system/etc/init.athwlan.sh
  457. oneshot
  458.  
  459. service wpa_supplicant /system/wifi/wpa_supplicant.sh
  460. disabled
  461. oneshot
  462.  
  463. service hostapd /system/bin/hostapd_wps /data/misc/wifi/hostapd.conf
  464. socket hostapd_wlap0 dgram 660 root wifi
  465. user root
  466. group wifi
  467. oneshot
  468. disabled
  469.  
  470. service dhcpcd /system/bin/dhcpcd -ABKL
  471. disabled
  472. oneshot
  473.  
  474. service wlan_tool /system/bin/wlan_tool
  475. user root
  476. group root
  477. disabled
  478. oneshot
  479.  
  480. service abtfilt /system/bin/abtfilt -c -d -z -n
  481. disabled
  482. oneshot
  483.  
  484. # Atheros ---
Add Comment
Please, Sign In to add comment