Koushik Dutta | 68df48c | 2010-09-13 15:04:54 -0700 | [diff] [blame] | 1 | #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 | |
| 23 | int |
| 24 | __system(const char *command); |
| 25 | |
Koushik Dutta | 5a9fe1c | 2010-09-13 14:33:50 -0700 | [diff] [blame] | 26 | int write_raw_image(const char* partition, const char* filename) { |
Koushik Dutta | 68df48c | 2010-09-13 15:04:54 -0700 | [diff] [blame] | 27 | 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 Dutta | 56c1b3b | 2010-09-13 15:08:49 -0700 | [diff] [blame^] | 34 | |
| 35 | int 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 | } |