[TOOL] NEW <<--->> OLD Bootloader ROM Converter v1.0 - LG Optimus 2x

P990 ROM Converter
from New BootLoader to Old and vice versa​
Actually this tool is Tonyp’s idea. All credits to him.
He asked me if I am interested in making a script and automating the rom porting from one bootloader to the other and he assisted me with all the changes that need to be done.
Due to different EOL (end of line) termination in text files between UNIX-Linux (LF) and windows (CRLF), I had to make bash (linux) scripts necessarily. The good thing is that the tool can be used in both windows and linux systems.​Installation:
Download and extract the attached ROM-Converter-tools.zip package anywhere you like.
Download and extract in the same folder, a newer ROM-Converter-scripts.zip if exists.
For Windows systems only:
Install Cygwin following the instructions below:
Download setup-x86.exe from here http://cygwin.com/install.html
Attention!! Even if you are running x64 windows system install the x86 version. DO NOT install the x64 cygwin version because two binaries (mkbootfs.exe & mkbootimg.exe used to pack boot.img do not work properly).
Run the setup-x86.exe, when the list of packages is shown make sure you add the following:
Expand Archive and select zip & unzip to be installed
Expand Utils and select cpio to be installed
Expand Perl and select ‘perl: Larry Wall’s Practical..’ and perl_vendor to be installed
(If you are already using cygwin run setup again and add the above packages to be installed.)
For Linux systems only:
Download the attached linux-mkboot-binaries.zip (mkbootfs, mkbootimg), extract them in tool folder and remove the windows ones (mkbootfs.exe, mkbootimg.exe).​How to use it:
Put the source ROM.zip(s) in the 'source_zips' folder (otherwise you’ll be prompted to drag n’ drop it in terminal)
Open Cygwin. Type cd (leave a space after cd) and type /cygdrive/c/dir1/dir2/../ROM-Converter-tools
where “c/dir1/dir2/../ROM-Converter-tools” is the full path of the folder you extracted the convert-tool package (e.g C:\dir1\dir2\..\ROM-Converter-tools) and press enter.
In case of long pathname, instead of typing the whole of it, use one of the following tips to easily change to tool's path.
Tip#1: After you type cd , drag n’ drop from windows explorer into cygwin terminal, the folder "ROM-Converter-tools" and it wiil automatically be converted to ‘/cygdrive/c/dir1/dir2/../ROM-Converter-tools’ press enter and that’s it.
Tip#2: After cd /cygdrive/c/ type the 1st one or two letters of the next subdir and autocomplete it's name with TAB.
Type one of these commands in cygwin terminal:
Code:
./convert_rom.sh -stepmode #--> starts in step-mode for debugging purposes
./convert_rom.sh #--> runs unattended (with no pauses).
​What it does:
The scripts use as input the 'files2convert.txt' which contains all possible files needed to be converted.
This is for compatibility purposes to support as many roms as possible and for future changes.
files2convert.txt
Code:
/ramdisk/fstab.star
/ramdisk/fstab.p990
/ramdisk/init.cm.rc
/ramdisk/init.cm-star.rc
/ramdisk/init.star.rc
/system/etc/vold.fstab
/system/bin/setup-recovery
/system/bin/check_sdcard.sh
/META-INF/com/google/android/updater-script
More files can easily be added for conversion if needed.
The converter:
Extracts source ROM zip
Unpacks the boot.img
Reads the above files, replacing partitions' mount points, among some othe things, for the selected bootloader
Replaces the kernel image for the selected bootloader
Builds new boot.img
Creates new converted ROM zip
Under 'kernels' folder there are already included the two latest Kowalski kernel images (zImage) for old & new BL and its modules.
You can add more kernels and you’ll be prompted to choose the desired one when converting a ROM (if more than one is found ).
Read how to do this:
kernels folder contains all kernel images (zImage), kernel modules and any other file the kernel needs.
for each kernel there are:
file(s) named: prefix-KernelName[-ver].zImage
folder(s) named: [prefix-]KernelName[-ver]Kernel
where:
prefix must be oldbl or newbl (depending on which bootloader this kernel is for.
KernelName[-ver] is whatever you like [and optionaly its version].
zImage is the extension of the kernel image.
How to maintain kernels folder
A. Update existing kernels
Download the desired kernel package and open it.
Replace its kernel zIamge in kernels folder
Extract its modules and any other file needed and replace all existing ones
B. Add kernels
Download the kernel package and open it.
Find the zImage inside package and extract it into kernels
Rename it this format: prefix-KernelName[-ver].zImage
Create a folder named: prefix-KernelName[-ver]. It will be used to keep kernel's modules and other files needed. If this kernel is released for both bootloaders and its modules are identicaly on both bootloaders (like the existing kowalski one) then name the folder only KernelName[-ver] (without prefix).
Inside this [prefix-]KernelName[-ver] folder create a subdir tree lib\modules
Extract in lib\modules all kernel's modules from kernel package.
If any other file is needed by kernel then create it's subdir tree (assuming that [prefix-]KernelName is the system folder of the kernel package) and extract it there.
Attention: Current version will hopefully work on CM-based ROMs.
Stock based ROMs need more files to be changed, but they are not included yet, because I don't have the whole info needed.
Hopefully @rugglez or someone else will be willing to help.
Till then avoid converting stock-based roms, (or if you do try, then after converting replace the boot.img in converted rom and "system/lib/modules/*" at least with a working boot.img and modules from another stock-based rom, for this bootloader of course. This could work but I am not the expert to say)​

ChangeLog:
Version 1.0 Aug 23, 2013
- The two convert2xxx_bl.sh scripts are now integrated into one script convert_rom.sh.
- The new convert_rom.sh also accepts an optional switch [-stepmode].
Code:
./convert_rom.sh -stepmode #--> starts in step-mode for debugging purposes
./convert_rom.sh #--> runs unattended (with no pauses).
- A technique added to preserve whitespaces in converted lines. So converted files keep margins and whitespaces of the source ones.
- Script checks whether source rom is a newbl or an oldbl one, displays an error message if rom is not for the expected bootloader and exits.
Version 0.3b Aug 23, 2013
-a typo fixed in converting scripts
Version 0.2b Aug 23, 2013
-liblgeril.so is also replaced with the one for the oldbl or newbl accordingly.
-A forced removal (switch -f) added when removing files and dirs just in case.
-Converted ROM name will be built automatically from the source name suffixed by -oldbl or -newbl accordingly. (If source rom's name contains 'newbl' or 'oldbl' it will be substituted by 'oldbl' or 'newbl' accordingly)
-Converted ROMs are now created under 'converted_roms' folder.
-Converting to oldbl: Files 'check_sdcard.sh' and 'lgdrm.img' are being removed if exist (as they are not used)
-Converting to newbl: Charger dependent images are also copied in ramdisk (not only the charger binary).
-Kernel modules will also be replaced with the ones coming with specific kernel image.
-Kowalski Kernel images & modules, in kernels folder, are replaced with latest ones dated:2013072013. (it was my fault, the previous ones were downloaded from "releases" download folder and were dated 20230303)
-Some changes in display messages.
Version 0.1b Aug 19, 2013
-1st beta version​

I really don't want to have all of the credits.
While it's been my idea to create such a script and I provided the input on what needs to be changed by the script, I couldn't have done it on my own.
I both lack the skills(!) and time.
Steve would say:
Anyways, don't leech. If this helps someone, donations are appreciated:
Donate to spyrosk
Donate to me​

spyrosk said:
To convert a new-bl rom to an old-bl rom: Type ./convert2old_bl.sh
To convert an old-bl rom to a new-bl rom: Type ./ convert2new_bl.sh
​
Click to expand...
Click to collapse
Thanks Android tool guru @spyrosk....and thanks @tonyp
just trying it out. A small comment....people might mistake this....there is no space between the / AND convert2new_bl.sh command line....should be the same with oldbl.sh command....isnt it?
thought of giving a feedback about this.
thanks once again
EDIT: battery charge script cannot be opened error....and cannot be removed error....
Creating new ROM zip ... zip warning: Permission denied
zip warning: Permission denied
something went wrong please zip contents in rom folder manually
done.

SREEPRAJAY said:
Thanks Android tool guru @spyrosk....and thanks @tonyp
just trying it out. A small comment....people might mistake this....there is no space between the / AND convert2new_bl.sh command line....should be the same with oldbl.sh command....isnt it?
thought of giving a feedback about this.
thanks once again
EDIT: battery charge script cannot be opened error....and cannot be removed error....
Creating new ROM zip ... zip warning: Permission denied
zip warning: Permission denied
something went wrong please zip contents in rom folder manually
done.
Click to expand...
Click to collapse
Hi my friend,
First of all sorry again for deleted post(s)..
and thank you.
The "typo" is corrected. Actually it was not a typo but I have noticed that it happens when pasting text from another editor.
Which ROM did you try to convert?
battery charge script cannot be opened error??? On which step did it happen?
I don't try to open any battery charge script
Did you add any file in "files2convert.txt"?

Very interesting tool.
Last july 7th I asked you if this were possibile and didn't have any reply. Now I'm happy that Tonyp convinced you.
Sent from my LG-P990 using xda app-developers app

wals46 said:
Very interesting tool.
Last july 7th I asked you if this were possibile and didn't have any reply. Now I'm happy that Tonyp convinced you.
Sent from my LG-P990 using xda app-developers app
Click to expand...
Click to collapse
I was on vacation sorry and when I came back I forgot to reply.
By that time I couldn't tell for sure anyway, before I have the total "picture" of the work that must be done, I mean.

@spyrosk,
my friend
Which ROM did you try to convert? Latest Avatar 3.1 Nightly OLD to NEW BL
battery charge script cannot be opened error??? On which step did it happen?I don't try to open any battery charge script It happened just the step before making the new ROM Zip
Did you add any file in "files2convert.txt"? NO
Nevertheless, I will try to flash the ROM and see what happens
EDIT:
Just now, I tried to do the PAC Man by Metallica for the Old BL and had the same error of battery charge script....
Same in Django Adios Amigo 1.6.5 to OldBL....see the script error below:
STEP 2: EXTRACTING BOOT.IMG ...
Press [enter] when ready
rm: remove write-protected regular file `out/ramdisk/charger'?
rm: cannot remove `out/ramdisk': Directory not empty
mkdir: cannot create directory `out': File exists
STEP 5: PACKING NEW BOOT.IMG ...
Press [enter] when ready
Selected kernel: kernels/oldbl-Kowalski-126.zImage
Using base address 0x10000000
Using command line ''
error: cannot open './ramdisk/charger' for read
rm: remove write-protected regular file `out/ramdisk/charger'?
rm: cannot remove `out/ramdisk': Directory not empty
Hope this helps in checking....

SREEPRAJAY said:
@spyrosk,
my friend
Which ROM did you try to convert? Latest Avatar 3.1 Nightly OLD to NEW BL
battery charge script cannot be opened error??? On which step did it happen?I don't try to open any battery charge script It happened just the step before making the new ROM Zip
Did you add any file in "files2convert.txt"? NO
Nevertheless, I will try to flash the ROM and see what happens
EDIT:
Just now, I tried to do the PAC Man by Metallica for the Old BL and had the same error of battery charge script....
Same in Django Adios Amigo 1.6.5 to OldBL....see the script error below:
STEP 2: EXTRACTING BOOT.IMG ...
Press [enter] when ready
rm: remove write-protected regular file `out/ramdisk/charger'?
rm: cannot remove `out/ramdisk': Directory not empty
mkdir: cannot create directory `out': File exists
STEP 5: PACKING NEW BOOT.IMG ...
Press [enter] when ready
Selected kernel: kernels/oldbl-Kowalski-126.zImage
Using base address 0x10000000
Using command line ''
error: cannot open './ramdisk/charger' for read
rm: remove write-protected regular file `out/ramdisk/charger'?
rm: cannot remove `out/ramdisk': Directory not empty
Hope this helps in checking....
Click to expand...
Click to collapse
I just converted Avatar-3.1 from old to new. No errors at all.
I don't like the write-protected error: rm: remove write-protected regular file `out/ramdisk/charger'
So it tries after that to remove the out directory but of course it's not empty.
Well,
Remove out directory manually and try again from the beginning..
After step 5, Before you continue to next step try to remove the whole out directory manually again.
Try also to give your account full control to the converter's folder.
This problem seems to he a windows security permission issue. Are you an administrator on the system you use?
-------------------------------------------------------------------
Stock based ROMs need more files to be changed, but they are not included yet, because I don't have the whole info needed.
Hope @rugglez or someone else will be willing to help.
Till then avoid converting stock-based roms,( or after converting replace the boot.img in converted rom with a working boot.img from another stock-based rom for the same bootloader of course. This may work)
Try ONLY CM-based roms.
I forgot to write it in OP. I'll do it asap.

spyrosk said:
I just converted Avatar-3.1 from old to new. No errors at all.
I don't like the write-protected error: rm: remove write-protected regular file `out/ramdisk/charger'
So it tries after that to remove the out directory but of course it's not empty.
Well,
Remove out directory manually and try again from the beginning..
After step 5, Before you continue to next step try to remove the whole out directory manually again.
Try also to give your account full control to the converter's folder.
This problem seems to he a windows security permission issue. Are you an administrator on the system you use?
-------------------------------------------------------------------
Stock based ROMs need more files to be changed, but they are not included yet, because I don't have the whole info needed.
Hope @rugglez or someone else will be willing to help.
Till then avoid converting stock-based roms,( or after converting replace the boot.img in converted rom with a working boot.img from another stock-based rom for the same bootloader of course. This may work)
Try ONLY CM-based roms.
I forgot to write it in OP. I'll do it asap.
Click to expand...
Click to collapse
I have a list of files/folders which I was using to port...Thanks to @rugglez ofcourse...
If you have seen the dev section....I was porting a few ROMs from Old to New BL including the stock ROMs.
So, I will send you the list by PM.
I will try the CM based ones with manual clearing...and will check that
EDIT: I am the administrator...so normally only one account and I have that rights too
thanks once again

Okay, I just used the converter on Win8 x64 to create an oldbl version of my CM10.2 ROM.
I have uploaded the resulting zip here: http://tonyp.basketbuild.com/index.php?dir=main/CM-10.2/oldbl-untested-builds/
It is untested - so do a backup!
I will post the steps I took, this might help some people who never worked with tools like this.
Please try it out with different ROMs - and if the resulting zips work a) post that here and b) share the zip in the respective threads for others to use
If you have any erros post the complete cygwin output here.
To get it do a right-click into the cygwin window, then press Enter - it's now copied into the clipboard!
Okay, off we go:
Preparation (one time only):
Downloaded cygwin. and install it
The path C:/cygwin is perfecly fine.
Just press Next until you get to the paket selection, then use the searchbox to quickly get to the tools needed:
(just click once on it, the first checkbox will get checked. The second one is for the sourcecode, you don't need that).
- zip (Archive)
- unzip (Archive)
- cpio (Utils)
- perl: Larry Wall’s Practical (perl) (you might have to open "perl" and look for it manually)
- perl_vendor (perl)
Downlaod the zip attached at the OP, extract it.
I extracted it to C:/temp/ROM-Converter-tools/
done
ROM conversion:
Open the Cygwin Terminal (either in the start menu or execute the Cygwin.bat at C:/cygwin/)
Put the ROM zip into the source_zips folder
Type:
Code:
cd /cygdrive/c/temp/ROM-Converter-tools
Needs to get adapted to your path if you extracted the ROM-Converter-tools somewhere else.
My path is: C:/temp/ROM-Converter-tools/
(Hint: after /cygdrive/c/ autocompletion with TAB will work!)
I didn't try the drag&drop tip of spyrosk.
Type:
Code:
./convert2old_bl.sh
(or convert2new_bl of course if you're going the other direction)
Follow the instructions on the screen,
As it's still in the debug mode you need to press [enter] a couple times.
This will change in the future.
Done, your converted ROM will be in the out_oldbl or out_newbl folder.

do this tool work with CM7

tonyp said:
Okay, I just used the converter on Win8 x64 to create an oldbl version of my CM10.2 ROM.
I have uploaded the resulting zip here: http://tonyp.basketbuild.com/index.php?dir=main/CM-10.2/oldbl-untested-builds/
It is untested - so do a backup!
[/LIST]
Click to expand...
Click to collapse
uhm ... in my case it got stuck at CM booting logo ... is flashing it recovery sensitive?

spyrosk said:
"...I just converted Avatar-3.1 from old to new. No errors at all.
I don't like the write-protected error: rm: remove write-protected regular file `out/ramdisk/charger'
So it tries after that to remove the out directory but of course it's not empty.
Well,
Remove out directory manually and try again from the beginning..
After step 5, Before you continue to next step try to remove the whole out directory manually again..."
Click to expand...
Click to collapse
Hummmmm, I tried experimenting, and it happened to me the same as the partner "SREEPRAJAY"! ...
Here are the errors I had during the experiments (three files *. pdf);

Hrmph.
Was running the latest CM 10.1 nightly. Rooted, old bootloader, CWM Recovery 6.0.3.1.
Made a Nandroid backup. Wiped everything from recovery, factory reset, flashed this :
http://tonyp.basketbuild.com/download.php?file=main/CM-10.2/cm-10.2-20130821-UNOFFICIAL-p990.zip
According to CWM all flashed and well. I rebooted.
Phone's bricked, won't even boot to recovery, gets stuck in the LG logo. Ouch. Halp ?

Ultramanoid said:
Hrmph.
Was running the latest CM 10.1 nightly. Rooted, old bootloader, CWM Recovery 6.0.3.1...flashed this :
http://tonyp.basketbuild.com/download.php?file=main/CM-10.2/cm-10.2-20130821-UNOFFICIAL-p990.zip
Click to expand...
Click to collapse
But...that ROM is for NEW BootLoader!!!...
Use All-In-One Toolkit to reattach the situation (reinstall again CWM Recovery);
http://forum.xda-developers.com/showpost.php?p=34809475&postcount=1

trocopassu said:
But...that ROM is for NEW BootLoader!!!...
Use All-In-One Toolkit to reattach the situation (reinstall again CWM Recovery);
http://forum.xda-developers.com/showpost.php?p=34809475&postcount=1
Click to expand...
Click to collapse
I know ! ( NEVER flash anything as soon as you wake up without checking twice, kids. )
I saw the one for old bootloader for the 20th, moved up a directory, happily flashed the one for the 21th... and for the NEW bootloader.
Don't have access to a laptop to tinker and won't for a few days. Sigh.

millionsun93 said:
do this tool work with CM7
Click to expand...
Click to collapse
No, and it never will.
GB relies on the old bootloader. It would be a lot of work to make it compatible, which isn't worth the trouble at all.
flat__line said:
uhm ... in my case it got stuck at CM booting logo ... is flashing it recovery sensitive?
Click to expand...
Click to collapse
Ah that's a shame. spyrosk needs to have a look at that when he gets some free time.
You did a full wipe didn't you?
If you did it sound like an error in the fstab.
Ultramanoid said:
I know ! ( NEVER flash anything as soon as you wake up without checking twice, kids. )
I saw the one for old bootloader for the 20th, moved up a directory, happily flashed the one for the 21th... and for the NEW bootloader.
Don't have access to a laptop to tinker and won't for a few days. Sigh.
Click to expand...
Click to collapse
Your partitions are borked and you will have to use nvflash.
I'm sorry about that although I don't really know how you came to the idea to try the untested oldbl builds when you got no PC around to recover.
This could have even happened with the correct rom - again, it is completely untested.
Sent from my LG-P990 using Tapatalk 4

  

tonyp said:
Ah that's a shame. spyrosk needs to have a look at that when he gets some free time.
You did a full wipe didn't you?
If you did it sound like an error in the fstab.
Click to expand...
Click to collapse
I did the full wipe (I checked: I used the ext4 full wipe zip by dr4go for the old bootloader, as I usually do, using CWM 5.0.2.8)

Related

[Script/Tools/APP]ROMTweaker 1.4/ROMKitchen (4-13-11) Updated

Lots of tools in a script...**** TARs are NOT to be flashed with Heimdall****
ADB Manager - push- pull - install- delete- backups - dial - reboot-menu
APK Editor - decompile - compile - flash - extract-from-zipped-rom
JAR Editor - same as above
ROM Manager - extractor - deodexer - zipalign - root injection - builder
TAR Manager - extractor - mounter - custom packager - tar2md5
Lots more...
You must have these installed on your PC:
java sdk - zip - tar - dirname - basename
TOOLs I included, in the bin folder, for the script to function:
SamsungSDK adb
SamsungSDK zipalign
JesusFreak's baksmali/smali
7z (see changelog)
I also included Heimdall and 7z (with licenses). Mainly I want to implement them in the future. Although java can make zips without META and folders can be pointed to better than zip. I chose to use zip anyways for now. I used pushd/popd instead of cd. Except the one time I was already into a folder then popd back "home". Of course going through some loops made it easier to pop out. But it still pains me to resort to such things. I like it clean. I am trying to call all locations completely from top dir. I am looking at using 7z to do the work soon. Also I am working on kernel development and dd backup ideas (the backing up is the easy part...even dd piped to the pc). Have fun. Peace.
Code:
[CENTER][U][B]Changelog:
[/B][/U][LEFT][U][B]Latest:[/B][/U]
[/LEFT]
[/CENTER]
[B]1.4[/B] (4-13-11)
Optimized ROM Signing
Optimized ROM Zipalign
Optimized TAR to MD5
Fixed ADB Delete Multiple Files
Fixed ADB Remote Dial *see note
Trimmed another ~200 lines of code
[B]1.3[/B] (4-12-11)
removed cp baksmali to decompiled jar - extra comments during tests
Optimized-Locate APK/JAR
Optimized-Flash APK/JAR
Trimmed ~150 lines of code
[B]1.2[/B] (4-12-11)
Optimized - The Decompiling and Compiling of APKs/JARs
Optimized - The ZIP/TAR/MD5 Extraction Process
...added more bootclass listings for deodex support - gingerbread
...recompiled 7z from source to include all CPUs
...started to implement 7z in the code
Trimed ~70 lines of code
[B]1.1[/B] (4-10-11)
Fixed a couple of issues...zipalign to force and display progress correctly
Tar Extractor was deleting the folder after extraction ...doh
cleaned up some code and made more messes elsewhere :-)
Trimmed ~500 lines of code
.
Note:
For adb shell remount command: I included a remount script in bin/script folder. Change settings as needed (in the remount script). It is currently set for rfs (voodoo disabled) change to ext4 (voodoo enabled) if needed.
The easy way:
0) edit script to your flavor
1) make script executable if it isn't already "chmod +x /path/to/file/remount" from terminal or right click.. file properties...permissions...enable execute
2) reboot phone into recovery via "ADB","Reboot Menu"
3) Drop the remount script into system/bin via "ADB", "Copy Files to Device"
4) Reboot phone normally via "ADB","Reboot Menu"
5) Remote Dial.
Side Note:
Remount script remounts system folder. Usage commands of remount from terminal are "adb shell remount rw" and "adb shell remount ro"
The_Ravager said:
This Script will package a ROM for flashing with Odin/Heimdall.
Click to expand...
Click to collapse
Slight correction, Heimdall does not use tar files, trying to flash a tar with Heimdall will very likely soft-brick your device.
Benjamin Dobell said:
Slight correction, Heimdall does not use tar files, trying to flash a tar with Heimdall will very likely soft-brick your device.
Click to expand...
Click to collapse
This extracts tars. Heimdall can flash your factoryfs.rfs param.lfs zImage modem.bin, what-have-you, once you do. This
will allow you to mount said factoryfs.rfs ... rip its guts out ...throw some new ones in....umount flash with heimdall but, this will ALSO repackage your modified factoryfs.rfs into tar or tar.md5 with a new zImage or modem.bin or any of the other selections for use with your windoze users.
So again for use with either method. I'll put a disclaimer.
This takes all the command line work out for newbies trying to mount their factoryfs because I've done it all for them. Then when I add the other components, deodex it, throw it back together with your custom framework, apps...there you go. Custom ODIN image. On the fly.
The version I'm waiting to release has
APK/JAR decompiling/compiling/push/pull.......ROM.zip builder..deodexer...and more....
EDIT: New version up. Again:
****DO NOT flash TARs with Heimdall***
Have fun with the build tools in the new version.
Sent from my GT-I9000 using Tapatalk
do you plan to include all of those other functions directly into the script, or will your script rely on any other tools that others have released? ex. deodexing, zip align
Looks great-- haven't tested it yet, but I browsed through all of the methods, and saw that you have made it modular rather than one long messy script, so I anticipate more functions/features going into it quite well! Kudos!
wvidrine said:
do you plan to include all of those other functions directly into the script, or will your script rely on any other tools that others have released? ex. deodexing, zip align
Looks great-- haven't tested it yet, but I browsed through all of the methods, and saw that you have made it modular rather than one long messy script, so I anticipate more functions/features going into it quite well! Kudos!
Click to expand...
Click to collapse
I'll include front end functions for the android sdk's adb server and zipalign tools. Also baksmali and smali.
Updated OP
New Version in OP

