i.MX8 adb bring up
The default BSP provided by NXP doesn’t support adb, we have to port it by ourselves. Our goal is making adbd running on SoC meanwhile we can use adb through USB port.
Let’s have a quick summary before I forget it(I already done this 3 months ago…)
Source code of adb & adbd
You can find adb & adbd source codes easily, but I found that there is a recipe in openembedded already provided adb & adbd:
meta-openembedded/meta-oe/recipes-devtools/android-tools
But the default recipes can’t work on imx8mm through USB. We need do some modifications later.
Adding support for login adb as root
There is a function called should_drop_privileges in adbd source code, modify this function that makes it always return 0 to disallow drop privileges. It has been added into newer openembedded but not the i.mx BSP.
1 | From 3a788e9168c9b9eac66c4fa479413f4a95c61be4 Mon Sep 17 00:00:00 2001 |
You need to add this patch into recipe sources as well:
1 | SRC_URI += " \ |
Adding support for USB adb
To connect adbd through USB, we need support from usb function filesystem. To enable it in kernel:
1 | │ Symbol: USB_FUNCTIONFS [=m] │ |
After installation of USB_FUNCTIONFS, we need to modprobe and mount functionfs before adbd start(initialization):
1 |
|
Then we can start adbd now.
In my case I’m using systemd to do this initialization(as a ExecStartPre), then set /usr/bin/adbd as ExecStart.
After all of those steps, we can do quick test by adb devices! If everything goes well, you can see your device has been recognized. Then use adb shell to login, a # symbol should be shown which means you are in root.