[GUIDE] How to Build TencentOS for any Device [GUIDE]

Search This thread

Qiangong2

Senior Member
Oct 31, 2014
1,450
376
Samsung Galaxy S20
00000.jpg

TencentOS is an aftermarket firmware designed by the Chinese company Tencent. Tencent also created the QQ and WeChat IM services.

TencentOS, just like MiUi is not open source. However, Tencent has provided a version of PatchRom for you to use called TOSPlus. I have tested this on the Samsung Galaxy Star Pro. The guide for the TencentOS PatchRom is different than the MiUi and LewaOS and it is written in Chinese only. I will be writing a guide in English so that more people can port this great ROM to their devices.

Pre Steps:
You should Install 2 versions of Java. Version 7, and Version 6.
For Ubuntu and derivatives, type:

Code:
sudo apt-get install openjdk-7-jdk

Now we need the official Java 6.
For Ubuntu and derivatives, type:

Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer

Be sure to select add when it asks if you want to add the repository or not.

Then, make sure you have all of the required android packages:

Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
  lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
  libgl1-mesa-dev libxml2-utils xsltproc unzip

Note: the above is only for 64-bit. Will update when 32-bit is tested.

------------------------------------------------------------------------------------------------------

Step 1:
Make sure you are on a version of Ubuntu 14.04 or greater (16.04 may or may not work).

Step 2:
Now you need to make a copy of the TencentOS PatchRom. Change to whatever directory you want and Type:
Code:
git clone https://github.com/TOSPlus/TPS
This will make a folder called TPS in whatever directory you were in before. The TPS folder will contain all of the code required to build TencentOS for your device.

Step 3:
Change the directory to TPS and type:
Code:
source build/envsetup.sh
This will initiate the build process.

Step 4:
Next, you build the directory for your device. Type:
Code:
make create brand=put-manufacturer-name device=device-model
Replace "put-manufacturer-name" with your manufacturer and replace "device-model" with your device model.

Step 5:
Next you need to copy a zip file of a ROM you want to use as your base into your device model folder. Name the zip file to ota.zip. Make sure the base ROM is android 4.3 or above.

Step 6:
Now, you configure the build. Type:
Code:
make config device=device-model
Replace device-model with your device's model.

Step 7:
Once you have that done, you need to edit a few files. Those files are misc_info.txt, remove_files.list, tos_system_files.ignore, and build.prop. You can find all of the files underneath the config folder within your device-model folder.

In misc_info.txt, you need to change blocksize, boot_size, recovery_size, system_size, userdata_size, and cache_size to match your device. You can find these in the BoardConfig.mk of your device.

In remove_files.list, you add the files that need to be removed so that TencentOS can function fully. This usually takes quite a bit of trial and error to get correct.

In tos_system_files.ignore, you designate which files should not get edited when you are patching the different services.

In the build.prop, you need to add the TencentOS properties.
example (for the gt-i9500):
ro.qrom.beaconkey=0M000V5PH01B6QQD
ro.qrom.product.device=ja3g
ro.qrom.product.device.brand=samsung
ro.qrom.build.brand=tos
ro.qrom.build.os=android4.4.2
ro.qrom.otapath=/data/media/0
qrom_disposeIcon_enable=1
qrom_permission_enable=1
# ro.qrom.build.version.snflag=ADRQRTOS
ro.qrom.build.version.snver=01
#need edit ro.qrom.build.version.day=151028
ro.qrom.build.version.name=ADRQRTOS01_M
ro.qrom.build.version.number=01151028
ro.qrom.build.version.type=M
#need edit ro.qrom.build.number=3
ro.qrom.build.lc=A1B2C3000D4E5F6
ro.qrom.build.lcid=99
#need edit ro.qrom.build.date=Wed OCT 28 21:01:25 CST 2015
ro.qrom.build.date.utc=1446014851
ro.qrom.build.type=mod

Everything that says need edit, you need to edit for your device specifically.

Step 8:
Copy file_contexts from the boot.img and put in the config folder.

Step 9:
Copy recovery.fstab from the recovery.img of your device to the config folder

Step 10:
Next, you need to extract all of the files from the ota.zip and put them in the correct place. To do that, type:
Code:
make prepare

Step 11:
Now, you can patch your ota.zip. type:
Code:
make patch
If there are any failed patches, you have to patch those smali files manually.

Step 12:
After patching has been done, type:
Code:
make repack
It repacks the jars and frameworks required that TencentOS has edited.

Step 13:
You made it :) this is the final step. Type:
Code:
make package
It will create a zip file of TencentOS for your device model.

