Hi
The imx8qxpc0mek kernel version is 4.14.98.2.3.3,the yocto version is 2.5.2.We wanted to use ADB in Linux, so we integrated with bitbake android-tools.However, we found that after the client established a connection with the device through adb shell, it was abnormal to switch to root permission by su command, and operations such as chmod cannot be performed under root permission.
The following are the adb.service in use and the adb.sh that starts the ADB service,What changes should be made to resolve the root permission exception
[Unit]
Description=adb start service
After=network.target
[Service]
Type=simple
WorkingDirectory=/home
ExecStart=/home/adb.sh
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
#!/bin/sh
groupadd -g 2000 test
groupadd soft3
useradd -u 2000 -g soft3 -G testtom
modprobe g_ffs idVendor=0x18d1 idProduct=0xd002 iSerialNumber="test"
mkdir -p /dev/usb-ffs/adb
mount -t functionfs adb /dev/usb-ffs/adb -o uid=2000,gid=2000
adbd &
Thanks & Regards,
Chris.