Disclaimer:
Our tool was made for testing and educational purposes, ME is not responsible for what you do on/with your device using our tool, you must agree that you using our tool on your own risk, I am not responsible if you brick your device or anything else!
What is this for:
This tool converts xperia sin file and directly create flashable.zip for use to flash your android device with recovery.
Changelog:
- version 1. (missing selinux label generator)
- version 2. (implemented selinux label generator tool. Missing static busybox)
- version 3.
- version 4. some small corections, added missing update-binary
- version 5. some improvements, new sin unpack tool
How to use:
Extract sin2zip.rar archive & simple run CONVERT.bat & chose system.sin image , tool will produce flashable.zip
What you need to check or probably modify in generated flashable.zip:
1. busybox I have used is 32bit, it will work on 64bit too (not busybox.exe !!), I not recommend to change busybox, but before you go for busybox replace make sure it is STATIC busybox and have working (chcon and chown) with -h parameter!
2. check updater-script e.g. first 3 lines and last 2 lines!
3. this -> https://forum.xda-developers.com/showpost.php?p=80593639&postcount=7
Source code:
modified ext4_read tool is in attachment. Original ext4_read is here, many thanks to author! I have notified Igor, hope we see selabels listing integration in 7z without need for hackish ext4_read
sony dump tool -> https://github.com/munjeni/anyxperia_dumper
munjeni said:
This tool converts xperia sin file and directly create flashable.zip for using with recovery. 75 percent is done. 25 percent of the things is missing, selinux related things. I need help for implement selinux to the 7z to list selinux labels from ext4! Here is work in proogress
Click to expand...
Click to collapse
Maybe @SuperR. of SuperR's Kitchen fame HERE could give you some pointers on this. :fingers-crossed:
Maybe you could work together to integrate some of your great Sony specific tools into the Kitchen
That kitchen do not have anything related to our tool. I have done some progress in extracting selabels from ext4 by searcing with inode number \0/
Right now tool is able to extract selabels by inode number pointing
So you are on the drawing board again! Cool... :highfive:
About what you wrote in the j4nn's thread (1. to make fota unpack tool), count on me if you need help, ok!
If I'm not mistaken, I sent you a ota update_package file from my x performance some time ago, but if I am, here it goes again.
Cheers.
serajr said:
So you are on the drawing board again! Cool... :highfive:
About what you wrote in the j4nn's thread (1. to make fota unpack tool), count on me if you need help, ok!
If I'm not mistaken, I sent you a ota update_package file from my x performance some time ago, but if I am, here it goes again.
Cheers.
Click to expand...
Click to collapse
Thanks! I will look into ota package till after I finish our tool
Almost done! New version v2 is out! Made small tool to read ext4 image and print selabels to updater-script, it look like this:
if regular file or folder:
Code:
run_program("/tmp/busybox", "chcon", "u:object_r:location_exec:s0", "/system/bin/xtwifi-inet-agent");
if symlink:
Code:
run_program("/tmp/busybox", "chcon", "-h", "u:object_r:vendor_file:s0", "/system/bin/xxd");
Tool is curently 95 percent done, not realy ready for flashig produced flashable.zip , need to implement 5 percent of the things. You can try but plese do not try to flash with recovery it will not work corectly!
Version 3 done! Before you flash flashable.zip please check updater-script first 3 lines and last 2 lines! Do in mind our tool didn't include the rest of firmware like kernel, vendor...etc, tool only convert one sin file to flashable.zip, if you need the rest of firmware run CONVERT.bat and chose another sin file, do merges in zip by hand and do merges-modification in updater-script by hand too. Not recommended for newbies! I can't tell you if produced flashable.zip is working I'm not tried to flash flashable.zip, but I think it going work. Important thing is initial tool is done and somebody need to test. Let me know Enjoy!
Version 4 done. Enjoy!
@serajr here is some info https://forum.xda-developers.com/showpost.php?p=80599561&postcount=1330 , your file is the same format as j4nn
Version 5 done.
Related
This is how I made ROM, I'll try to write the steps as simple as I can. For advanced users only!
Update 22/08/11:
Revised packaging steps.
Update 13/08/11:
Removed unwanted method for ROM cooking.
Update 04/08/11:
Modified extract and repack ROM guide and added extracting system.rfs guide.
Things you need:
Base firmware
Archiver software (7zip recommended)
Any Linux environment to build ROM or Cygwin
APK Manager to optimize and decompile *.apk files
MagicISO (Optional) if you want to extract system.rfs
And the last thing is... You need enough experience in android world
So, here is the steps to cook a ROM:
Flash your phone with your desired base firmware
Make required modifications
Pull system.rfs from your phone by running this command on adb shell or Terminal Emulator:
Code:
dd if=/dev/stl12 of=/sdcard/system.rfs
Extract any *.tar.md5 files from your base firmware to your working folder with 7zip
Replace the current system.rfs with your modified one
EDIT: Pack your ROM by running this code via terminal or just pack it with 7zip/WinRAR as *.tar
Code:
tar -H ustar -c * >> ROMNAME.tar
change ROMNAME to your desired, well, ROM name.
Here is (yet) useful guide to modify your ROM.
Extract system files on system.rfs to make modding easier:
Extract PDA file (*.tar.md5) files with 7zip
Open system.rfs with MagicISO
To extract it, just drag and drop
NOTE: Never edit your ROM with MagicISO because the file permissions will be ignored, use MagicISO only for extracting files from system.rfs
Deodex, and Zipalign (optimize) your ROM apk files:
Ready to use deodex + root for KPN: http://forum.xda-developers.com/showthread.php?t=1196230
Ready to use deodex + root for KPH and other firmware: http://forum.xda-developers.com/showthread.php?t=1118048
Open APK Manager
To zipalign your apk files, in apk manager folder /place-apk-here-to-batch-optimize put your:
framework-res.apk, twframework-res.apk and all system apk
but not these:
AxT9IME, Calculator, Camera, Email, MMS, Phone, Screen Capture, Settings, Swype, Thinkdroid, Voice search
Choose Choose option 15
Then choose both (zp)
Let it run and done.
Now put back the apk files where they belong in the ROM.
How to put these apk files to my ROM? Copy these files to appropriate locations, such as /system/app to your ROM's /system/app, and etc.
Another handy modification guide:
Unpack and repack boot.img - http://forum.xda-developers.com/showthread.php?t=1173427
Convert firmware filesystem to ext4 - http://forum.xda-developers.com/showthread.php?t=1202049
Overscroll glow for any firmware - http://forum.xda-developers.com/showthread.php?t=1215933"
Give thanks to all dev who made that possible!
If you have more guides to put here, please PM me.
Am I pertamax?
hehe..just kidding.
Nice Info....great share.
I would want the Fla.sh Rom :'(
Thats a gr8 share...Thank you...)
saiftheboss7 said:
I would want the Fla.sh Rom :'(
Click to expand...
Click to collapse
sorry... once again, I'm sorry, I can't continue my ROM
Helpful thread man!
Thanks!
Great job taking your time to make this! Unfortunately, i dont even know the basics but now I know where to check when I do
fla.sh said:
sorry... once again, I'm sorry, I can't continue my ROM
Click to expand...
Click to collapse
Hey!
THX man, nice thread. Very useful!
Just PM to MOD, that they close you previous thread, a bout fla.sh.ROM. Or ppl just waiting it and asking.
CHEERS!
i think the most troublesome problem i encounter is to repack system.rfs. yes it can be mounted in magiciso, but howto repack/compile it back?
an0nym0us_ said:
i think the most troublesome problem i encounter is to repack system.rfs. yes it can be mounted in magiciso, but howto repack/compile it back?
Click to expand...
Click to collapse
Just save it.
didnt work when i just save it. my device got bootloop
an0nym0us_ said:
didnt work when i just save it. my device got bootloop
Click to expand...
Click to collapse
What modification you've added to your ROM? Maybe that modification causing the problem...
fla.sh said:
What modification you've added to your ROM? Maybe that modification causing the problem...
Click to expand...
Click to collapse
As Linux, MagicISO read RFS image as a FAT filesystem. File permissions can not be maintained. A better way but need linux:
1. Mount system.rfs as FAT and mount it to /tmp/rfs
2. Make ext4 image, and mount it to /tmp/system
3. Copy /tmp/rfs contents to /tmp/system
4. Make modification inside /tmp/system
5. Fix file permissions inside /tmp/system
6. Umount both image
7. Make ODIN flashable image, contains system.rfs (now in ext4 format) and CF-Root-S5830 boot and recovery image (for ext4 support)
8. Boot to Windows and flash your new firmware using ODIN.
ketut.kumajaya said:
As Linux, MagicISO read RFS image as a FAT filesystem. File permissions can not be maintained. A better way but need linux:
1. Mount system.rfs as FAT and mount it to /tmp/rfs
2. Make ext4 image, and mount it to /tmp/system
3. Copy /tmp/rfs contents to /tmp/system
4. Make modification inside /tmp/system
5. Fix file permissions inside /tmp/system
6. Umount both image
7. Make ODIN flashable image, contains system.rfs (now in ext4 format) and CF-Root-S5830 boot and recovery image (for ext4 support)
8. Boot to Windows and flash your new firmware using ODIN.
Click to expand...
Click to collapse
I use this command to mount rfs:
Code:
mount -o loop system.rfs /some_dir
Can you share us the command?
now thats really informative. thanks
ROM unpacking and repacking gude has been corrected. Tested by me. If you have any problems, just ask here.
Thanks.
I think you should add the date of update in the title, so that everyone can know about the update...
BTW thanks for this amazing guide...
Love it!!!
After making changes to system.rfs, how to save it as .rfs again?
adiles said:
After making changes to system.rfs, how to save it as .rfs again?
Click to expand...
Click to collapse
Please take look at the first page, it's updated, you know?
After I created md5 file and selected it in odin, it says "invalid image type" and "invalid model binary". How to solve that? After that I continued, skipped these errors and flashed, my phone stopped at boot screen with text "Galaxy ACE....". Plz help me
WHAT'S IN THE RAMDISK
So anyone who has compiled a kernel (for the X8) or is about to step into the world of developing android awesomeness through kernel building, should know that there are 2 (two) parts to the kernel:
The kernel image compiled from source code, and
The ramdisk
Both are equally important and are inter-dependent; without the kernel, the ramdisk is nothing (unless of course the devs come up with any other use) and without the ramdisk, the kernel is incomplete (again, this may change in the near future).
You (XDA-ians as I like to call you guys), especially those in the X8 sub-forums must have read viper001's kernel building guide. If you haven't, and do not want to read just 4 posts because of your laziness, it tells you how to compile your kernel image. Hah, now you are almost dying to read it. Well go ahead, read it.
Done reading. Well if you followed that guide to the letter (which I am sure many of you haven't), you'll have compiled your kernel with the FXP ramdisk. Now you want to build it from another source. It's pretty much the same process. However the FXP ramdisk won't work with this kernel. Not a chance (maybe a little). You need the ramdisk so you unpack the kernel using DooMLorD's tool (and forget to thank him; go thank him right now) and see a folder named kernel.sin-unpacked. You open it and see a bunch of files that you've never even heard of. You drop the kernel-building project.
This guide will hopefully eradicate that fear, or ignorance (maybe), and cover up what's in the ramdisk.
The parent (or root) directory of the ramdisk folder itself contains a bunch of files and folsers, which also contain more files.
Let's look at the contents in the root directory:
1 “modules” folder – This one is pretty easy. It contains the kernel specific modules that are loaded up at boot.
2 “res” folder – This folder contains another folder named “images” which contains images to be used in the recovery (more on that later).
3 “sbin” folder – Inside this folder are about 200 files (may vary), most of which are responsible for basic functioning of the phone.
4 default.prop – This file contains only a few lines of code that allow adb to run (line 4) and also makes the kernel insecure to give us permanent root.
5 init – This program initializes elements of the android OS and looks at the two following files:
6 init.rc – This file contains generic initialization code
7 init.<machine_name>.rc – This file contains device-specific initialization code.
8 initlogo.rle – This is the bootlogo (not the bootanimation which comes with the ROM).
9 pre_hw_config.sh – This file is executed at boot to get settings like cpu freq and governors just right.
10 recovery.fstab – This file specifies how the different partitions and file systems are to be mounted.
11 ueventd.rc – This file sets user or group (or root?) permissions on /dev nodes. (I got this line from the Internet and have no idea myself what the hell this means o_0).
12 ueventd.goldfish.rc – This file is empty in our kernels. Dunno why, though.
Now for the files in the /res/images directory:
1 icon_clockwork.png – This is the background seen in CWM.
2 icon_error.png and icon_firmware_error.png – These images are displayed on the screen when there is an error. Not sure though as I have never encountered any such error before in my life.
3 icon_firmware_install.png and icon_installing.png – These images are displayed when installing anything via CWM.
4 indeterminateX.png (where X is a number from 1 to 6, both inclusive) – This is basically the animation of the progress bar (the grey stripes moving forwards, or backwards, or both).
5 progress_empty.png – This is the progress bar during the initial stages of flashing anything in CWM.
6 progress_fill.png – This is the progress bar fill.
These are the files in the /modules folder:
1 sdio.ko – This is a file related to WiFi.
2 tiwlan_drv.ko – This is the tiwlan WiFi driver module.
3 tiap_drv.ko – This is the tiap WiFi driver module.
4 x8uv.ko – This is the undervolting module.
5 synaptics_i2c_rmi4_no_dt.ko – This disables dual touch in Synaptics.
6 synaptics_i2c_rmi4_dt.ko – This enables dual touch in Synaptics.
NOTE: I am not an expert.
More to come soon. See you and I hope sincerely that I do not get banned for this.
THE DREADED SBIN DIRECTORY
Going into the /sbin directory, we see a lot of files, the names of each sending shivers down your spine. But fear not, for sgt. meow will help you understand the functions of some important ones:
1. adbd – The file that allows you to use the adb shell. “adbd” stands for “Android Debugging Bridge Daemon”.
2. bootlogo – This file starts the kernel bootlogo (according to some user on the androidcentral forum; just saw a snippet on google search, opened the page and there was no thread).
3. bootrec – This file basically tells a kernel how to boot up a recovery
4. busybox – It lets you run LINUX / UNIX based commands (ls, gzip, uname etc.) that are required for root-level tasks.
5. dmesg – It is the Linux kernel's own logging system and is similar to logcat.
6. fix_permissions – This file applies and fixes permissions on the Android data folders.
7. insmod – This file is basically what is executed when you type insmod /..../../../../ xxx.ko (or similar) to load up the modules. An alternative way to do this is to write the line in hw_config.sh of /system folder (I guess) to load up modules at every boot. Or you could place the modules in the /modules directory of the kernel.
8. killrecovery.sh – This file, as the name suggests, kills the recovery when you exit it and boots into Android.
9. nandroid – The file responsible for nandroid backups.
10. nandroid-md5.sh – This file generates MD5 checksums for nandroid backups to verify its integrity.
11. reboot – This file reboots the phone when prompted to.
12. recovery – This is the recovery binary. For our devices, it is CWM recovery. This file can be changed easily (what I did with oxydo ICS) to other recoveries for this device for that version of Android.
Most of the other files are LINUX / UNIX based commands and some are files the functions of which cannot be explained by me.
More to come soon. Hope you enjoyed it so far.
FILES YOU CAN EASILY EDIT IN THE RAMDISK
There are some files in the ramdisk that can be edited pretty easily. There are also other files editing which means you gotta be RD or gotta have similar talent. Let's not go into that for now. The easy ones are:
1. initlogo.rle - The file that is easiest to edit. Basically you can convert any image to .rle format and replace it. make sure it is the right resolution.
2. /sbin/recovery - You can use recovery from another kernel (for the same Android version)and replace it in yours. You can also compile your own recovery binary by issuing the make recovery command after a successful CM build.
3./sbin/bootrec - You may have to change this when you change the recovery. Just a simple copy paste, that's all.
4. /sbin/rec_input - This file may need changing too when you change recovery.
5. /res/images/.. - Every .png file in this directory can be easily changed to any other .png file. Just make sure the resolutions are right, or else you will not be able to navigate properly in recovery.
6. init.rc - This file is easily changeable but you need to know what you are doing, otherwise you may mess up the boot sequence.
You can have a shot at changing other files, too. Lemme know how it goes.
CREDITS:
1. Allah Almighty (yes I'm a Muslim)
2. All XDA-ians, especially those in the X8 sub-forum for help (and for pressing thanks)
3. The Internet (Google, Wikipedia and Github mostly) for info
4. Me, for spending hours behind this guide.
5. My family, for not disturbing me while I was doing this. LOL
thank you
that is what i'm trying to understand :good:
This is for sure a valuable thread. Thanks for this!!
Sent With My Brains To Yours. Duh.
Nice thread , Captain Meow Meow
Sent from my X8 using xda app-developers app
sbin will take some time to cover but i will try my best.
sgt. meow said:
sbin will take some time to cover but i will try my best.
Click to expand...
Click to collapse
Its good to see that you are working hard...
Keep it up
great thread.thanks
sent from my x8™ using gingerzaraki®
THREAD UPDATED WITH SBIN CONTENTS. OMG. :wink:
Dude, you should make an *updated* Kernel Building Guide with new sources (i.e. alfs kernel or nAa kernel). Old one still uses FXP kernel source and outdated toolchain instead of Linaro.
RohinZaraki said:
Dude, you should make an *updated* Kernel Building Guide with new sources (i.e. alfs kernel or nAa kernel). Old one still uses FXP kernel source and outdated toolchain instead of Linaro.
Click to expand...
Click to collapse
And link to your sources as an example for others..
Banned? And why? This is usefull =))
Sent from my E15i using xda premium
@Rohin
yeah I might
@Elmir
that was a joke
@all
THREAD UPDATED WITH FILES THAT CAN BE EDITED AND CREDITS. :BIG GRIN:
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
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...
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
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!
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.
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!
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...
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!
Put your '$NAME.flashable.zip' on (the external) SDcard;
Put the 'FTF' inside the FlashTool/firmwares folder;
Create a backup of your phone in CWM or TWRP and don't forget to backup the contents of 'SDCard0';
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.
Flash '$NAME.flashable.zip' in recovery (Works in both CWM and TWRP!)
Reboot to system without clearing (dalvik-/)cache.
And you're done! :victory:
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.
Put your '$NAME.flashable.zip' on (the external) SDcard;
Put the 'FTF' inside the FlashTool/firmwares folder;
Create a backup of your phone in CWM or TWRP and don't forget to backup the contents of 'SDCard0';
Flash '$NAME.flashable.zip' in TWRP, then TURN YOUR PHONE OFF AFTERWARDS - DO NOT BOOT IT YET!
Flash everything in the 'FTF' to your phone;
Now boot to system without clearing (dalvik-/)cache.
And you're done! :victory:
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.
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! :fingers-crossed:
The update package 2 contains the following:
Flashtool 0.9.13.0
SuperSU 1.86
XZDualRecovery 2.7.62.
How to update:
Download the update package from the link in the OP;
Open the Home directory in the VM on the bar on the left;
Drag the file in to the home directory straight from your host PC's location where you stored the downloaded package;
Remove the FlashTool and DYI_Guide folders or rename them (to rename, right click on them to get the menu with the rename option);
Now open the diyvm-update.tar.gz, drag the 2 folders in to the Home directory.
All done! :good:
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.
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...
Fishmanzero said:
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...
Click to expand...
Click to collapse
No
It's not hard to find parts in my releases...
Sent from my C6603 using xda app-developers app
Great guide! Thanks a lot for this!
Gesendet von meinem Xperia Z via Tapatalk
Don't suppose anyone's come up with a way to rebuild to FTF?
Would love to be able to do that and just load with FlashTool.
Johbremat said:
Don't suppose anyone's come up with a way to rebuild to FTF?
Would love to be able to do that and just load with FlashTool.
Click to expand...
Click to collapse
Me too, but unfortunately that's just impossible... Sorry
Sent from my C6603 using xda app-developers app
Great Guide
Thanks for sharing - I was able to create my own deodexed and zipaligned 10.1.1.A.1.307 firmware. I tweaked it a bit so it doesn't reboot when changing system to R/W.
Next I'll try creating one for the Japanese 10.1.D.0.343 build
I was able to create a working 10.1.D.0.343 build for the SO-02E variant using your guide. Is it cool with you if I upload it and share it for our Japanese friends? I'll give you credit of course. :good:
lancebukkake said:
I was able to create a working 10.1.D.0.343 build for the SO-02E variant using your guide. Is it cool with you if I upload it and share it for our Japanese friends? I'll give you credit of course. :good:
Click to expand...
Click to collapse
Of course you can
If I didn't want you to release it to the public I'd have that explicitly stated in the OP ... which I haven't, so go right ahead! :good:
--- ON A DIFFERENT NOTE ---
I'll be updating the VM soon to reflect the changes in the updater script, the remount-reboot fix and the latest XZDualRecovery.
I'll also make a tar archive with a little guide in one of the reserved posts to help you update your VM so you won't have to download it all over again
Thanks!
But its possible to create a ROM out of a CWM Backup on Windows.. I.E. thats more simple
Thanks for the VM though
jader13254 said:
Thanks!
But its possible to create a ROM out of a CWM Backup on Windows.. I.E. thats more simple
Thanks for the VM though
Click to expand...
Click to collapse
I know it is, but that is basically a TAR backup and requires a few extra steps: flashing the FTF to your phone, then booting to recovery to make that backup, dragging that to your PC and stripping the META info from the nandroid backup process adds to the TAR (which makes it a non-standard tar archive!) and you still risk losing all permissions and ownership information on the files inside the archive when extracting that to integrate it in your flashable zip... which is a ZIP and does not know about the extended file permissions and ownership from a Linux system... so you will have to make your updater-script reset permissions or instruct your users to do so using recovery... :silly:
Using this VM and my method of using the SIN file to extract a ROM prevents a huge heap of possible issues and keeps the updater-script nice and small and the installation a breeze
[NUT] said:
I know it is, but that is basically a TAR backup and requires a few extra steps: flashing the FTF to your phone, then booting to recovery to make that backup, dragging that to your PC and stripping the META info from the nandroid backup process adds to the TAR (which makes it a non-standard tar archive!) and you still risk losing all permissions and ownership information on the files inside the archive when extracting that to integrate it in your flashable zip... which is a ZIP and does not know about the extended file permissions and ownership from a Linux system... so you will have to make your updater-script reset permissions or instruct your users to do so using recovery... :silly:
Using this VM and my method of using the SIN file to extract a ROM prevents a huge heap of possible issues and keeps the updater-script nice and small and the installation a breeze
Click to expand...
Click to collapse
I just used a nice tool called "yaffey" which keeps the file structure and I set permissions via updater-script.
Works really fine but may be more difficult
Reall great way though and big thanks for this guide
What's ziplign ?
Read,Android Developers site.https://developer.android.com/studio/command-line/zipalign
zipalign is an archive alignment tool that provides important optimization to Android application (APK) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the APK, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application.
This tool should always be used to align your APK file before distributing it to end-users. The Android build tools can handle this for you. Android Studio automatically aligns your APK.
Click to expand...
Click to collapse
Why this tool is needed ?
There are a lot of APK modifications on XDA, most of which are done through APKTOOL (Thanks @iBotPeaches for this great tool)
But after apktool compilation, apks needs to be zipalign manually -> which is missing from some these Modded/Distributed Apks found in the forum.
So, I decided to go ahead and make simple tool for this task.
This tool will help end-users/devs in such cases.
How to Use ?
It's One-Click tool, As simple as it gets !
Download & Extract Zip file from attachment.
Put All apks in "Input" folder
Do not leave "SPACES" in file name of APKs For example, Use "AppName_v1.apk" instead of "AppName v171.apk"
Double Click the Batch file (.bat)
You can find zipaliged APKs in "Output" folder after it's done.
That's It !!
PS : (Devs only) Use this tool **AFTER** signing APKs
Users don't need to worry about this because APKs you have/download are already signed.
FAQs
# How to know whether APKs are zipaligned or not after using this tool ?
Check file size of APK Before & After (In Input & Output folders). You will see the differnce in file size on bytes level So, you need to open full property of file via right click.
If file size if exactly the same, means APK was already zipaligned
# How to know whether APKs i have are already zipaligned or not ?
As of now there's no method to my knowledge. So, you need to go through above process.
In general, APKs directly from PlayStore (you backup/apkmirror) are zipaligned so you don't need to zipalign them unless there's some modifications performed on it.
Change log
v1.0 Release 2017
Initial Release
Latest available zipalign binary
v2.0 Release 2022
Based on Android SDK Build-Tools 30.1.0 and should be compatible with latest Android versions (A9-A12+)
Tried this. Nothing in the output folder
Serpentinefire76 said:
Tried this. Nothing in the output folder
Click to expand...
Click to collapse
I'm not actively maintaining this tool due to personal commitments. Theoretically it should still work even with older binaries but if you are looking for specific support I suggest search for other/newer threads.
jineshpatel30 said:
I'm not actively maintaining this tool due to personal commitments. Theoretically it should still work even with older binaries but if you are looking for specific support I suggest search for other/newer threads.
Click to expand...
Click to collapse
I tried it again. It works like a charm. Awesome. Thank you!
Update after a long time.
v2 is based on Android SDK Build-Tools 30.1.0 and should be compatible with latest Android versions (A9-A12+)
Happy Modding!
i get this error a mod apk
Code:
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed collecting certificates for /data/app/vmdl262490375.tmp/base.apk: Failed to collect certificates from /data/app/vmdl262490375.tmp/base.apk: META-INF/APKEASYT.SF indicates /data/app/vmdl262490375.tmp/base.apk is signed using APK Signature Scheme v2, but no such signature was found. Signature stripped?]
Command file current zipalign.bat:
for %%X in (.\Input\*.apk) do (
echo Zipaligning - %%~nX.apk
.\Tools\zipalign -cv 4 %%X
.\Tools\zipalign -fv 4 %%X .\Output\%%~nX.apk
)
Maybe it should be reversed like this:
for %%X in (.\Input\*.apk) do (
echo Zipaligning - %%~nX.apk
rem To align infile.apk and save it as outfile.apk
.\Tools\zipalign -fv 4 %%X .\Output\%%~nX.apk
rem check alignment outfile.apk only after having zipalign (does not modify file)
.\Tools\zipalign -cv 4 %%X
)
Multi Image Kitchen - Repack Android partitions from Windows
Possibilities:
Unpacking and packing partitions: System, Vendor, Product, ODM, SOCKO, ELABLE (RAW, SPARSE)
Unpacking and packing partitions with extension: * .img; * .fex; * .Partition; * .new.dat; * .new.dat.br; * .lz4; * .exT4; * .tar; * .md5
Unpacking and packaging logo partition: logo.img, logo.partition
Unpacking and Packaging: _aml_dtb.partition (Single, Multi, Multi / Gzipped)
Extract from the PAYLOAD.BIN file sections file
Removing from the Super.img file partitions
Unpacking and packaging of resource partition: resource.img
Unpacking and packaging SOC Amlogic firmware, Rockchip and Allwinner
Unpacking and assembling Service Package: * .zip (Update.zip)
Decompiling and compile applications (* .apk)
Github: https://github.com/CryptoNickSoft/MIK
Reserved
Reserved 2
Download link not working for me
Scramble said:
Download link not working for me
Click to expand...
Click to collapse
Update
Mine's in Russian
Edit: Nevermind, I've managed to change the language
RichardHer said:
Mine's in Russian
Edit: Nevermind, I've managed to change the language
Click to expand...
Click to collapse
So do something wrong.
omg, thanks you,this tool is useful!
@CryptoNick
Amazing, I was finally able to extract the system.fex. Originally I have a super.fex, which contained 3 other files: product.fex, system.fex and vendor.fex
Out of the 3 fex-files only 2 were automatically extracted after the initial split: system.fex and vendor.fex. The 3rd file product.fex could be manually extracted with your tool.
System.fex etc. can be created after modification, but how do I re-pack the 3 sub-files into the single super.fex again?
Packaging in super.fex has not yet been implemented. If there is a desire, help the project is financially and I will have more motivation to develop it.
Scramble said:
Download link not working for me
Click to expand...
Click to collapse
yes , not working
Zhao li said:
yes , not working
Click to expand...
Click to collapse
Everything is excellent friend
下载链接对我缠绕
just a readme
GitHub - CryptoNickSoft/MIK: Repack Android partitions from Windows
Repack Android partitions from Windows. Contribute to CryptoNickSoft/MIK development by creating an account on GitHub.
github.com
GitHub - CryptoNickSoft/MIK: Repack Android partitions from Windows
Repack Android partitions from Windows. Contribute to CryptoNickSoft/MIK development by creating an account on GitHub.
github.com
thanks
CryptoNick said:
GitHub - CryptoNickSoft/MIK: Repack Android partitions from Windows
Repack Android partitions from Windows. Contribute to CryptoNickSoft/MIK development by creating an account on GitHub.
github.com
Click to expand...
Click to collapse
CryptoNick said:
GitHub - CryptoNickSoft/MIK: Repack Android partitions from Windows
Repack Android partitions from Windows. Contribute to CryptoNickSoft/MIK development by creating an account on GitHub.
github.com
Click to expand...
Click to collapse
Thanks
Halo sir,can this tool solve Samsung devices that fail to flash with odin in the system.img section, after editing system.img with the other tool ?
Droid Maps said:
Halo sir,can this tool solve Samsung devices that fail to flash with odin in the system.img section, after editing system.img with the other tool ?
Click to expand...
Click to collapse
Hey! Try. I did not test, since this functionality is not interesting to me.
After hours and hours of googling I finally found something that can unlock logo.img files on Windows. However, it doesn't seem to work for me. I got the following error:
[7920] Failed to execute script 'imgextractor' due to unhandled exception!
Traceback (most recent call last):
File "imgextractor.py", line 374, in <module>
File "imgextractor.py", line 368, in main
File "imgextractor.py", line 261, in __ext4extractor
File "ext4.py", line 484, in __init__
ext4.MagicError: Invalid magic value in superblock: 0x0000 (expected 0xEF53)
I would really appreciate help as I'm really desperate by now.