FORUMS
Remove All Ads from XDA

[DIY GUIDE] Create a personalized ROM yourself! [UPDATED: 28-07-2014]

5,379 posts
Thanks Meter: 10,422
 
Post Reply Email Thread
Introduction
After releasing my 'Update to .253' thread, I've figured it is something you might want to do your self, maybe because you like to use your own created FTF, or even want to modify your ROM a bit before flashing. This guide will help you through it, as secure and successful as possible!

Anyone can do it!
There is no need to unlock your bootloader to work this guide, however it did help me out of some sticky situations myself, as long as you keep a cool head while working on your ROM, you'll be able to get out of any situation.

The XDA mantra: MAKE BACKUPS!
Before you do anything on your phone, make sure you create a solid backup first. As CWM and TWRP both do not backup your internal storage, create a backup of it's contents too before trying to install your very own ROM.

Prerequisites
Flashtool version 0.9.x.x (the latest) - Windows / Linux / Mac

Needed to flash your phone, also needed to create the FTF bundle. The Linux version is already installed in the VM but you can download any other version too, to do the flashing and FTF building before hand in a desktop enviroment you are accustomed to.

[GUIDE] Download ANY firmware customization from Sony & create an FTF with Flashtool

This thread will help you make an FTF file for your DIY project, as we already have this excelent thread I will save myself the trouble of creating a guide for that

VMWare Player (76Mb) (Free for non-commercial use) and [NUT]'s UbuntuHost VM (Bittorrent: 4.84Gb)

The VM you download is OK to use on any 4.1.2 ROM as base.
If you wish to use a 4.2.2 ROM, you will need the DIYGuide UPDATE PACKAGE 1 (Bittorrent: 169Mb).
If you wish to use a 4.3 or 4.4 ROM, you will be needing DIYGuide UPDATE PACKAGE 2 (Bittorrent: 159Mb). Flashtool however needs to be updated to 0.9.15.0 if you are going to build a 4.4 ROM
See the index below for the link to the guide post that explains how to use it.

This you will need for the tricky bits, as modifying a ROM is safer on a Linux host with less chances of breaking file permissions. As most of the world around us uses Windows, I've created a VM to support you in your tasks. I've installed the Linux tools you need, for me this VM works just fine.

The VM needs about 10Gb space on your pc and you need around 1Gb of free RAM when trying to use it smoothly.

This VM also contains a build script, simple but effective, which will create the (unsigned) flashable zip for you, grabbing all the files it needs along the way and giving you time to edit what ever you want during the building process.

I've made sure you have fastboot and adb commands to be found in the PATH variable, and that the connection to most android phones and tablets will most probably work just fine. You can do adb and fastboot commands to your phone without having them in the directory where you keep the files, easy to use!

The VM has one user, which is called XDA Community. To log in on Ubuntu, use the following credentials:
User: xda
Password: xdauser

This user has SUDO privileges, so expect to type that password again when prompted to do so while installing packages or even when running the rombuilder script.

Download and install WinRAR or 7Zip to be able to unpack my VM.

Included in the ROM you will build using this DIY Guide
Your DIY ROM will be rooted with SuperUser (or SuperSU when you used an update package), including the reboot fix. It will also include XZDualRecovery 2.3 RELEASE (or newer if you used an update package). So you will end up with a cool ROM!

Extra's
You will be able to use my AROMA ROM Mutator package to fix your JB 4.1 ROM if anything might fall to pieces in the future regarding root. You'll also be able to use it to make the switch from SuperUser to SuperSU using the mutator, if you might change your mind in the future.

Guide Index
Chapter 1: Introduction and Prerequisites
Chapter 2: Installing VMWare Player and getting 'UbuntuHost' running
Chapter 3: Preparing the FTF for NOOB use
Chapter 4: Preparing and Extracting the ROM
Chapter 5: Building the (unsigned) flashable ZIP
Chapter 6: Installing your DIY ROM
Addendum: How to replace the recoveries to suit your device
Addendum: How to update your VM
Frequently Asked Questions
The Following 92 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
 
 
2nd June 2013, 10:19 PM |#2  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Info 2 Installing VMWare Player and getting 'UbuntuHost' running
I'm assuming you have downloaded the VMWare Player application suitable for your system. Installing it is a basic knowledge to most Windows users, so I'm not going to elaborate on the actual installation.

I'm also assuming you have downloaded the VM. You can now unpack it to your Documents folder.

Now, fire up VMware player and when you see the following...



Then click on 'Open a Virtual Machine' and navigate to the folder you just extracted:



Click on the UbuntuHost.vmx and confirm the choice. You'll end up with this view:



Now you can either double click on the name in the list on the left or click play on the right to start it.



Remember, the password is xdauser



NOTE: This Ubuntu has the Unity interface which means, among other things, the menus are moved from the application window to the top bar. Move your mouse over it and the menus will appear.

