Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarative ADB keys; adb at boot #267

Open
Atemu opened this issue Dec 23, 2024 · 6 comments
Open

Declarative ADB keys; adb at boot #267

Atemu opened this issue Dec 23, 2024 · 6 comments

Comments

@Atemu
Copy link
Contributor

Atemu commented Dec 23, 2024

For debugging purposes, it'd be incredibly useful to be able to declaratively enable ADB on boot and have your keys be trusted.

The following props need to be set in order to enable ADB on boot:

persist.service.adb.enable=1
persist.service.debuggable=1
persist.sys.usb.config=mtp,adb

There probably is a way to set these but I haven't found it yet or how to do it via robotnix.

Trusted ADB keys go in /data/misc/adb/adb_keys. This is a lot harder to bake into the ROM as that's a runtime state directory. It also gets reset frequently. Perhaps there's a way to bake in the key into the ROM though.

@samueldr
Copy link
Contributor

Not sure if any helpful, but IIRC setting the build variant to eng makes adb available at boot. (Or was it userdebug?)

I'm thinking a bit more here, and I seem to recall that maybe LinageOS made their userdebug builds differ in semantics from AOSP... aaaaaaaaand:

Not sure if any of those hints will help. Those, in any way, don't help with the adb key.

@Atemu
Copy link
Contributor Author

Atemu commented Dec 24, 2024

This makes sense because most LOS devices are userdebug rather than user.

I'm wondering though whether it's possible to override this setting somehow. I guess you can always patch the sources...

@samueldr
Copy link
Contributor

🤔 I don't grok the big picture enough to know how post_process_props ends-up used.

I don't see any usage that would make any keys disallowed

So that leaves the mangle_build_prop function that could throw a wrench into any plans...

Except that it looks like it should be fine:

Only if ro.adb.secure does it setup persist.sys.usb.config. So at the very least it shouldn't be fighting against additional shenanigans around build.prop.

So, my gut feeling here is that it's “just” (lol) a matter of having a way to override build.prop props.

@Atemu
Copy link
Contributor Author

Atemu commented Dec 25, 2024

Thanks a bunch for the research notes!

How would I set those additional properties in Robotnix though?

@samueldr
Copy link
Contributor

I don't know, but I believe this is the current best(?) mechanism for LineageOS:

So something like source.dirs."vendor/extra", which can be built via a Nix expression.

Though I wonder if AOSP has such a thing. If it doesn't, it would require patching the AOSP android_build to do so, but that's not a lot to implement tbf, so it should be trivial to add there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants