2010-09-13 22:04:54 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/reboot.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <sys/limits.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
extern int __system(const char *command);
|
2010-12-12 10:52:44 +00:00
|
|
|
#define BML_UNLOCK_ALL 0x8A29 ///< unlock all partition RO -> RW
|
2010-09-13 22:04:54 +00:00
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
int cmd_bml_restore_raw_partition(const char *partition, const char *filename)
|
2010-11-11 09:19:10 +00:00
|
|
|
{
|
2010-12-12 10:52:44 +00:00
|
|
|
printf("bml restore\n");
|
|
|
|
int fd = open("/dev/block/bml7", O_RDWR | O_LARGEFILE);
|
|
|
|
return ioctl(fd, BML_UNLOCK_ALL, 0);
|
|
|
|
|
2010-09-13 22:04:54 +00:00
|
|
|
char tmp[PATH_MAX];
|
2010-11-11 09:19:10 +00:00
|
|
|
sprintf("dd if=%s of=/dev/block/bml7 bs=4096", filename);
|
2010-09-13 22:04:54 +00:00
|
|
|
return __system(tmp);
|
|
|
|
}
|
2010-09-13 22:08:49 +00:00
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
int cmd_bml_backup_raw_partition(const char *partition, const char *filename)
|
2010-11-11 09:19:10 +00:00
|
|
|
{
|
2010-09-13 22:08:49 +00:00
|
|
|
char tmp[PATH_MAX];
|
2010-11-11 09:19:10 +00:00
|
|
|
sprintf("dd of=%s if=/dev/block/bml7 bs=4096", filename);
|
2010-09-13 22:08:49 +00:00
|
|
|
return __system(tmp);
|
|
|
|
}
|
2010-11-11 09:19:10 +00:00
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
int cmd_bml_erase_raw_partition(const char *partition)
|
2010-11-11 09:19:10 +00:00
|
|
|
{
|
|
|
|
// TODO: implement raw wipe
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
int cmd_bml_erase_partition(const char *partition, const char *filesystem)
|
2010-11-11 09:19:10 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
int cmd_bml_mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only)
|
2010-11-11 09:19:10 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-11-14 08:18:40 +00:00
|
|
|
int cmd_bml_get_partition_device(const char *partition, char *device)
|
2010-11-11 09:19:10 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|