init.rc and recovery.rc - Are these worthwhile?


Last Updated:

  1. glitch77

    glitch77 Member This Topic's Starter

    Joined:
    Nov 14, 2009
    Messages:
    6
    Likes Received:
    0
    init.rc

    Code (Text):
    1.  
    2.  
    3. on init
    4.  
    5. #sysclktz 0
    6.  
    7. loglevel 3
    8.  
    9. # setup the global environment
    10.     export PATH /sbin:/system/sbin:/system/bin:/system/xbin
    11.     export LD_LIBRARY_PATH /system/lib
    12.     export ANDROID_BOOTLOGO 1
    13.     export ANDROID_ROOT /system
    14.     export ANDROID_ASSETS /system/app
    15.     export ANDROID_DATA /data
    16.     export EXTERNAL_STORAGE /sdcard
    17.     export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
    18.  
    19. # Backward compatibility
    20.     symlink /system/etc /etc
    21.  
    22. # create mountpoints and mount tmpfs on sqlite_stmt_journals
    23.     mkdir /lib/modules
    24.     insmod /lib/modules/xsr.ko
    25.     insmod /lib/modules/dpram.ko
    26.  
    27.     insmod /lib/modules/xsr_stl.ko
    28.     insmod /lib/modules/rfs.ko
    29. #    insmod /lib/modules/yaffs2.ko
    30.  
    31. #    insmod /lib/modules/multipdp.ko
    32.     insmod /lib/modules/vibrator.ko
    33.  
    34.     insmod /lib/modules/s3c_rotator.ko
    35.     insmod /lib/modules/s3c_mfc.ko
    36.     insmod /lib/modules/s3c_g2d_driver.ko
    37.     insmod /lib/modules/s3c_pp.ko
    38.     insmod /lib/modules/s3c_jpeg.ko
    39.     insmod /lib/modules/s3c_g3d.ko
    40.     insmod /lib/modules/s3c_cmm.ko
    41.     insmod /lib/modules/s3c_camera.ko
    42.     insmod /lib/modules/param.ko
    43.     insmod /lib/modules/btgpio.ko
    44.  
    45.  
    46.     mkdir /sdcard 0000 system system
    47.     mkdir /system
    48.     mkdir /data 0771 system system
    49.     mkdir /cache 0770 system cache
    50.     mkdir /sqlite_stmt_journals 01777 root root
    51.     mount tmpfs tmpfs /sqlite_stmt_journals size=4m
    52.  
    53.     #mount rootfs rootfs / ro remount
    54.  
    55.     write /proc/sys/kernel/panic_on_oops 1
    56.     write /proc/sys/kernel/hung_task_timeout_secs 0
    57.     write /proc/cpu/alignment 4
    58.     write /proc/sys/kernel/sched_latency_ns 10000000
    59.     write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
    60.  
    61. # mount mtd partitions
    62.     # Mount /system rw first to give the filesystem a chance to save a checkpoint
    63.     #mount yaffs2 mtd@system /system
    64.     #mount yaffs2 mtd@system /system ro remount
    65.     #mount yaffs2 /dev/bml5 /system
    66.     #mount yaffs2 /dev/bml5 /system ro remount
    67.     mount rfs /dev/stl5 /system ro xattr,check=no
    68.     #mount rfs /dev/stl5 /system ro remount xattr,check=no
    69.  
    70.     # We chown/chmod /data again so because mount is run as root + defaults
    71.     #mount yaffs2 mtd@userdata /data nosuid nodev
    72.     #mount yaffs2 /dev/bml6 /data nosuid nodev
    73.     mount rfs /dev/stl6 /data nosuid nodev xattr,check=no
    74.     chown system system /data
    75.     chmod 0773 /data
    76.     chmod 0666 /dev/log/radio
    77.     chmod 0666 /dev/log/main
    78.     chmod 0666 /dev/graphics/fb0
    79.     chmod 0666 /dev/graphics/fb1
    80.     chmod 0666 /dev/graphics/fb2
    81.  
    82.     # We chown/chmod /cache again so because mount is run as root + defaults
    83.     #mount yaffs2 mtd@cache /cache nosuid nodev
    84.     #mount yaffs2 /dev/bml7 /cache nosuid nodev
    85.     mount rfs /dev/stl7 /cache nosuid nodev xattr,check=no
    86.     chown system cache /cache
    87.     chmod 0770 /cache
    88.  
    89.     # This may have been created by the recovery system with odd permissions
    90.     chown system system /cache/recovery
    91.     chmod 0770 /cache/recovery
    92.  
    93.     chmod 0666 /dev/bml8
    94.  
    95. # create basic filesystem structure
    96.     mkdir /data/misc 01771 system misc
    97.     mkdir /data/misc/hcid 0770 bluetooth bluetooth
    98.     mkdir /data/local 0771 shell shell
    99.     mkdir /data/local/tmp 0771 shell shell
    100.     mkdir /data/data 0771 system system
    101.     mkdir /data/app-private 0771 system system
    102.     mkdir /data/app 0771 system system
    103.     mkdir /data/property 0700 root root
    104.  
    105. # to enable wifi
    106.     setprop wifi.interface "eth0"
    107.  
    108.     # create dalvik-cache and double-check the perms
    109.     mkdir /data/dalvik-cache 0771 system system
    110.     chown system system /data/dalvik-cache
    111.     chmod 0771 /data/dalvik-cache
    112.  
    113.     # create the lost+found directories, so as to enforce our permissions
    114.     mkdir /data/lost+found 0770
    115.     mkdir /cache/lost+found 0770
    116.  
    117.     # double check the perms, in case lost+found already exists, and set owner
    118.     chown root root /data/lost+found
    119.     chmod 0770 /data/lost+found
    120.     chown root root /cache/lost+found
    121.     chmod 0770 /cache/lost+found
    122.  
    123. # to enable wifi
    124.      mkdir /data/misc/wifi 0777 wifi wifi
    125.      mkdir /data/misc/dhcp 0777 dhcp dhcp
    126.      mkdir /data/misc/wifi/sockets 0777 wifi wifi
    127.      #chown root root /system/bin/wlservice
    128.      #chmod 6777 /system/bin/wlservice
    129.      #chmod 0777 /system/bin/wlarm_android
    130.  
    131. on boot
    132. # basic network init
    133.     ifup lo
    134.     hostname localhost
    135.     domainname localdomain
    136.  
    137. # set RLIMIT_NICE to allow priorities from 19 to -20
    138.     setrlimit 13 40 40
    139.  
    140. # Set timeout value for rmnet stats.
    141.     write /sys/devices/virtual/net/rmnet0/timeout_suspend 5000000
    142.  
    143. # Define the oom_adj values for the classes of processes that can be
    144. # killed by the kernel.  These are used in ActivityManagerService.
    145.     setprop ro.FOREGROUND_APP_ADJ 0
    146.     setprop ro.VISIBLE_APP_ADJ 1
    147.     setprop ro.SECONDARY_SERVER_ADJ 2
    148.     setprop ro.HOME_APP_ADJ 4
    149.     setprop ro.HIDDEN_APP_MIN_ADJ 7
    150.     setprop ro.CONTENT_PROVIDER_ADJ 14
    151.     setprop ro.EMPTY_APP_ADJ 15
    152.  
    153. # Define the memory thresholds at which the above process classes will
    154. # be killed.  These numbers are in pages (4k).
    155.     setprop ro.FOREGROUND_APP_MEM 1536
    156.     setprop ro.VISIBLE_APP_MEM 2048
    157.     setprop ro.SECONDARY_SERVER_MEM 4096
    158.     setprop ro.HOME_APP_MEM 4096
    159.     setprop ro.HIDDEN_APP_MEM 5120
    160.     setprop ro.CONTENT_PROVIDER_MEM 5632
    161.     setprop ro.EMPTY_APP_MEM 6144
    162.  
    163. # Write value must be consistent with the above properties.
    164. # Note that the driver only supports 6 slots, so we have HOME_APP at the
    165. # same memory level as services.
    166.     write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
    167.  
    168.     write /proc/sys/vm/overcommit_memory 1
    169.     write /proc/sys/vm/min_free_order_shift 4
    170.     write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144
    171.  
    172.     # Set init its forked children's oom_adj
    173.     write /proc/1/oom_adj -16
    174.  
    175.     # Permissions for System Server and daemons.
    176.     chown radio system /sys/android_power/state
    177.     chown radio system /sys/android_power/request_state
    178.     chown radio system /sys/android_power/acquire_full_wake_lock
    179.     chown radio system /sys/android_power/acquire_partial_wake_lock
    180.     chown radio system /sys/android_power/release_wake_lock
    181.     chown radio system /sys/power/state
    182.     chown radio system /sys/power/wake_lock
    183.     chown radio system /sys/power/wake_unlock
    184.     chmod 0660 /sys/power/state
    185.     chmod 0660 /sys/power/wake_lock
    186.     chmod 0660 /sys/power/wake_unlock
    187.     chown system system /sys/class/timed_output/vibrator/enable
    188.     chown system system /sys/class/leds/keyboard-backlight/brightness
    189.     chown system system /sys/class/leds/lcd-backlight/brightness
    190.     chown system system /sys/class/leds/button-backlight/brightness
    191.     chown system system /sys/class/leds/red/brightness
    192.     chown system system /sys/class/leds/green/brightness
    193.     chown system system /sys/class/leds/blue/brightness
    194.     chown system system /sys/class/leds/red/device/grpfreq
    195.     chown system system /sys/class/leds/red/device/grppwm
    196.     chown system system /sys/class/leds/red/device/blink
    197.     chown system system /sys/class/leds/red/brightness
    198.     chown system system /sys/class/leds/green/brightness
    199.     chown system system /sys/class/leds/blue/brightness
    200.     chown system system /sys/class/leds/red/device/grpfreq
    201.     chown system system /sys/class/leds/red/device/grppwm
    202.     chown system system /sys/class/leds/red/device/blink
    203.     chown system system /sys/class/timed_output/vibrator/enable
    204.     chown system system /sys/class/lightsensor/switch_cmd/lightsensor_file_cmd
    205.     chown system system /sys/class/power_supply/battery/mp3
    206.     chown system system /sys/class/power_supply/battery/video
    207.     chown system system /sys/module/sco/parameters/disable_esco
    208.     chown system system /sys/kernel/ipv4/tcp_wmem_min
    209.     chown system system /sys/kernel/ipv4/tcp_wmem_def
    210.     chown system system /sys/kernel/ipv4/tcp_wmem_max
    211.     chown system system /sys/kernel/ipv4/tcp_rmem_min
    212.     chown system system /sys/kernel/ipv4/tcp_rmem_def
    213.     chown system system /sys/kernel/ipv4/tcp_rmem_max
    214.     chown root radio /proc/cmdline
    215. #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    216.     chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power
    217.     chown bluetooth bluetooth /proc/bluetooth/sleep/proto
    218.     chown system system /sys/module/sco/parameters/disable_esco
    219.     chmod 0660 /sys/module/bluetooth_power/parameters/power
    220.     chmod 0660 /proc/bluetooth/sleep/proto
    221.     chown bluetooth bluetooth /dev/s3c2410_serial1
    222.  
    223. # for Sensor HAL
    224.     chown system system /dev/bma150
    225.     chown system system /dev/akm8973_daemon
    226.     chown system system /dev/akm8973_aot
    227.     chown system system /dev/bma020
    228. #    chown system system /dev/proximity
    229.     chmod 0777 /dev/bma150
    230.     chmod 0777 /dev/akm8973_daemon
    231.     chmod 0777 /dev/akm8973_aot
    232.     chmod 0777 /dev/bma020
    233. #    chmod 0777 /dev/proximity
    234.  
    235.  # Permissions for btld_testmode
    236.     chmod 0666 /dev/s3c2410_serial1
    237.     chown bluetooth bluetooth /dev/uinput
    238.     chmod 0666 /dev/uinput
    239.     chmod 0777 /sys/class/rfkill/rfkill0/state
    240.     chmod 0777 /sys/class/rfkill/rfkill1/state
    241.     #chown root root /system/bin/btld_testmode
    242.     #chmod 6777 /system/bin/btld_testmode
    243.  
    244. #For manufacturing test 9-11(North America Manufacturing Quality Requirement List)
    245.     chmod  0777 /sys/class/timed_output/vibrator/enable
    246.  
    247. #For Melfas firmware update
    248.     chmod  0777 /sys/class/sec/ts/firmware
    249.  
    250. #For Subdiag Command
    251.     chmod 0777 /sys/class/timed_output/flash/enable
    252.     chmod 0777 /sys/class/sec/switch/usb_sel
    253.     chmod 0777 /sys/power/state
    254.  
    255. # Define TCP buffer sizes for various networks
    256. #   ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
    257.     setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
    258.     setprop net.tcp.buffersize.wifi    4095,87380,110208,4096,16384,110208
    259.     setprop net.tcp.buffersize.umts    4094,87380,110208,4096,16384,110208
    260.     setprop net.tcp.buffersize.edge    4093,26280,35040,4096,16384,35040
    261.     setprop net.tcp.buffersize.gprs    4092,8760,11680,4096,8760,11680
    262.     setprop net.tcp.buffersize.cdma 4096,87380,110208,4096,16384,110208
    263.     setprop net.tcp.buffersize.evdo 4096,87380,110208,4096,16384,110208
    264.  
    265. # CDMA datalink property
    266.     setprop net.cdma.datalinkinterface ttyCDMA0
    267. # Define property for disabling rfkill interface
    268.     setprop ro.rfkilldisabled 0 // enable rfkill
    269. #   setprop ro.rfkilldisabled 1
    270.  
    271. # define PCM property for InstinctQ
    272.     setprop ril.bt_pcm_clk 1
    273.     setprop ril.bt_pcm_ms_role 1
    274.  
    275.     class_start default
    276.  
    277. ## Daemon processes to be run by init.
    278. ##
    279. service console /system/bin/sh
    280.     console
    281.  
    282. # adbd is controlled by the persist.service.adb.enable system property
    283. service adbd /sbin/adbd
    284.     disabled
    285.  
    286. # adbd on at boot in emulator
    287. on property:ro.kernel.qemu=1
    288.     start adbd
    289.  
    290. on property:persist.service.adb.enable=1
    291.     start adbd
    292.  
    293. on property:persist.service.adb.enable=0
    294.     stop adbd
    295.  
    296. service servicemanager /system/bin/servicemanager
    297.     user system
    298.     critical
    299.     onrestart restart zygote
    300.     onrestart restart media
    301.  
    302. service vold /system/bin/vold
    303.     socket vold stream 0660 root mount
    304.  
    305. # donut does not use mountd
    306. #service mountd /system/bin/mountd
    307. #    socket mountd stream 0660 root mount
    308.  
    309. # to enable wifi
    310. service wpa_supplicant /system/bin/wpa_supplicant -Dwext -i eth0 -c /data/misc/wifi/bcm_supp.conf
    311.    disabled
    312.    oneshot
    313.  
    314. service dhcpcd /system/bin/dhcpcd -BKL eth0
    315.    disabled
    316.    oneshot
    317.  
    318. service ifcfg_eth0 /system/bin/ifconfig eth0 up
    319.     disabled
    320.     oneshot
    321. # end of wifi
    322.  
    323. service debuggerd /system/bin/debuggerd
    324.  
    325. service ril-daemon /system/bin/rild
    326.     socket rild stream 660 root radio
    327.     socket rild-debug stream 660 radio system
    328.     user root
    329.     group radio cache inet misc
    330. service DR-daemon /system/bin/drexe
    331.     user root
    332.  
    333. service mobex-daemon /system/bin/npsmobex
    334.     user root
    335.  
    336. service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
    337.     socket zygote stream 666
    338.     onrestart write /sys/android_power/request_state wake
    339.     onrestart write /sys/power/state on
    340.  
    341. service killmedia /system/bin/killmediaserver
    342.     user root
    343.     oneshot
    344.  
    345. service media /system/bin/mediaserver
    346.     user media
    347.     group system audio camera graphics inet net_bt net_bt_admin
    348.  
    349. service playlogo /system/bin/playlogo
    350.     user root
    351. #    group root
    352.     oneshot
    353.  
    354. service dbus /system/bin/dbus-daemon --system --nofork
    355.     socket dbus stream 660 bluetooth bluetooth
    356.     user bluetooth
    357.     group bluetooth net_bt_admin
    358.  
    359. service hci_qcom_init /system/bin/hci_qcomm_init  -s 921600 -d /dev/s3c2410_serial1
    360.     user root
    361.     group bluetooth net_bt_admin
    362.     oneshot
    363.  
    364. service hciattach /system/bin/hciattach \
    365.     -n -s 115200 /dev/ttyMSM0 texas 115200 flow
    366.     user bluetooth
    367.     group bluetooth net_bt_admin
    368.     disabled
    369.  
    370. # Make sure we startup btld before hcid
    371. # -lpm 0 => Disable LPM (Default) , -lpm 1 => Enabled LPM
    372. service btld /system/bin/logwrapper /system/bin/btld -hb 3000000 -hp /dev/s3c2410_serial1 -lpm 1
    373.     user root
    374.     group bluetooth net_bt_admin
    375.     disabled
    376.     oneshot
    377.  
    378. # Start DTUN HCID
    379. service hcid /system/bin/logwrapper /system/bin/hcid
    380.     socket bluetooth stream 660 bluetooth bluetooth
    381.     socket dbus_bluetooth stream 660 bluetooth bluetooth
    382.     # init.rc does not yet support applying capabilities, so run as root and
    383.     # let hcid drop uid to bluetooth with the right linux capabilities
    384.     group bluetooth net_bt_admin misc
    385.     disabled
    386.  
    387. # Start DTUN OBEXD
    388. service obexd /system/bin/logwrapper /system/bin/obexd
    389.     #socket bluetooth stream 660 bluetooth bluetooth
    390.     #socket dbus_bluetooth stream 660 bluetooth bluetooth
    391.     # init.rc does not yet support applying capabilities, so run as root and
    392.     # let obexd drop uid to bluetooth with the right linux capabilities
    393.     user root
    394.     group bluetooth net_bt_admin
    395.     disabled
    396.     oneshot
    397.  
    398. service h*** /system/bin/sdptool add --channel=10 H***
    399.     user bluetooth
    400.     group bluetooth net_bt_admin
    401.     disabled
    402.     oneshot
    403.  
    404. service hsag /system/bin/sdptool add --channel=11 HSAG
    405.     user bluetooth
    406.     group bluetooth net_bt_admin
    407.     disabled
    408.     oneshot
    409.  
    410. service installd /system/bin/installd
    411.     socket installd stream 600 system system
    412.  
    413. service pppd_cdma /system/bin/pppd_runner
    414.     user root
    415.     group radio cache inet misc system
    416.      disabled
    417.      oneshot
    418.  
    419.  
    420. service flash_recovery /system/bin/flash_image recovery /system/recovery.img
    421.     oneshot
    422.  
    423. service iqmsd /system/bin/iqmsd
    424.     disabled
    425.  
    426. on property:service.iq.active=1
    427.     start iqmsd
    428.  
    429. on property:service.iq.active=0
    430.     stop iqmsd
    431.  
    432. # akmd service
    433. service akmd2 /system/bin/akmd2
    434.     user system
    435.     oneshot
    436.  
    437. # to enable wifi
    438. on property:init.svc.wpa_supplicant=stopped
    439.     stop dhcpcd
    440.  
    441. on property:init.svc.dhcpcd=stopped
    442.     dhcpcd -k eth0
    443. # end of wifi
    444.  
    445.  

    recovery.rc

    Code (Text):
    1.  
    2. aon init
    3.  
    4. # S.LSI FIX : output console directly
    5. #    export PATH /sbin
    6.         export PATH /sbin:/system/sbin:/system/bin:/system/xbin
    7.  
    8.     export ANDROID_DATA /data
    9.     export EXTERNAL_STORAGE /sdcard
    10.  
    11.     symlink /system/etc /etc
    12.  
    13.     mkdir /sdcard
    14.     mkdir /system
    15.     mkdir /data
    16.     mkdir /cache
    17.         mount tmpfs nodev /tmp
    18.  
    19. # S.LSI FIX START: output console directly
    20.         insmod /lib/modules/xsr.ko
    21.         insmod /lib/modules/dpram.ko
    22.  
    23.         insmod /lib/modules/xsr_stl.ko
    24.         insmod /lib/modules/rfs.ko
    25. #        insmod /lib/modules/yaffs2.ko
    26.         insmod /lib/modules/param.ko
    27.      
    28.         mkdir /sdcard 0000 system system
    29.         mkdir /system
    30.         mkdir /data 0771 system system
    31.         mkdir /cache 0770 system cache
    32.  
    33.         #mount yaffs2 /dev/bml5 /system
    34.         mount rfs /dev/stl5 /system xattr,check=no
    35. # S.LSI FIX END
    36.  
    37. on boot
    38.        write /sys/class/sec/switch/uart_sel MODEM
    39.        write /sys/class/sec/switch/usb_sel PDA
    40.  
    41.     ifup lo
    42.     hostname localhost
    43.     domainname localdomain
    44.  
    45.     class_start default
    46.  
    47. # S.LSI FIX START: output console directly
    48.         service console /system/bin/sh
    49.             console
    50. # S.LSI FIX END
    51.  
    52.     service recovery /sbin/recovery
    53.  
    54.     service adbd /sbin/adbd recovery
    55.  
    56.     on property:persist.service.adb.enable=1
    57.     start adbd
    58.  
    59.     on property:persist.service.adb.enable=0
    60.     stop adbd
    61.  
    62.  
    These files look interesting, but I am such a noob I dont know if they are or not.


    Edit: Also, the file /sbin/recovery talks about (when looked at by a hex editor) /sdcard/update.zip
     

    Advertisement

Share This Page

Loading...