[DEV] Using Project Treble to boot generic AOSP Image

Search This thread

PhantomGamers

Senior Member
Jun 27, 2011
919
920
NY
sundergaming.com
According to Project Treble lead Iliyan Malchev,
Malchev says that Treble standardizes Android hardware support to such a degree that generic Android builds compiled from AOSP can boot and run on every Treble device. In fact, these “raw AOSP” builds are what will be used for some of the CTS testing Google requires all Android OEMs to pass in order to license the Google apps—it’s not just that things should work, they are required to work.

Now that there's an Oreo beta for the Essential Phone that supports Treble, perhaps this can be used to further development on the device.
/u/foremi on Reddit confirmed that simply flashing a Pixel 2 system and boot image to the device is not enough, as it fails to boot, so the question is what constitutes a generic AOSP build?

I don't have Linux installed right now or I'd build it myself, but I suspect that building it with the simple target device of "generic" might be what Malchev is referring to.

If any devs would like to test this theory or give their input as to how they think this actually works I think it'd be incredibly useful for not just Essential phone development, but Android development as a whole.

EDIT: @phhusson confirms that the target device should be aosp_arm64_ab
 
Last edited:

phhusson

Recognized Developer
Jul 23, 2009
2,489
4,796
Paris
FWIW "generic AOSP build" is really what it says it is.
I have access to the "Google certification generic AOSP build" (that's weirdly not public, I don't know why), so I gave it a try. (Edit: So if the ROM was Treble-certified, it would work)

I get the Android bootanimation, but that's all (I have to say that's still a big step forward compared to other Android versions ;)

Looking at the logs, I see a loop of crash because of: /vendor/bin/hw/vendor.essential.hardware.sidecar@1.0-service
Which I guess is the HAL for the accessories, but that doesn't seem to be the reason for the crash

The reason of the crash, seem to be this:
11-15 12:59:04.491 5331 5331 F MediaProfiles: frameworks/av/media/libmedia/MediaProfiles.cpp:329 CHECK(quality != -1) failed.
in CAF, frameworks/av/media/libmedia/MediaProfiles.cpp we see vendor-specific (i.e. not in AOSP) quality attributes, like "vga"
And it is defined by Essential's framework (in vendor/etc/media_profiles_V1_0.xml)
Considering there are media_profiles xml files, I'd guess that _V1_0 is supposed to only contain AOSP-capable qualities


Edit2: The fingerprint of "certification generic AOSP", is Android/aosp_arm64_ab/generic_arm64_ab:8.0.0/OTR1.171023.001/4412360:userdebug/test-keys
So my guess to build this is that lunch aosp_arm64_ab && make should work

Edit3: the generated fingerprint is too long to build, needs to do make BUILD_NUMBER=4412360

Edit4: To make the situation more clear:
- NO, current ROM is NOT Treble capable
- BUT, almost everything is available for that. Every HAL is using "hwbinder" which is the basis, and most work needed for Treble

Also, I've seen some reddit comment mentioning boot.img.
Current version of Treble only concerns system.img, and NOT boot.img!
Future version are supposed to have generic boot.img as well, but that's not to be expected before at the very least Android P.
 
Last edited:

PhantomGamers

Senior Member
Jun 27, 2011
919
920
NY
sundergaming.com
Edit2: The fingerprint of "certification generic AOSP", is Android/aosp_arm64_ab/generic_arm64_ab:8.0.0/OTR1.171023.001/4412360:userdebug/test-keys
So my guess to build this is that lunch aosp_arm64_ab && make should work

I was gonna link to the aosp_arm64 make file but it said it was specifically for the emulator so I wasn't sure, that's good to know though.

Also, I've seen some reddit comment mentioning boot.img.
Current version of Treble only concerns system.img, and NOT boot.img!
Future version are supposed to have generic boot.img as well, but that's not to be expected before at the very least Android P.

Thanks for this, I suspected such but couldn't find a clear answer from Google on the matter so I suggested trying the boot.img as well just in case.

Now, someone has to test this on a different Treble device such as the Pixel or Pixel 2. I'm thinking MAYBE because the Oreo build for essential is just a beta its treble implementation isn't finished and hasn't passed Google's CTS requirements to boot the generic aosp image. Perhaps this will change in the final build.

For what it's worth I only have a LG V20 right now which currently doesn't support Treble, so I'm pretty useless as far as testing anything goes, but if this is figured out it'll greatly influence what device I go with when I eventually upgrade.
 

phhusson

Recognized Developer
Jul 23, 2009
2,489
4,796
Paris
Now, someone has to test this on a different Treble device such as the Pixel or Pixel 2.
Yup. I feel like Treble deserves its own "device" section in XDA ;)
I'm afraid I'm working on something that other people already did on other devices...

I'm thinking MAYBE because the Oreo build for essential is just a beta its treble implementation isn't finished and hasn't passed Google's CTS requirements to boot the generic aosp image. Perhaps this will change in the final build.
That's my guess as well.
 
  • Like
Reactions: PhantomGamers

TheDethEgineer

Senior Member
Apr 5, 2016
336
92
33
Juarez

Attachments

  • Screenshot_20171115-214635.png
    Screenshot_20171115-214635.png
    208.4 KB · Views: 2,957

phhusson