[HOW-TO][TUTORIAL]ROOT, DEODEX, BUILD KERNEL, BUILD CUSTOM ROM and MORE

Hi all,
In this thread, I will try to share the knowledge I have on deodexing, making custom ROMs, modifying initramfs, building kernel and much more.
Please check the below posts for each of these tutorials.
Hope this opens doors to many new ROM and Kernel developers.
NOTE: THESE TUTORIALS ARE WRITTEN FOR I9100G. WILL NOT WORK ON OTHER DEVICES. I DON'T TAKE ANY RESPONSIBILITY IF YOU MESS UP AND BRICK YOUR DEVICE OR ANYTHING ELSE. USE AT YOUR OWN RISK.
Deodexing Stock Rom
For GINGERBREAD ROMS:
What you need to have:
xUltimate v2.3.3 - you can download it HERE (Thanks and Credits to Xeudoxus for this awesome app)
Rooted kernel with busybox
JDK installed on your Windows system
If adb is not available in your windows PC, in xUltimate folder open "jar" folder. You'll find adb there.
Extract stock app & framework folders and Deodex:
Connect your device to computer.
Start xUltimate (double-click on Main.exe)
Select option 1. (Pull /system/app)
Once option is done, select option 2. (Pull /system/framework)
In the same folder, now you'll see two new folders (origi_app, origi_frame)
For I9100G, go to origi_app folder and delete apk and odex files of Maps, PhoneSky and VoiceSearch.
Select option 3 in Main menu (Deodex /system/app)
Once its done, select option 4 in Main menu (Deodex /system/framework)
DONE!!
Now you'll see two new folders done_app and done_frame.
Push deodexed app and framework to device:
Connect your device to PC in USB debugging mode.
Copy done_app and done_frame folders to root of sdcard (/sdcard).
Open Windows command prompt and type the below commands.
Code:
[LIST]
[*]adb shell
[*]su
[*]stop
[*]mount -o remount,rw /dev/block/mmcblk0p9 /system
[*]rm /system/app/*.odex
[*]rm /system/framework/*.odex
[*]busybox cp /sdcard/done_app/* /system/app/
[*]busybox cp /sdcard/done_frame/* /system/framework/
[*]chmod 644 /system/app/*
[*]chmod 644 /system/framework/*
[*]mount -o remount,ro /dev/block/mmcblk0p9 /system
[*]sync
[*]reboot recovery
[/LIST]
In Recovery, Wipe Cache and Wipe Data/Factory reset.
Reboot.
Now you've deodexed app and framework.
For ICS ROMS:
For ICS Roms, the process is quite easy. (Thanks and Credits to jaydvn.)
Download the attached zip file.
Extract it on your windows PC.
Copy your /system/app to _app folder
Copy your /system/framework to _framework folder.
Run AutoDEOToolMain.bat
Follow the instructions.
deodexed jars and apks will be found in deodexed_APK and deodexed_JAR.
Push deodexed app and framework to device:
Connect your device to PC in USB debugging mode.
Copy deodexed_APK and deodexed_JAR folders to root of sdcard (/sdcard).
Open Windows command prompt and type the below commands.
Code:
[LIST]
[*]adb shell
[*]su
[*]stop
[*]mount -o remount,rw /dev/block/mmcblk0p9 /system
[*]rm /system/app/*.odex
[*]rm /system/framework/*.odex
[*]busybox cp /sdcard/deodexed_APK/* /system/app/
[*]busybox cp /sdcard/deodexed_JAR/* /system/framework/
[*]chmod 644 /system/app/*
[*]chmod 644 /system/framework/*
[*]mount -o remount,ro /dev/block/mmcblk0p9 /system
[*]sync
[*]reboot recovery
[/LIST]
In Recovery, Wipe Cache and Wipe Data/Factory reset.
Reboot.
Done.
Other references:
How to deodex ICS roms by samyam2002000
Enjoy.
Building Kernel
Okay. Let's learn how to build kernel for our I9100G. There are many ways to build. I am just presenting here the way I build and make kernel.
NOTE 1: Follow the instructions exactly.
NOTE 2: Kernel is opensource. If you make any changes to it, you're expected to share your source. (Usually people share it over github )
NOTE 3: FLASHING KERNEL IS RISKY AND DANGEROUS. BE CAREFUL. BUILD AND FLASH ON YOUR OWN RISK.
What you need to have:
Ubuntu 10.04 and above (I use 10.04 )
ARM tool chain (Download HERE. Click on IA32 GNU/Linux TAR under Advanced Packages)
Samsung's opensource kernel for I9100G (Download HERE. Go to Mobile->Mobile Phone-> Select I9100G and download the zip)
Setting up toolchain:
Extract the tar you downloaded(Suggestion: Extract to one folder where you can have everything. In my case /home/superatmos/build_kernel).
After extracting, you'll see a folder named arm-2010q1. Inside there will be many folders (ex. bin, lib and so on.)
Folder structure will be: /home/<your_name>/build_kernel/arm-2010q1
Setting up kernel:
Extract the zip you've downloaded from samsung's opensource.
You'll find two zips.
Extract GT-I9100G_Kernel.tar.gz to /home/<your_name>/build_kernel/
Folder structure: /home/<your_name>/build_kernel/GT-I9100G_Kernel
Setting up initramfs:
Samsung's zImage is divided into two parts: Opensource kernel (which you downloaded from samsung's website) and initramfs (which is root file system to boot up the device).
I am providing my initramfs HERE. (You can use it as it is or modify it. But give credits to me. )
Extract the downloaded zip and copy it to /home/<your_name>/build_kernel/
Folder structure: /home/<your_name>/build_kernel/initramfs
Now the entire setup is ready. Let's start modifying kernel configuration.
Setting up kernel config:
Go to /home/<your_name>/build_kernel/GT-I9100G_Kernel/arch/arm/configs folder.
Copy t1_defconfig file and paste it in kernel root folder (/home/<your_name>/build_kernel/GT-I9100G_Kernel/).
Rename t1_defconfig to .config in kernel root folder.
Now open Makefile which is in your kernel root folder(/home/<your_name>/build_kernel/GT-I9100G_Kernel/).
Modify the below lines (I guess line 195 and 196).
Code:
ARCH ?= arm
CROSS_COMPILE ?= /home/<your_name>/build_kernel/arm-2010q1/bin/arm-none-linux-gnueabi-
Save and close.
Modifying kernel configuration:
Now open .config file(which you renamed). If its not seen, it might be hidden. Go to View->Show hidden files and there you go.
Do the below things:
Adding local version:
Change CONFIG_LOCALVERSION=" " to anything you like. I add this way:
CONFIG_LOCALVERSION="-I9100G-superatmos"
Adding initramfs path:
You need to let kernel know the path from which it needs to take initramfs.
Change CONFIG_INITRAMFS_SOURCE=" " to ../initramfs (In this tutorial it's the path. If you had copied anywhere else, give the path properly).
Enough for now. Once you get experience, you can modify many configurations as per your liking and save. This configuration can be changed by GUI too with the command make menuconfig.
The Important part: Building the kernel:
Open terminal.
Go to path /home/<your_name>/build_kernel/GT-I9100G_Kernel/
Type make.
THAT'S ALL. YOUR zImage is ready and is available in /home/<your_name>/build_kernel/GT-I9100G_Kernel/arch/arm/boot/zImage.
Install the zImage on the device:
Go to the path where zImage is present and type the below line in command line.
Code:
tar cvf I9100G_kernel.tar zImage
Flash the tar using odin.
DONE. CONGRATULATIONS. NOW YOU'VE YOUR OWN KERNEL.
Other references:
Building Kernel by bedalus
How to compile your first Nexus Kernel by djjonastybe
Give me your feedback so that I can improve this tutorial. And post here about how your build went. All the best.
Making custom ROM
Let's move on to make a custom ROM.
Inputs/Feedback/Suggestions are more than welcome. Lets improve this tutorial together for the betterment of the android community.
Steps involved in making a custom ROM:
Getting the system dump from the device.
Deodexing app and framework folders.
Creating various mods by modifying framework and system files.
Modifying build.prop and adding tweaks.
Making META-INF folder and writing an updater-script (edify scripting).
Signing the ROM and making a flashable zip.
Folder Structure:
Before going forward, let's follow the below structure folder to make the tutorial more understandable.
Let our ROM name be CustomROM. The folder structure will be C:\Users\<your name>\CustomROM.
Let's move step by step. Are you ready??
<b>Getting the system dump from the device:​
</b>
Make sure USB debugging is ON and connect your device to the PC.
Open command prompt on your windows PC and go to CustomROM folder path.
Type adb devices. You should be able to see the device detected. (If not check environmental variables whether adb is in system path or not. If not present, add the adb path.)
Type the below command to get the dump of system folder.
Code:
adb pull /system system/
Now inside the folder CustomROM, you should be able to see system folder with many folders like app, etc, framework etc inside.
Done with first step.
<b>Deodexing app and framework folders:​
</b>
Look HERE how to deodex app and framework folders. Copy the app and framework folders to xUltimate folder, rename them to origi_app and origi_frame and follow the given link to deodex.
NOTE: After deodexing, merge origi_app folder with app folder under C:\Users\<your name>\CustomROM\system\app and origi_frame with framework folder under C:\Users\<your name>\CustomROM\system\framework.
<b>Creating various mods by modifying framework and system files​
</b>
Okay. This the section where your hardwork, innovation and talent comes in. You can use the mods available already, create your own mods, port various mods from other devices and so on.
Below is a list of various mods which can be ported on to I9100G. All the credits go these respective thread owners. Thanks to them.
Lidroid 14 toggle mod
Extended power menu with/without header
CRT Off Animation & SIP Over LTE/HSPA
Swipe to remove notifications
NOTE: Let me know more mods with links so that I can add here.
<b>Modifying build.prop and adding tweaks​
</b>
Okay. This is one of those files where you name your ROM(to be visible in settings. ) and add many tweaks.
To name your ROM (to be visible in settings), change the below code.
Code:
ro.build.display.id=CustomROM v1.0
Check the below links for many other tweaks. All credits go to respective thread owners. Thanks to them.
build.prop tweaks by TheFrankenstain
build.prop tweaks by dhlalit11
<b>
Making META-INF folder and writing an updater-script (edify scripting)​
</b>
Once you're done with all the modifications, mods and additions, its time to create META-INF folder and make the updater script. Once the user flashes the ROM zip, this is the script that runs and does everything written inside the script. PLEASE BE CAREFUL WITH THIS. TAKE REFERENCE FROM OTHER (SAME DEVICE) ROMS' UPDATER-SCRIPT. (In this case, take reference from other GT-I9100G roms.)
Check the below links for tutorial and how-to on writing edify script and making updater script. All credits go to respective owners of the threads. Thanks to them.
Edify Scripting, Making Flashable ZIPs, ZIP Signing & Key Creation
Edify Scripting Notes
How to Write an Updater-Script with Edify Code
Edify Installation Script Syntax's
NOTE: system folders path, boot/kernel partition path, modem partition path and so on are COMPLETELY DIFFERENT for DIFFERENT DEVICES. Check the partitions for your device properly, carefully and then work on updater-script. TAKE HELP OR REFERENCE FROM OTHER ROM DEVELOPERS FOR YOUR DEVICE.
Lets move on to last step. Making a signing and making a flashable zip.
<b>Signing the ROM and making a flashable zip​
</b>
Make sure, now you should be able to find two folders (META-INF and system) inside C:\Users\<your name>\CustomROM.
Check in THIS thread for test signing your ROM. It WORKS with GT-I9100G. TESTED.
or Check THIS thread to create your own signing key and certificate.
Now you're done with making a custom ROM. Hope to see more custom ROMs from many users.
For porting ROMs, refer THIS tutorial. (thanks and credits to ayushrox)
Give me your feedback so that I can improve this tutorial. And post here about how your custom ROM making went. All the best.
Root and busybox
If you don't want to modify anything else except to have root and busybox for the stock rom, Check the below link.
How to ROOT/UNROOT your I9100G via Stock Recovery (Credits: Ryuinferno)
GOt error wHILE DEODEXING USING XULTIMATE
galaxy sl STOCK ROMS ARE MUCH BETTER THAN g
Starting Email.odex
*****************************************
* Deodexing... *
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find sup
erclass Ljava/awt/Component;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadSuperclass(ClassPa
th.java:784)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
668)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:105)
at org.jf.baksmali.main.main(main.java:278)
Error while loading class Lgnu/activation/viewers/ImageViewer; from file .\origi
_app\Email.odex
Error while loading ClassPath class Lgnu/activation/viewers/ImageViewer;
Press any key to continue . . .
tarunagg said:
GOt error wHILE DEODEXING USING XULTIMATE
galaxy sl STOCK ROMS ARE MUCH BETTER THAN g
Starting Email.odex
*****************************************
* Deodexing... *
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find sup
erclass Ljava/awt/Component;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadSuperclass(ClassPa
th.java:784)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
668)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:105)
at org.jf.baksmali.main.main(main.java:278)
Error while loading class Lgnu/activation/viewers/ImageViewer; from file .\origi
_app\Email.odex
Error while loading ClassPath class Lgnu/activation/viewers/ImageViewer;
Press any key to continue . . .
Click to expand...
Click to collapse
Which version of xUltimate you're using? only x2.3.3 supports GT-I9100G. Please follow the steps I mentioned above and you should be able to deodex.
ok will try that version also
superatmos said:
Which version of xUltimate you're using? only x2.3.3 supports GT-I9100G. Please follow the steps I mentioned above and you should be able to deodex.
Click to expand...
Click to collapse
Sent from my GT-I9100G using XDA App
Does this script work for ICS odexed apk's?
zylor said:
Does this script work for ICS odexed apk's?
Click to expand...
Click to collapse
I am not sure about it since I never tested myself on ICS since its not yet released for I9100G.
tarunagg said:
ok will try that version also
Sent from my GT-I9100G using XDA App
Click to expand...
Click to collapse
Did you try? Were you able to deodex using this tutorial?
next action
manage to deodex using above step.
once deodex what is the next action?
[email protected] said:
manage to deodex using above step.
once deodex what is the next action?
Click to expand...
Click to collapse
After deodexing, did you push deodexed app and framework folder back onto device? (third section of deodex post). If done, then you can apply themes to it, use apks of other roms and so on.
Enjoy.
hey superatmos have u tried the dsiXDA kitchen with our phone
samyam2002000 said:
hey superatmos have u tried the dsiXDA kitchen with our phone
Click to expand...
Click to collapse
No. Not yet. Will try it and check whether it works with I9100G.
waiting for the rest of it patiently. hope u get time quite soon
samyam2002000 said:
waiting for the rest of it patiently. hope u get time quite soon
Click to expand...
Click to collapse
Yes. Very soon. Keep your linux environment ready to build your own kernel.
Always Got Error
Starting Maps.odex
*****************************************
* Deodexing... *
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find int
erface Landroid/view/MenuItem$OnActionExpandListener;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadAllImplementedInte
rfaces(ClassPath.java:823)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
683)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:111)
at org.jf.baksmali.main.main(main.java:282)
Error while loading class Lcom/google/googlenav/actionbar/d; from file .\origi_a
pp\Maps.odex
Error while loading ClassPath class Lcom/google/googlenav/actionbar/d;
Press any key to continue . . .
tarunagg said:
Always Got Error
Starting Maps.odex
*****************************************
* Deodexing... *
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find int
erface Landroid/view/MenuItem$OnActionExpandListener;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadAllImplementedInte
rfaces(ClassPath.java:823)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
683)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:111)
at org.jf.baksmali.main.main(main.java:282)
Error while loading class Lcom/google/googlenav/actionbar/d; from file .\origi_a
pp\Maps.odex
Error while loading ClassPath class Lcom/google/googlenav/actionbar/d;
Press any key to continue . . .
Click to expand...
Click to collapse
Please read the instructions. I mentioned to remove (Maps.apk, Maps.odex, PhoneSky.apk, PhoneSky.odex, VoiceSearch.apk and VoiceSearch.odex). These files give issue while deodexing I9100G.
Building kernel section updated
Hi,
Building kernel updated in 3rd post. Start building your own kernel.

Samsung Galaxy Tab A 7.0 LTE (2016) SM-T285 Lineage OS complete build guide

For SM-T285 users that want to build Lineage OS for their own device I have posted a complete build guide here:
https://github.com/lineage-gtexslte/build_guide
jedld said:
For SM-T285 users that want to build Lineage OS for their own device I have posted a complete build guide here:
https://github.com/lineage-gtexslte/build_guide
Click to expand...
Click to collapse
Thanks for the ROM update!
I started from scratch and when I compiled, I got this error:
fixdep: error opening config file: ../../../../../../kernel/samsung/gtexslte/scripts/genksyms/parse.tab.c: No such file or directory
I have had this error before and had to copy the file from another folder, but I should not have to do this.
So, I copied the file to folder where it was missing.
New error:
target Prebuilt: am (/home/gcrutchr/taba/out/target/product/gtexslte/obj/EXECUTABLES/am_intermediates/am)
Symlink: /home/gcrutchr/taba/out/target/product/gtexslte/system/bin/app_process -> app_process32
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: linker command failed due to signal (use -v to see invocation)
gcrutchr said:
Thanks for the ROM update!
I started from scratch and when I compiled, I got this error:
fixdep: error opening config file: ../../../../../../kernel/samsung/gtexslte/scripts/genksyms/parse.tab.c: No such file or directory
I have had this error before and had to copy the file from another folder, but I should not have to do this.
So, I copied the file to folder where it was missing.
New error:
target Prebuilt: am (/home/gcrutchr/taba/out/target/product/gtexslte/obj/EXECUTABLES/am_intermediates/am)
Symlink: /home/gcrutchr/taba/out/target/product/gtexslte/system/bin/app_process -> app_process32
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: linker command failed due to signal (use -v to see invocation)
Click to expand...
Click to collapse
What's your gcc version? might need to use gcc 6
jedld said:
What's your gcc version? might need to use gcc 6
Click to expand...
Click to collapse
gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC)
gcrutchr said:
gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC)
Click to expand...
Click to collapse
later versions of gcc may not work with lineage 14.1, I had to downgrade mine, though for another project.
you can do:
Code:
sudo apt-get install gcc-6 g++-6 g++-6-multilib
sudo update-alternatives --install
inform me if this works and I'll update my guide. Might consider making a docker based build if issues like this happen often.
jedld said:
later versions of gcc may not work with lineage 14.1, I had to downgrade mine, though for another project.
you can do:
Code:
sudo apt-get install gcc-6 g++-6 g++-6-multilib
sudo update-alternatives --install
inform me if this works and I'll update my guide. Might consider making a docker based build if issues like this happen often.
Click to expand...
Click to collapse
Actually, I am on Fedora Linux (uses less resources) and have been using gcc 8xx for some time. I compile LineageOS 14.1 for Note 3 (ha3g) and the Note Pro 12.3 (v1a3g) and have no problems. But, I will investigate further.
Ok...so I had issues building the kernel...could not find some include files.
So...I decided to use build_kernel.sh script to to make boot.img. The resultant file is about 1.4 MB smaller, there is no init file in the ramdisk folder and the boot.img-ramdisk.cpio.gz in the split_img folder is about 1/2 the size of your recent boot.img file.
Not sure when to go from here.
Okay, so I followed the instructions - after upgrading Fedora to v29 - but, this time I used Docker. Had to make some script changes for Fedora, but got most everything installed. The "work" directory is empty. I was able to make a working system.img that installed with the built .zip file. The kernel would not boot - hung on the logo screen. I restored the 10/17 boot.img and the system booted up. Now, I will work on the boot.img file. I did notice this time that the boot.img file was about the same size as the 10/17 boot.img file I downloaded. So, that's an improvement. I just finished modifying the build_kernel.sh file. So, I installed the kernel I made and it still hung on the logo screen. So, back to square 1 regarding the kernel.
gcrutchr said:
Okay, so I followed the instructions - after upgrading Fedora to v29 - but, this time I used Docker. Had to make some script changes for Fedora, but got most everything installed. The "work" directory is empty. I was able to make a working system.img that installed with the built .zip file. The kernel would not boot - hung on the logo screen. I restored the 10/17 boot.img and the system booted up. Now, I will work on the boot.img file. I did notice this time that the boot.img file was about the same size as the 10/17 boot.img file I downloaded. So, that's an improvement. I just finished modifying the build_kernel.sh file. So, I installed the kernel I made and it still hung on the logo screen. So, back to square 1 regarding the kernel.
Click to expand...
Click to collapse
Were you able to obtain a logcat with the failed boot? Possible issue is that the external kernel modules did not get compiled
jedld said:
Were you able to obtain a logcat with the failed boot? Possible issue is that the external kernel modules did not get compiled
Click to expand...
Click to collapse
Actually, not sure how I got it to compile. Having problems with docker. Cannot run python or any other dev command. Stuck as root user. So am trying to learn about docker. I do not think I was in docker when it compiled. Will get back to you after I figure this whole mess out.
27 October 2018
After reading the Docker documentation and playing with Docker, I removed it from Fedora. It is just too complicated to use even though it sounds simple. After removing Docker, I did a make clean and a make mrproper in the kernel folder. I ran 'brunch gtexslte'. The compile completed after I copied mkbootimg to the out folder - for some reason it is not getting copied there during the make process. This time the boot.img was over 9mb. It still will not boot. I will get log files today. I will also check to make sure the system files work with the good boot.img.
Question how do I update the system folder to the latest builds of lineage 14.1?
Your repo xml file restricts the source to your repo.
Okay!
Fixed boot.img not booting.
If you unpack boot.img, the file 'boot.img-imgtype' has an invalid image type. In the file, it says 'AOSP-PXA'.
It should say 'AOSP'.
I do not know where this is getting added. I have done a grep and could not find it.
As a side note, I used the build_kernel.sh script to make the kernel.
Question: How do I apply the security updates without manually following the (-) (+) in the diff file?
I am now able to do a complete make and install using the generated .zip file.
Here are the steps:
1. Setup your environment - I am using Fedora, but these instructions will work for any flavor of linux
2. Make sure you have the linaro gcc toolchain (32-bit) installed, and you have modified kernel/samsung/gtexslte/build_kernel.sh
3. Run: build/envsetup.sh, then brunch gtexslte
4. If the brunch stops near the end, copy mkbootimg from system/core/mkbootimg to out/host/linux-x86/bin
......or you can write a shell script to copy the file, as I did, before starting the build
5. After the build completes, cd into kernel/samsung/gtexslte
6. Run make mrproper, to clean the kernel folders
7. Run build_kernel.sh
8. After the kernel (zImage) is built, you need to make the boot.img
9. @jedld has posted how to do this in his build instructions
10. Now that you have a boot.img, you need to modify it.
11. Unpack boot.img
12. In the file 'boot.img-imgtype' , you need to change 'AOSP-PXA' to 'AOSP' - without the quotes
13. Repack boot.img
14. Replace boot.img in the lineage*.zip file with the one you just modified
15. Copy the lineage*.zip to you Tab-A, reboot into recovery and install it.
Here is my script for copying the mkbootimg file into the out folder, BEFORE I run brunch gtexslte:
if [ ! -d "out/host" ]; then
mkdir out/host
mkdir out/host/linux-x86
mkdir out/host/linux-x86/bin
fi
cp system/core/mkbootimg/mkbootimg out/host/linux-x86/bin
@jedld
Update on normal kernel build:
The reason the boot.img - when building via brunch gtexslte - will not boot is a bad zImage. If I replace the zImage from a bootable boot.img, the bad boot.img will boot okay.
Now I need to figure out what the problem is.
you can get the incremental diffs from linux.org
jedld said:
you can get the incremental diffs from linux.org
Click to expand...
Click to collapse
Is this for kernel changes or security patches?
gcrutchr said:
Is this for kernel changes or security patches?
Click to expand...
Click to collapse
My mistake, I meant kernel.org not linux.org. The incremental diffs contain changes to the mainline kernel which can contain security fixes and/or bug fixes. This is different from android specific patches which google releases separately as kernel patches. The kernel started out from the stock sources provided by samsung on 5.1.1 and then I added google's N and Oreo patches on it (patches related to selinux and oreo binder enhancements). I also added incremental diffs from kernel.org, it started out at 3.10.58 and then I applied incremental diffs until I got to 3.10.107. Unfortunately 3.10 is EOL now, upgrading the kernel to the 4.10 series will take a lot of work.
The SM-T285 Lineage OS is excellent. Is it possible to get the FM radio working? I have tried everything but can't get it to work. I would appreciate your help.
akasarf said:
The SM-T285 Lineage OS is excellent. Is it possible to get the FM radio working? I have tried everything but can't get it to work. I would appreciate your help.
Click to expand...
Click to collapse
It's probably not implemented in the kernel.
Just downloaded Radio FM from PlayStore and installed it. It works!!
I meant if there is a working FM radio tuner app that works without the internet on Lineage
gcrutchr said:
It's probably not implemented in the kernel.
Just downloaded Radio FM from PlayStore and installed it. It works!!
Click to expand...
Click to collapse

How-To Modify boot.img for DualBoot Patcher (Android 9)

One of the things I missed most since moving to Oreo and Pie on the Note 4 has been trying out the new ROMs without having to mess with my daily driver setup. After a ton of research and some training on building ROMs from source, I was finally able to make Android Pie boot from any slot on Dualboot patcher. *
What you need?
* An Android Pie ROM
* Android Image Kitchen (AIK)
* modified device tree binary (dtb)
* a text editor
* RAR or some other zip file manager.
Instructions
1) Download and extract AIK from https://forum.xda-developers.com/showthread.php?t=2073775
2) extract the boot.IMG from your ROM to the same folder where you extracted AIK.
3) unpack the boot image using the unpackimg.sh script. This will create a split_img folder and a ramdisk folder.
4) go to the split_img folder and delete boot.img_dt (or boot.img_dtb depending on which version of AIK you are using).
5) copy the attached dtb.img file to the split_img folder and rename it to the original file name (boot.img_dt or boot.img_dtb)
6) go to the ramdisk folder and edit fstab.qcom. change this line:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait,recoveryonly
To this:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1,discard wait
7) still in the ramdisk folder, modify init.qcom.rc. change this line **:
mount_all fstab.qcom
To this:
mount_all /fstab.qcom
8) go back to the AIK folder and run repacking.sh. this will create a file called image_new.img.
9) rename image_new.img to boot.img
10) replace the boot.img in your ROM zip file with the new one you just created.
Now you can use DualBoot Patcher to patch the ROM file for any slot and flash the patched file.
Just a few extra notes here:
* I only built these images for Android Pie for Snapdragon Note 4 devices. Make sure you use the the correct file for your device.
** in step 7, I noticed that some ROMs have an earlymount flag. You must delete that flag, otherwise the phone reboots to download mode.
***If anyone has any ideas to make this a flashable process, let me know. I would push these change upstream, but I don't know know enough about Git to do that. And, I don't know if the other devs want these changes.
Ok, so that was the manual way, but these changes can also be added to the kernel and boot image files at the time you build your ROM. Here is where you make the changes:
In the kernel, go to the dts sources. The file to modify is this one:
kernel/samsung/apq8084/arch/arm/boot/dts/qcom/aps8084.dtsi
Find this section and delete it:
Code:
system {
compatible = "android,system";
dev = "/dev/block/platform/msm_sdcc.1/by-name/system";
type = "ext4";
mnt_flags = "ro,barrier=1,discard";
fsmgr_flags = "wait";
status = "ok";
};
In the boot image, there are 2 files to modify.
1) device/samsung/trlte-common/rootdir/etc/fstab.qcom
Change this line:
Code:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait,recoveryonly
to this:
Code:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1,discard wait
2) device/samsung/trlte-common/rootdir/etc/init.qcom.rc
Change this line:
Code:
mount_all fstab.qcom
to this:
Code:
mount_all /fstab.qcom
That's it. Build the ROM and it will be compatible with DualBoot Patcher. Since those are common files across the TRLTE, TBLTE and DUOS devices, all of those builds will be compatible with dualboot patcher.
So, one more thing. There are limitations to what you can install with DualBoot Patcher. Most things are easy to get around, though.
1) Flashable zip's that use Aroma installer might not change their behavior after being patched, and might install to your primary ROM slot anyway. Just something to be aware of.
2) Any flashable zip that has a custom script for updater-binary will fail to flash after being patched. For example, all the MicroG installers that I know of use custom scripts instead of the real updater-binary.
3) you cannot install a patched Magisk zip. But, you can install the Magisk Manager in your ROM, tap the install button (and the next install button that shows up), choose "Select and Patch a file", then choose the boot image from the Multiboot folder on your internal storage (/sdcard). It will patch the boot image and leave a file called "magisk_patched.img" in your Download folder on the internal storage (/sdcard). Use TWRP to flash this file to your boot partition, then reboot. Open DualBoot Patcher, tap the 3-dot button next to the ROM name, and tap "Set Kernel" to replace the saved boot image with the Magisk patched boot image. Note: if you accidentally
4) Magisk doesn't do much. You can use it to grant superuser permissions, but modules only work on the primary ROM.
5) custom kernels probably include their own dtb files. Flashpoint is an example of this. You may have to update the zip to remove the existing dtb file and add one of the files attached to OP. Make sure you rename it to match the original name in the zip file.
I set up my primary ROM per the above instructions, installed it, and I am trying to get my secondary rom installed. Do I need to set it up the same way (it is a 7.1.2 rom). When I patch it (7.1.2) through Dual Boot and try to flash it I get the following error.... " Failed to create temporary image /raw/data/.system.img.tmp" and it fails to flash. I've tried setting it both as secondary and in slot 1.... Any help would be appreciated... Hopefully I am just missing something simple.
rickpub said:
I set up my primary ROM per the above instructions, installed it, and I am trying to get my secondary rom installed. Do I need to set it up the same way (it is a 7.1.2 rom). When I patch it (7.1.2) through Dual Boot and try to flash it I get the following error.... " Failed to create temporary image /raw/data/.system.img.tmp" and it fails to flash. I've tried setting it both as secondary and in slot 1.... Any help would be appreciated... Hopefully I am just missing something simple.
Click to expand...
Click to collapse
What Rom are you trying to flash? Do you have enough space available on system or cache to flash that Rom? If not, try patching it for a data slot instead.
thanks
why when i do this the rom that have modified wont turn wifi on ?
n910f
i try it on linageos pie and havocos 2.8 and both have same issue after doing this solution
samdakid said:
thanks
why when i do this the rom that have modified wont turn wifi on ?
n910f
i try it on linageos pie and havocos 2.8 and both have same issue after doing this solution
Click to expand...
Click to collapse
That's really odd. Maybe I need to update the dtb images here. I will try to do that this weekend.
Would love to try this out

Themes / Apps / Mods [TOOL] Custom boot logo / splash screen generator

Here simple Windows tool (x64 only) to unpack existing or create your own logo.img
Based on Python script by penn5, I only created "wrapper" for comfortable using.
Guide, all simple:
1. Unpack attached archive
2. Edit images logo-*.bmp, keep 24bit color
3. Run "2 Repack.bat"
4. In folder appear done.zip, flash it via recovery
To edit existing logos replace logo.img in folder, run "1 Unpack.bat" and process as above.
Most likely app will work with other modern Xiaomi models.
If you want to try – use your own logo.img, because screen resolution may be different.
File can be copied from fastboot / recovery stock ROM or firmware.
UPD: fixed, file was not created if 7-Zip not installed.
I would like to bring to your attention that this post is currently marked as a question.
While running 2 repack.bat, it ends with error "Can't load module: 7z.dll"
HUe1998 said:
While running 2 repack.bat, it ends with error "Can't load module: 7z.dll"
Click to expand...
Click to collapse
Sorry for long answer.
Oops, my fault, file was not created if 7-Zip not installed.
Re-download ZIP, this problem fixed.

Categories

Resources