Android Root principle and androidroot

Source: Internet
Author: User

Android Root principle and androidroot
Root

Linux: Root = Windows: Adminstrator

Is Android a Linux system?

Operating System = system kernel + File System
Linux release: Linux kernel + File System (ext3/4)
Android: Linux kernel + File System (ext3/4)


Android does not have a local Window System

Linux can be separated from the X Window.

Android does not have glibc library
Android does not include a complete set of standard Linux applications

Linux can also be separated from these two points.

Android has built-in proprietary drivers

However. Linux Kernel is also divided into primary and secondary, and the driver cannot be separated. after removal, the corresponding device cannot be identified and the Linux kernel loading and running are not affected. In addition, you can freely configure the project to be uninstalled in Linux Kernel Configuration. It cannot be considered as Linux because of the added driver. It is not the key to determining the nature of the operating system. What determines the operating system type is not its superstructure, but its deep system kernel and file structure.
Driver interfaces (Linux driver running and installation specifications) are the core drivers in the Linux kernel and are a set of binary specifications.
In summary, Android is essentially Linux.

So what does Root Mean for Android?

Use the su command to switch to the root user

Why is Android Root? Delete junk applications pre-installed by unofficial or custom systems
  • Copy directly with root permission
  • Copy Based on Android Rom
  • Use the Recovery upgrade package to copy
Control the boot add-on to have more permissions to debug the Linux driver and modify the boot screen to extract the Root permission step 1. Click a suitable Recovery

Method 1: copy the entire file system in bootloader Mode
Method 2: copy the file to the specified directory of the Android device in Recovery mode.

Click Clockwork Recovery

Run the adb reboot bootloader command or press the combined button to enter the bootloader mode.

Fastboot:

Dangerous commands:

Fastboot flash bootloader. img
// If bootloader. img is incorrect, you need to change the motherboard

Self-destruction command:

Fastboot erase bootloader
// Erase

Recovery covery:

Fastboot flash recovery. img

Restart the device

Fastboot reboot

2. Modify the source code of the su command

The su command provided by Android can only be called by the root and shell users (adb shell ).

3. Create a Recovery file (*. zip)

It is mainly composed of the files to be copied and the script files written in Edify language (for file and directory operations ).
Compile the updater-script file in the Recovery upgrade package and copy the su command to the/system/xbin directory.

4. Execute the su command to extract the Root permission

The modified su command can be called by terminals and apps.

5. Grant the ROM Root permission (not required)

Otherwise, the Root permission is granted only after the su command is executed on the terminal.

Edify

The Android embedded script language is used to compile the updater-script file.
Updater-script is the core of the Recovery Rom and upgrade package. Fully composed of functions.

Ui_print (msg_1 ,..., Msg_N );

Output a string on the Recovery interface. At least one parameter is required. If multiple parameters are specified, the parameter values are output.

Run_program (prog, arg1 ,..., ArgN );

This function is used to execute the program. The prog parameter is required, indicating the complete path of the program file to be executed. Other parameters are optional. For example:

Run_program ("/sbin/busybox", "mount", "/system ");

Delete (file1 ,..., FileN );

Delete one or more files. The parameter is the file path. For example:

Delete ("/system/xbin/su ");

Package_extract_dir (package_path, destination_path );

This command is used to extract all files in the package_path directory specified by the refresh handler to the destination directory destination_path.

Set_perm (uid, gid, mode, file1 ,... FileN );

Set the permissions for one or more files.
Uid is the user ID. Gid is the user group id.
To make the user and User Group of the file Root, set uid and gid to 0.

Mount (fs_type, partition_type, location, mount_point );

Mount a partition. For example:

Mount ("ext4", "EMMC", "/dev/block/paltform/s3c-sdhci.0/by-name/system", "/system ");

Unmount (mount_point );

Detach a partition. For example:

Unmount ("/system ");

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.