summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bootloader/Makefile2
-rwxr-xr-xtools/configure6
-rw-r--r--tools/creative.c39
-rw-r--r--tools/creative.h2
-rw-r--r--tools/scramble.c31
5 files changed, 55 insertions, 25 deletions
diff --git a/bootloader/Makefile b/bootloader/Makefile
index 796cd9ae2c..3272510051 100644
--- a/bootloader/Makefile
+++ b/bootloader/Makefile
@@ -98,7 +98,7 @@ $(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(BITMAP
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Wl,--gc-sections -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootloader.map
$(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
+ $(call PRINTS,OBJCOPY $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
$(OBJDIR)/bootloader.asm: $(OBJDIR)/bootloader.bin
$(TOOLSDIR)/sh2d -sh1 $< > $@
diff --git a/tools/configure b/tools/configure
index 2267489997..e709bff62d 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1489,7 +1489,7 @@ fi
plugins=""
swcodec="yes"
toolset=$ipodbitmaptools
- boottool="$rootdir/tools/scramble -creative=zvm"
+ boottool="$rootdir/tools/scramble -creative=zvm -no-ciff"
bootoutput="rockbox.zvmboot"
# architecture, manufacturer and model for the target-tree build
t_cpu="arm"
@@ -1507,7 +1507,7 @@ fi
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
- tool="$rootdir/tools/scramble -creative=zvm60"
+ tool="$rootdir/tools/scramble -creative=zvm60 -no-ciff"
USE_ELF="yes"
output="rockbox.zvm60"
appextra="recorder:gui"
@@ -1532,7 +1532,7 @@ fi
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
- tool="$rootdir/tools/scramble -creative=zenvision"
+ tool="$rootdir/tools/scramble -creative=zenvision -no-ciff"
USE_ELF="yes"
output="rockbox.zv"
appextra="recorder:gui"
diff --git a/tools/creative.c b/tools/creative.c
index 43fdbbc917..1698f58930 100644
--- a/tools/creative.c
+++ b/tools/creative.c
@@ -155,7 +155,7 @@ static int make_jrm_file(const unsigned char *inbuf, unsigned char *outbuf)
return 0xC+length;
}
-int zvm_encode(const char *iname, const char *oname, int device)
+int zvm_encode(const char *iname, const char *oname, int device, bool enable_ciff)
{
size_t len;
int length;
@@ -164,7 +164,8 @@ int zvm_encode(const char *iname, const char *oname, int device)
unsigned char *buf;
file = fopen(iname, "rb");
- if (!file) {
+ if (!file)
+ {
perror(iname);
return -1;
}
@@ -174,20 +175,23 @@ int zvm_encode(const char *iname, const char *oname, int device)
fseek(file, 0, SEEK_SET);
buf = (unsigned char*)malloc(length);
- if ( !buf ) {
+ if ( !buf )
+ {
printf("Out of memory!\n");
return -1;
}
len = fread(buf, 1, length, file);
- if(len < (size_t)length) {
+ if(len < (size_t)length)
+ {
perror(iname);
return -2;
}
fclose(file);
outbuf = (unsigned char*)malloc(length+0x300);
- if ( !outbuf ) {
+ if ( !outbuf )
+ {
free(buf);
printf("Out of memory!\n");
return -1;
@@ -200,20 +204,33 @@ int zvm_encode(const char *iname, const char *oname, int device)
printf("Error in making JRM file!\n");
return -1;
}
- buf = (unsigned char*)malloc(length+0x200);
- memset(buf, 0, length+0x200);
- length = make_ciff_file(outbuf, length, buf, device);
- free(outbuf);
+ if(enable_ciff)
+ {
+ buf = (unsigned char*)malloc(length+0x200);
+ if ( !buf )
+ {
+ free(outbuf);
+ printf("Out of memory!\n");
+ return -1;
+ }
+ memset(buf, 0, length+0x200);
+ length = make_ciff_file(outbuf, length, buf, device);
+ free(outbuf);
+ }
+ else
+ buf = outbuf;
file = fopen(oname, "wb");
- if (!file) {
+ if (!file)
+ {
free(buf);
perror(oname);
return -3;
}
len = fwrite(buf, 1, length, file);
- if(len < (size_t)length) {
+ if(len < (size_t)length)
+ {
free(buf);
perror(oname);
return -4;
diff --git a/tools/creative.h b/tools/creative.h
index a634e439c6..ee2cf90582 100644
--- a/tools/creative.h
+++ b/tools/creative.h
@@ -38,6 +38,6 @@ struct device_info
const char* null;
};
-int zvm_encode(const char *iname, const char *oname, int device);
+int zvm_encode(const char *iname, const char *oname, int device, bool enable_ciff);
#endif /*CREATIVE_H_*/
diff --git a/tools/scramble.c b/tools/scramble.c
index ace8337a1b..5dff4f4086 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -145,6 +145,7 @@ int main (int argc, char** argv)
char modelname[5];
int model_id;
enum { none, scramble, xor, tcc_sum, tcc_crc, add } method = scramble;
+ bool creative_enable_ciff;
model_id = ARCHOS_PLAYER;
@@ -341,20 +342,32 @@ int main (int argc, char** argv)
oname = argv[3];
return ipod_encode(iname, oname, 3, true); /* Firmware image v3 */
}
- else if(!strncmp(argv[1], "-creative=", 10)) {
- iname = argv[2];
- oname = argv[3];
+ else if(!strncmp(argv[1], "-creative=", 10))
+ {
+ if(!strcmp(argv[2], "-no-ciff"))
+ {
+ creative_enable_ciff = false;
+ iname = argv[3];
+ oname = argv[4];
+ }
+ else
+ {
+ creative_enable_ciff = true;
+ iname = argv[2];
+ oname = argv[3];
+ }
if(!strcmp(&argv[1][10], "zvm"))
- return zvm_encode(iname, oname, ZENVISIONM);
+ return zvm_encode(iname, oname, ZENVISIONM, creative_enable_ciff);
else if(!strcmp(&argv[1][10], "zvm60"))
- return zvm_encode(iname, oname, ZENVISIONM60);
+ return zvm_encode(iname, oname, ZENVISIONM60, creative_enable_ciff);
else if(!strcmp(&argv[1][10], "zenvision"))
- return zvm_encode(iname, oname, ZENVISION);
+ return zvm_encode(iname, oname, ZENVISION, creative_enable_ciff);
else if(!strcmp(&argv[1][10], "zenv"))
- return zvm_encode(iname, oname, ZENV);
+ return zvm_encode(iname, oname, ZENV, creative_enable_ciff);
else if(!strcmp(&argv[1][10], "zen"))
- return zvm_encode(iname, oname, ZEN);
- else {
+ return zvm_encode(iname, oname, ZEN, creative_enable_ciff);
+ else
+ {
fprintf(stderr, "unsupported Creative device: %s\n", &argv[1][10]);
return 2;
}