Then you can flash it in a custom recovery and enjoy your new ROM :)


Here is a video of how to do it: http://forum.xda-developers.com/showpost.php?p=67495578&postcount=75

===========================================================================================

Apps you should manually remove after building (not all may be in your ROM)
:

SystemUI.apk
Trebuchet.apk
Dialer.apk
Mms.apk
Contacts.apk
Email.apk
DSPManager.apk
qotaupdater.apk (let's face it, our devices will never get an official update :p )
Apollo.apk
Launcher3.apk
SetupWizard.apk
VideoEditor.apk
Calculator.apk
Calendar.apk
CalendarProvider.apk
CMFileManager.apk
CMHome.apk
CMWallpapers.apk
DocumentsUI.apk
Gallery2.apk
DownloadProviderUI.apk
HoloSpiralWallpaper.apk
InCallUI.apk
LatinIME.apk (or qime.apk)
LiveWallpapers.apk
LiveWallpapersPicker.apk
LockClock.apk
MagicSmokeWallpapers.apk
PackageInstaller.apk
SoundRecorder.apk
Term.apk
VideoEditor.apk
CMAccount.apk
CMUpdater.apk
Contactsprovider.apk
VoiceDialer.apk
qtheme.apk
ThemeChooser.apk
ThemeProvider.apk
 
Last edited:

Qiangong2

Senior Member
Oct 31, 2014
1,450
376
Samsung Galaxy S20
What are spreadtrum devices. Won't u continue the rom for star pro

Sent from my XT1022 using XDA-Developers mobile app

Spreadtrum devices refers to the processor. Spreadtrum devices use spreadtrum processors, Mediatek devices use Mediatek processors, and Qualcomm devices use Qualcomm processors. Spreadtrum devices are notorious for being hard to develop for as there is not as much information on them as on Qualcomm and Mediatek devices.

Sent from my Q5 using XDA Free mobile app
 
  • Like
Reactions: zhaozihanzzh

The Marionette

Senior Member
Jun 27, 2011
5,146
2,678
Zagreb
Hello.
I want to ask about something.

Can we enable the navigation bar in build.prop,and is the system fully compatible with it?

Also,has it been tested on Lollipop?
 
Last edited:

Qiangong2

Senior Member
Oct 31, 2014
1,450
376
Samsung Galaxy S20
Hello.
I want to ask about something.

Can we enable the navigation bar in build.prop,and is the system fully compatible with it?

Also,has it been tested on Lollipop?

The notification bar is built into qsystemui.apk. You need to remove the original systemui.apk that you had in the ota.zip after the packaging.

Sent from my Q5 using XDA Free mobile app
 
  • Like
Reactions: The Marionette

The Marionette

Senior Member
Jun 27, 2011
5,146
2,678
Zagreb
Hmmm, I got around 40 errors. Where are the "reject" files put after the command ends?

The errors look like this:
Code:
[ERROR]patching /home/the/roms/tencent/TPS/devices/tos/smali/framework2.jar/smali/com/android/internal/app/ChooserActivity.smali ... fail.
[ERROR] cannot find corresponding target smali file of com/android/internal/app/ChooserActivity.smali
 
Last edited:

Qiangong2

Senior Member
Oct 31, 2014
1,450
376
Samsung Galaxy S20
Hmmm, I got around 40 errors. Where are the "reject" files put after the command ends?

The errors look like this:
Code:
[ERROR]patching /home/the/roms/tencent/TPS/devices/tos/smali/framework2.jar/smali/com/android/internal/app/ChooserActivity.smali ... fail.
[ERROR] cannot find corresponding target smali file of com/android/internal/app/ChooserActivity.smali

There is no reject file as far as I can find. I didn't honestly look too hard though. If you are on Lollipop, I haven't tried it on 5.0 or above. You have to go into the smali file that has an error and manually patch it. Also, I used CM11 as my base. You may need an aosp or cm based rom to be used as your base.

Sent from my Q5 using XDA Free mobile app
 

The Marionette

Senior Member
Jun 27, 2011
5,146
2,678
Zagreb
There is no reject file as far as I can find. I didn't honestly look too hard though. If you are on Lollipop, I haven't tried it on 5.0 or above. You have to go into the smali file that has an error and manually patch it. Also, I used CM11 as my base. You may need an aosp or cm based rom to be used as your base.

Sent from my Q5 using XDA Free mobile app

I am using Cm12.1 as a base. And we have nothing older than CM12.1...
When I was using the FlymeOS Patchtool,if it had errors,it would distinctively show the conflicts in the troublesome files.
But Tencent Patchtool doesn't make a "reject" folder.
I tried searching for the files,and I would get two files found. I open them both in text editors,but there are no conflict lines in there. :confused:

Then I tried to just make the package,but it gave me an error mentioning those files which weren't edited.
 

Qiangong2

Senior Member
Oct 31, 2014
1,450
376
Samsung Galaxy S20
I am using Cm12.1 as a base. And we have nothing older than CM12.1...
When I was using the FlymeOS Patchtool,if it had errors,it would distinctively show the conflicts in the troublesome files.
But Tencent Patchtool doesn't make a "reject" folder.
I tried searching for the files,and I would get two files found. I open them both in text editors,but there are no conflict lines in there. :confused:

Then I tried to just make the package,but it gave me an error mentioning those files which weren't edited.

Okay. Were any successful at patching?

Sent from my Q5 using XDA Free mobile app
 

Qiangong2

Senior Member
Oct 31, 2014
1,450
376
Samsung Galaxy S20
I am using Cm12.1 as a base. And we have nothing older than CM12.1...
When I was using the FlymeOS Patchtool,if it had errors,it would distinctively show the conflicts in the troublesome files.
But Tencent Patchtool doesn't make a "reject" folder.
I tried searching for the files,and I would get two files found. I open them both in text editors,but there are no conflict lines in there. :confused:

Then I tried to just make the package,but it gave me an error mentioning those files which weren't edited.

I think I figured out why it won't work. It won't work if you have the rom with .dat files. You need it open like on 4.4 and below.

Sent from my Q5 using XDA Free mobile app
 

The Marionette

Senior Member
Jun 27, 2011
5,146
2,678
Zagreb
I think I figured out why it won't work. It won't work if you have the rom with .dat files. You need it open like on 4.4 and below.

I made the zip open already,I am not THAT bad. xD

But I hope we are on the same page here. I made sure that my zip wasn't block based,but normal like 4.4 was(I could edit all things inside the zip instead of having one system.DAT image in the zip).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    00000.jpg

    TencentOS is an aftermarket firmware designed by the Chinese company Tencent. Tencent also created the QQ and WeChat IM services.

    TencentOS, just like MiUi is not open source. However, Tencent has provided a version of PatchRom for you to use called TOSPlus. I have tested this on the Samsung Galaxy Star Pro. The guide for the TencentOS PatchRom is different than the MiUi and LewaOS and it is written in Chinese only. I will be writing a guide in English so that more people can port this great ROM to their devices.

    Pre Steps:
    You should Install 2 versions of Java. Version 7, and Version 6.
    For Ubuntu and derivatives, type:

    Code:
    sudo apt-get install openjdk-7-jdk

    Now we need the official Java 6.
    For Ubuntu and derivatives, type:

    Code:
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java6-installer

    Be sure to select add when it asks if you want to add the repository or not.

    Then, make sure you have all of the required android packages:

    Code:
    sudo apt-get install git-core gnupg flex bison gperf build-essential \
      zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
      lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
      libgl1-mesa-dev libxml2-utils xsltproc unzip

    Note: the above is only for 64-bit. Will update when 32-bit is tested.

    ------------------------------------------------------------------------------------------------------

    Step 1:
    Make sure you are on a version of Ubuntu 14.04 or greater (16.04 may or may not work).

    Step 2:
    Now you need to make a copy of the TencentOS PatchRom. Change to whatever directory you want and Type:
    Code:
    git clone https://github.com/TOSPlus/TPS
    This will make a folder called TPS in whatever directory you were in before. The TPS folder will contain all of the code required to build TencentOS for your device.

    Step 3:
    Change the directory to TPS and type:
    Code:
    source build/envsetup.sh
    This will initiate the build process.

    Step 4:
    Next, you build the directory for your device. Type:
    Code:
    make create brand=put-manufacturer-name device=device-model
    Replace "put-manufacturer-name" with your manufacturer and replace "device-model" with your device model.

    Step 5:
    Next you need to copy a zip file of a ROM you want to use as your base into your device model folder. Name the zip file to ota.zip. Make sure the base ROM is android 4.3 or above.

    Step 6:
    Now, you configure the build. Type:
    Code:
    make config device=device-model
    Replace device-model with your device's model.

    Step 7:
    Once you have that done, you need to edit a few files. Those files are misc_info.txt, remove_files.list, tos_system_files.ignore, and build.prop. You can find all of the files underneath the config folder within your device-model folder.

    In misc_info.txt, you need to change blocksize, boot_size, recovery_size, system_size, userdata_size, and cache_size to match your device. You can find these in the BoardConfig.mk of your device.

    In remove_files.list, you add the files that need to be removed so that TencentOS can function fully. This usually takes quite a bit of trial and error to get correct.

    In tos_system_files.ignore, you designate which files should not get edited when you are patching the different services.

    In the build.prop, you need to add the TencentOS properties.
    example (for the gt-i9500):
    ro.qrom.beaconkey=0M000V5PH01B6QQD
    ro.qrom.product.device=ja3g
    ro.qrom.product.device.brand=samsung
    ro.qrom.build.brand=tos
    ro.qrom.build.os=android4.4.2
    ro.qrom.otapath=/data/media/0
    qrom_disposeIcon_enable=1
    qrom_permission_enable=1
    # ro.qrom.build.version.snflag=ADRQRTOS
    ro.qrom.build.version.snver=01
    #need edit ro.qrom.build.version.day=151028
    ro.qrom.build.version.name=ADRQRTOS01_M
    ro.qrom.build.version.number=01151028
    ro.qrom.build.version.type=M
    #need edit ro.qrom.build.number=3
    ro.qrom.build.lc=A1B2C3000D4E5F6
    ro.qrom.build.lcid=99
    #need edit ro.qrom.build.date=Wed OCT 28 21:01:25 CST 2015
    ro.qrom.build.date.utc=1446014851
    ro.qrom.build.type=mod

    Everything that says need edit, you need to edit for your device specifically.

    Step 8:
    Copy file_contexts from the boot.img and put in the config folder.

    Step 9:
    Copy recovery.fstab from the recovery.img of your device to the config folder

    Step 10:
    Next, you need to extract all of the files from the ota.zip and put them in the correct place. To do that, type:
    Code:
    make prepare

    Step 11:
    Now, you can patch your ota.zip. type:
    Code:
    make patch
    If there are any failed patches, you have to patch those smali files manually.

    Step 12:
    After patching has been done, type:
    Code:
    make repack
    It repacks the jars and frameworks required that TencentOS has edited.

    Step 13:
    You made it :) this is the final step. Type:
    Code:
    make package
    It will create a zip file of TencentOS for your device model.

    Then you can flash it in a custom recovery and enjoy your new ROM :)


    Here is a video of how to do it: http://forum.xda-developers.com/showpost.php?p=67495578&postcount=75

    ===========================================================================================

    Apps you should manually remove after building (not all may be in your ROM)
    :

    SystemUI.apk
    Trebuchet.apk
    Dialer.apk
    Mms.apk
    Contacts.apk
    Email.apk
    DSPManager.apk
    qotaupdater.apk (let's face it, our devices will never get an official update :p )
    Apollo.apk
    Launcher3.apk
    SetupWizard.apk
    VideoEditor.apk
    Calculator.apk
    Calendar.apk
    CalendarProvider.apk
    CMFileManager.apk
    CMHome.apk
    CMWallpapers.apk
    DocumentsUI.apk
    Gallery2.apk
    DownloadProviderUI.apk
    HoloSpiralWallpaper.apk
    InCallUI.apk
    LatinIME.apk (or qime.apk)
    LiveWallpapers.apk
    LiveWallpapersPicker.apk
    LockClock.apk
    MagicSmokeWallpapers.apk
    PackageInstaller.apk
    SoundRecorder.apk
    Term.apk
    VideoEditor.apk
    CMAccount.apk
    CMUpdater.apk
    Contactsprovider.apk
    VoiceDialer.apk
    qtheme.apk
    ThemeChooser.apk
    ThemeProvider.apk
    2
    i've quit trying. to much of a hassle.
    thx for a clean guide but i think it's above my hat for now.

    Np. It may be that TPS just doesn't work on 6.0.1

    Sent from my Q5 using XDA Free mobile app
    2
    Thanks .....where u ll upload the video

    Sent from my Moto E using XDA-Developers mobile app

    Here it is:

    https://vimeo.com/172327871

    Sorry the quality isn't too good, but it's a video :)
    1
    Can we port this rom for any device with above mentioned steps

    Sent from my XT1022 using XDA-Developers mobile app

    Yes. It even works on Spreadtrum devices

    Sent from my Q5 using XDA Free mobile app
    1
    Hey @Qiangong2 I remember I had asked you to Port guide of flyme os did u do that please tell

    Sent from my Moto E using XDA-Developers mobile app

    I've been working on the smali tutorial first, then i'll work on the Flyme tutorial.

    Sent from my Q5 using XDA Free mobile app
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone