Enable adbd on microdroid
The following system properties are forcibly set to make adbd function.
ro.apex.updatable=true : otherwise, apexd doesn't activate critical
APEXes like the runtime APEX
ro.adb.secure=0 : to bypass the adb authentication
ro.debuggable=1 : to be able to use ro.adb.secure=0
This change also updates README.md file for the instruction to use adb.
Bug: 181728474
Test: adb shell works towards microdroid. See microdroid/README.md
Change-Id: Ica405e8bd4d2d1ef03e545aef5ed07ddc4bea34c
diff --git a/microdroid/Android.bp b/microdroid/Android.bp
index d0c6675..7bb1d4a 100644
--- a/microdroid/Android.bp
+++ b/microdroid/Android.bp
@@ -46,6 +46,7 @@
deps: [
"init_second_stage",
"microdroid_init_rc",
+ "ueventd.rc",
"libbinder",
"libstdc++",
"logcat",
diff --git a/microdroid/README.md b/microdroid/README.md
index fef5997..e6cbec8 100644
--- a/microdroid/README.md
+++ b/microdroid/README.md
@@ -53,7 +53,24 @@
```
$ adb shell 'HOME=/data/local/tmp; /apex/com.android.virt/bin/assemble_cvd < /dev/null'
-$ adb shell 'cd /data/local/tmp; /apex/com.android.virt/bin/crosvm run --disable-sandbox --bios=bootloader --serial=type=stdout --disk=cuttlefish_runtime/composite.img'
+$ adb shell 'cd /data/local/tmp; /apex/com.android.virt/bin/crosvm run --cid=5 --disable-sandbox --bios=bootloader --serial=type=stdout --disk=cuttlefish_runtime/composite.img'
```
-At this moment, this doesn't boot to the shell, but to the second-stage init.
+The CID in `--cid` parameter can be anything greater than 2 (`VMADDR_CID_HOST`).
+
+## ADB
+
+```
+$ adb forward tcp:8000 vsock:5:5555
+$ adb connect localhost:8000
+```
+
+`5` in `vsock:5` should match with the CID number that was given to `crosvm`.
+`5555` must be the value. `8000` however can be any port in the development
+machine.
+
+Done. Now you can log into microdroid. Have fun!
+
+```
+$ adb -s localhost:8000 shell
+```
diff --git a/microdroid/init.rc b/microdroid/init.rc
index 9500f7c..2c32b28 100644
--- a/microdroid/init.rc
+++ b/microdroid/init.rc
@@ -13,6 +13,9 @@
# Cgroups are mounted right before early-init using list from /etc/cgroups.json
on early-init
start ueventd
+ setprop ro.apex.updatable true
+ setprop ro.debuggable 1
+ setprop ro.adb.secure 0
# Generate ld.config.txt
exec -- /system/bin/bootstrap/linkerconfig --target /linkerconfig