Current location - Quotes Website - Signature design - How to Modify the Tutorial of Making Card Brush Pack for Android Card Brush Pack
How to Modify the Tutorial of Making Card Brush Pack for Android Card Brush Pack
Let's be clear here:

According to this practice, you are not responsible for any problems with your mobile phone! !

Friends with good English can directly look at the official English reference website:

Friends who only use android source code to do some simple experiments can refer to the following websites:

Speaking of Android brush package, it sounds mysterious. Actually, it's just a digitally signed zip package. If you want to make your own brush package, you must understand the basic working principle of the brush package. Let me start with the startup of the android system:

When the android system is started, some operations such as hardware self-check will be carried out first. After these operations are completed (at least it should know whether the current machine has power), it will check the status of the current phone buttons (so-called brush mode switching, different Android phones have different key combinations to enter the brush mode). If the button is in the refresh mode at this time, the system will call a program named recovery in the ROM (at this time, it will enter the so-called refresh program, which is just a tool program to check the integrity of refresh package and the legality of digital signature. For most machines that have been rooted at present, the legality of digital signature will not be a problem, and then the recovery program will decompress the brush package, and then write the files in the brush package into ROM to complete the brush process); If the button is not marked as brush mode at this time, the system will create a memory disk, start loading the corresponding file system from rom, and copy the relevant files to the memory disk, so as to boot linux, then start the virtual machine dalvik, create a work process to load the running framework, and then you will see the standby screen. Of course, many things have happened in this process and many services have been started. For the sake of simplicity, only the startup process is described here, and interested friends can learn by comparing with the startup process of linux.

To sum up, the brush package is actually a compressed package of ROM files. After entering the brush mode, the recovery program will write the files in the brush package into the ROM storage area to replace the original files in the ROM storage area. The next time you start the phone, the newly replaced files will be loaded from the rom, which will be used to start and run the system. This is all the functions and functions of the brush bag. Friends who don't understand can watch it several times. The essence of a brush is the operation of overwriting and replacing files. I believe you can understand!

Ok, now everyone knows that the zip compressed package of ROM file is the so-called brush package. The process of making brush package is the process of preparing these files and then compressing them into zip package. At the end of production, you can test and publish the brush package by signing with the signing tool. Although it is a matter of words, the process of preparing these documents is actually very painful and long.

So what files are included in the update.zip compressed package? How are these documents made? Hoho, now we're talking about the essence of the problem. After unzipping the update.zip package, we can see two directories and a file:

Boot.img & lt-file is a kernel image generated by compiling kernel source code, and then it is created by mkbootimg tool together with ramdisk.img compiled by android source code. Friends who want to save trouble can also copy a usable one from other online packages, which is basically the same.

META-INF & lt; -Directory, which is created by hand, is mainly used to store an upgrade script update-script (the content of this script is closely related to the files contained in the system directory) and to save the signatures of apk files in several brush packages.

The system & lt-Directory is generated by compiling the platform source code of android.

In fact, the best way to learn is to unpack those update.zip packages on the Internet, then read, analyze and modify them one by one, and try to make a brush package yourself.

For this boot.img, the basic idea is to compile the android kernel code, generate the kernel image, and then use mkbootimg. Interested friends can refer to the following two wiki sites:

The following practices are even done under Linux (Slackware13.1):

(1) Download and compile the source code of android, and the specific process will not be described here.

If you don't know the commands such as repo sync, you can refer to the online articles about downloading and compiling android source code. As far as I know, these articles are very rich. Be sure to pay attention to the choice of platform before compiling, the drivers of different platforms are different! These parameters can be obtained in the following ways:

$ CD Android-src & lt; -Enter the source code directory of android.

$ .build/env setup . sh & lt; -Set environment variables. After running, you can enter the help command to see how many useful and convenient commands are provided by google's team, which is very helpful for us to modify the code and recompile it in the future.

$ lunch category-eng <; -Start configuring compilation options for android source code.

After running the above command, you will see the following output:

Wayne@wayne:~/android-src$ lunch generic-eng

============================================

Platform version code =REL

PLATFORM _ VERSION = 2. 1-update 1

Target product = generic

Target _ Build _ Variable = Project

Target simulator = false

Target _ Build _ Type = Publish

TARGET_ARCH=arm

HOST_ARCH=x86

HOST_OS=linux

Host build type = release

BUILD_ID=ECLAIR

============================================

$ make-J2 & lt; -Only friends with single-core CPU can try this parameter, and friends with dual-core CPU can try -j3, otherwise you can honestly run make.

Then there is a long wait, about 1-2 hours (even my machine is slow). After compiling, the hard disk will take up about 8gb of space.

(2) Enter Wayne @ Wayne: ~/Android-src/out/target/product/generic directory after compilation, and you should see the following files:

Android information.txt

data

object file

ramdisk.img

Software development kit

system

userdata.img

clean_steps.mk

Installed file. txt.

Previous _build_config.mk

root

sign

system.img

Is the system.img here familiar? ! Yes, there seems to be a directory called system in this brush package, so what is in this system.img? The content in this directory is actually the content of a directory named system under the current directory, but it is saved in the format of yaffs file system. We can unlock the system.img with the unyaffs tool, and then we can understand what I'm talking about.

The code download address of unyaffs is:

The compiling method under linux is very simple. Just download the source code and run it: $ gcc -c unyaffs.c

$ gcc -o unyaffs unyaffs.o

Unpacking tool that can generate unyaffs. With this tool, you can unpack your own generated system.img and then modify its contents.

Unyaffs is very simple to use:

$ unyafssystem.img [enter]

You can extract the system.img into a directory named System, which contains the entire android file system.

(3) At first, it is not suitable to start all over again. Tell the truth. Let's start by modifying the brush package made by other Daniel.

Copy a brush package downloaded from the internet first, and then find a directory to decompress it (of course, this is the safest way, and it is no problem to make these directories yourself, but it takes time)

$ unzipxxxxx.zip & lt-This xxxxxxxx.zip is a brush package downloaded from the Internet (it must be basically the same as your code version, and I use a brush package of 2. 1 here).

(4) replace the original system directory

After unzipping the brush package, you will see the two directories and one file mentioned at the beginning:

boot.img

Meta information

system

Well, you can copy the system directory to another path for backup to prevent other problems with these modifications. Then copy the system under Wayne @ Wayne: ~/Android-src/out/target/product/generic to the current working directory. Note that there are many "symbolic links" to the toolbox in this system directory. In fact, these links are useless and can be created automatically through the later update-script. So you need to use a script to delete all these links.

You can refer to:

Rewrite the DeleteExtras.txt given in the attachment of this webpage into the DeleteExtras.sh script to clear these symbolic links.

(5) Modify and update the script.

Modify the script named update-script in the META-INF/com/google/android directory. As long as you modify it, you mainly delete some non-existent files and increase the permissions of some files (the syntax is very clear and clear at a glance). Prepare all the apk installers in the brush package that need to be "pre-installed" and copy these apk to the system/app directory. That boot.img can be left unchanged, because it involves driver and kernel problems. If something goes wrong, the brush package will not start.