[MOD][12.11] Your own OTA for custom roms [DEVS ONLY]

m0narx

Recognized Developer
Jun 5, 2008
262
7,314
133
Moscow
uhdrom.net
I use this technology to update my roms in Russia, and now i want to share it
You must have own server to use it.
Step 1. Preparing ROM
build.prop mods:
Code:
#Version of your rom in format: Name X.X.X for example: ViperY 1.0.1
ro.product.version = <YOUR ROM NAME> <VERSION>
#Path to checkin script
ro.htc.checkin.url = http://ruhdrom.ru/cgi-bin/checkin 
#Path to script [JUST BLOCK]
ro.htc.checkin.crashurl = http://ruhdrom.ru/cgi-bin/crash
 #Path to checkin script
ro.htc.checkin.url_CN = http://ruhdrom.ru/cgi-bin/checkin
 #Path to script [JUST BLOCK]
ro.htc.checkin.crashurl_CN = http://ruhdrom.ru/cgi-bin/crash
 #Path to script [JUST BLOCK]
ro.htc.checkin.exmsg.url = http://ruhdrom.ru/cgi-bin/extra
 #Path to script [JUST BLOCK]
ro.htc.checkin.exmsg.url_CN = http://ruhdrom.ru/cgi-bin/extra
ro.htc.appupdate.url = http://ruhdrom.ru/cgi-bin/appupdate 
ro.htc.appupdate.url_CN = http://apu-chin.htccomm.com.cn/check-in/rws/and-app/update
 #Path to script [JUST BLOCK]
ro.htc.iappupdate.url = http://ruhdrom.ru/cgi-bin/iappupdate
 #Path to script [JUST BLOCK]
ro.htc.iappupdate.url_CN = http://ruhdrom.ru/cgi-bin/iappupdate
 #Path to script [JUST BLOCK]
ro.htc.appupdate.exmsg.url = http://ruhdrom.ru/cgi-bin/appupdate_extra
 #Path to script [JUST BLOCK]
ro.htc.appupdate.exmsg.url_CN = http://ruhdrom.ru/cgi-bin/appupdate_extra
Adding certs
pack pem cert that you use for signing rom's zip with name releasekey.x509.pem to the zip archive and name it otacerts.zip
place otacerts.zip in /system/etc/security in your Rom

HTCCheckin modification
1. Extract and decompile file HTCOTAClient.apk or HTCCheckin.apk from you rom
2. Find word "ro.build.version.sdk" in all smali files and replace it with "ro.product.version"
3. Find word "apiLevel" in all smali files and replace it with "rom_version"
4. Compile HTCOTAClient and put it in your rom

ROM Modification DONE

Step 2: Setting up server
You need perl installed on server and mysql db, to use my solution
Creating DBS
Just import my sql files to create dbs
Whats containing in tables:
Users table:
IMEI - user imei
User - user nick
Version - current rom version
BetaTester - is this your beta tester
device - user device - value from ro.product.device
LastCheck - last update check
CheckResult - teh field - talk if user request update, but not download it yet

Fota table:
Device - for what device this update ( value from ro.product.device of build.prop )
FromVer - for what version this update
ToVer - to what version rom will be updated
FileName - direct link to flashable zip file
FileSize - file size in mbytes
Description - description of update
IsBeta - send this update only for beta testers

Installing perl scripts
Edit file checkin
Code:
my $server = ''; #server
my $db_user_name = ''; #DB User
my $db_password = '';  #DB Password
my $db_server = '';    #DB Server
my $db = '';           #DB
place both files into cgi-bin directory on server
change permission for scripts to 0755

CHECK UPDATE))))

Using beta testers function:
Say you beta tester to check update
Find his imei in users table, and set BetaTester=1 and User=<UserNick>
Insert record about update in fota table, and set isBeta = 1
 

Attachments

Last edited:

V6-Maniac

Senior Member
Jun 27, 2006
4,585
7,239
0
Groningen
Just noticed your guide and thx for that.
But i have a few questions and hope you'll could help a bit.
I trying to implant this into my Sense 4.0 for pyramid rom.

First of all when following your guide and monitoring my phones traffic via proxy there is no outbound traffic.
When using (for testing purpose) your ViperSs rom modded files there is some traffic to your server.
Editing them to connect mine it does seems to work.
Also the checking script seems to work due the fact it is writing some data into MySQL.

But this was just for testing purposes, kanging aint my thing.
Also i think this guide i missing some essential scripts or guide lines.
Because until now the available scripts here only writes some data to MySQL and are doing nothing besides that, right.

Here are my question:
- Where should the OTA zip be placed
- How should the OTA look like (usual rom.zip, ota style like HTC, ect)
- Which script is needed so the OTA is distributed automatically instead of modding the fota table manually
- Whichis smali modifications should be made so the OTA can be found and downloaded, installed automaticly (only have checkin now)
- Seems your ViperSs rom uses a lot more perl scripts, are these missing here

