Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Anonymous
Wednesday, March 14th, 2007 at 4:17:40pm UTC 

  1. Index: tools/configure
  2. ===================================================================
  3. --- tools/configure     (revision 12755)
  4. +++ tools/configure     (working copy)
  5. @@ -1164,16 +1164,16 @@
  6.      target="-DIRIVER_H10"
  7.      memory=32 # always
  8.      arm7tdmicc
  9. -    tool="$rootdir/tools/scramble -add=h10"
  10. +    tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
  11.      bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
  12.      bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
  13. -    output="rockbox.h10"
  14. +    output="rockbox.mi4"
  15.      appextra="recorder:gui"
  16.      archosrom=""
  17.      flash=""
  18.      plugins="yes"
  19.      codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a  libspeex"
  20. -    boottool="$rootdir/tools/scramble -mi4v3"
  21. +    boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
  22.      bootoutput="H10_20GC.mi4"
  23.      # toolset is the tools within the tools directory that we build for
  24.      # this particular target.
  25. @@ -1184,22 +1184,48 @@
  26.      t_model="h10"
  27.      ;;
  28.  
  29. +   15|h10_5gb)
  30. +    target_id=24
  31. +    archos="h10_5gb"
  32. +    target="-DIRIVER_H10_5GB"
  33. +    memory=32 # always
  34. +    arm7tdmicc
  35. +    tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
  36. +    bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
  37. +    bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
  38. +    output="rockbox.mi4"
  39. +    appextra="recorder:gui"
  40. +    archosrom=""
  41. +    flash=""
  42. +    plugins="yes"
  43. +    codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a  libspeex"
  44. +    boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
  45. +    bootoutput="H10.mi4"
  46. +    # toolset is the tools within the tools directory that we build for
  47. +    # this particular target.
  48. +    toolset="$genericbitmaptools scramble"
  49. +    # architecture, manufacturer and model for the target-tree build
  50. +    t_cpu="arm"
  51. +    t_manufacturer="iriver"
  52. +    t_model="h10"
  53. +    ;;
  54. +
  55.     50|e200)
  56.      target_id=23
  57.      archos="e200"
  58.      target="-DSANSA_E200"
  59.      memory=32 # supposedly
  60.      arm7tdmicc
  61. -    tool="$rootdir/tools/scramble -add=e200"
  62. +    tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
  63.      bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
  64.      bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
  65. -    output="rockbox.e200"
  66. +    output="rockbox.mi4"
  67.      appextra="recorder:gui"
  68.      archosrom=""
  69.      flash=""
  70.      plugins="yes"
  71.      codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a  libspeex"
  72. -    boottool="$rootdir/tools/scramble -mi4v3"
  73. +    boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
  74.      bootoutput="PP5022.mi4"
  75.      # toolset is the tools within the tools directory that we build for
  76.      # this particular target.
  77. @@ -1219,16 +1245,16 @@
  78.      target="-DSANSA_E200"
  79.      memory=32 # supposedly
  80.      arm7tdmicc
  81. -    tool="$rootdir/tools/scramble -add=e200"
  82. +    tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
  83.      bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
  84.      bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
  85. -    output="rockbox.e200"
  86. +    output="rockbox.mi4"
  87.      appextra="recorder:gui"
  88.      archosrom=""
  89.      flash=""
  90.      plugins="yes"
  91.      codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a  libspeex"
  92. -    boottool="$rootdir/tools/scramble -mi4r"
  93. +    boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
  94.      bootoutput="pp5022.mi4"
  95.      # toolset is the tools within the tools directory that we build for
  96.      # this particular target.
  97. @@ -1239,32 +1265,6 @@
  98.      t_model="sansa-e200"
  99.      ;;
  100.  
  101. -   15|h10_5gb)
  102. -    target_id=24
  103. -    archos="h10_5gb"
  104. -    target="-DIRIVER_H10_5GB"
  105. -    memory=32 # always
  106. -    arm7tdmicc
  107. -    tool="$rootdir/tools/scramble -add=h10_5gb"
  108. -    bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
  109. -    bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
  110. -    output="rockbox.h10"
  111. -    appextra="recorder:gui"
  112. -    archosrom=""
  113. -    flash=""
  114. -    plugins="yes"
  115. -    codecs="libmad liba52 libffmpegFLAC libTremor libwavpack libmusepack libalac libfaad libm4a  libspeex"
  116. -    boottool="$rootdir/tools/scramble -mi4v2"
  117. -    bootoutput="H10.mi4"
  118. -    # toolset is the tools within the tools directory that we build for
  119. -    # this particular target.
  120. -    toolset="$genericbitmaptools scramble"
  121. -    # architecture, manufacturer and model for the target-tree build
  122. -    t_cpu="arm"
  123. -    t_manufacturer="iriver"
  124. -    t_model="h10"
  125. -    ;;
  126. -
  127.     60|tpj1022)
  128.      target_id=25
  129.      archos="tpj1022"
  130. Index: tools/mi4.c
  131. ===================================================================
  132. --- tools/mi4.c (revision 12760)
  133. +++ tools/mi4.c (working copy)
  134. @@ -152,8 +152,8 @@
  135.  
  136.      int2le(0xaa55aa55,   &outbuf[0x200+length]);  /* More Magic */
  137.      
  138. -    strncpy((char *)outbuf+0x1f8, type, 4);    /* type of binary - RBBL, RBOS, ... */
  139. -    strncpy((char *)outbuf+0x1fc, model, 4);    /* type of binary - RBBL, RBOS, ... */
  140. +    strncpy((char *)outbuf+0x1f8, type, 4);  /* type of binary (RBBL, RBOS) */
  141. +    strncpy((char *)outbuf+0x1fc, model, 4); /* 4 character model id */
  142.      
  143.      /* Calculate CRC32 checksum */
  144.      chksum_crc32gentab ();
  145. Index: bootloader/main-pp.c
  146. ===================================================================
  147. --- bootloader/main-pp.c        (revision 12755)
  148. +++ bootloader/main-pp.c        (working copy)
  149. @@ -111,7 +111,7 @@
  150.             buffer called loadbuffer. The rest of the loading is done in crt0.S
  151.          */
  152.          printf("Loading original firmware...");
  153. -        rc=load_raw_firmware(loadbuffer, "/System/OF.bin", MAX_LOADSIZE);
  154. +        rc=load_firmware(loadbuffer, "/System/OF.mi4", MAX_LOADSIZE);
  155.          if (rc < EOK) {
  156.              printf("Can't load /System/OF.bin");
  157.              error(EBOOTFILE, rc);
  158. Index: bootloader/common.c
  159. ===================================================================
  160. --- bootloader/common.c (revision 12755)
  161. +++ bootloader/common.c (working copy)
  162. @@ -28,6 +28,79 @@
  163.  #include "power.h"
  164.  #include "kernel.h"
  165.  
  166. +/*
  167. + * CRC32 implementation taken from:
  168. + *
  169. + * efone - Distributed internet phone system.
  170. + *
  171. + * (c) 1999,2000 Krzysztof Dabrowski
  172. + * (c) 1999,2000 ElysiuM deeZine
  173. + *
  174. + * This program is free software; you can redistribute it and/or
  175. + * modify it under the terms of the GNU General Public License
  176. + * as published by the Free Software Foundation; either version
  177. + * 2 of the License, or (at your option) any later version.
  178. + *
  179. + */
  180. +
  181. +/* based on implementation by Finn Yannick Jacobs */
  182. +
  183. +#include <stdio.h>
  184. +#include <stdlib.h>
  185. +
  186. +/* crc_tab[] -- this crcTable is being build by chksum_crc32GenTab().
  187. + *          so make sure, you call it before using the other
  188. + *          functions!
  189. + */
  190. +static unsigned int crc_tab[256];
  191. +
  192. +/* chksum_crc() -- to a given block, this one calculates the
  193. + *                    crc32-checksum until the length is
  194. + *                    reached. the crc32-checksum will be
  195. + *                    the result.
  196. + */
  197. +static unsigned int chksum_crc32 (unsigned char *block, unsigned int length)
  198. +{
  199. +   register unsigned long crc;
  200. +   unsigned long i;
  201. +
  202. +   crc = 0;
  203. +   for (i = 0; i < length; i++)
  204. +   {
  205. +      crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_tab[(crc ^ *block++) & 0xFF];
  206. +   }
  207. +   return (crc);
  208. +}
  209. +
  210. +/* chksum_crc32gentab() --      to a global crc_tab[256], this one will
  211. + *                    calculate the crcTable for crc32-checksums.
  212. + *                    it is generated to the polynom [..]
  213. + */
  214. +
  215. +static void chksum_crc32gentab (void)
  216. +{
  217. +   unsigned long crc, poly;
  218. +   int i, j;
  219. +
  220. +   poly = 0xEDB88320L;
  221. +   for (i = 0; i < 256; i++)
  222. +   {
  223. +      crc = i;
  224. +      for (j = 8; j > 0; j--)
  225. +      {
  226. +        if (crc & 1)
  227. +        {
  228. +           crc = (crc >> 1) ^ poly;
  229. +        }
  230. +        else
  231. +        {
  232. +           crc >>= 1;
  233. +        }
  234. +      }
  235. +      crc_tab[i] = crc;
  236. +   }
  237. +}
  238. +
  239.  /* TODO: Other bootloaders need to be adjusted to set this variable to true
  240.     on a button press - currently only the ipod, H10 and Sansa versions do. */
  241.  #if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \
  242. @@ -131,9 +204,8 @@
  243.      int rc;
  244.      int len;
  245.      unsigned long chksum;
  246. -    char model[5];
  247. +    char model[5], type[5];
  248.      unsigned long sum;
  249. -    int i;
  250.      char filename[MAX_PATH];
  251.  
  252.      snprintf(filename,sizeof(filename),"/.rockbox/%s",firmware);
  253. @@ -146,13 +218,21 @@
  254.              return EFILE_NOT_FOUND;
  255.      }
  256.  
  257. +    /* Determinte firmware size */
  258. +#ifdef FIRMWARE_OFFSET_FILE_LENGTH
  259. +    lseek(fd, FIRMWARE_OFFSET_FILE_LENGTH, SEEK_SET);
  260. +    read(fd, &len, 4);
  261. +#else
  262.      len = filesize(fd) - 8;
  263. +#endif
  264.  
  265.      printf("Length: %x", len);
  266.  
  267.      if (len > buffer_size)
  268.          return EFILE_TOO_BIG;
  269.  
  270. +
  271. +    /* Read CRC */
  272.      lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET);
  273.  
  274.      rc = read(fd, &chksum, 4);
  275. @@ -162,6 +242,9 @@
  276.  
  277.      printf("Checksum: %x", chksum);
  278.  
  279. +#ifdef FIRMWARE_OFFSET_FILE_MODEL
  280. +    /* Read model id */
  281. +    lseek(fd, FIRMWARE_OFFSET_FILE_MODEL, SEEK_SET);
  282.      rc = read(fd, model, 4);
  283.      if(rc < 4)
  284.          return EREAD_MODEL_FAILED;
  285. @@ -169,27 +252,55 @@
  286.      model[4] = 0;
  287.  
  288.      printf("Model name: %s", model);
  289. +#endif
  290. +
  291. +#ifdef FIRMWARE_OFFSET_FILE_TYPE
  292. +    /* Read binary type (RBOS, RBBL) */
  293. +    lseek(fd, FIRMWARE_OFFSET_FILE_TYPE, SEEK_SET);
  294. +    rc = read(fd, type, 4);
  295. +    if(rc < 4)
  296. +        return EREAD_MODEL_FAILED;
  297. +
  298. +    type[4] = 0;
  299. +
  300. +    printf("Binary type: %s", type);
  301. +#endif
  302. +
  303. +    /* Load firmware */
  304.      printf("Loading %s", firmware);
  305.  
  306. -    lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
  307. +    lseek(fd, 28, SEEK_SET);
  308.  
  309. -    rc = read(fd, buf, len);
  310. +    rc = read(fd, buf, filesize(fd)-28);
  311.      if(rc < len)
  312.          return EREAD_IMAGE_FAILED;
  313.  
  314. -    close(fd);
  315. -
  316. +    /* Check CRC to see if we have a valid file */
  317. +#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(SANSA_E200)
  318. +    /* Calculate CRC32 checksum */
  319. +    chksum_crc32gentab ();
  320. +    sum = chksum_crc32 (buf,filesize(fd)-28);
  321. +#else
  322.      sum = MODEL_NUMBER;
  323.  
  324.      for(i = 0;i < len;i++) {
  325.          sum += buf[i];
  326.      }
  327. +#endif
  328.  
  329.      printf("Sum: %x", sum);
  330.  
  331.      if(sum != chksum)
  332.          return EBAD_CHKSUM;
  333.  
  334. +    lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
  335. +
  336. +    rc = read(fd, buf, len);
  337. +    if(rc < len)
  338. +        return EREAD_IMAGE_FAILED;
  339. +
  340. +    close(fd);
  341. +   
  342.      return EOK;
  343.  }
  344.  
  345. Index: firmware/export/config-h10.h
  346. ===================================================================
  347. --- firmware/export/config-h10.h        (revision 12755)
  348. +++ firmware/export/config-h10.h        (working copy)
  349. @@ -138,13 +138,19 @@
  350.  #define HAVE_ATA_POWER_OFF
  351.  
  352.  /* Offset ( in the firmware file's header ) to the file length */
  353. -#define FIRMWARE_OFFSET_FILE_LENGTH 0
  354. +#define FIRMWARE_OFFSET_FILE_LENGTH 0x8
  355.  
  356.  /* Offset ( in the firmware file's header ) to the file CRC */
  357. -#define FIRMWARE_OFFSET_FILE_CRC 0
  358. +#define FIRMWARE_OFFSET_FILE_CRC    0x0c
  359.  
  360. +/* Offset ( in the firmware file's header ) to the file type */
  361. +#define FIRMWARE_OFFSET_FILE_TYPE   0x1f8
  362. +
  363. +/* Offset ( in the firmware file's header ) to the file model id */
  364. +#define FIRMWARE_OFFSET_FILE_MODEL  0x1fc
  365. +
  366.  /* Offset ( in the firmware file's header ) to the real data */
  367. -#define FIRMWARE_OFFSET_FILE_DATA 8
  368. +#define FIRMWARE_OFFSET_FILE_DATA   0x200
  369.  
  370.  /* #define USB_IPODSTYLE */
  371.  
  372. @@ -160,7 +166,7 @@
  373.  /* Define this if you have adjustable CPU frequency */
  374.  /*#define HAVE_ADJUSTABLE_CPU_FREQ*/
  375.  
  376. -#define BOOTFILE_EXT "h10"
  377. +#define BOOTFILE_EXT "mi4"
  378.  #define BOOTFILE "rockbox." BOOTFILE_EXT
  379.  
  380.  #define ICODE_ATTR_TREMOR_NOT_MDCT
  381. Index: firmware/export/config-e200.h
  382. ===================================================================
  383. --- firmware/export/config-e200.h       (revision 12755)
  384. +++ firmware/export/config-e200.h       (working copy)
  385. @@ -108,13 +108,19 @@
  386.  #define CONFIG_LCD LCD_X5
  387.  
  388.  /* Offset ( in the firmware file's header ) to the file length */
  389. -#define FIRMWARE_OFFSET_FILE_LENGTH 0
  390. +#define FIRMWARE_OFFSET_FILE_LENGTH 0x8
  391.  
  392.  /* Offset ( in the firmware file's header ) to the file CRC */
  393. -#define FIRMWARE_OFFSET_FILE_CRC 0
  394. +#define FIRMWARE_OFFSET_FILE_CRC    0x0c
  395.  
  396. +/* Offset ( in the firmware file's header ) to the file type */
  397. +#define FIRMWARE_OFFSET_FILE_TYPE   0x1f8
  398. +
  399. +/* Offset ( in the firmware file's header ) to the file model id */
  400. +#define FIRMWARE_OFFSET_FILE_MODEL  0x1fc
  401. +
  402.  /* Offset ( in the firmware file's header ) to the real data */
  403. -#define FIRMWARE_OFFSET_FILE_DATA 8
  404. +#define FIRMWARE_OFFSET_FILE_DATA   0x200
  405.  
  406.  /* #define USB_IPODSTYLE */
  407.  
  408. @@ -130,7 +136,7 @@
  409.  /* Define this if you have adjustable CPU frequency */
  410.  /*#define HAVE_ADJUSTABLE_CPU_FREQ Let's say we don't for now*/
  411.  
  412. -#define BOOTFILE_EXT "e200"
  413. +#define BOOTFILE_EXT "mi4"
  414.  #define BOOTFILE "rockbox." BOOTFILE_EXT
  415.  
  416.  #define ICODE_ATTR_TREMOR_NOT_MDCT
  417. Index: firmware/export/config-h10_5gb.h
  418. ===================================================================
  419. --- firmware/export/config-h10_5gb.h    (revision 12755)
  420. +++ firmware/export/config-h10_5gb.h    (working copy)
  421. @@ -118,13 +118,19 @@
  422.  #define HAVE_ATA_POWER_OFF
  423.  
  424.  /* Offset ( in the firmware file's header ) to the file length */
  425. -#define FIRMWARE_OFFSET_FILE_LENGTH 0
  426. +#define FIRMWARE_OFFSET_FILE_LENGTH 0x8
  427.  
  428.  /* Offset ( in the firmware file's header ) to the file CRC */
  429. -#define FIRMWARE_OFFSET_FILE_CRC 0
  430. +#define FIRMWARE_OFFSET_FILE_CRC    0x0c
  431.  
  432. +/* Offset ( in the firmware file's header ) to the file type */
  433. +#define FIRMWARE_OFFSET_FILE_TYPE   0x1f8
  434. +
  435. +/* Offset ( in the firmware file's header ) to the file model id */
  436. +#define FIRMWARE_OFFSET_FILE_MODEL  0x1fc
  437. +
  438.  /* Offset ( in the firmware file's header ) to the real data */
  439. -#define FIRMWARE_OFFSET_FILE_DATA 8
  440. +#define FIRMWARE_OFFSET_FILE_DATA   0x200
  441.  
  442.  /* #define USB_IPODSTYLE */
  443.  
  444. @@ -140,7 +146,7 @@
  445.  /* Define this if you have adjustable CPU frequency */
  446.  /*#define HAVE_ADJUSTABLE_CPU_FREQ*/
  447.  
  448. -#define BOOTFILE_EXT "h10"
  449. +#define BOOTFILE_EXT "mi4"
  450.  #define BOOTFILE "rockbox." BOOTFILE_EXT
  451.  
  452.  #define ICODE_ATTR_TREMOR_NOT_MDCT
  453. Index: firmware/target/arm/crt0-pp.S
  454. ===================================================================
  455. --- firmware/target/arm/crt0-pp.S       (revision 12755)
  456. +++ firmware/target/arm/crt0-pp.S       (working copy)
  457. @@ -54,7 +54,7 @@
  458.  
  459.      b      pad_skip
  460.  
  461. -.space 50*4 /* (more than enough) space for exception vectors */
  462. +.space 60*4 /* (more than enough) space for exception vectors */
  463.  
  464.  pad_skip:
  465.  #ifdef SANSA_E200

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right