Recognized Developer
Jul 23, 2009
2,489
4,796
Paris
Thanks a lot!

This is interesting... according to Malchev, CTS testing REQUIRES a device to boot a generic AOSP image, and yet the Oreo build is CTS certified and doesn't boot the AOSP image...

That's true only for new devices, not for devices upgrading for nougat to oreo.
I wasn't aware there was an AMA yesterday... Too bad we could have asked.
 
  • Like
Reactions: Cuffuffles

PhantomGamers

Senior Member
Jun 27, 2011
919
920
NY
sundergaming.com
Tester with OG Pixel XL says it gives invalid zip file format error when trying to flash in TWRP

It's not a TWRP flashable zip, you have to extract the system.img from the zip and flash it with fastboot in the bootloader.

Also as @PresidentMcCain said, seeing the results of flashing a pixel 2 xl system image would be interesting too.

Oh and make sure the tester's OG pixel is already running Oreo before trying. Just adding that in case they didn't upgrade yet.
 
Last edited:

MishaalRahman

Retired Editor in Chief
Nov 2, 2015
1,045
2,153
www.xda-developers.com
It's not a TWRP flashable zip, you have to extract the system.img from the zip and flash it with fastboot in the bootloader.

Also as @PresidentMcCain said, seeing the results of flashing a pixel 2 xl system image would be interesting too.

Oh and make sure the tester's OG pixel is already running Oreo before trying. Just adding that in case they didn't upgrade yet.


Ah, I see.

Do you happen to know the exact command? I'm not that familiar with A/B partition devices and how that changes fastboot commands.
 
  • Like
Reactions: IH8TouchWiz

PhantomGamers

Senior Member
Jun 27, 2011
919
920
NY
sundergaming.com
Ah, I see.

Do you happen to know the exact command? I'm not that familiar with A/B partition devices and how that changes fastboot commands.

I believe it should work as normal
fastboot flash system system.img

EDIT: Apparently with the A/B partitions you'd do fastboot flash system_b system_other.img to flash the b partition, but the aosp build didn't include a system_other.img so I'm assuming perhaps it's not necessary
 
Last edited:
  • Like
Reactions: developweb

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    FWIW "generic AOSP build" is really what it says it is.
    I have access to the "Google certification generic AOSP build" (that's weirdly not public, I don't know why), so I gave it a try. (Edit: So if the ROM was Treble-certified, it would work)

    I get the Android bootanimation, but that's all (I have to say that's still a big step forward compared to other Android versions ;)

    Looking at the logs, I see a loop of crash because of: /vendor/bin/hw/vendor.essential.hardware.sidecar@1.0-service
    Which I guess is the HAL for the accessories, but that doesn't seem to be the reason for the crash

    The reason of the crash, seem to be this:
    11-15 12:59:04.491 5331 5331 F MediaProfiles: frameworks/av/media/libmedia/MediaProfiles.cpp:329 CHECK(quality != -1) failed.
    in CAF, frameworks/av/media/libmedia/MediaProfiles.cpp we see vendor-specific (i.e. not in AOSP) quality attributes, like "vga"
    And it is defined by Essential's framework (in vendor/etc/media_profiles_V1_0.xml)
    Considering there are media_profiles xml files, I'd guess that _V1_0 is supposed to only contain AOSP-capable qualities


    Edit2: The fingerprint of "certification generic AOSP", is Android/aosp_arm64_ab/generic_arm64_ab:8.0.0/OTR1.171023.001/4412360:userdebug/test-keys
    So my guess to build this is that lunch aosp_arm64_ab && make should work

    Edit3: the generated fingerprint is too long to build, needs to do make BUILD_NUMBER=4412360

    Edit4: To make the situation more clear:
    - NO, current ROM is NOT Treble capable
    - BUT, almost everything is available for that. Every HAL is using "hwbinder" which is the basis, and most work needed for Treble

    Also, I've seen some reddit comment mentioning boot.img.
    Current version of Treble only concerns system.img, and NOT boot.img!
    Future version are supposed to have generic boot.img as well, but that's not to be expected before at the very least Android P.
    6
    Full Treble Support in 8.1 Confirmed

    "We are aiming for full treble support on our 8.1 release and we are getting pretty close"

    Essential just posted this on their reddit AMA.
    5
    Where did you end up getting gsi for bliss?

    News and updates from Team Bliss will arrive soon.

    We have test builds running daily, I get them from mine, or one of several Team only Build Boxes.

    We will share in the community when the time is right
    5
    Ok, so I got the courage to test a bit further.
    And the conclusion is that Treble support is still quite far.
    Let's hope the beta 2 works better.

    I'll report the bugs to Essential anyway. I've already reported them half a dozen of bugs, and 0 feedback, but well...
    (and I missed the AMA AGAIN.)
    4
    Oh shoot I misread it as well. I can flash it tomorrow morning.

    Edit - I went ahead and did it now, we have a successful no crash boot on the Essential using the last System Image you posted

    Edit 2 - I am not sure what is supposed to be working and what is not since I have not flashed an AOSP image for a long time.

    Some things that stood out to me were:
    WiFi, BT, NFC, Display, touch, buttons, front and rear cameras - all working

    No Cellular or sound though.


    Sent from my iPhone using Tapatalk