Implementation of the factory reset function of samg‑210
1. Modify android2.3.4/device/Samsung/smdkv210/recovery/recovery_ui.c
Char * menu_headers [] = {"volume up/down to move highlight ;",
-// "Menu button to select .",
+ "Home button to select .",
"",
Null };
Modify the UI display character selection in recovery mode and use home instead of menu.
Int device_handle_key (INT key_code, int visible ){
If (visible ){
Switch (key_code ){
Case 42:
Case key_down:
Case key_volumedown:
Return highlight_down;
Case 58:
Case key_up:
Case key_volumeup:
Return highlight_up;
-// Case 50: // block the Enter key value
+ Case 11: // Add the Home key value
-// Case key_enter: // block the enter
+ Case key_home: // Add the Home Key
Return select_item;
}
}
Return no_action;
}
Modify button: the machine does not implement the enter function key, so it is changed to the home function key.
Bytes ---------------------------------------------------------------------------------------------------------------------
2. Modify android2.3.4/bootable/recovery. C.
// Remove the comment
-// Ui_print ("\ n -- wiping data... \ n ");
-// Device_wipe_data ();
-// Erase_volume ("/Data ");
-// Erase_volume ("/cache ");
-// Ui_print ("Data wipe complete. \ n ");
+ Ui_print ("\ n -- wiping data... \ n ");
+ Device_wipe_data ();
+ Erase_volume ("/Data ");
+ Erase_volume ("/cache ");
+ Ui_print ("Data wipe complete. \ n ");
The Code modified above is located:
Static int
Wipe_data (INT confirm ){
} In the function,
When the factory settings are restored, they will be executed in this structure.
Device_wipe_data ();
Erase_volume ("/Data ");
Erase_volume ("/cache ");
So remove the comment.
If (status! = Install_success) ui_set_background (background_icon_error );
If (status! = Install_success | ui_text_visible ())
{
-# If 0
+ // Modify for recovery
Int I = devices_file_load ();
-If (I = 1)
+/* If (I = 1)
{
Ui_print ("\ n -- wiping data... \ n ");
Erase_volume ("/Data ");
Erase_volume ("/cache ");
Ui_print ("Data wipe complete. \ n ");
-}
-Else if (I = 2)
+ }*/
+/* Else */if (I = 2)
{
Erase_volume ("/cache ");
}
-Else
+/* Else
{
Prompt_and_wait ();
}
-# Endif
+ */
Prompt_and_wait ();
}
Modify the code above to restore the factory settings option "Wipe data/factory reset ".
3. Modify android2.3.4/device/sAmsung/smdkv210/Boardconfig. mk
# Switch the options when compile recovery Images
# Target_no_kernel: = true
Target_no_kernel: = false
The above modification is a condition for compiling recoveryimage.
See In android2.3.4/build/CORE/makefile
#-----------------------------------------------------------------
# Recovery Image
# If neither target_no_kernel nor target_no_recovery are true
Ifeq (, $ (filter true, $ (target_no_kernel) $ (target_no_recovery) $ (build_tiny_android )))
This section is modified
After modification, compile the source code in the directory android2.3.4.
Source./build/envsetup. Sh
Lunch full_smdkv210-userdebug
Make recoveryimage
After compilation, it will be generated in android2.3.4/out/target/product/smdkv210 /.
Recovery. img
Ramdisk-recovery-uboot.img
Burn-write ramdisk-recovery-uboot.img
Enter fastboot Mode
Keyboard Input
Fastboot flash recovery ramdisk-recovery-uboot.img
After the completion of ramdisk-recovery-uboot.img burning, Android restore factory settings complete.