rendered paste bodyIndex: tools/mi4.h
===================================================================
--- tools/mi4.h (revision 12755)
+++ tools/mi4.h (working copy)
@@ -23,6 +23,7 @@
#define MI4_MAGIC_DEFAULT 0xec
#define MI4_MAGIC_R 0xfc
-int mi4_encode(char *iname, char *oname, int version, int magic);
+int mi4_encode(char *iname, char *oname, int version, int magic,
+ int model, char *type);
#endif
Index: tools/configure
===================================================================
--- tools/configure (revision 12755)
+++ tools/configure (working copy)
@@ -1164,16 +1164,16 @@
target="-DIRIVER_H10"
memory=32 # always
arm7tdmicc
- tool="$rootdir/tools/scramble -add=h10"
+ tool="$rootdir/tools/scramble -mi4v3 -model=13 -type=RBOS"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- output="rockbox.h10"
+ output="rockbox.mi4"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
- boottool="$rootdir/tools/scramble -mi4v3"
+ boottool="$rootdir/tools/scramble -mi4v3 -model=13 -type=RBBL"
bootoutput="H10_20GC.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
@@ -1184,22 +1184,48 @@
t_model="h10"
;;
+ 15|h10_5gb)
+ target_id=24
+ archos="h10_5gb"
+ target="-DIRIVER_H10_5GB"
+ memory=32 # always
+ arm7tdmicc
+ tool="$rootdir/tools/scramble -mi4v2 -model=14 -type=RBOS"
+ bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
+ bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
+ output="rockbox.mi4"
+ appextra="recorder:gui"
+ archosrom=""
+ flash=""
+ plugins="yes"
+ codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
+ boottool="$rootdir/tools/scramble -mi4v2 -model=14 -type=RBBL"
+ bootoutput="H10.mi4"
+ # toolset is the tools within the tools directory that we build for
+ # this particular target.
+ toolset="$genericbitmaptools scramble"
+ # architecture, manufacturer and model for the target-tree build
+ t_cpu="arm"
+ t_manufacturer="iriver"
+ t_model="h10"
+ ;;
+
50|e200)
target_id=23
archos="e200"
target="-DSANSA_E200"
memory=32 # supposedly
arm7tdmicc
- tool="$rootdir/tools/scramble -add=e200"
+ tool="$rootdir/tools/scramble -mi4v3 -model=16 -type=RBOS"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- output="rockbox.e200"
+ output="rockbox.mi4"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
- boottool="$rootdir/tools/scramble -mi4v3"
+ boottool="$rootdir/tools/scramble -mi4v3 -model=16 -type=RBBL"
bootoutput="PP5022.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
@@ -1219,16 +1245,16 @@
target="-DSANSA_E200"
memory=32 # supposedly
arm7tdmicc
- tool="$rootdir/tools/scramble -add=e200"
+ tool="$rootdir/tools/scramble -mi4v3 -model=16 -type=RBOS"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- output="rockbox.e200"
+ output="rockbox.mi4"
appextra="recorder:gui"
archosrom=""
flash=""
plugins="yes"
codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
- boottool="$rootdir/tools/scramble -mi4r"
+ boottool="$rootdir/tools/scramble -mi4r -model=16 -type=RBBL"
bootoutput="pp5022.mi4"
# toolset is the tools within the tools directory that we build for
# this particular target.
@@ -1239,32 +1265,6 @@
t_model="sansa-e200"
;;
- 15|h10_5gb)
- target_id=24
- archos="h10_5gb"
- target="-DIRIVER_H10_5GB"
- memory=32 # always
- arm7tdmicc
- tool="$rootdir/tools/scramble -add=h10_5gb"
- bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
- output="rockbox.h10"
- appextra="recorder:gui"
- archosrom=""
- flash=""
- plugins="yes"
- codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a libspeex"
- boottool="$rootdir/tools/scramble -mi4v2"
- bootoutput="H10.mi4"
- # toolset is the tools within the tools directory that we build for
- # this particular target.
- toolset="$genericbitmaptools scramble"
- # architecture, manufacturer and model for the target-tree build
- t_cpu="arm"
- t_manufacturer="iriver"
- t_model="h10"
- ;;
-
60|tpj1022)
target_id=25
archos="tpj1022"
Index: tools/scramble.c
===================================================================
--- tools/scramble.c (revision 12755)
+++ tools/scramble.c (working copy)
@@ -89,6 +89,10 @@
"\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n"
"\t-mi4v3 PortalPlayer .mi4 format (revision 010301)\n"
"\t-mi4r Sandisk Rhapsody .mi4 format\n"
+ "\t All mi4 options take two optional arguments:\n"
+ "\t -model=XX where XX is the model number\n"
+ "\t -type=XXXX where XXXX is a string indicating the \n"
+ "\t type of binary, eg. RBOS, RBBL\n"
"\t-add=X Rockbox generic \"add-up\" checksum format\n"
"\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n"
"\t ip3g, ip4g, mini, iax5, h10, h10_5gb, tpj2, e200)\n"
@@ -266,21 +270,46 @@
oname = argv[3];
return ipod_encode(iname, oname, 3, true); /* Firmware image v3 */
}
- else if(!strcmp(argv[1], "-mi4v2")) {
+ else if(!strncmp(argv[1], "-mi4", 4)) {
+ int mi4magic;
+ int version;
+ int model = 0;
+ char type[4] = "";
+
+ if(!strcmp(&argv[1][4], "v2")) {
+ mi4magic = MI4_MAGIC_DEFAULT;
+ version = 0x00010201;
+ }
+ else if(!strcmp(&argv[1][4], "v3")) {
+ mi4magic = MI4_MAGIC_DEFAULT;
+ version = 0x00010301;
+ }
+ else if(!strcmp(&argv[1][4], "r")) {
+ mi4magic = MI4_MAGIC_R;
+ version = 0x00010301;
+ }
+ else {
+ printf( "Invalid mi4 version: %s\n", &argv[1][4]);
+ return -1;
+ }
+
iname = argv[2];
oname = argv[3];
- return mi4_encode(iname, oname, 0x00010201, MI4_MAGIC_DEFAULT);
+
+ if(!strncmp(argv[2], "-model=", 7)) {
+ iname = argv[3];
+ oname = argv[4];
+ model = atoi(&argv[2][7]);
+
+ if(!strncmp(argv[3], "-type=", 6)) {
+ iname = argv[4];
+ oname = argv[5];
+ strncpy(type, &argv[3][6], 4);
+ }
+ }
+
+ return mi4_encode(iname, oname, version, mi4magic, model, type);
}
- else if(!strcmp(argv[1], "-mi4v3")) {
- iname = argv[2];
- oname = argv[3];
- return mi4_encode(iname, oname, 0x00010301, MI4_MAGIC_DEFAULT);
- }
- else if(!strcmp(argv[1], "-mi4r")) {
- iname = argv[2];
- oname = argv[3];
- return mi4_encode(iname, oname, 0x00010301, MI4_MAGIC_R);
- }
/* open file */
file = fopen(iname,"rb");
Index: tools/mi4.c
===================================================================
--- tools/mi4.c (revision 12755)
+++ tools/mi4.c (working copy)
@@ -102,7 +102,8 @@
addr[3] = (val >> 24) & 0xff;
}
-int mi4_encode(char *iname, char *oname, int version, int magic)
+int mi4_encode(char *iname, char *oname, int version, int magic,
+ char model, char *type)
{
size_t len;
int length;
@@ -150,6 +151,9 @@
int2le(length+4, &outbuf[0x2e8]); /* length plus 0xaa55aa55 */
int2le(0xaa55aa55, &outbuf[0x200+length]); /* More Magic */
+
+ strncpy((char *)outbuf+0x1f8, type, 4); /* type of binary - RBBL, RBOS, ... */
+ outbuf[0x1fc] = model; /* model - used by Rockbox */
/* Calculate CRC32 checksum */
chksum_crc32gentab ();