blob: d886898bfd1cafaf30ec019d267809f16c68a049 [file] [log] [blame]
Koushik Dutta68df48c2010-09-13 15:04:54 -07001#include <ctype.h>
2#include <errno.h>
3#include <fcntl.h>
4#include <getopt.h>
5#include <limits.h>
6#include <linux/input.h>
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
10#include <sys/reboot.h>
11#include <sys/types.h>
12#include <time.h>
13#include <unistd.h>
14
15#include <sys/wait.h>
16#include <sys/limits.h>
17#include <dirent.h>
18#include <sys/stat.h>
19
20#include <signal.h>
21#include <sys/wait.h>
22
23int
24__system(const char *command);
25
Koushik Dutta5a9fe1c2010-09-13 14:33:50 -070026int write_raw_image(const char* partition, const char* filename) {
Koushik Dutta68df48c2010-09-13 15:04:54 -070027 char tmp[PATH_MAX];
28 if (0 != strcmp("boot", partition)) {
29 return -1;
30 }
31 sprintf(tmp, "/sbin/redbend_ua restore %s %s", filename, BOARD_BOOT_DEVICE);
32 return __system(tmp);
33}
Koushik Dutta56c1b3b2010-09-13 15:08:49 -070034
35int read_raw_image(const char* partition, const char* filename) {
36 char tmp[PATH_MAX];
37 sprintf(tmp, "dd if=/dev/block/bml7 of=%s", filename);
38 return __system(tmp);
39}