LightBlog

lundi 19 décembre 2016

SultanXDA Explains Unified ROM Method and Approach on the OnePlus 3 and OnePlus 3T

Back when we covered that XDA Recognized Developer Sultanxda released his custom CyanogenMod 13 ROM and Kernel for the OnePlus 3T, a lot of people were surprised to see the "same" ROM build that was released for the OnePlus 3T make its way to the OnePlus 3 (or vice versa!).

Sultanxda adopted the unified approach to distributing ROMs for the OnePlus 3 and the OnePlus 3T owing to their largely similar hardware and low level software. This meant that the ROM offered cross-compatibility among both devices, where the same ROM zip could be distributed to the duo. Cross-compatible zips allowed users (and the developer too) to not worry about flashing the wrong zip accidentally and getting a bricked device. This is not to say that the OnePlus 3/3T are easy-to-brick — it just entails lesser headaches overall for all the parties involved.

We reached out to XDA Recognized Developer Sultanxda to shed some more light on the entire procedure, in order to encourage adoption of his method. Here are the main takeaways from the conversation with added emphasis:

What is different on the OnePlus 3/3T that allows for unified ROMs?

The reason why a unified ROM is possible is because OnePlus unified the BSP (the proprietary libraries) [Board Support Package]. Although unifying a kernel is easy, unifying a ROM is normally impossible for [ROM] developers due to inconsistencies in the BSP that only the OEM can address. On my end, all I had to do was unify the kernel and separate some GPU firmware images. The GPU's firmware images are different between the Snapdragon 820 and 821, so they are not cross compatible. I modified the kernel to make it load the correct GPU firmware for each device to fix this. I then added the corresponding firmware images to the ROM in this commit. The rest of the device-specific firmware images (such as the modem images) are located in a firmware partition on each device, so the GPU problem was the only firmware-related issue I faced.

How do the ROM and Kernel figure out which device it is?

The kernel knows which device it is running on thanks to the bootloader. The bootloader selects the Device Tree configuration (packed into the kernel image) that matches its board ID and passes this configuration onto the kernel This gives the kernel flexibility to load the appropriate configurations for both the OnePlus 3 and the OnePlus 3T. You can find the board ID for the OnePlus 3 and the OnePlus 3T by following the hyperlinks.

Do you only need a modified kernel to support unified builds?

No, the ROM must be unified as well. OnePlus unified the BSP starting from the Open Betas for the OP3, and kept it unified in the official OP3T OxygenOS release. This means that ROMs must be using proprietary libraries from either the OP3's Open Beta builds or the OP3T's official OxygenOS release in order to be unified. There is also the GPU firmware image requirement that I described above, and the OP3T's touchscreen firmware needs to be included in the ROM as well (this was added in the GPU firmware commit I linked to above).

Also, there is a caveat to the unified kernel: developers must either use my kernel (which is already unified), or they must add OP3 support to the OP3T's OxygenOS kernel. Support for the OP3T cannot simply be added to the OP3's kernel due to incomplete Snapdragon 821 support, so unification may require a lot of work from willing OP3 developers. My kernel already had complete Snapdragon 821 support when I received the OP3T (since my kernel is based off the Snapdragon 821 branch from CAF), so the unification process was rather painless for me.

I'm sure a lot of developers would rather use the OP3T's OxygenOS kernel rather than my kernel, which would require adding support for the OP3 to it. I didn't look into making a unified kernel for OxygenOS ROMs, so additional work may be required to make that happen.

Can other developers take a look at the code and see how this is done?

Yes. Sultanxda mentions that all of his work is publicly available on his GitHub account, so anyone with the requisite know-how can see how the ROM unification was undertaken. Granted, the procedure is a bit involved and requires a level of expertise, but it is a very much set-and-forget process with benefits originating in the form of lesser maintenance, less duplication of work, and a enhanced sense of assurance that people will not confuse files of the two devices as only one zip work for both. Once a ROM or kernel are unified and confirmed to be fully functional on both the OnePlus 3 and OnePlus 3T, very little additional work is required.


We hope we brought to light new information which should help more developers opt for unified builds for the devices. Development on the OnePlus 3T is growing, and unified builds are the future for both devices going forward.



from xda-developers http://ift.tt/2hMMIYG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire