[Android Software Development] kumarayush2104:
HOW TO PORT ROMS IN WINDOWS​

WARNING :- I AM NOT RESPONSIBLE FOR BRICKED DEVICES, DEAD SD CARDS OR ANY OTHER STUFFS HAPPEN WITH YOU.

WARNING:- THIS IS FOR SNAPDRAGON DEVICES ONLY.

YOU NEED A WORKING A PC AND SOME SOFTWARES LIKE:-​

WINRAR (https://www.win-rar.com/download.html?&L=0)

NOTEPAD++ (https://notepad-plus-plus.org/)

ANDROID IMAGE KITCHEN (https://mega.nz/#F!P5AA3azC!AijFT4S-dAwbt88eKkTIMA)

EXTRACTOR 4.0 (https://mega.nz/#F!y0YhwT5D!SX6cQ7lPv7XGiH7GLDXLyw)

MELD (https://download.gnome.org/binaries/win32/meld/?_e_pi_=7,PAGE_ID10,4038285101)

SO HERE WE GO,

STEP 1

EXTRACT YOUR BASE ROM AND PORT ROM IN TWO DIFFERENT FOLDER.

STEP 2

MAKE TWO DIFFERENT FOLDER AND NAME THEM PORT BOOT IMAGE AND BASE BOOT IMAGE.

(NOT INSIDE THE ROM FOLDER)

STEP 3

COPY THE BASE BOOT IMAGE IN BASE BOOT IMAGE FOLDER

AND COPY THE PORT BOOT IMAGE IN PORT BOOT IMAGE FOLDER

STEP 4

USING ANDROID IMAGE KITCHEN

EXTRACT BOTH BOOT IMAGE (BASE AND PORT)

STEP 5

REPLACE [/SPLIT_IMG/boot.img-zImage](AFTER EXTRACTION )

REPLACE [/SPLIT_IMG/boot.img-dtb](AFTER EXTRACTION )

(FROM BASE BOOT IMAGE TO PORT BOOT IMAGE)

STEP 6

USING MELD,

COMPARE FILES [RAMDISK/INIT.RC]

COMPARE FILES [RAMDISK/FSTAB.QCOM]

(FROM BASE BOOT IMAGE TO PORT BOOT IMAGE)

STEP 7

USING ANDROID IMAGE KITCHEN

REPACK YOUR BOOT IMAGE.

FINALLY WE HAVE PORTED BOOT IMAGE !!!
​

STEP 8

EDIT YOUR UPDATE SCRIPT PRESENT IN [PORT ROM/META-INF/COM/GOOGLE/ANDROID/UPDATE SCRIPT]

ERASE

getprop("ro.product.device") == "XXXXXXX" || abort("This package is for "XXXXXX"" devices; this is a "" + getprop("ro.product.device")

FROM THE UPDATE SCRIPT

STEP 9

EDIT YOUR BUILD.PROP USING NOTEPAD++

COMPARE LCD DENSITY IN BUILD.PROP [PORT ROM/SYSTEM][WITH BASE ROM/SYSTEM/BUILD.PROP]

CHANGE YOUR MODEL NO. IN THESE LINES [IN PORT ROM'S BUILD.PROP]

ro.product.model=

ro.product.brand=

ro.product.name=

ro.product.device=

STEP 10

REPACK YOUR PORT ROM USING WINRAR

DONE !!!

HOW TO PORT ROM IN LINUX​

FIRST STEP :-- INSTALL PACKAGES

ZIP, UNZIP, PYTHON,ADB, FASTBOOT, MELD

FOR DEBIAN BASED LINUX

sudo apt update; sudo apt install zip adb meld fastboot python unzip zip

DOWNLOAD THESE AND EXTRACT IT IN SEPERATE FOLDER

SUPERR 'S KITCHEN (https://xdaforums.com/apps/superr-kitchen/kitchen-superr-s-kitchen-v1-1-50-v2-1-6-t3597434)

AIK-LINUX (https://xdaforums.com/showthread.php?t=2073775) EXTRACT THIS 2 TIME AND NAME IT PORT BOOT AND STOCK BOOT

IF YOU HAVE SYSTEM FOLDER THEN

MAKE TWO FOLDER NAME STOCK AND PORT

FOR MAKING FOLDER

mkdir stock port

(YOU CAN REPLACE THE NAME)

HERE WE GOT TWO FOLDERS, COPY YOUR STOCK ROM IN STOCK FOLDER AND PORT IN PORT FOLDER

THEN EXTRACT BOTH FILES BY UNZIP LIKE

name@pcname:~/path/to/your/rom/stock$ unzip *.zip

SAME FOR PORT ROM

name@pcname:~/path/to/your/rom/port$ unzip *.zip

NOW WE HAVE TO PORT THE BOOT IMAGE

GO TO WHERE YOU HAVE EXTRACTED AIK-LINUX , COPY THE STOCK BOOT IMAGE IN STOCK BOOT FOLDER AND PORT IN PORT BOOT FOLDER

NOW EXTRACT BOOT IMAGE

name@pcname:~/path/to/your/aik-linux/stock boot$ ./unpackimg.sh

AND SAME WITH PORT

name@pcname:~/path/to/your/aik-linux/port boot$ ./unpackimg.sh

NOW REPLACE, (FROM STOCK TO PORT

/SPLIT_IMG/BOOT.IMG-ZIMAGE
/SPLIT_IMG/BOOT.IMG-DTB

AFTER THAT USE MELD FOR COMPARING RAMDISK FILES, FOR MELD WRITE THIS IN TERMINAL

sudo meld

COMPARE,(FROM STOCK TO PORT

/ramdisk/fstab.qcom
/ramdisk/init.rc
/ramdisk/uneventd.rc
/ramdisk/uneventd.qcom.rc

NOW REPACK THE PORT BOOT IMAGE BY

name@pcname:~/path/to/your/aik-linux/port boot$ ./repackimg.sh

NOW WE HAVE SUCCESSFULLY PORTED THE BOOT IMAGE

PLACE IT IN YOUR PORT ROM

NOW THROUGH MELD, COMPARE YOUR BUILD.PROP FOR LCD DENSITY AND DEVICE NAME AND BRAND (FROM STOCK TO PORT

NOW OPEN YOUR UPDATER-SCRIPT PATH:- PORT ROM/META-INF/COM/GOOGLE/ANDROID

REMOVE THESE LINES IF IT HAVE

getprop("ro.product.device") == "XXXXXXX" || abort("This package is for "XXXXXX"" devices; this is a "" + getprop("ro.product.device")

AND REPLACE YOUR MOUNT SYSTEM,FORMAT SYSTEM AND BOOT.IMG FLASHING LINE FROM YOUR STOCK UPDATER-SCRIPT

REPACK YOUR ROM BY

name@pcname:~/path/to/your/port rom$ zip -r $ROMNAME meta-inf system boot.img

REPLACE $ROMNAME WITH YOUR ROM ZIP NAME AND IF YOU HAVE FOLDER TO COMPRESS JUST ADD THOSE AFTER META-INF WITH SPACE BETWEEN EACH FOLDER

DONE !!!

IF YOU HAVE SYSTEM.IMG OR SYSTEM.NEW.DAT.BR OR SYSTEM.NEW.DAT

USE SUPERR KITCHEN TO EXTRACT THOSE AND USE METHOD WRITTEN A BIT ABOVE​