<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 5.0 SELinux And GPIO in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411045#M61572</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The question is add below context&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/direction u:object_r:gpio_control:s0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;when plug into harddisk or u-disk,can't boot into os.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Nov 2015 00:39:32 GMT</pubDate>
    <dc:creator>lifusong</dc:creator>
    <dc:date>2015-11-09T00:39:32Z</dc:date>
    <item>
      <title>5.0 SELinux And GPIO</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411043#M61570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear sir.&lt;/P&gt;&lt;P&gt;&amp;nbsp; we want access gpio pin from android app.&lt;/P&gt;&lt;P&gt;Android 5.0 has a function SELinux. and default is enable&lt;/P&gt;&lt;P&gt;we use function &lt;SPAN style="color: #008800; font-family: monospace; font-size: 12px;"&gt;gpio_export To &lt;SPAN style="color: #000000; font-family: arial, sans-serif; font-size: 13px;"&gt;generate gpio device file &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;in the os the file patch look like as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/direction&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;and have symlink file &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;/sys/class/gpio/gpio35/value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;/sys/class/gpio/gpio35/direction&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;&lt;SPAN&gt;our android app will read and write /sys/class/gpio/gpio35/value &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: arial, sans-serif;"&gt;but The android app only can read the file,can't wirte ,it &lt;SPAN style="color: #000000; font-family: arial, sans-serif; font-size: 13px;"&gt;refuse&amp;nbsp; by SELinux policy&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so we want change this policy.&lt;/P&gt;&lt;P&gt;file_contexts add&lt;/P&gt;&lt;P&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/value u:object_r:gpio_control:s0&lt;/P&gt;&lt;P&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/direction u:object_r:gpio_control:s0&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file.te add&lt;/P&gt;&lt;P&gt;type gpio_control, fs_type, sysfs_type;&lt;/P&gt;&lt;P&gt;build image and boot .&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;question one.&lt;/P&gt;&lt;P&gt;the mainboard haven't plug into USB disk \sdcard\sata _hdd&lt;/P&gt;&lt;P&gt;the system will normal boot into os , and check the /sys/class/gpio/gpio35/value attributes&lt;/P&gt;&lt;P&gt;it display the selinux attributes changed from default sysfs to gpio_control&lt;/P&gt;&lt;P&gt;root@sabresd_6dq:/sys/class/gpio/gpio35 # ls -Z&lt;/P&gt;&lt;P&gt;-rw-r--r-- root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:sysfs:s0 active_low&lt;/P&gt;&lt;P&gt;lrwxrwxrwx root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:sysfs:s0 device -&amp;gt; ../../../20a0000.gpio&lt;/P&gt;&lt;P&gt;-rw-rw-rw- root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; system&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:gpio_control:s0 direction&lt;/P&gt;&lt;P&gt;-rw-r--r-- root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:sysfs:s0 edge&lt;/P&gt;&lt;P&gt;drwxr-xr-x root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:sysfs:s0 power&lt;/P&gt;&lt;P&gt;lrwxrwxrwx root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:sysfs:s0 subsystem -&amp;gt; ../../../../../../../class/gpio&lt;/P&gt;&lt;P&gt;-rw-r--r-- root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:sysfs:s0 uevent&lt;/P&gt;&lt;P&gt;-rw-rw-rw- root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; system&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:gpio_control:s0 value&lt;/P&gt;&lt;P&gt;root@sabresd_6dq:/sys/class/gpio/gpio35 #&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the file_contexts File content format as a regular expression,the character "." must be escape,&lt;/P&gt;&lt;P&gt;look like as&lt;/P&gt;&lt;P&gt;/sys/devices/soc0/soc\.1/2000000\.aips-bus/20a0000\.gpio/gpio/gpio35/value u:object_r:gpio_control:s0&lt;/P&gt;&lt;P&gt;build and boot ,the kernel can't boot into os,please see append file escape_file.txt&lt;/P&gt;&lt;P&gt;why can't use escape character "."?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;question tow.&lt;/P&gt;&lt;P&gt;plug usb disk \sdcard \sata_hdd into mainboard&lt;/P&gt;&lt;P&gt;file_contexts file add below code &lt;/P&gt;&lt;P&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/value u:object_r:gpio_control:s0&lt;/P&gt;&lt;P&gt;the kernel can't boot into os .the error log look like as append escape_file.txt&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file_contexts file add below code &lt;/P&gt;&lt;P&gt;/sys/devices/soc0/soc\.1/2000000\.aips-bus/20a0000\.gpio/gpio/gpio35/value u:object_r:gpio_control:s0&lt;/P&gt;&lt;P&gt;the kernel can boot into os ,but the gpio device file can't change anything.The SELinux attributes still is sysfs ,not gpio_control&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;help please.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337045"&gt;Escape_file.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2015 05:07:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411043#M61570</guid>
      <dc:creator>lifusong</dc:creator>
      <dc:date>2015-10-20T05:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: 5.0 SELinux And GPIO</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411044#M61571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fusong,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Your questions are on how to use devices based on&amp;nbsp; android 5.0 in APP, so it belongs to system application, I only give you some advice on it, you can get corresponding experience from internet, such as :&lt;/P&gt;&lt;P&gt;&lt;A href="http://blog.csdn.net/wh_19910525/article/details/45170755" title="http://blog.csdn.net/wh_19910525/article/details/45170755"&gt;http://blog.csdn.net/wh_19910525/article/details/45170755&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.hackblog.cn/post/41.html" title="http://www.hackblog.cn/post/41.html"&gt;SELinux on Android（三） - Hack Blog | 黑客博客&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Weidong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2015 05:49:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411044#M61571</guid>
      <dc:creator>weidong_sun</dc:creator>
      <dc:date>2015-11-06T05:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: 5.0 SELinux And GPIO</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411045#M61572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The question is add below context&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;/sys/devices/soc0/soc.1/2000000.aips-bus/20a0000.gpio/gpio/gpio35/direction u:object_r:gpio_control:s0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;when plug into harddisk or u-disk,can't boot into os.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Nov 2015 00:39:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/5-0-SELinux-And-GPIO/m-p/411045#M61572</guid>
      <dc:creator>lifusong</dc:creator>
      <dc:date>2015-11-09T00:39:32Z</dc:date>
    </item>
  </channel>
</rss>

