summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 6e20304..b3bf51e 100644
--- a/rbutil/sansapatcher/Makefile
+++ b/rbutil/sansapatcher/Makefile
@@ -11,7 +11,6 @@ CFLAGS += -Wall -W -D_LARGEFILE64_SOURCE
OUTPUT = sansapatcher
# inputs
-BOOTSRC = bootimg_c200.c bootimg_e200.c
LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c
SOURCES := $(LIBSOURCES) main.c
# additional link dependencies for the standalone executable
@@ -25,6 +24,7 @@ BOOTOBJS=1
endif
ifdef WITH_BOOTOBJS
+BOOTSRC = bootimg_c200.c bootimg_e200.c
SOURCES += $(BOOTSRC)
CFLAGS += -DWITH_BOOTOBJS
endif
@@ -37,6 +37,7 @@ ifeq ($(findstring exe,$(BINARY)),exe)
$(BINARY): $(OBJDIR)sansapatcher-rc.o
endif
+$(OBJDIR)main.o: $(BOOTSRC)
$(OBJDIR)sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
$(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o
@@ -47,5 +48,6 @@ bootimg_c200.c: firmware.mi4 ../tools/bin2c
bootimg_e200.c: PP5022.mi4 ../tools/bin2c
@echo BIN2C $<
$(SILENT)../tools/bin2c PP5022.mi4 bootimg_e200
+
../tools/bin2c:
$(SILENT)make -C ../tools bin2c
diff --git a/rbutil/sansapatcher/main.c b/rbutil/sansapatcher/main.c
index 31b6905..985e1b7 100644
--- a/rbutil/sansapatcher/main.c
+++ b/rbutil/sansapatcher/main.c
@@ -31,10 +31,14 @@
#include "sansapatcher.h"
#include "sansaio.h"
#include "parttypes.h"
+#ifdef WITH_BOOTOBJS
#include "bootimg_c200.h"
#include "bootimg_e200.h"
+#endif
+#ifndef VERSION
#define VERSION "0.8 with v6.0 bootloaders"
+#endif
enum {
NONE,
@@ -200,7 +204,9 @@ int main(int argc, char* argv[])
i = 1;
}
+#ifdef WITH_BOOTOBJS
action = INTERACTIVE;
+#endif
while (i < argc) {
if ((strcmp(argv[i],"-l")==0) || (strcmp(argv[i],"--list")==0)) {
@@ -279,6 +285,7 @@ int main(int argc, char* argv[])
} else {
if (action==LIST_IMAGES) {
sansa_list_images(&sansa);
+#ifdef WITH_BOOTOBJS
} else if (action==INTERACTIVE) {
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[])
}
}
}
+#endif
} else if (action==READ_FIRMWARE) {
if (sansa_read_firmware(&sansa, filename)==0) {
fprintf(stderr,"[INFO] Firmware read to file %s.\n",filename);
} else {
fprintf(stderr,"[ERR] --read-firmware failed.\n");
}
+#ifdef WITH_BOOTOBJS
} else if (action==INSTALL) {
if (sansa_reopen_rw(&sansa) < 0) {
return 5;
@@ -338,6 +347,7 @@ int main(int argc, char* argv[])
} else {
fprintf(stderr,"[ERR] --install failed.\n");
}
+#endif
} else if (action==ADD_BOOTLOADER) {
if (sansa_reopen_rw(&sansa) < 0) {
return 5;