0

Currently, I'm working on iMX7D board (from Toradex) with Android Nougat 7.1.2.

I'm writing a connection to peripherals via I2C, GPIO, UART protocol (I'm using a JNI binding that interacts with lower layers like the kernel)

Before do that, I have to make config for this board like export GPIOs, grant permission for GPIOs and I2C and UART:

# export GPIO
    echo 112 > /sys/class/gpio/export
    echo 113 > /sys/class/gpio/export
    echo 58 > /sys/class/gpio/export

# grant permission
    chmod 777 gpio112/value
    chmod 777 gpio113/value
    chmod 777 gpio58/value
       
    chmod 777 /dev/i2c-3

    chmod 777 /dev/ttymxc2

The problem happened when I rebooting board, all configs that I make before was erased.

I searched on internet how the way export and grant permission automatically at startup, I've already tried but it either require root permission or re-config in Android OS image. I was stuck in here and don't have any solution now!!!

I don't have more experiment about Android OS in embedded system. How can I rooting Android OS in embedded system or Is there another way to solve this problem?

Any suggestions will be appreciated.

tuanphan
  • 3
  • 2
  • How is it possibile that you can execute CHMOD without already have root? I'm looking in my "/dev/" folder and all files are owned by "Input", "System" or "Root" so if your user is not in those groups you cannot run CHMOD successfully..... – emandt Jun 07 '21 at 07:58
  • Thanks @emand. More information, I tried signing my android application as system app (link [https://www.kynetics.com/docs/2018/introduction-to-dm-verity-on-android/](https://www.kynetics.com/docs/2018/introduction-to-dm-verity-on-android/). After that, I tested with function SetTime ok. But I can't using CHMOD in my app. Do you have any ideal??? – tuanphan Jun 08 '21 at 00:21
  • I never used Android boards so I'm not usual about their File Permissions. Usually all /dev/* files are owned by "Input", "System" or "Root" Groups but an App, starting from SDK 26, uses a dedicated/reserved User for each of them and all these special-Users are not included in neither of these Groups. So you need Root (or a modified System Image) to set different Owner/Permissions for one of /dev files. There isn't any other way. – emandt Jun 08 '21 at 13:52

0 Answers0