thx in advanced
 
Last edited:

Jonny

Retired Forum Moderator
Jul 22, 2011
9,285
9,606
263
Birmingham
jonathonfitch.com
Here are my question:
- Where should the OTA zip be placed
- How should the OTA look like (usual rom.zip, ota style like HTC, ect)
- Which script is needed so the OTA is distributed automatically instead of modding the fota table manually
- Whichis smali modifications should be made so the OTA can be found and downloaded, installed automaticly (only have checkin now)
- Seems your ViperSs rom uses a lot more perl scripts, are these missing here

thx in advanced
The OTA file should be placed in the directory defined in "my $server="http://xxx/fota";"
E.g Venom OneX ROM is in:
http://***********/fota/endavourU/ViperXOTA_2.5.0-2.6.0.zip
so
my $server="http://***********/fota/endavourU/";
Note: I have starred out the URL .com domain.
OTA file should be usual custom ROM zip file

As to the others, I cant answer them yet but there are perl scripts missing - iapp_update and app_update
 
Last edited:
  • Like
Reactions: kinghunki

ONeill123

Senior Member
Dec 8, 2011
609
94
58
www.droidwiki.org
Then i think, that this thread is very unuseful.
@m0narx:
If you create those threads, then plz upload all files needed and give us all information, if not, this threads are not goo seen here.

I hope, that m0narx do the uploads, it give not another OTA method, or?
 

Jonny

Retired Forum Moderator
Jul 22, 2011
9,285
9,606
263
Birmingham
jonathonfitch.com
I upload all needed files, no more files needed for ota
What do you do with the checkin script in Venom ROM though because you have edited smali, not build.prop
Code:
.field public static CLIENT_VERSION:Ljava/lang/String; = null

.field private static final COTA_DFT_CHECKIN_URL:Ljava/lang/String; = "http://ruhdrom.net/cgi-bin/cota"

.field private static final COTA_DFT_CHECKIN_URL_CN:Ljava/lang/String; = "http://ruhdrom.net/cgi-bin/cota"

.field private static final COTA_ENABLE_PROPERTY:Ljava/lang/String; = "ro.config.venom.enableCOTA"

.field private static final COTA_PROP_CHECKIN_URL:Ljava/lang/String; = "ro.venom.cota.url"

.field private static final COTA_PROP_CHECKIN_URL_CN:Ljava/lang/String; = "ro.venom.cota.url"

.field private static final FOLDER_CW_OUTPUT:Ljava/lang/String; = "/data/data/cwtemp/"

.field public static LOCAL_LOGV:Z

.field public static TAG:Ljava/lang/String;
Code:
    invoke-virtual {v11, v0, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v19, "ro.product.version"

    invoke-static/range {v19 .. v19}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v16

    if-nez v16, :cond_c

    const-string v16, "N/A"

    :cond_c
    const-string v19, "romVersion"

    move-object/from16 v0, v19

    move-object/from16 v1, v16
In COTAReceiver.smali so you must have changed something in your checkin perl file to adapt it to use ro.product.version instead of my.rom.version - because ro.product.version is not in 1.x.x format, its ro.product.version=ViperS 1.2.1 so what edit did you do to the checkin script?

---------- Post added at 08:03 PM ---------- Previous post was at 08:02 PM ----------

M0narx, i habe Tester this method, übt Not funct. And Chat i mist Type for the appupdate in Bild.Prop?

Sent from my HTC Sensation XE with Beats Audio Z715e using xda app-developers app
I think a way round the appupdate problem is create an empty script file named appupdate - maybe thats what m0narx meant by [JUST BLOCK]?
 
Last edited:

Jonny

Retired Forum Moderator
Jul 22, 2011
9,285
9,606
263
Birmingham
jonathonfitch.com
Code:
.field private static final COTA_DFT_CHECKIN_URL:Ljava/lang/String; = "http://ruhdrom.net/cgi-bin/cota"

.field private static final COTA_DFT_CHECKIN_URL_CN:Ljava/lang/String; = "http://ruhdrom.net/cgi-bin/cota"
There appears to also be a cota perl script missing that is present in Viper ROMs
 
  • Like
Reactions: ONeill123

Jonny

Retired Forum Moderator
Jul 22, 2011
9,285
9,606
263
Birmingham
jonathonfitch.com
This its just block from going to HTC site. It's just empty Perl script
how about the checkin mod to get ro.product.version recognised though because in OP you say my.rom.version bust be in x.x.x format but in COTAReceiver.smali you have replaced "<SHORTROMNAME>_version" with "romVersion and "my.rom.version" with ro.product.version"