-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmlutils.c
39 lines (34 loc) · 880 Bytes
/
bmlutils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#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>
int
__system(const char *command);
int write_raw_image(const char* partition, const char* filename) {
char tmp[PATH_MAX];
if (0 != strcmp("boot", partition)) {
return -1;
}
sprintf(tmp, "/sbin/redbend_ua restore %s %s", filename, BOARD_BOOT_DEVICE);
return __system(tmp);
}
int read_raw_image(const char* partition, const char* filename) {
char tmp[PATH_MAX];
sprintf(tmp, "dd if=/dev/block/bml7 of=%s", filename);
return __system(tmp);
}