diff options
Diffstat (limited to 'firmware/load_code.c')
-rw-r--r-- | firmware/load_code.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/firmware/load_code.c b/firmware/load_code.c index 2337ee5cad..59eb7ac0f7 100644 --- a/firmware/load_code.c +++ b/firmware/load_code.c | |||
@@ -134,6 +134,16 @@ void * _lc_open(const _lc_open_char *filename, unsigned char *buf, size_t buf_si | |||
134 | 134 | ||
135 | void *lc_open_from_mem(void *addr, size_t blob_size) | 135 | void *lc_open_from_mem(void *addr, size_t blob_size) |
136 | { | 136 | { |
137 | #ifndef SIMULATOR | ||
138 | (void)addr; | ||
139 | (void)blob_size; | ||
140 | /* we don't support loading code from memory on application builds, | ||
141 | * it doesn't make sense (since it means writing the blob to disk again and | ||
142 | * then falling back to load from disk) and requires the ability to write | ||
143 | * to an executable directory */ | ||
144 | return NULL; | ||
145 | #else | ||
146 | /* support it in the sim for the sake of simulating */ | ||
137 | int fd, i; | 147 | int fd, i; |
138 | char temp_filename[MAX_PATH]; | 148 | char temp_filename[MAX_PATH]; |
139 | 149 | ||
@@ -143,17 +153,8 @@ void *lc_open_from_mem(void *addr, size_t blob_size) | |||
143 | to find an unused filename */ | 153 | to find an unused filename */ |
144 | for (i = 0; i < 10; i++) | 154 | for (i = 0; i < 10; i++) |
145 | { | 155 | { |
146 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) | ||
147 | /* we need that path fixed, since _get_user_file_path() | ||
148 | * gives us the folder on the sdcard where we cannot load libraries | ||
149 | * from (no exec permissions) | ||
150 | */ | ||
151 | snprintf(temp_filename, sizeof(temp_filename), | ||
152 | "/data/data/org.rockbox/app_rockbox/libtemp_binary_%d.so", i); | ||
153 | #else | ||
154 | snprintf(temp_filename, sizeof(temp_filename), | 156 | snprintf(temp_filename, sizeof(temp_filename), |
155 | ROCKBOX_DIR "/libtemp_binary_%d.dll", i); | 157 | ROCKBOX_DIR "/libtemp_binary_%d.dll", i); |
156 | #endif | ||
157 | fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700); | 158 | fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700); |
158 | if (fd >= 0) | 159 | if (fd >= 0) |
159 | break; /* Created a file ok */ | 160 | break; /* Created a file ok */ |
@@ -175,6 +176,7 @@ void *lc_open_from_mem(void *addr, size_t blob_size) | |||
175 | 176 | ||
176 | close(fd); | 177 | close(fd); |
177 | return lc_open(temp_filename, NULL, 0); | 178 | return lc_open(temp_filename, NULL, 0); |
179 | #endif | ||
178 | } | 180 | } |
179 | 181 | ||
180 | 182 | ||