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

Build Glodroid flavor? #32

Open
colemickens opened this issue Sep 2, 2020 · 10 comments
Open

Build Glodroid flavor? #32

colemickens opened this issue Sep 2, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@colemickens
Copy link
Member

Hi,

I was telling samueldr about how I am looking forward to being able to boot Glodroid and mobile-nixos on my Pinephone. They pointed me towards this project. I'm not super well-versed in AOSP to understand where boundaries of projects lie, but maybe you are familiar with Glodroid?

Would it be possible to build Glodroid with Robotnix?

https://glodroid.github.io/
https://github.com/GloDroid/glodroid_manifest

@colemickens
Copy link
Member Author

I guess it wouldn't be a variant like lineageos/grapheneos, but rather a board/target?

@samueldr
Copy link
Contributor

samueldr commented Sep 2, 2020

AFAIUI it would be both.

A variant flavour that can't build most other boards devices...

And a board/target device that can't be built using most variants flavours.

@danielfullmer
Copy link
Collaborator

No, I wasn't familiar with Glodroid until you mentioned it. It certainly looks interesting, and they have goals I like: sticking close to mainline Android, upstreaming their changes, etc. It definitely should be possible to build with robotnix. (And it incentivizes me to get a pinephone at some point!)

I've been trying to stick somewhat to the terminology described here. So, instead of "variant" , I've been using "flavor" in robotnix for things like vanilla, grapheneos, and lineageos.

I would probably call GloDroid a "flavor" which supports a number of "devices". One thing supporting calling them a flavor is the fact that they publish their own manifests which override a bunch of upstream AOSP repos with patched versions. They don't do this nearly to the same extent as something like LineageOS or GrapheneOS, but it is still looks different enough that I wouldn't be comfortable with the other option, which would be adding this as a bunch of devices inside the existing vanilla flavor.

Here's a few notes to hopefully get started if you are interested in trying this out, based on reading the documentation here: You'd need to create a new "repo" json file using mk-repo-file.py. Then, in your configuration, add something like source.dirs = lib.importJSON ./repo-v0.3.0.json;. It looks like you'd also need { productNamePrefix = ""; device = "pinephone"; }. Finally, it looks like they want you to build the images make target instead of target-files-package. So, you'd need to use the build.mkAndroid function from modules/base.nix to have it build that.

If I have some extra time, I might take a stab at this as well--but I don't have any devices to test.

@danielfullmer
Copy link
Collaborator

I just noticed they have WIP support for RPI3, so if we're lucky I might actually be able to test this on a real device.

@danielfullmer
Copy link
Collaborator

danielfullmer commented Sep 3, 2020

So I was able to get it to build for pinephone, with the configuration file and repo file here: https://gist.github.com/danielfullmer/fe9c7cf8579c9b0ecc373fc456790fa4
This command should be enough to build it (pinned to the robotnix revision I tested it on):

nix-build "https://gist.github.com/danielfullmer/fe9c7cf8579c9b0ecc373fc456790fa4/archive/8c712df004379537ad1deb754742c83cc2d365ab.tar.gz" -A build.images

After a long wait, this will produce images.tar.gz under result. I'd presume you'd follow the instructions to flash this onto a device.

The support for signed builds in robotnix will not work with this, since it relies on signing target-files, and the glodroid instructions don't seem to consider that. It probably wouldn't be too hard to reimplement the final steps they have in their images target in nix, using the images from a signed target-files-package.

Also, I wasn't able to test this on my RPI3, since it fails to compile for me, which is understandable given the RPI3 support isn't released yet.

@danielfullmer danielfullmer added the enhancement New feature or request label Oct 22, 2020
@Mindavi
Copy link

Mindavi commented Oct 5, 2021

I'd like to give building and flashing the pinephone variant a try. I'm currently building the variant you mentioned, but I think it would give better results to build a more up-to-date version.

I'm not 100% certain about the steps, but this is what I think I should do:

  1. use scripts/mk_repo_file https://github.com/GloDroid/glodroid_manifest v0.7.0 to generate a repo file
  2. Update the nix script with any new requirements w.r.t. build packages
  3. Build it
  4. Flash it (according to their instructions)

Does that sound about right?

@danielfullmer
Copy link
Collaborator

Yes, that sounds right to me. Let us know if you're able to successfully build and flash an image, or if you run into any other issues.

@Mindavi
Copy link

Mindavi commented Oct 21, 2021

I did get the version you posted built, but when I put it on an SD card and try to boot the pinephone from that SD, absolutely nothing seems to happen (not even a LED showing life). Unfortunately I don't have a 3.5mm debug cable, otherwise I might be able to see debug logging -- if there is anything.

I also found that there's an adb, fastboot and mke2fs shipped inside the images.tar.gz, they don't work on nixos since they have the incorrect dynamic linker (among other things, possibly). But I can just use ones from my PATH when I install them, that's no biggie.

Edit: I might need to charge the phone a bit before giving up...

@samueldr
Copy link
Contributor

@Mindavi note that enabling LEDs is entirely software-driven on Pinephone.

IIRC the default U-Boot configs don't touch LEDs at all. So it's entirely plausible you can't expect to see the LED being turned on.

@Mindavi
Copy link

Mindavi commented Nov 22, 2021

I should get a (bigger) sd card and a serial cable soon, hopefully I can at least get some logs then.

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

No branches or pull requests

4 participants