How to unzip the system img file. How to extract APK files from IMG (Parsing Android firmware). How to correctly extract the kernel from FTF firmware
Almost everyone android user smartphone, there was a desire to create or edit the firmware to suit your needs and desires. In this article we will look at the principle of editing firmware for CWM (in zip format).
Preparation:
First of all, we need to decide which firmware we will use as a basis. It's better to use off. firmware in zip. For almost every common device there is a clean firmware + root.
When the firmware is selected, it must be downloaded to any location convenient for you on your PC (no need to unpack).
We will also need an archiver, I recommend using 7zip and the best of its kind text editor Notepad++.
Firmware structure:
Opening the archive with the firmware you see the following:
META-INF- Firmware installation scripts are stored in the folder.
system- a folder with all firmware files (applications, tweaks, scripts, etc.).
boot.img- the core of the system.
Almost all manipulations are carried out in the folder system, its structure:
app- system applications.
bin- resources of the system itself.
etc- Scripts, tweaks, configs, profiles and system settings.
fonts- System fonts.
framework- the main system files are stored here (graphics, animation text settings, etc.).
lib- system libraries.
media- multimedia files (notification ringtones, loading animation, wallpaper, etc.).
usr- settings that cannot be changed in the future by the system (they work in read-only mode).
xbin- again, system configs and other tweaks.
build.prop- information about the system, locale settings and system performance.
Applications:
Before adding/removing software to the system, you need to check whether your firmware is deodexed (that is, check for the presence of .odex files in the app folder. If there are files, then you need to get rid of them using this instructions .
Add software to the firmware:
First of all, you need to install in your smart those programs that you want to add to the assembly. After installation, we remove them from the system using Root Explorer and its analogues, they are located on the data/app path, we also need their libs (if they exist, of course), they are located on the data/data path. They are located in the folder of the same name in the application and have the extension .so. Then seized .apk put the files in the archive along the path system/app and files with the extension .so(libs) along the path system/lib .
We remove the software from the firmware:
Everything is simple here, go to the folder app- we decide what we don’t need and remove all unnecessary software (it’s better not to touch the system).
Language and firmware version:
Copy the build.prop file to your desktop. Open it with notepad and find the lines:
ro.product.locale.language=en
ro.product.locale.region=US
for the Russian language you need to do this:
ro.product.locale.language=ru
ro.product.locale.region=RU
enter the name of your mod in the line
in the same build.prop
Graphic arts:
The entire graphical part of the firmware is stored in two files framework-res.apk file path systemframework and SystemUI.apk along the way systemapp. And the graphical part of the settings application is stored naturally in the Settings.apk application.
Scripts and tweaks (system acceleration and optimization):
Most of the settings are done in the file build.prop, you can read about this. Also, if your kernel supports init.d there are a number of scripts for optimizing the system, one of them is described in this article (RAM optimization) and in this article Tweak scripts for init.d
Replacing system fonts:
As stated above, all fonts are contained in the folder fonts, the main fonts are: DroidSans.ttf and DroidSans-Bold.ttf they can be replaced with any fonts, renaming them similarly to the above and moving with replacement to the archive with the firmware in the folder fonts.
Core:
Theoretically, it is enough to replace boot.img its own, but in some cases the Cores are accompanied by additional scripts. Therefore, I advise you not to do anything if you have any doubts.
For those who want to start the journey of creating their own firmware for Sony based on the official ones, you need to know how to unpack the firmware Sony format FTF.
What is necessary?
1. Computer
2. Download latest version not an official flasher FlashTool and install
3. Download the Unix image manager ext2explore.exe
3. Download and install the free 7-zip archiver
4. Sony firmware FTF format
Instructions on how to unpack Sony firmware in FTF format
1. Right-click on the FTF firmware - open the archive or unpack from the archive
2. After installing FlashTool, go to the path C:Flashtool
3. Launch the FlashTool program and select the menu in the panel Tools -> Sin Editor
4. Select the sin file extracted from the ftf firmware in the Sin Editor and click Extract data. After this, the process of converting the firmware file into readable form will begin.
5. At the exit you can get new file with extension yassf2 or ext4 or elf
If the file *. yassf2
Select Tools -> Yaffs2, after which a window will appear to select a file, select a file with the extension *.yasff2
In a couple of minutes you will receive a folder with files that were in the firmware
If the file is *.ext4 or *.elf
1. If you have a file with the extension *.elf, then rename it to *.ext4
2. Run the previously downloaded ext2explore program, select the firmware file, after which the contents of the firmware will appear in the window, now you can save the contents.
What's next?
If you plan to create a flashable update.zip in the future, then you should go to the article - creating an Updater Script
How to correctly extract the kernel from FTF firmware?
In order to get the “correct” kernel for flashing using update.zip, you will need the same Flashtool.
1. Open the FTF firmware with an archiver and extract kernel.sin
Do you want to try your hand at creating and editing firmware on Android, then the program Samsung Root Firmware Replacer will help you create firmware!
Briefly about the Samsung Root Firmware Replacer program and its capabilities
With this program you will be able to:
- Unpack Samsung firmware
- Dress up the firmware
- IN automatic mode embed Root rights
- Automatically fill the firmware with your files
- Freeze a project and then continue working on it
- Pack the firmware
Required components and operating conditions for Samsung Root Firmware Replacer
Overview and description of functions Samsung Root Firmware Replacer program start
1. Go to the folder with the Samsung Root Firmware Replacer program, right-click to open in the terminal
2. In the terminal, enter the command
3. The program interface will open in front of you
4. If you launched the program for the first time, then execute - Settings Configuration
Working with Samsung Root Firmware Replacer
Paragraph Unpack firmware *.tar.md5- unpacks the firmware, to do this, move the file to the folder unpack_tar_md5, after which all files will be extracted, and the factoryfs or system file will be moved to input_img
paragraph Creating *.img from your Android (needs Android)- allows you to create firmware from your current Android state. For this item to work, you must have Android connected to your PC with USB debugging enabled.
This item has a submenu
Paragraph Creating *.img with original firmware allows you to change ready-made firmware; to do this, move any IMG file to the input_img folder.
This item also has its own submenu
An example of using the Samsung Root Firmware Replacer program
In this example, the firmware is created from the current state of Android
1. Connect Android to PC
2. Launch the program
3. Select Create *.img from your Android (needs Android)
4. Select Remove image from Android and unpack img
5. Selecting the partition from which the image will be removed
6. Wait 6-7 minutes for the image to be removed and transferred to the PC.
Important! Your smartphone or tablet, as well as your PC, must have enough memory to take the image. The image size can range from 2MB to 2GB
7. After you have removed the image, you can modify it, if necessary (embed Root), you can package it back, for this
8. Select Package project in img
9. Specify the size and name of the firmware.
- Specify the partition size in this way: divide the block size by 1024 and add the letter M to the result.
- The name must match the name you used to change
11. Also, do not forget to copy the kernel from your Android, to do this, use the item - Remove image from Android - boot.img or zImage
12. After all the manipulations, you need to assemble the firmware in TAR.MD5
13 In the main menu, select Pack firmware *.tar.md5
14 Firmware in Samsung program Root Firmware Replacer is ready, you can
Mega utility Android IMG Repack Tools for all beginners and advanced romodelers, developers, for editing Android images.
Android IMG Repack Tools what is it and why?
Android IMG Repack Tools utility from user under nickname A.S._id(xda, w3bsit3-dns.com), designed to edit Android images:
- unpack Android image (img, ext4)
- editing files (manually)
- collect image
And also work with kernels (boot.img) and recovery (recovery). The utility is designed to work both under Linux and Windows (you must install Cygwin).
Android IMG Repack Tools will be useful to absolutely all Android Romodels for creating new custom firmware, as well as software developers.
Where to find and download Android IMG Repack Tools?
Download and latest version Android IMG Repack Tools utilities can be found from the official project page on XDA.
Installing Android IMG Repack Tools on your computer
Since the Android OS is based on the Linux kernel, it will still work more correctly Android utility IMG Repack Tools from operating system based on Linux.
OS pre-configuration for Android IMG Repack Tools
If you have Ubuntu version 14.04 and older (and Mint based on it), then you will need to install GCC 5 from the repository (open a terminal and type the following commands):
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
For users of Ubuntu 16.04 (and Mint based on it), then you need to install first:
1. GNU Automake 1.14 (download and unpack)
2. Go to the folder with Gnu Automake, open a terminal and execute the commands one by one: ./configure make sudo make install
3. Install packages: sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind libreadline6-dev gcc-multilib g++-multilib libc6-dev x11proto-core -dev libx11-dev libz-dev gawk texinfo automake libtool cvs libsdl-dev
Setting up Android IMG Repack Tools
1. After downloading Android IMG Repack Tools, unpack, go, open terminal
2. Type the command to launch the utility./main_menu
If you have Mint installed, then click on the main_menu file
3. Go to the utility section " 0 - Configure & clean tools menu»
4. Select " 1 - Build android_img_repack_tools“, in order to download and configure the tools that work with Android images.
Working with the Android IMG Repack Tools utility
Expect an update to the article with instructions on how to use the utility soon!
Need to flash Android using FastBoot, but don't know how? This article gives detailed instructions on using the FastBoot utility and how to use it to flash an Android device.
This manual will fully explain how to use FastBoot! If you don’t know how to install archived updates, then you need the article - Clockwordmod - what is it. Instructions for CWM recovery with pictures
Downloading and installing FastBoot
Before flashing Android using FastBoot, you need to download it and install it on the desired computer.
1. You can download the FastBoot utility from official program Android SDK (heavy weight)
why ADB RUN is better
Launch
If you downloaded Separately Fastboot
After you have downloaded and installed FastBoot, open the " Command line »
and vve Enter the commands to go to the folder with Fastboot utility(if installed separately FastBoot)
cd/cd adb
If you downloaded ADB RUN
If your choice fell on ADB program RUN, then launch it and select Manual -> ADB from the menu
The files that need to be flashed must be located in the same folder as the Fastboot utilityInstructions for commands on how to flash Android using FastBoot
It is very important to write commands and firmware files as they are specified!
If your command is specified
fastboot flash cache NazvaniAFiLe.imgthen you need to write exactly like that, but not any other way. In other words, the case of letters is important, otherwise you will get an error cannot load 'image' - there is no such file.
Reboot commands into firmware mode (bootloader)
fastboot reboot-bootloaderThe command "sees" your Android PC
Get into the habit of checking before doing anything in Fastboot if the connection between your computer and Android is:
Checking whether your PC can see your Android
fastboot devicesExecute this command when the device is already in firmware mode (bootloader)
Nexus Bootloader Unlock and Lock Commands
Unlock bootloader for Nexus
fastboot oem unlockLock bootloader for Nexus
fastboot oem lockCommand to find out bootloader version
Shows the version number of the bootloader installed on Android
fastboot getvar version-bootloaderPartition formatting commands
Before flashing any partition in Android, you must first format it so that there are no problems with operation
fastboot erase Imya_razdela - erase partition: boot, radio, recovery, system, userdata and others
Erases the Cache partition
fastboot erase cacheErases the Data section
fastboot erase userdataErases the System partition
fastboot erase systemErases Recovery section
fastboot erase recoveryCommands for flashing a partition
After you have formatted the partition or partitions, you can start flashing the firmware
fastboot flash Imya_razdela imya_file.img - firmware of the selected partition: boot, radio, recovery, system, userdata and others
Flash the system partition (System)
fastboot flash system imya.imgFlash the cache partition
fastboot flash cache imya.imgFlash the data section
fastboot flash userdata imya.imgFlash the Recovery partition
fastboot flash recovery imya.imgSetting the power-on animation (firmware partition with animation)
fastboot flash splash1 splash.imgFlash all partitions (boot, recovery and system)
fastboot flashallInstead of imya.img- you need to enter the name of the file you are going to flash
Command to install update.zip
Flashes an update archive on Android in the update.zip format or a ZIP archive with IMG images various sections
fastboot update filename.zipFor Sony devices
Checking the connection Sony devices, if the answer is 0.3 device, then connected
fastboot.exe -i 0x0fce getvar versionUnlock bootloader
fastboot.exe -i 0x0fce oem unlock 0xReceived_KeyMore detailed information on unlocking bootloader Sony - How to unlock Bootloader Sony
Waiting for Device error
If you have the following message on in the command window for a long time: waiting for device- Means:
- The driver is not installed or installed incorrectly - reinstall or install
- Android device is not in Bootloader mode - translate
- Incorrect connection to USB port- use the rear ones USB ports 2.0 computers, do not use USB hubs