add Wipe Battery stats. Generate fstab dynamically.

This commit is contained in:
Koushik Dutta 2010-05-01 12:46:55 -07:00
parent 1e9f60a967
commit fd1579b7c0
5 changed files with 61 additions and 1 deletions

View File

@ -26,7 +26,7 @@ LOCAL_MODULE := recovery
LOCAL_FORCE_STATIC_EXECUTABLE := true
RECOVERY_VERSION := ClockworkMod Recovery v1.8.1.2
RECOVERY_VERSION := ClockworkMod Recovery v1.8.1.3
LOCAL_CFLAGS := -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
@ -84,6 +84,14 @@ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := nandroid-md5.sh
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := mkfstab.sh
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := mkfstab.sh
include $(BUILD_PREBUILT)
include $(commands_recovery_local_path)/amend/Android.mk
include $(commands_recovery_local_path)/minui/Android.mk
include $(commands_recovery_local_path)/minzip/Android.mk

View File

@ -736,6 +736,13 @@ void show_nandroid_menu()
}
}
void wipe_battery_stats()
{
ensure_root_path_mounted("DATA:");
remove("/data/system/batterystats.bin");
ensure_root_path_unmounted("DATA:");
}
void show_advanced_menu()
{
static char* headers[] = { "Advanced and Debugging Menu",
@ -744,6 +751,7 @@ void show_advanced_menu()
};
static char* list[] = { "Reboot Recovery",
"Wipe Battery Stats",
"Key Test",
NULL
};
@ -759,6 +767,9 @@ void show_advanced_menu()
__reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, "recovery");
break;
case 1:
wipe_battery_stats();
break;
case 2:
{
ui_print("Outputting key codes.\n");
ui_print("Go back to end debugging.\n");

View File

@ -39,3 +39,7 @@ show_advanced_menu();
int
format_non_mtd_device(const char* root);
void
wipe_battery_stats();

35
mkfstab.sh Executable file
View File

@ -0,0 +1,35 @@
#!/sbin/sh
rm -f /etc/fstab
cat /proc/mtd | while read mtdentry
do
mtd=$(echo $mtdentry | awk '{print $1}')
mtd=$(echo $mtd | sed s/mtd//)
mtd=$(echo $mtd | sed s/://)
exist=$(ls -l /dev/block/mtdblock$mtd) 2> /dev/null
if [ -z "$exist" ]
then
continue
fi
partition=$(echo $mtdentry | awk '{print $4}')
partition=$(echo $partition | sed s/\"//g)
mount=$partition
type=
if [ "$partition" = "system" ]
then
type=yaffs2
elif [ "$partition" = "userdata" ]
then
type=yaffs2
mount=data
elif [ "$partition" == "cache" ]
then
type=yaffs2
else
continue
fi
echo "/dev/block/mtdblock$mtd /$mount $type rw" >> /etc/fstab
done
echo "/dev/block/mmcblk0p1" /sdcard vfat rw >> /etc/fstab
echo "/dev/block/mmbblk0p2" /sd-ext vfat rw >> /etc/fstab

View File

@ -483,6 +483,8 @@ main(int argc, char **argv)
return amend_main(argc, argv);
return busybox_driver(argc, argv);
}
__system("/sbin/mkfstab.sh");
int is_user_initiated_recovery = 0;
time_t start = time(NULL);