Recovery ing Process

Source: Internet
Author: User

It took two weeks to compile the recovery recently. Now, let's take a look.

After the CM source code is synchronized, the built-in rwm recovery source code is available in the bootloader directory.

Bytes -----------------------------------------------------------------------------------------

Taking ZTE's v880 + as an example, compiling recovery requires the following files:

/Device/ZTE/blade/kernel(ZTE is the vendor directory, blade is the model name, and kernel is boot. IMG extraction)

/Device/ZTE/blade/androidproducts. mk 

/Device/ZTE/blade/androidboard. mk

/Device/ZTE/blade/boardconfig. mk(Device configuration)

/Device/ZTE/blade/device_blade.mk(Mobile phone configuration file)

/Device/ZTE/blade/Qwerty. KL(Mobile phone key ing)

/Device/ZTE/blade/recovery. fstab(Recovery partition table)

/Device/ZTE/blade/recovery_ui.c(Rediscovery key ing)

Bytes ------------------------------------------------------------------------------------------

The files in the device are complete.

1. Kernel

This file is a kernel file that contains private files of devices such as device drivers. IMG and recovery. imgfile extraction. It is best to extract this file from the official file. Otherwise, there may be some messy situations, such as flashback, black screen, restart, and so on.


2. androidproducts. mk

Product_makefiles: = \
$ (Local_dir)/device_blade.mk

Contains the device_blade.mk file.


3. androidboard. mk

Local_path: = $ (call my-DIR)
Include $ (clear_vars)
All_prebuilt + = $ (installed_kernel_target)


4. device_blade.mk

Product_name: = zte_blade
Product_device: = Blade
Ifeq ($ (target_prebuilt_kernel ),)
Local_kernel: = device/ZTE/blade/kernel
Else
Local_kernel: = $ (target_prebuilt_kernel)
Endif
Product_copy_files + = \
$ (Local_kernel): Kernel

The file name can be defined at will, as long as it contains the same name in androidproducts. mk,

Note:

1) The product_name name must be consistent.

2) The last sentence copies the kernel to the folder out. If this sentence does not exist, the boot. imgfile cannot be generated.


5. Qwerty. KL

The key value corresponding to the mobile phone buttons, which can be extracted from the mobile phone


6. Recovery. fstab

# Mount pointfstypedevice [device2]

/Boot MTD
Boot
/Cache yaffs2
Cache
/Data yaffs2
Userdata
/MISC MTD
Misc
/Recovery MTD
Recovery
/Sdcard vfat
/Dev/block/mmcblk0p1/dev/block/mmcblk0
/System yaffs2system
/SD-ext Auto/dev/block/mmcblk0p2

This file can be viewed on the mobile phone, and proc/MTD and mount can be divided by themselves


7. recovery_ui.c

# Include <Linux/input. h>
# Include "recovery_ui.h"
# Include "common. H"
# Include "extendedcommands. H"

Char * menu_headers [] = {"use vol keys to highlight and home to select .",
"",
Null };

Char * menu_items [] = {"reboot system now ",
"Apply update from sdcard ",
"Wipe data/factory reset ",
"Wipe cache partition ",
"Install zip from sdcard ",
"Backup and Restore ",
"Mounts and storage ",
"Advanced ",
"Power off ",
Null };

Int device_recovery_start (){
Return 0;
}

Int device_toggle_display (volatile char * key_pressed, int key_code ){
Int alt = key_pressed [key_leftalt] | key_pressed [key_rightalt];
If (ALT & key_code = key_l)
Return 1;
// Allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
If (ui_get_showing_back_button ()){
Return get_allow_toggle_display () & (key_code = key_menu | key_code = key_end );
}
Return get_allow_toggle_display () & (key_code = key_menu | key_code = key_power | key_code = key_end );
}

Int device_reboot_now (volatile char * key_pressed, int key_code ){
Return 0;
}

Int device_handle_key (INT key_code, int visible ){
If (visible ){
Switch (key_code ){
Case key_capslock:
Case key_down:
Case key_volumeup:
Return highlight_up;

Case key_leftshift:
Case key_up:
Case key_volumedown:
Return highlight_down;

Case 62:
Return select_item;

Case key_power:
If (ui_get_showing_back_button ()){
Return select_item;
}
If (! Get_allow_toggle_display ())
Return go_back;
Break;
Case key_leftbrace:
Case key_enter:
Case btn_mouse:
Case key_center:
Case key_camera:
Case key_f21:
Case key_send:
Case key_home:
Return select_item;

Case key_end:
Case key_backspace:
Case key_back:
If (! Get_allow_toggle_display ())
Return go_back;
}
}

Return no_action;
}

Int device_rjm_action (INT which ){
Return which;
}

Int device_wipe_data (){
Return 0;
}

This file is the key operation file after the recovery partition is refreshed. You can write this file based on the corresponding buttons in the key-value file of the mobile phone key.

8. boardconfig. mk

Use_camera_stub: = false

Target_no_bootloader: = true
Target_board_platform: = unknown
Target_cpu_abi: = armeabi
Target_bootloader_board_name: = Blade

Board_has_flipped_screen: = true
Board_kernel_cmdline: = androidboot. Hardware = blade console = ttymsm2, 115200 g_android.product_id = 0x1354 g_android.serial_number = blade-geno
Board_kernel_base: = 0x02600000
Board_kernel_pagesize: = 2048

Board_ums_lunfile: = "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
# Fix this up by examining/proc/MTD on a running Device
Board_bootimage_partition_size: = 0x00380000
Board_recoveryimage_partition_size: = 0x00480000
Board_systemimage_partition_size: = 0x08c60000
Board_userdataimage_partition_size: = 0x105c0000
Board_flash_block_size: = 131072

Target_prebuilt_kernel: = device/ZTE/blade/kernel

Board_custom_recovery_keymapping: =.../../device/ZTE/blade/recovery_ui.c

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

The above is the file to be configured in the device, and in order to compile and pass, you have to configure

Vendor/cyanogen/vendorsetup. Sh

Vendor/cyanogen/products/androidproducts. mk

Vendor/cyanogen/products/cyanogen_blade.mk

----------------------------------------------------------------------------------

Details about the changes required in the document

1. vendorsetup. Sh

Add the following content:

Add-lunch-combo cyanogen_blade-eng


2. androidproducts. mk

Add the cyanogen_blade.mk file.


3. cyanogen_blade.mk
You can write this file by yourself, but note that the productname must be consistent.

Above

Basically, you need to configure the necessary file for your own recovery on the basis of the source code.

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

PS: I am also in exploration and learning. If any of the above errors are found, please leave a correct message and I am very grateful.

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.