Jump to content

Example of how a proper init.x3.rc would look for 3.4


Guest Mourta
 Share

Recommended Posts

This is just an example, it's not a completely finished file but it's better than whatever you are using now with my kernel:

 

mport init.x3.usb.rc

on early-init
    mount debugfs debugfs /sys/kernel/debug
    write /sys/class/firmware/timeout 5

    mkdir /cal 0770 root system
    mkdir /persist-lg 0771 system system
    mkdir /mpt 0775 system system

on init
    mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    mkdir /storage/sdcard1 0700 root root

    # See storage config details at http://source.android.com/tech/storage/
    mkdir /storage 0050 system sdcard_r
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /storage/emulated 0555 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated
    export SECONDARY_STORAGE /storage/sdcard1


    # Support legacy paths
    symlink /storage/emulated/legacy /sdcard
    symlink /storage/emulated/legacy /mnt/sdcard
    symlink /storage/emulated/legacy /storage/sdcard0
    symlink /mnt/shell/emulated/0 /storage/emulated/legacy

    mkdir /storage/sdcard1 0000 system system

on fs
    mount_all ./fstab.x3

    mkdir /data/dontpanic
    chown root system /data/dontpanic
    chmod 0750 /data/dontpanic

    chmod 777 /dev/mtc_eta_log

    # Collect ramconsole data for last kmsg
    copy /proc/last_kmsg /data/dontpanic/last_kmsg
    chown root log /data/dontpanic/last_kmsg
    chmod 0640 /data/dontpanic/last_kmsg

    # Create this file in case it doesn't exist, needed to switch wifi modes:
    write /data/misc/wifi/firmware_path ""
    chmod 0666 /data/misc/wifi/firmware_path

    setprop ro.crypto.fuse_sdcard true

on boot
    insmod /system/lib/modules/bthid.ko
    mkdir /data/misc/bluetooth 0770 bluetooth bluetooth
# --- BRCM
    mkdir /data/misc/wifi 0775 wifi radio
    mkdir /data/misc/wifi/sockets 0770 wifi wifi
    mkdir /data/misc/dhcp 0770 dhcp dhcp
    chown dhcp dhcp /data/misc/dhcp
    mkdir /data/nvcam 0700 media camera
    # we will remap this as /mnt/sdcard with the sdcard fuse tool
    mkdir /data/media 0775 media_rw media_rw
    chown media_rw media_rw /data/media

    chmod 0777 /dev/block/platform/sdhci-tegra.3/by-name/NVA
    chown system sdcard_rw /dev/block/platform/sdhci-tegra.3/by-name/NVA
    chmod 0660 /dev/block/platform/sdhci-tegra.3/by-name/NVA ## NV partition

    chown system system /sys/devices/virtual/input/lge_touch/keyguard

# Power control interface
    chmod 0660 /sys/class/rfkill/rfkill0/state
    chmod 0660 /sys/class/rfkill/rfkill0/type
    chmod 0660 /sys/class/rfkill/rfkill1/state
    chmod 0660 /sys/class/rfkill/rfkill1/type
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
    chown bluetooth bluetooth /sys/class/rfkill/rfkill1/state
    chown bluetooth bluetooth /sys/class/rfkill/rfkill1/type
    write /sys/class/rfkill/rfkill0/state 0

# FactoryTest AT command
    chmod 0664 /sys/devices/platform/bd_address/bdaddr_if
    chown radio bluetooth /sys/devices/platform/bd_address/bdaddr_if

# bluetooth LPM
    chmod 0220 /proc/bluetooth/sleep/lpm
    chmod 0220 /proc/bluetooth/sleep/btwrite
    chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm
    chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite

# NFC
    setprop ro.nfc.port "I2C"
    chmod 0660 /dev/pn544
    chown nfc nfc /dev/pn544

# backlight
    chown system radio /sys/class/leds/lcd-backlight/brightness
    chmod 0664 /sys/class/leds/lcd-backlight/brightness

# key led
    chown system radio /sys/class/leds/button-backlight/brightness
    chmod 0664 /sys/class/leds/button-backlight/brightness
    chown system radio /sys/class/leds/button-backlight/br_maintain_on
    chmod 0664 /sys/class/leds/button-backlight/br_maintain_on
    chown system radio /sys/devices/platform/gpio-keys.0/key_test_mode

# RGB bridge IC(SSD2825)
    chown system radio /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_tuning
    chown system radio /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_saved
    chown system system /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/device_id
    chown system system /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/mipi_lp
    chown system system /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/mipi_hs
    chown system system /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/reg_dump
    chmod 0660 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_tuning
    chmod 0660 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_saved
    chmod 0660 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/device_id
    chmod 0660 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/mipi_lp
    chmod 0660 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/mipi_hs
    chmod 0660 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/reg_dump

# fuelgauge
    chown system radio /sys/devices/platform/tegra-i2c.4/i2c-4/4-0036/state
    chown system radio /sys/class/power_supply/fuelgauge/device/state
    chown system radio /sys/class/power_supply/charger/device/chgcc_ta

# didim
    chown system system /sys/devices/platform/host1x/tegradc.0/smartdimmer/enable
    chown system system /sys/devices/platform/host1x/tegradc.0/smartdimmer/aggressiveness
    chown system system /sys/devices/platform/host1x/tegradc.0/smartdimmer/phase_in_video

# power
    chown system system /sys/kernel/tegra_cap/core_cap_level
    chown system system /sys/kernel/tegra_cap/core_cap_state
    chown system system /sys/module/cpu_tegra/parameters/cpu_user_cap
    chown system system /sys/module/cpu_tegra/parameters/force_disable_edp
    chown system system /sys/module/cpu_tegra/parameters/force_policy_max
    chown system system /sys/module/cpu_tegra/parameters/is_enable_boost_load_shaper


# sangwon.jeon for gyro and accel.
    chmod 0666 dev/mpu
    chmod 0666 dev/mpuirq
    chmod 0666 dev/accelirq
    chmod 0666 dev/timerirq

# PROXIMITY SENSOR
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/enable_ps_sensor
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/enable_ps_sensor
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/enable_als_sensor
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/enable_als_sensor
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/proxidata
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/proxidata
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/luxdata
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/luxdata
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/ps_hysteresis
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/ps_hysteresis
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/ps_threshold
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/ps_threshold
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/run_calibration
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/run_calibration
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/ppcount
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/ppcount
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/default_calibration
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/default_calibration
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/ps_data
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/ps_data
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/is_white
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/is_white
    chown system system /sys/bus/i2c/drivers/apds990x/0-0039/ps_cal_result
    chmod 0660 /sys/bus/i2c/drivers/apds990x/0-0039/ps_cal_result

# Power management settings
    write /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/no_lp 0
    #write /sys/module/tegra3_emc/parameters/emc_enable 0
    #write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 1000000
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor abyssplugv2
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor abyssplugv2
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor abyssplugv2
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor abyssplugv2
    #chown system system /sys/devices/system/cpu/cpufreq/interactive/cores_states
    #chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/cores_states
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    chmod 0644 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    write /sys/module/cpu_tegra/parameters/force_policy_max Y
    write /sys/devices/system/cpu/cpufreq/abyssplugv2/powersave_bias 1
    #write /sys/devices/system/cpu/cpufreq/interactive/sustain_load 80
    write /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable 1
    write /sys/module/cpuidle/parameters/power_down_in_idle Y

# AbyssplugV2 dynamic frequecy mode settings
    write /sys/devices/system/cpu/cpufreq/abyssplugv2/up_threshold 95
    write /sys/devices/system/cpu/cpufreq/abyssplugv2/sampling_down_factor 1
    write /sys/devices/system/cpu/cpufreq/abyssplugv2/sampling_rate_min 20000

# Power Save for camera preview and recording
    chown media camera /sys/devices/platform/host1x/vi/power_save_preview
    chown media camera /sys/devices/platform/host1x/vi/power_save_rec

# Power management for jpeg decode
    chown media sdcard_rw /sys/devices/nvavp/jpeg_decode

    chown system radio /sys/devices/platform/tegra-i2c.4/i2c-4/4-001c/max77663-rtc/enablesmpl
    chown system radio /sys/devices/platform/tegra-i2c.4/i2c-4/4-001c/max77663-rtc/smplcount
    write /sys/block/mmcblk0/queue/read_ahead_kb 2048
    write /sys/block/mmcblk1/queue/read_ahead_kb 2048

#LGE_CHANGE_S 20120720, [email protected] [data] Disable IPv6 for mobile network
    write /proc/sys/net/ipv6/conf/all/disable_ipv6 1
#LGE_CHANGE_E 20120720, [email protected] [data] Disable IPv6 for mobile network

# didim
    chown system system /sys/class/graphics/fb0/device/smartdimmer/enable
    chown system system /sys/class/graphics/fb0/device/smartdimmer/aggressiveness

    #Give nvaudio_hw acess to /sys/power/suspend/mode
    chmod 0660 /sys/power/suspend/mode
    chown system system /sys/power/suspend/mode
    
    #Give telephony manager read rights
    chmod 0444 /proc/cmdline
    chown system radio /proc/cmdline
    
service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
    class late_start
    disabled
    oneshot

service iprenew_wlan0 /system/bin/dhcpcd -n
    class late_start
    disabled
    oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL
    class late_start
    disabled
    oneshot

