linux文件权限报错实例,自定义系统service SELinux权限报错
報錯:
E SELinux : avc:? denied? { add } for service=flashlight pid=3485 uid=1000 scontext=u:r:system_server:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager permissive=1
添加權(quán)限:
android\out\target\product\product-xxx\root\service_contexts
Android源碼添加自定義系統(tǒng)服務(wù)
http://www.cnblogs.com/liam999/p/5933827.html
android\device\xxx\sepolicy
android\system\sepolicy
報錯:
01-01 07:34:37.870? 3704? 3704 E flashlightHAL: Failed to open device file /sys/class/leds/flashlight/brightness -- Permission denied.
修改文件權(quán)限:(類似)
@ubuntu-server:~$ grep -rsn "timed_output" android/device/ android/system/
android/device/xxx/common/rootdir/etc/init.xxx.factory.rc:224:??? chown system system /sys/class/timed_output/vibrator/enable
android/device/xxx/common/rootdir/etc/init.xxx.factory.rc:237:??? chown system system /sys/class/timed_output/vibrator/enable
android/system/core/rootdir/init.rc:565:??? chown system system /sys/class/timed_output/vibrator/enable
android/system/core/rootdir/init.rc:577:??? chown system system /sys/class/timed_output/vibrator/enable
android/system/sepolicy/dumpstate.te:87:# /sys/class/timed_output/vibrator/enable
一、ramdisk介紹
ramdisk通過直面意思就大概能理解意思,ram disk虛擬內(nèi)存盤,將ram模擬成硬盤來使用的文件系統(tǒng)。對于傳統(tǒng)的磁盤文件系統(tǒng)來說,這樣做的好處是可以極大提高文件訪問速度;但由于是ram,所以在掉電后,這部分內(nèi)容不能保存。ramdisk文件系統(tǒng)是在系統(tǒng)上電后直接從磁盤一次性加載到內(nèi)存,在整個運行期間都不會有寫回操作,所以,任何修改都掉電后丟失。
二、ramdisk.img介紹
ramdisk.img是編譯Android生成的一個鏡像文件,最后和kernel一起打包生成boot.img鏡像。ramdisk.img中主要是存放android啟動后第一個用戶進(jìn)程init可執(zhí)行文件和init.*.rc等相關(guān)啟動腳本以及sbin目錄下的adbd工具。如下圖所示
ramdisk.img是將上圖目錄打包壓縮而來的,我們可以通過下面命令,來解壓出其中的內(nèi)容
首先使用file命令查看ramdisk.img文件類型
file?ramdisk.imgramdisk.img:?gzip?compressed?data,?from?Unix
看出為gzip壓縮過的文件,將ramdisk.img重命名為ramdisk.img.gzmv?ramdisk.img?ramdisk.img.gz再用file來看一下ramdisk.img,此時為
ramdisk.img:?ASCII?cpio?archive?(SVR4?with?no?CRC)
這時候使用cpio來提取ramdisk.img中的內(nèi)容mkdir?temp
cp?temp
cpio?-i?-F?../ramdisk.img
android的init.rc腳本就是ramdisk一個例子,在板子上修改是沒有用的,重啟丟失,只有修改device/平臺/../init.rc然后重新make bootimage重新生產(chǎn)boot.img燒錄到板子上才能修改成功
總結(jié)
以上是生活随笔為你收集整理的linux文件权限报错实例,自定义系统service SELinux权限报错的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python中字典和集合对象是无序的_P
- 下一篇: readkeyboard方法_Linux