diff options
author | Davide Garberi <dade.garberi@gmail.com> | 2019-03-02 13:23:14 +0100 |
---|---|---|
committer | Davide Garberi <dade.garberi@gmail.com> | 2019-03-02 13:56:05 +0100 |
commit | 95f4617bec43046ca6d418b606175978eea22be2 (patch) | |
tree | b9706466e41c6c85131d25696b7f7abf74c763ab | |
parent | 56a0d4e8bca5cb53407e9d615ed5566e87f34c2b (diff) |
msm8996-common: Set the hardware wlan mac using wcg_mac_tool
* Bin extracted from ZUI
* Add init.wlan.sh to check if the mac address in wlan_mac.bin is already correct, if not correct it
* Run both the bins on boot completed as wcg can't run earlier
* Label both the bins and address their denials
Change-Id: I7a8001465ec9c3d69bd228efa57dddfdd8e3c6f3
-rwxr-xr-x | msm8996.mk | 1 | ||||
-rw-r--r-- | proprietary-files.txt | 3 | ||||
-rw-r--r-- | rootdir/Android.mk | 8 | ||||
-rw-r--r-- | rootdir/bin/init.wlan.sh | 24 | ||||
-rw-r--r-- | rootdir/etc/init.qcom.rc | 18 | ||||
-rw-r--r-- | sepolicy/file_contexts | 4 | ||||
-rw-r--r-- | sepolicy/property.te | 1 | ||||
-rw-r--r-- | sepolicy/property_contexts | 16 | ||||
-rw-r--r-- | sepolicy/qti_init_shell.te | 6 | ||||
-rw-r--r-- | sepolicy/shell.te | 1 | ||||
-rw-r--r-- | sepolicy/wcg_mac.te | 10 |
11 files changed, 92 insertions, 0 deletions
@@ -154,6 +154,7 @@ PRODUCT_PACKAGES += \ init.qcom.sh \ init.qcom.power.rc \ init.qcom.usb.rc \ + init.wlan.sh \ ueventd.qcom.rc # Display diff --git a/proprietary-files.txt b/proprietary-files.txt index 0658496..4eeb08b 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -770,6 +770,9 @@ vendor/etc/init/vendor.qti.hardware.tui_comm@1.0-service-qti.rc|2cfc563d7e157937 vendor/lib/vendor.qti.hardware.tui_comm@1.0_vendor.so|cdb0454905bcd5124ccb6e69df6f8256ce203250 vendor/lib64/vendor.qti.hardware.tui_comm@1.0_vendor.so|359b87c1daad8c430005c86c451a7b095a934d91 +# wcg_mac_tool +-sbin/wcg_mac_tool:vendor/bin/wcg_mac_tool|390a5a2425fab861c753743b1df3808acb1ee7d6 + # Widevine DRM - from LA.UM.7.6.r1-02800-89xx.0 - daisy 9/PKQ1.180917.001/V10.0.1.0PDLMIFJ vendor/bin/hw/android.hardware.drm@1.1-service.widevine|9743c4ecd0fb8773795bcbfbb406f25616c04129 vendor/etc/init/android.hardware.drm@1.1-service.widevine.rc|5a01d337c1d375ee24a6c8992ba91f54afb7637e diff --git a/rootdir/Android.mk b/rootdir/Android.mk index 6f61c5b..c7b6f0a 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -10,6 +10,14 @@ LOCAL_SRC_FILES := bin/init.qcom.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) +include $(CLEAR_VARS) +LOCAL_MODULE := init.wlan.sh +LOCAL_MODULE_TAGS := optional eng +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.wlan.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + # Common init scripts include $(CLEAR_VARS) diff --git a/rootdir/bin/init.wlan.sh b/rootdir/bin/init.wlan.sh new file mode 100644 index 0000000..36c0430 --- /dev/null +++ b/rootdir/bin/init.wlan.sh @@ -0,0 +1,24 @@ +#! /vendor/bin/sh + +# +# Copyright (C) 2019 The LineageOS Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set the proper hardware based wlan mac +if [[ ! -f /persist/wlan_mac.bin ]] || [[ $(cat /persist/wlan_mac.bin | grep Intf0MacAddress | sed 's/Intf0MacAddress=//') != $(getprop sys.wifimac | sed 's/://g') ]]; then + wifi_mac=$(getprop sys.wifimac | sed 's/://g'); +echo "Intf0MacAddress=$wifi_mac +END" > /persist/wlan_mac.bin +fi; diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index dc95d51..5d1e1ae 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -574,6 +574,24 @@ service vendor.ppd /vendor/bin/mm-pp-dpps disabled writepid /dev/cpuset/system-background/tasks +service wcg_mac_tool /vendor/bin/wcg_mac_tool + class late_start + group root + user root + disabled + oneshot + +service wlan-sh /vendor/bin/init.wlan.sh + class late_start + user root + group root + disabled + oneshot + +on property:sys.boot_completed=1 + start wcg_mac_tool + start wlan-sh + on property:init.svc.vendor.hwcomposer-2-1=stopped stop vendor.ppd diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index f4b765f..12e3edd 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -1,6 +1,10 @@ # Partitions /dev/block/platform/soc/(624000\.ufshc|7464900\.sdhci)/by-name/persist u:object_r:persist_block_device:s0 +# Binaries +/vendor/bin/wcg_mac_tool u:object_r:wcg_mac_exec:s0 +/vendor/bin/init.wlan.sh u:object_r:qti_init_shell_exec:s0 + # Devices /dev/fpc1020 u:object_r:fpc1020_device:s0 /dev/tfa9890 u:object_r:audio_device:s0 diff --git a/sepolicy/property.te b/sepolicy/property.te new file mode 100644 index 0000000..550baf9 --- /dev/null +++ b/sepolicy/property.te @@ -0,0 +1 @@ +type wcg_prop, property_type; diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts index ecce687..bc0c909 100644 --- a/sepolicy/property_contexts +++ b/sepolicy/property_contexts @@ -13,3 +13,19 @@ ro.min_freq_4 u:object_r:freq_prop:s0 # Qseecomd sys.listeners.registered u:object_r:vendor_tee_listener_prop:s0 + +# WCG +sys.wifimac u:object_r:wcg_prop:s0 +sys.bt.address u:object_r:wcg_prop:s0 +persist.bt.max.hs.connections u:object_r:wcg_prop:s0 +gsm.sn1 u:object_r:wcg_prop:s0 +sys.customsn.showcode u:object_r:wcg_prop:s0 +cdma.meid u:object_r:wcg_prop:s0 +gsm.imei1 u:object_r:wcg_prop:s0 +gsm.imei2 u:object_r:wcg_prop:s0 +persist.cdma.meid u:object_r:wcg_prop:s0 +persist.gsm.imei1 u:object_r:wcg_prop:s0 +persist.gsm.imei2 u:object_r:wcg_prop:s0 +gsm.hwid u:object_r:wcg_prop:s0 +gsm.station u:object_r:wcg_prop:s0 +persist.gsm.qlogd.on u:object_r:wcg_prop:s0 diff --git a/sepolicy/qti_init_shell.te b/sepolicy/qti_init_shell.te index 1841019..64ab2bc 100644 --- a/sepolicy/qti_init_shell.te +++ b/sepolicy/qti_init_shell.te @@ -3,3 +3,9 @@ allow qti_init_shell vendor_radio_data_file:dir { getattr open read search setat allow qti_init_shell vfat:file { getattr open read setattr }; allow qti_init_shell vfat:dir { open read search }; allow qti_init_shell file_contexts_file:file { getattr open read }; + +# Allow qti_init_shell to fully access wlan_mac.bin persist file +allow qti_init_shell mnt_vendor_file:dir rw_dir_perms; +allow qti_init_shell mnt_vendor_file:file create_file_perms; + +get_prop(qti_init_shell, wcg_prop) diff --git a/sepolicy/shell.te b/sepolicy/shell.te new file mode 100644 index 0000000..df6b670 --- /dev/null +++ b/sepolicy/shell.te @@ -0,0 +1 @@ +get_prop(shell, wcg_prop) diff --git a/sepolicy/wcg_mac.te b/sepolicy/wcg_mac.te new file mode 100644 index 0000000..2e8ec94 --- /dev/null +++ b/sepolicy/wcg_mac.te @@ -0,0 +1,10 @@ +type wcg_mac, domain; +type wcg_mac_exec, exec_type, vendor_file_type, file_type; + +# Allow for transition from init domain to wcg_mac +init_daemon_domain(wcg_mac) + +# Allow wcg_mac to set sys.wifimac +set_prop(wcg_mac, wcg_prop) + +allow wcg_mac proc:file { open read }; |