service iprenew_p2p /system/bin/dhcpcd -n
    class late_start
    disabled
    oneshot
    
service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG
    disabled
    oneshot

service iprenew_bt-pan /system/bin/dhcpcd -n
    disabled
    oneshot

service p2p_supplicant /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets -N \
    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
    -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \
    [email protected]roid:wpa_wlan0
    #   we will start as root and wpa_supplicant will switch to user wifi
    #   after setting up the capabilities required for WEXT
    #   user wifi
    #   group wifi inet keystore
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service wpa_supplicant /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets \
    -e/data/misc/wifi/entropy.bin [email protected]:wpa_wlan0
    # we will start as root and wpa_supplicant will switch to user wifi
    # after setting up the capabilities required for WEXT
    # user wifi
    # group wifi inet keystore
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
    class late_start

service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
    class late_start
    disabled

on boot

###TEMP set selinux to permissive
    setenforce 0

    #Misc tweaks
    write /proc/sys/vm/highmem_is_dirtyable 1
    write /proc/sys/vm/min_free_kbytes 4096

    # GPS init
    write /sys/class/gpio/export 61
    write /sys/class/gpio/gpio61/value 0
    write /sys/class/gpio/gpio61/direction out
    chown gps system /sys/class/gpio/gpio61/value
    chmod 0664 /sys/class/gpio/gpio61/value
    chown system system /sys/devices/platform/gps_gpio/poweron
    chown system system /sys/devices/platform/gps_gpio/reset
    chown system system /sys/devices/platform/gps_gpio/eclk
    chown system system /dev/pts17
    mkdir /data/gps
    chmod 770 /data/gps
    chown gps system /data/gps
    chmod 770 /system/etc/cert/lge.cer
    chown system system /system/etc/cert/lge.cer
    chmod 770 /system/etc/hmconfig.txt
    chown system system /system/etc/hmconfig.txt
    chown gps system /dev/ttyHS1
    chmod 0660 /dev/ttyHS1
    chown audio audio /dev/pts29

    mkdir /cal/secclk 0770 system system
    chmod 0770 /cal/secclk
    chown system system /cal/secclk

    chown root radio /sys/devices/platform/baseband_xmm_power/xmm_onoff

    setprop nvcpud.enabled true
    setprop nvcpud.config_refresh_ms -1

    # Torch perms
    chown system camera /sys/devices/platform/tegra-i2c.2/i2c-2/2-0053/torch
    chmod 0660 /sys/devices/platform/tegra-i2c.2/i2c-2/2-0053/torch

service nvcpud /system/bin/nvcpud
    class main
    user root
    group root

service charger /charger
    class charger
    user root
    group root
    oneshot

#service hdmid /system/bin/hdmid
#    class core
#    socket hdmid stream 0660 root system graphics
#    user system
#    group system

on boot
    chown system system /sys/power/lge_logstart
    chmod 0660 /sys/power/lge_logstart

service lgsecclk /system/bin/lgsecclkserver
    class main
    user system
    group system sdcard_rw media_rw

########################################
# CAPP_DRM
########################################
service lgdrm /system/bin/lgdrmserver
    class main
    user system
    group sdcard_rw media_rw system radio media

service tf_daemon /system/bin/tf_daemon -storageDir /cal/widevine -d
    class main
    user system
    group shell system
    oneshot

# restart when servicemanager is restarted
on property:init.svc.servicemanager=restarting
    restart lgdrm
    restart lgsecclk

on post-fs-data
    # create directory for lgdrm
    mkdir /data/lgdrm 0770 system media
    setprop vold.post_fs_data_done 1

    # Set buffer sizes from stock (lower readmax)
    # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
    setprop net.tcp.buffersize.hsdpa    4094,87380,704512,4096,16384,110208
    setprop net.tcp.buffersize.hspa     4094,87380,704512,4096,16384,110208
    setprop net.tcp.buffersize.hsupa    4094,87380,704512,4096,16384,110208
    
# Assign TCP buffer thresholds to be ceiling value of technology maximums
    # Increased technology maximums should be reflected here.
    write /proc/sys/net/core/rmem_max 2097152
    write /proc/sys/net/core/wmem_max 2097152

# Hardware tunable perms
    chown root system /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_tuning
    chown root system /sys/devices/platform/tspdrv/nforce_timed
    chown root system /sys/devices/virtual/input/lge_touch/keypad_enable
    chmod 0664 /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_tuning
    chmod 0664 /sys/devices/platform/tspdrv/nforce_timed
    chmod 0664 /sys/devices/virtual/input/lge_touch/keypad_enable
    restorecon /sys/devices/platform/spi_tegra.4/spi_master/spi4/spi4.2/gamma_tuning
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.