And you are ready for the next chapter!
The Following 21 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:20 PM |#3  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Info 2 Preparing the FTF for NOOB use
Why would you do that? Well... to make sure you won't screw up flashing the wrong bits and make it erase your userdata... better safe then sorry!

This step is actually also needed to unpack the system partition from the FTF you created using the guide I put in the OP.

Copy the FTF you created to the VM by dragging the file in to the VM window. You can see Ubuntu recognizes it as a ZIP, which it essentially is.

Open it by double clicking on it.



Now delete userdata.sin, cache.sin and appslog.sin from it. Then drag system.sin to the DIY Guide folder on the desktop. Once it's unpacked, delete system.sin from the FTF as well.



That was easy, wasn't it? Lets move on to the next chapter.
The Following 21 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:22 PM |#4  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Info 2 Preparing and Extracting the ROM
Click on the Terminal icon on the left, type 'cd FlashTool' and then './FlashTool'.
NOTE: Use 'sudo' and your password you used to login to run FlashTool as root if you run in to problems.



In the Tools menu, you can select Sin Editor, select the system.sin in your DIY_Guide folder in your home.



Then click 'Extract data' to start the extraction, now go get a cup of coffee, this might take a while



Once it's done you will end up with a file called 'system.ext4' inside your DIY_Guide directory.



Click Close and close FlashTool using the orange X in the top left corner.

You can rename it to something you like but it should end with '.ext4' to allow the scripts to recognize it. Just open up the DIY Guide folder on the desktop and right click on the system.ext4 file and choose 'Rename'. For purpose of demonstration I renamed mine to 'nuts.ext4'

NOTE: The scripts allow for more then one flashable system to be created, so you can repeat the above multiple times, just remember to rename the system.ext4 to something else, otherwise you'll just end up overwriting the same file over and over again

Because of size considerations, the virtual disk is not really big (10Gb) so you'll run out of space fairly quickly, do not forget to empty the trash after this step!

That's it for this chapter, lets move on!
The Following 20 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:22 PM |#5  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Info 2 Building the (unsigned) flashable ZIP
Now we can open the Terminal by clicking on the icon on the left with the '>_' sign in the 'monitor'. Change directory to DIY_Guide and type 'ls -la' to show the following



You can start the build process using the rombuilder script by typing './rombuilder' and it will ask you for your password before it starts.
Once it successfully mounts the system partition it will open it for you. The script will pause for you to complete whatever modifications you want to do to it. Remember the XDA Mantra? Well... a backup would be good to make right now.



If you have more then one system.sin extracted, the above process will repeat itself until it passes all the various .ext4 files it has found.

NOTE: The mounted ext4 image has been mounted as root and as the contents are owned by root, you will need to sudo your actions when modifying the contents!

Tip: To make it easy on yourself you can use the terminal to open a file manager running as root. Type ctrl+shift+t, this will open a new terminal tab. In there type 'sudo nautilus' which starts the file manager again, but with an appropriate warning at the top of the explorer window, that one will be running as root. Be careful, you might wreck your entire VM if you mess things up big!

Once you are finished with the modifications or just enter through to the next bit, it will pack up the system partition and repeat or when done it will continue to create a flashable ZIP for each of the different .ext4 files you created.



You're almost done! Lets move to the next chapter...
The Following 21 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:24 PM |#6  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Info 2 Installing your DIY ROM
FOR 4.1.2 ROM's:

Before doing these steps, remember to have any recovery installed on your phone if you are doing this with a locked bootloader, otherwise you won't be able to flash the zip you've built!
  1. Put your '$NAME.flashable.zip' on (the external) SDcard;
  2. Put the 'FTF' inside the FlashTool/firmwares folder;
  3. Create a backup of your phone in CWM or TWRP and don't forget to backup the contents of 'SDCard0';
  4. Flash everything in the 'FTF' to your phone and boot the phone straight to recovery after that;
    NOTE: If you have an unlocked bootloader, you CAN flash the kernel, but you do not need to, to keep your custom kernel.
  5. Flash '$NAME.flashable.zip' in recovery (Works in both CWM and TWRP!)
  6. Reboot to system without clearing (dalvik-/)cache.

And you're done!

FOR 4.2.2 AND 4.3 ROM's:

Before doing these steps, remember to have any recovery installed on your phone if you are doing this with a locked bootloader, otherwise you won't be able to flash the zip you've built! You will need XZDualRecovery 2.5 BETA or newer to make this work.

NOTE: This guide assumes you are coming from a 4.1.2 ROM. If you have a 4.2.2 ROM already installed, you can skip this one and use the above guide.
  1. Put your '$NAME.flashable.zip' on (the external) SDcard;
  2. Put the 'FTF' inside the FlashTool/firmwares folder;
  3. Create a backup of your phone in CWM or TWRP and don't forget to backup the contents of 'SDCard0';
  4. Flash '$NAME.flashable.zip' in TWRP, then TURN YOUR PHONE OFF AFTERWARDS - DO NOT BOOT IT YET!
  5. Flash everything in the 'FTF' to your phone;
  6. Now boot to system without clearing (dalvik-/)cache.

