diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-07-17 14:30:42 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-07-17 14:30:42 +0000 |
commit | cf9935d6362dd52e4b2f33dd19fff0a0860814d7 (patch) | |
tree | 1530a9450d78768077798bd756fbfa67ea1efb12 /tools | |
parent | 1dc0c46d930d8e59902e9b3ce92aab21a5311d78 (diff) | |
download | rockbox-cf9935d6362dd52e4b2f33dd19fff0a0860814d7.tar.gz rockbox-cf9935d6362dd52e4b2f33dd19fff0a0860814d7.zip |
Onda VX747: add dual-boot capability + make it possible to permanently 'stick' Rockbox to your DAP
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21919 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/configure | 16 | ||||
-rw-r--r-- | tools/scramble.c | 64 |
2 files changed, 70 insertions, 10 deletions
diff --git a/tools/configure b/tools/configure index f5aeceaf58..802173f1b6 100755 --- a/tools/configure +++ b/tools/configure @@ -2105,8 +2105,8 @@ fi plugins="yes" swcodec="yes" toolset=$genericbitmaptools - boottool="cp" - bootoutput="rockboot.vx747" + boottool="$rootdir/tools/scramble -ccpmp" + bootoutput="ccpmp.bin" # architecture, manufacturer and model for the target-tree build t_cpu="mips" t_manufacturer="ingenic_jz47xx" @@ -2127,8 +2127,8 @@ fi plugins="" #FIXME swcodec="yes" toolset=$genericbitmaptools - boottool="cp" - bootoutput="rockboot.vx767" + boottool="$rootdir/tools/scramble -ccpmp" + bootoutput="ccpmp.bin" # architecture, manufacturer and model for the target-tree build t_cpu="mips" t_manufacturer="ingenic_jz47xx" @@ -2149,8 +2149,8 @@ fi plugins="yes" swcodec="yes" toolset=$genericbitmaptools - boottool="cp" - bootoutput="rockboot.vx747p" + boottool="$rootdir/tools/scramble -ccpmp" + bootoutput="ccpmp.bin" # architecture, manufacturer and model for the target-tree build t_cpu="mips" t_manufacturer="ingenic_jz47xx" @@ -2171,8 +2171,8 @@ fi plugins="" #TODO swcodec="yes" toolset=$genericbitmaptools - boottool="cp" - bootoutput="rockboot.vx777" + boottool="$rootdir/tools/scramble -ccpmp" + bootoutput="ccpmp.bin" # architecture, manufacturer and model for the target-tree build t_cpu="mips" t_manufacturer="ingenic_jz47xx" diff --git a/tools/scramble.c b/tools/scramble.c index cabe15f48d..5d2b12fb84 100644 --- a/tools/scramble.c +++ b/tools/scramble.c @@ -33,6 +33,7 @@ int iaudio_encode(char *iname, char *oname, char *idstring); int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc); +int ccpmp_encode(char *iname, char *oname); enum { @@ -375,8 +376,7 @@ 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)) - { + else if(!strncmp(argv[1], "-creative=", 10)) { if(!strcmp(argv[2], "-no-ciff")) { creative_enable_ciff = false; @@ -405,6 +405,11 @@ int main (int argc, char** argv) return 2; } } + else if(!strcmp(argv[1], "-ccpmp")) { + iname = argv[2]; + oname = argv[3]; + return ccpmp_encode(iname, oname); + } else if(!strncmp(argv[1], "-mi4", 4)) { int mi4magic; char model[4] = ""; @@ -824,3 +829,58 @@ int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc) return 0; } +#define CCPMP_SIZE 0x500000 +int ccpmp_encode(char *iname, char *oname) +{ + size_t len; + int length; + FILE *file; + unsigned char *outbuf; + + file = fopen(iname, "rb"); + if (!file) { + perror(iname); + return -1; + } + fseek(file,0,SEEK_END); + length = ftell(file); + + fseek(file,0,SEEK_SET); + + outbuf = malloc(CCPMP_SIZE); + + if ( !outbuf ) { + printf("out of memory!\n"); + return -1; + } + + len = fread(outbuf, 1, length, file); + if(len < (size_t)length) { + perror(iname); + return -2; + } + fclose(file); + + /* Clear the tail area to 0xFF */ + memset(&outbuf[length], 0xFF, CCPMP_SIZE - length); + + /* Header */ + int2le(length, &outbuf[0x4]); + + file = fopen(oname, "wb"); + if (!file) { + perror(oname); + return -3; + } + + len = fwrite(outbuf, 1, CCPMP_SIZE, file); + if(len < (size_t)length) { + perror(oname); + return -4; + } + + fclose(file); + + return 0; +} + |