diff options
Diffstat (limited to 'utils')
-rw-r--r--[-rwxr-xr-x] | utils/jz4740_tools/HXFmerge.c | 42 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/jz4740_tools/HXFreplace.c | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/jz4740_tools/HXFsplit.c | 25 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/jz4740_tools/Makefile | 27 | ||||
-rw-r--r-- | utils/jz4740_tools/README | 36 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/jz4740_tools/jz4740.h | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/jz4740_tools/jz4740_usbtool.c | 2 |
7 files changed, 138 insertions, 17 deletions
diff --git a/utils/jz4740_tools/HXFmerge.c b/utils/jz4740_tools/HXFmerge.c index f90d094fd9..fb5a0bf2f3 100755..100644 --- a/utils/jz4740_tools/HXFmerge.c +++ b/utils/jz4740_tools/HXFmerge.c | |||
@@ -1,6 +1,23 @@ | |||
1 | /* | 1 | /*************************************************************************** |
2 | Made by Maurus Cuelenaere | 2 | * __________ __ ___. |
3 | */ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
4 | 21 | ||
5 | #include <stdio.h> | 22 | #include <stdio.h> |
6 | #include <stdlib.h> | 23 | #include <stdlib.h> |
@@ -42,8 +59,8 @@ static unsigned int le2int(unsigned char* buf) | |||
42 | #define MIN(a, b) (a > b ? b : a) | 59 | #define MIN(a, b) (a > b ? b : a) |
43 | static char* replace(char* str) | 60 | static char* replace(char* str) |
44 | { | 61 | { |
45 | char tmp[255]; | 62 | static char tmp[255]; |
46 | memcpy(tmp, str, MIN(strlen(str), 255); | 63 | memcpy(tmp, str, MIN(strlen(str), 255)); |
47 | char *ptr = tmp; | 64 | char *ptr = tmp; |
48 | while(*ptr != 0) | 65 | while(*ptr != 0) |
49 | { | 66 | { |
@@ -156,19 +173,32 @@ static void merge_hxf(const char* indir, FILE* outfile, const char* add) | |||
156 | 173 | ||
157 | if(strlen(add)>0) | 174 | if(strlen(add)>0) |
158 | { | 175 | { |
176 | #ifdef _DIRENT_HAVE_D_NAMLEN | ||
159 | WRITE(int2le(dirs->d_namlen+strlen(add)), 4); | 177 | WRITE(int2le(dirs->d_namlen+strlen(add)), 4); |
178 | #else | ||
179 | WRITE(int2le(strlen(dirs->d_name)+strlen(add)), 4); | ||
180 | #endif | ||
160 | #ifndef _WIN32 | 181 | #ifndef _WIN32 |
161 | WRITE(replace(add), strlen(add)-1); | 182 | WRITE(replace(&add), strlen(add)-1); |
162 | #else | 183 | #else |
163 | WRITE(add, strlen(add)-1); | 184 | WRITE(add, strlen(add)-1); |
164 | #endif | 185 | #endif |
165 | WRITE(PATH_SEPARATOR, 1); | 186 | WRITE(PATH_SEPARATOR, 1); |
187 | #ifdef _DIRENT_HAVE_D_NAMLEN | ||
166 | WRITE(dirs->d_name, dirs->d_namlen); | 188 | WRITE(dirs->d_name, dirs->d_namlen); |
189 | #else | ||
190 | WRITE(dirs->d_name, strlen(dirs->d_name)); | ||
191 | #endif | ||
167 | } | 192 | } |
168 | else | 193 | else |
169 | { | 194 | { |
195 | #ifdef _DIRENT_HAVE_D_NAMLEN | ||
170 | WRITE(int2le(dirs->d_namlen), 4); | 196 | WRITE(int2le(dirs->d_namlen), 4); |
171 | WRITE(dirs->d_name, dirs->d_namlen); | 197 | WRITE(dirs->d_name, dirs->d_namlen); |
198 | #else | ||
199 | WRITE(int2le(strlen(dirs->d_name)), 4); | ||
200 | WRITE(dirs->d_name, strlen(dirs->d_name)); | ||
201 | #endif | ||
172 | } | 202 | } |
173 | WRITE(int2le(filesize), 4); | 203 | WRITE(int2le(filesize), 4); |
174 | if(filesize>0) | 204 | if(filesize>0) |
diff --git a/utils/jz4740_tools/HXFreplace.c b/utils/jz4740_tools/HXFreplace.c index fc97a3c1e8..154bc13071 100755..100644 --- a/utils/jz4740_tools/HXFreplace.c +++ b/utils/jz4740_tools/HXFreplace.c | |||
@@ -1,6 +1,23 @@ | |||
1 | /* | 1 | /*************************************************************************** |
2 | Made by Maurus Cuelenaere | 2 | * __________ __ ___. |
3 | */ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
4 | 21 | ||
5 | #include <stdio.h> | 22 | #include <stdio.h> |
6 | #include <stdlib.h> | 23 | #include <stdlib.h> |
diff --git a/utils/jz4740_tools/HXFsplit.c b/utils/jz4740_tools/HXFsplit.c index ede22170e4..d5e578625b 100755..100644 --- a/utils/jz4740_tools/HXFsplit.c +++ b/utils/jz4740_tools/HXFsplit.c | |||
@@ -1,6 +1,23 @@ | |||
1 | /* | 1 | /*************************************************************************** |
2 | Made by Maurus Cuelenaere | 2 | * __________ __ ___. |
3 | */ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
4 | 21 | ||
5 | #include <stdio.h> | 22 | #include <stdio.h> |
6 | #include <stdlib.h> | 23 | #include <stdlib.h> |
@@ -43,7 +60,7 @@ static char* basepath(char* path) | |||
43 | #else | 60 | #else |
44 | *ptr2 = 0x2F; | 61 | *ptr2 = 0x2F; |
45 | #endif | 62 | #endif |
46 | *ptr2++; | 63 | ptr2++; |
47 | *ptr2 = 0; | 64 | *ptr2 = 0; |
48 | return (char*)tmp; | 65 | return (char*)tmp; |
49 | } | 66 | } |
diff --git a/utils/jz4740_tools/Makefile b/utils/jz4740_tools/Makefile index e61b837d99..6ebf0c8fb3 100755..100644 --- a/utils/jz4740_tools/Makefile +++ b/utils/jz4740_tools/Makefile | |||
@@ -1,9 +1,30 @@ | |||
1 | WIN_DRIVERS_LIBUSB_DIR = D:\Program Files\LibUSB-Win32 | 1 | WIN_DRIVERS_LIBUSB_DIR = C:\Program Files\LibUSB-Win32 |
2 | WIN_LIBUSB_INCLUDE_DIR = "$(WIN_DRIVERS_LIBUSB_DIR)\include" | 2 | WIN_LIBUSB_INCLUDE_DIR = "$(WIN_DRIVERS_LIBUSB_DIR)\include" |
3 | WIN_LIBUSB_LIB_DIR = "$(WIN_DRIVERS_LIBUSB_DIR)\lib\gcc" | 3 | WIN_LIBUSB_LIB_DIR = "$(WIN_DRIVERS_LIBUSB_DIR)\lib\gcc" |
4 | 4 | ||
5 | linux: usbtool HXFmerge HXFreplace HXFsplit | ||
6 | win: usbtool_win HXFmerge_win HXFsplit_win HXFreplace_win | ||
7 | |||
5 | usbtool: | 8 | usbtool: |
6 | gcc -Wall -o usbtool jz4740_usbtool.c -lusb | 9 | gcc -Wall -o usbtool jz4740_usbtool.c -lusb |
10 | usbtool_win: | ||
11 | gcc -Wall -o usbtool.exe jz4740_usbtool.c -lusb -I $(WIN_LIBUSB_INCLUDE_DIR) -L $(WIN_LIBUSB_LIB_DIR) | ||
12 | |||
13 | HXFmerge: | ||
14 | gcc -Wall -o HXFmerge HXFmerge.c | ||
15 | HXFreplace: | ||
16 | gcc -Wall -o HXFreplace HXFreplace.c | ||
17 | HXFsplit: | ||
18 | gcc -Wall -o HXFsplit HXFsplit.c | ||
19 | |||
20 | HXFmerge_win: | ||
21 | gcc -Wall -o HXFmerge.exe HXFmerge.c | ||
22 | HXFreplace_win: | ||
23 | gcc -Wall -o HXFreplace.exe HXFreplace.c | ||
24 | HXFsplit_win: | ||
25 | gcc -Wall -o HXFsplit.exe HXFsplit.c | ||
7 | 26 | ||
8 | usbtoolwin: | 27 | clean-linux: |
9 | gcc -Wall -o usbtool.exe jz4740_usbtool.c -lusb -I $(WIN_LIBUSB_INCLUDE_DIR) -L $(WIN_LIBUSB_LIB_DIR) \ No newline at end of file | 28 | rm HXFmerge HXFreplace HXFsplit usbtool |
29 | clean-win: | ||
30 | del HXFmerge.exe HXFreplace.exe HXFsplit.exe usbtool.exe | ||
diff --git a/utils/jz4740_tools/README b/utils/jz4740_tools/README new file mode 100644 index 0000000000..b75f36aa51 --- /dev/null +++ b/utils/jz4740_tools/README | |||
@@ -0,0 +1,36 @@ | |||
1 | ******************************************************************************* | ||
2 | Jz4740 USB tools | ||
3 | |||
4 | Made by Maurus Cuelenaere for Rockbox | ||
5 | Copyright (C) 2008 | ||
6 | ******************************************************************************* | ||
7 | |||
8 | When you're on Linux, just type "make linux" to compile all the utilities (make | ||
9 | sure you have libusb-dev installed). | ||
10 | For cleaning: "make clean-linux" | ||
11 | |||
12 | When you're on Windows, install MingW32 and LibUSB-Win32 and edit "Makefile" to | ||
13 | make sure "WIN_DRIVERS_LIBUSB_DIR" is set correctly. | ||
14 | For cleaning: "make clean-win" | ||
15 | |||
16 | That's all! | ||
17 | |||
18 | |||
19 | *************************************************************************** | ||
20 | * __________ __ ___. | ||
21 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
22 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
23 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
24 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
25 | * \/ \/ \/ \/ \/ | ||
26 | * $Id$ | ||
27 | * | ||
28 | * This program is free software; you can redistribute it and/or | ||
29 | * modify it under the terms of the GNU General Public License | ||
30 | * as published by the Free Software Foundation; either version 2 | ||
31 | * of the License, or (at your option) any later version. | ||
32 | * | ||
33 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
34 | * KIND, either express or implied. | ||
35 | * | ||
36 | **************************************************************************** | ||
diff --git a/utils/jz4740_tools/jz4740.h b/utils/jz4740_tools/jz4740.h index 87b400e3b9..87b400e3b9 100755..100644 --- a/utils/jz4740_tools/jz4740.h +++ b/utils/jz4740_tools/jz4740.h | |||
diff --git a/utils/jz4740_tools/jz4740_usbtool.c b/utils/jz4740_tools/jz4740_usbtool.c index 6d670254e4..165aafb19d 100755..100644 --- a/utils/jz4740_tools/jz4740_usbtool.c +++ b/utils/jz4740_tools/jz4740_usbtool.c | |||
@@ -199,7 +199,7 @@ int upload_app(usb_dev_handle* dh, int address, unsigned char* p, int len, bool | |||
199 | free(tmp_buf); | 199 | free(tmp_buf); |
200 | 200 | ||
201 | fprintf(stderr, "[INFO] Booting device [STAGE%d]...", (stage2 ? 2 : 1)); | 201 | fprintf(stderr, "[INFO] Booting device [STAGE%d]...", (stage2 ? 2 : 1)); |
202 | SEND_COMMAND((stage2 ? VR_PROGRAM_START2 : VR_PROGRAM_START1), (address+(stage2 ? 8 : 0)) ); | 202 | SEND_COMMAND((stage2 ? VR_PROGRAM_START2 : VR_PROGRAM_START1), address ); |
203 | fprintf(stderr, " Done!\n"); | 203 | fprintf(stderr, " Done!\n"); |
204 | 204 | ||
205 | return 0; | 205 | return 0; |