And you're done!
The Following 14 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:26 PM |#7  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Question Addendum: How to replace the recoveries to suit your device
Download XZDualRecovery specific for your device, the flashable package to be precise.

Drag the file to the VM window and open the zip. You will see 2 folders in there, traverse in to system/bin where you will see the files you need most.
Open the DIY_Guide on the VM's desktop, traverse to updater/system/bin and drag all the files from the zip in to this directory, replacing all the files already in your VM and you are set to go

On the Xperia Z Ultra, Z1 Compact, Z1 and (Tablet) Z2, don't forget to copy the disableric file from the tmp folder inside the recovery zip to the updater/system/xbin folder. Forgetting to do so will cause your system partition to be not fully accessible from the fully booted ROM.

For completeness, you could copy the dr.prop file inside the zip to the updater directory too: this will ensure people downloading your package will know what XZDR version was included.
The Following 7 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:26 PM |#8  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Addendum: How to update your VM
The update package 1 contains the following:
  • FlashTool 0.9.11.0
  • XZDualRecovery 2.5 BETA
  • The Remount-Reboot fix
  • Superuser has been replaced by SuperSU

IMPORTANT NOTE: This update makes your flashable ZIP assume you are updating from a 4.1.2 ROM to a 4.2.2 ROM. So the resulting flashable ZIP will move the contents of your internal storage to the new 4.2.2 location. If you are creating a package to go from a 4.2.2 ROM to a 4.2.2 ROM, you will need to edit the updater-script to stop it from doing that

Code:
ui_print("  Moving contents of the internal storage to it's new location...");
ui_print("");
ui_print("  NOTE: This may take a while!");
ui_print("");
run_program("/sbin/busybox", "mv", "/data/media", "/data/temporary");
run_program("/sbin/busybox", "mkdir", "/data/media");
run_program("/sbin/busybox", "mv", "/data/temporary", "/data/media/0");
set_progress(0.850000);
Remove the above portion from updater/META-INF/com/google/android/updater-script using gedit and you're set!

The update package 2 contains the following:
  • Flashtool 0.9.13.0
  • SuperSU 1.86
  • XZDualRecovery 2.7.62.

How to update:
  1. Download the update package from the link in the OP;
  2. Open the Home directory in the VM on the bar on the left;
  3. Drag the file in to the home directory straight from your host PC's location where you stored the downloaded package;
  4. Remove the FlashTool and DYI_Guide folders or rename them (to rename, right click on them to get the menu with the rename option);
  5. Now open the diyvm-update.tar.gz, drag the 2 folders in to the Home directory.

All done!
The Following 9 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
2nd June 2013, 10:26 PM |#9  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Question Frequently Asked Questions
Q: Could I use this for any other Xperia device?
A: Sure you can! The proof is starting to pop up now and then
Just make sure you put in the right recovery pieces to support your specific device

Q: Am I allowed to release my ROM to the public?
A: Of course! I only require a simple mention or a humble thank you in your topic, where ever that may be. I like to know where my work travels to, so post or PM me the links to it

Q: Am I allowed to change the updater script to suit my needs?
A: You are allowed to change whatever you wish, I have NO copyright or license stuck to my work, simply because I consider anything with a license or copyright not to be 100% pure open source.

Q: I would like to make a ROM for my device, but there is no XZDualRecovery for it?
A: Try to integrate a recovery package available for your device. You can of course also request XZDR support, but it can take some time before that happens.

Q: I want to expand the storage capacity of the VM, is there any guide for that?
A: Yes, @gregbradley posted one here.

Q: My VM disk is slowly filling up, while I am keeping the trash empty, how come?
A: @GavTheStoner found out why, read his post on the subject and the solution he found.
The Following 13 Users Say Thank You to [NUT] For This Useful Post: [ View ] Gift [NUT] Ad-Free
3rd June 2013, 03:56 AM |#10  
Senior Member
Thanks Meter: 24
 
More
Would be very useful! Thank you for the nice and clear guide!

Could you please also provide the script and other files needed such recovery etc. ? The whole VM image is large...
3rd June 2013, 05:52 AM |#11  
[NUT]'s Avatar
OP Senior Member
Flag Cyberspace and the Universe
Thanks Meter: 10,422
 
Donate to Me
More
Quote:
Originally Posted by Fishmanzero

Would be very useful! Thank you for the nice and clear guide!

Could you please also provide the script and other files needed such recovery etc. ? The whole VM image is large...

No

It's not hard to find parts in my releases...

Sent from my C6603 using xda app-developers app
Post Reply Subscribe to Thread

Tags
flashtool, guide, rom, root, vmware
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes