summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-16 20:10:33 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-16 20:10:33 +0000
commit1828bb8ea3f555fba987e1e5664a040c9376b6a6 (patch)
tree4a49c0a017072228802c8b343a5da0a66c008627
parent472c02d0f7c8980b7ea9d5980d3bbd9befe81300 (diff)
downloadrockbox-1828bb8ea3f555fba987e1e5664a040c9376b6a6.tar.gz
rockbox-1828bb8ea3f555fba987e1e5664a040c9376b6a6.zip
sansapatcher: allow building without bootloaders.
There is no need to always build sansapatcher with embedded bootloaders. Allow building without similar to ipodpatcher. Interactive mode will obviously not be available if built without bootloaders. Fix rules for creating the source files for the embedded bootloaders. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31328 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/sansapatcher/Makefile4
-rw-r--r--rbutil/sansapatcher/main.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/rbutil/sansapatcher/Makefile b/rbutil/sansapatcher/Makefile
index 6e203042be..b3bf51ee2a 100644
--- a/rbutil/sansapatcher/Makefile
+++ b/rbutil/sansapatcher/Makefile
@@ -11,7 +11,6 @@ CFLAGS += -Wall -W -D_LARGEFILE64_SOURCE
11OUTPUT = sansapatcher 11OUTPUT = sansapatcher
12 12
13# inputs 13# inputs
14BOOTSRC = bootimg_c200.c bootimg_e200.c
15LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c 14LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c
16SOURCES := $(LIBSOURCES) main.c 15SOURCES := $(LIBSOURCES) main.c
17# additional link dependencies for the standalone executable 16# additional link dependencies for the standalone executable
@@ -25,6 +24,7 @@ BOOTOBJS=1
25endif 24endif
26 25
27ifdef WITH_BOOTOBJS 26ifdef WITH_BOOTOBJS
27BOOTSRC = bootimg_c200.c bootimg_e200.c
28SOURCES += $(BOOTSRC) 28SOURCES += $(BOOTSRC)
29CFLAGS += -DWITH_BOOTOBJS 29CFLAGS += -DWITH_BOOTOBJS
30endif 30endif
@@ -37,6 +37,7 @@ ifeq ($(findstring exe,$(BINARY)),exe)
37$(BINARY): $(OBJDIR)sansapatcher-rc.o 37$(BINARY): $(OBJDIR)sansapatcher-rc.o
38endif 38endif
39 39
40$(OBJDIR)main.o: $(BOOTSRC)
40$(OBJDIR)sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest 41$(OBJDIR)sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
41 $(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o 42 $(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o
42 43
@@ -47,5 +48,6 @@ bootimg_c200.c: firmware.mi4 ../tools/bin2c
47bootimg_e200.c: PP5022.mi4 ../tools/bin2c 48bootimg_e200.c: PP5022.mi4 ../tools/bin2c
48 @echo BIN2C $< 49 @echo BIN2C $<
49 $(SILENT)../tools/bin2c PP5022.mi4 bootimg_e200 50 $(SILENT)../tools/bin2c PP5022.mi4 bootimg_e200
51
50../tools/bin2c: 52../tools/bin2c:
51 $(SILENT)make -C ../tools bin2c 53 $(SILENT)make -C ../tools bin2c
diff --git a/rbutil/sansapatcher/main.c b/rbutil/sansapatcher/main.c
index 31b690509f..985e1b7262 100644
--- a/rbutil/sansapatcher/main.c
+++ b/rbutil/sansapatcher/main.c
@@ -31,10 +31,14 @@
31#include "sansapatcher.h" 31#include "sansapatcher.h"
32#include "sansaio.h" 32#include "sansaio.h"
33#include "parttypes.h" 33#include "parttypes.h"
34#ifdef WITH_BOOTOBJS
34#include "bootimg_c200.h" 35#include "bootimg_c200.h"
35#include "bootimg_e200.h" 36#include "bootimg_e200.h"
37#endif
36 38
39#ifndef VERSION
37#define VERSION "0.8 with v6.0 bootloaders" 40#define VERSION "0.8 with v6.0 bootloaders"
41#endif
38 42
39enum { 43enum {
40 NONE, 44 NONE,
@@ -200,7 +204,9 @@ int main(int argc, char* argv[])
200 i = 1; 204 i = 1;
201 } 205 }
202 206
207#ifdef WITH_BOOTOBJS
203 action = INTERACTIVE; 208 action = INTERACTIVE;
209#endif
204 210
205 while (i < argc) { 211 while (i < argc) {
206 if ((strcmp(argv[i],"-l")==0) || (strcmp(argv[i],"--list")==0)) { 212 if ((strcmp(argv[i],"-l")==0) || (strcmp(argv[i],"--list")==0)) {
@@ -279,6 +285,7 @@ int main(int argc, char* argv[])
279 } else { 285 } else {
280 if (action==LIST_IMAGES) { 286 if (action==LIST_IMAGES) {
281 sansa_list_images(&sansa); 287 sansa_list_images(&sansa);
288#ifdef WITH_BOOTOBJS
282 } else if (action==INTERACTIVE) { 289 } else if (action==INTERACTIVE) {
283 290
284 printf("Enter i to install the Rockbox bootloader, u to uninstall\n or c to cancel and do nothing (i/u/c) :"); 291 printf("Enter i to install the Rockbox bootloader, u to uninstall\n or c to cancel and do nothing (i/u/c) :");
@@ -314,12 +321,14 @@ int main(int argc, char* argv[])
314 } 321 }
315 } 322 }
316 } 323 }
324#endif
317 } else if (action==READ_FIRMWARE) { 325 } else if (action==READ_FIRMWARE) {
318 if (sansa_read_firmware(&sansa, filename)==0) { 326 if (sansa_read_firmware(&sansa, filename)==0) {
319 fprintf(stderr,"[INFO] Firmware read to file %s.\n",filename); 327 fprintf(stderr,"[INFO] Firmware read to file %s.\n",filename);
320 } else { 328 } else {
321 fprintf(stderr,"[ERR] --read-firmware failed.\n"); 329 fprintf(stderr,"[ERR] --read-firmware failed.\n");
322 } 330 }
331#ifdef WITH_BOOTOBJS
323 } else if (action==INSTALL) { 332 } else if (action==INSTALL) {
324 if (sansa_reopen_rw(&sansa) < 0) { 333 if (sansa_reopen_rw(&sansa) < 0) {
325 return 5; 334 return 5;
@@ -338,6 +347,7 @@ int main(int argc, char* argv[])
338 } else { 347 } else {
339 fprintf(stderr,"[ERR] --install failed.\n"); 348 fprintf(stderr,"[ERR] --install failed.\n");
340 } 349 }
350#endif
341 } else if (action==ADD_BOOTLOADER) { 351 } else if (action==ADD_BOOTLOADER) {
342 if (sansa_reopen_rw(&sansa) < 0) { 352 if (sansa_reopen_rw(&sansa) < 0) {
343 return 5; 353 return 5;