local: Enable N900 code only for ARM and enable Linux code only on Linux

This commit is contained in:
Pali Rohár committed 2014-11-26 16:32:36 +01:00
1 parent d61815f40e
commit 5633a06710
1 file changed
+16 -1
+16 -1
View File
@@ -55,6 +55,8 @@ static int root_device = -1;
#define local_cal_read(cal, str, ptr, len) ( cal_read_block(cal, str, &ptr, &len, 0) == 0 && ptr ) #define local_cal_read(cal, str, ptr, len) ( cal_read_block(cal, str, &ptr, &len, 0) == 0 && ptr )
#define local_cal_readcopy(cal, str, dest) do { void * ptr; unsigned long int len; if ( local_cal_read(cal, str, ptr, len) ) local_cal_copy(dest, ptr, len); } while ( 0 ) #define local_cal_readcopy(cal, str, dest) do { void * ptr; unsigned long int len; if ( local_cal_read(cal, str, ptr, len) ) local_cal_copy(dest, ptr, len); } while ( 0 )
#if defined(__linux__) && defined(__arm__)
static void local_cal_parse(void) { static void local_cal_parse(void) {
struct cal * cal = NULL; struct cal * cal = NULL;
@@ -109,16 +111,22 @@ static void local_cal_parse(void) {
} }
#endif
int local_init(void) { int local_init(void) {
#if defined(__linux__) && defined(__arm__)
char buf[1024]; char buf[1024];
char * ptr; char * ptr;
char * ptr2; char * ptr2;
FILE * file; FILE * file;
#endif
if ( failed ) if ( failed )
return -1; return -1;
#if defined(__linux__) && defined(__arm__)
file = fopen("/proc/cpuinfo", "r"); file = fopen("/proc/cpuinfo", "r");
if ( ! file ) { if ( ! file ) {
failed = 1; failed = 1;
@@ -174,9 +182,12 @@ int local_init(void) {
} }
fclose(file);
#endif
failed = 1; failed = 1;
printf("Not a local device\n"); printf("Not a local device\n");
fclose(file);
return -1; return -1;
} }
@@ -284,6 +295,8 @@ static struct nanddump_device nanddump[] = {
static void local_find_internal_mydocs(int * maj, int * min) { static void local_find_internal_mydocs(int * maj, int * min) {
#ifdef __linux__
int fd; int fd;
DIR * dir; DIR * dir;
DIR * dir2; DIR * dir2;
@@ -361,6 +374,8 @@ static void local_find_internal_mydocs(int * maj, int * min) {
closedir(dir); closedir(dir);
#endif
} }
int local_dump_image(enum image_type image, const char * file) { int local_dump_image(enum image_type image, const char * file) {