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

Restart adb in stage-2 #41

Merged
merged 2 commits into from Dec 5, 2019
Merged

Restart adb in stage-2 #41

merged 2 commits into from Dec 5, 2019

Conversation

kirelagin
Copy link
Member

No description provided.

* Move adb to a separate module. It used to be in stage-1, but it is no
  longer stage-1 specific, as it is now started in stage-2 as well.
* After switching to stage-2 kill the old adbd and start a new one.
@kirelagin
Copy link
Member Author

Apparently this shouldn’t work 🤔, because systemd is supposed to kill all processes, so, probably, it’s safer to set argv0 so that it starts with a @.

modules/adb.nix Outdated Show resolved Hide resolved
@lheckemann
Copy link
Member

I don't understand why systemd doesn't kill adbd. Perhaps it will only do so if it's the first process in the new root, or if it's the process doing the root switching? In any case, I'm sure it won't do any harm to kill the stage-1 adbd ourselves "just in case".

@lheckemann
Copy link
Member

(documentation for the expected systemd behaviour: https://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/ )

@kirelagin
Copy link
Member Author

@lheckemann I think this documentation only applies when systemd manages stage1 and root is switched with systemctl switch-root.

@kirelagin
Copy link
Member Author

(Which actually brings the question: do we want to use systemd for our stage1, since @samueldr was saying that one of his goals is pioneering a better stage1 for NixOS?)

init = lib.mkOrder AFTER_DEVICE_INIT ''
(
mkdir -p /dev/usb-ffs/adb
mount -t functionfs adb /dev/usb-ffs/adb/
Copy link
Member

@samueldr samueldr Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing with WIP and bleeding edge code is always fun 💦

With the lavender port, I had to implement the new gadgetfs stuff, and my experience with it is that the functionfs stuff is actually related to it... When I'll be back home, with devices ready to test, I'll figure out what's actually required to happen and in what order for those devices. I'll comment here with what is needed to be done.

Though, if I remember correctly, with the pixel 2 I had kernel panics when doing things in the wrong order, but it might not be functionfs-related, fuzzy about the details, and don't have one of those handy currently.

@samueldr samueldr added the 4. type: enhancement New feature or request label Nov 19, 2019
@samueldr
Copy link
Member

samueldr commented Dec 5, 2019

Hi, sorry this took so long to re-review and actually test.

This works. There'll be bits that need changing for "new style" usb gadget, but that's entirely irrelevant to this PR.

@samueldr samueldr merged commit 4811ac6 into NixOS:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants