Android-system.img format Rom customization tutorial

Source: Internet
Author: User
Tags symlink

Preparations
1. install Linux or Ubuntu on a PC. [recommended for Ubuntu]

2. After the system is installed, it is best to use the root user to customize the Rom.
The following describes how to enable the root user;
Run sudo passwd root, enter the password and root password, and repeat the password. You can use root to log on after restarting.
Now, we can start customizing the Rom.
First, the decomposition and Synthesis tools
Decomposition Tool

Synthesis tool

Put the above two tools under Linux
Start rom now
1. For example, I create a folder named and in the root file and put unyaffs, mkyaffs2image, and system. IMG in it.
Then, create a system under the and folder. This folder is used to put the decomposed files]
Decomposition Method
Grant unyaffs 777 permissions before splitting
Run the following command: sudo chmod
777
Unyaffs
Execution permission)
Start Decomposition
Locate the terminal to the directory CD/root/and to be extracted, and then run the command/root/AND/unyaffs system. IMG.
Put all the decomposed files under the system file just created [except unyaffs, mkyaffs2image, system. img]
After breaking it down, you can start to xxoo it [remove MM's clothes with you, then xxoo does not wipe much]
After xxoo is used, people must wear their clothes.
Run the following merging command:
/Root/AND/mkyaffs2image-F/root/AND/system Newsystem. img
Start packaging (if zimageexists in rom, intrd.gz does not need-f)
Finally, Newsystem. IMG is synthesized, and the new ROM is generated.
Some RoM does not contain app and framework folders.
It is compressed into squashed. sqsh.
The following is the command for breaking down and merging squashed. sqsh:
Decomposition
Unsquashfs squashed. sqsh
Synthesis
Mksquashfs squashed. sqsh

Basic tutorial on ROM creation: How to Create a refresh
There are several ways to install software or library files on your Android phone. You can use a marketplace program to find and install software, or use the ADB command line tool to install or send files to your android file system. The volume (that is, the volume) file. The androidsystem uses the recovery tool (recovery.pdf to install the software or library file in this update.zip file to the android file system. A rom or theme developer usually uses this method to publish their works ).
Creating an update.zip file is very easy. All you need to do is place the file in a folder corresponding to the android file system, then write an update-script file to copy these files to the corresponding location of the mobile phone. As an example, this document will install calculator.apk to the system/APP folder, copy the libsec-ril.so file to the system/lib Folder:
Create an empty folder (in this example, c: \ goapk)

The c: \ goapk \ System \ app folder for the newly created calculator.apk and the C: \ goapk \ System \ Lib folder for the libsec-ril.so.

Create a folder C: \ goapk \ META-INF \ com \ google \ android to place the update-script file.

Create an update-script file with the following content (highlighted ):

1 show_progress 0.1 0
2
3 copy_dir package: System system:
4
5 show_progress 0.1 10
6

Rows 1 and 5: display the progress bar
Row 3: copy the system folder in the refresh to the/system directory of Android.
Note: You should add an empty row (that is, Row 6) at the end of the file)

Compress all the content in the C: \ goapk compressed file into a zip package (remember: It is to compress the content in the goapk folder, not the goapk folder itself)

Sign goapk.zip
Signature command: Java-jar signapk. Jar certificate. pem key. pk8 goapk.zip update.zip
Note: In this post, you can find the tutorials and tools used to sign the QR code.

Copy the update.zip file to the SD card, and then click "recovery" on the phone to enter the recovery interface.

Advanced learning: (for reference only, there may be some discrepancies due to different situations. But it is highly recommended to study this part)
For the update-script syntax, refer to (defined in the recovery. c file of the android source code ):

Copy_dir
Syntax: copy_dir <source directory> <target directory> [<timestamp>]
Description: copy the content in <source directory> to <target directory>. If no file with the same name is overwritten in the <source directory>, the original content in the <target directory> will remain unchanged.
Example: copy_dir package: System system:. This command will copy the system folder in the refresh folder to the/system folder of the mobile phone.

Format
Syntax: Format <root directory>
Description: format a partition.
Example: format system:, this command will format the entire/system. Note: The data deletion operations performed during formatting are irreversible.

Delete
Syntax: delete <file 1> [... <file n>]
Description: delete an object.
Example: delete system: APP/calculator.apk. This command will delete the calculator.apk file in the system/appfolder of the mobile phone.

Delete_recursive
Syntax: delete_recursive <file or directory 1> [... <file or directory n>]
Description: deletes a file or recursively deletes a folder (including all the content in the folder)
Example: delete_recursive data: Dalvik-Cache. This command deletes the/data/Dalvik-Cache folder and all content in the folder.

Run_program
Syntax: run_program <execution program> [<parameter>...]
Description: runs an external program in the refresh process.
Example: run_program package: install_busybox.sh. This command will execute the install_busybox.sh script (command line) in the refresh ).

Set_perm (the value involved in this command. If you have any questions, Google it yourself. Uid = user ID, gid = group ID)
Syntax: set_perm <uid> <GID> <attribute> <path> [... <path n>]
Description: sets the owner and permissions of a file or the specified entire directory tree, like a collection of 'chmod', 'chown ', and 'chgrp' commands.
Example: set_perm 0 2000 0550 system: etc/init. goldfish. sh. This command sets the etc/init in the system partition on the mobile phone. goldfish. the User Group of the sh file is shell, the user is root, and the permission is: the owner and the user group members can read and execute operations. Other users have no operation permission.

Set_perm_recursive (the value involved in this command. If you have any questions, Google it yourself. Uid = user ID, gid = group ID)
Syntax: set_perm_recursive <uid> <GID> <folder attribute> <File Attribute> <path> [... <path n>]
Description: recursively sets the owner and permissions of all content in a folder.
Example: set_perm_recursive 0 0 0755 0644 system: App. This command recursively sets the system/APP folder on the mobile phone and the user group of all its contents as root; User: root; the permission of the app folder is as follows: the owner can read, write, and execute operations, while other users can read and execute operations. The permission of all files in the app folder is as follows: the owner can perform read and write operations, while other users can perform read operations.

Show_progress
Syntax: show_progress <decimal> <duration>
Description: displays a progress bar for the next operation on the screen. The progress bar status is automatically increased based on the number of seconds specified by <duration>. (If the progress bar is actually pushed, it can be determined, it will be faster ).
Example: show_progress 0.1 0. This command indicates that after the operation is completed, the progress bar advances to 0.1 (10%)

Symlink
Syntax: symlink <Link Target> <link path>
Description: Creates a conforming Link (like 'ln-S '). The format of <link path> is similar to the following: root directory: path, but <Link Target> refers to the target file (and the location may be relative to the link path)
Example: symlink/system/bin/su system: xbin/su. This command creates a symbolic link named Su for/system/bin/su in the xbin folder of the system partition of the mobile phone.

Root directory and partition definition (defined in the root. c file of Android source code)
Root directory: Linux block device/mount point/file system size description
Boot:/dev/mtdblock [?] /(RAM) Raw kernel, memory disk, and boot configuration.
Data:/dev/mtdblock5/data/yaffs2 91904kb user, system configuration, software configuration and software (without a2sd)
Cache:/dev/mtdblock4/Cache/yaffs2 30720kb OTA cache, recovery/Update Configuration and Temporary Folder
Misc:/dev/mtdblock [?] N/a raw, [?] KB (waiting to be added)
Package: A pseudo File System (relative to the volume) where N/A refreshes the volume.
Recovery:/dev/mtdblock [?] /(RAM) Raw, [?] KB recovery and kernel and memory disks for updating the environment. Similar to boot :.
Sdcard:/dev/mmcblk0 (P1)/sdcard/FAT32 32 MB-32 gb tf card. Usually, click here.
System:/dev/mtdblock3/system/yaffs2 92160kb system partition, static and read-only.
TMP:/tmp/(RAM) standard Linux temporary folders are cleared during Shutdown/restart.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.