Rockbox Development > New Ports

iriver x20

<< < (2/4) > >>

haden:
Hey guys.. ive just found this link where u can download the x20 firmware.. not sure if its the original stuff though.. will have to go through it and figure out how to manually load it to the x20..

http://nyaochi.sakura.ne.jp/iriverupdate/

keenox:
hello! i have an x20 and i've read the tcc8200 section on this site. i downloaded the hash calculator and modified it in c++ to automatically write the hashes into the file. i modified the version of the firmware and applied the hashes, but the player didn't accept the file.

here's the modified code (most of it is taken from this site, i only did the part for file writing):


--- Code: ---/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Telechips firmware checksum support for scramble
 *
 * Copyright (C) 2007 Dave Chapman
 *
 * Thanks to Hein-Pieter van Braam for his work in identifying the
 * CRC algorithm used.
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cstdio>

using namespace std;

static uint32_t crctable[256];

/* Simple implementation of a function to reverse the bottom n bits in x */
static uint32_t bitreverse(uint32_t x,int n)
{
    int i;
    uint32_t mask = 1<<(n-1);
    uint32_t res = 0;

    for (i=0; i<n; i++)
    {
        if (x & 1)
            res |=  mask;

        x >>= 1;
        mask >>= 1;
    }
    return res;
}

/* Generate a lookup table for a reverse CRC32 */
static void gentable(uint32_t poly)
{
    int i;
    uint32_t r;
    uint32_t index;

    for (index = 0; index < 256; index++)
    {
        r = bitreverse(index,8) << 24;
        for (i=0; i<8; i++)
        {
            if (r & (1 << 31))
                r = (r << 1) ^ poly;
            else
                r<<=1;
        }
        crctable[index] = bitreverse(r,32);
    }
}

/* Perform a reverse CRC32 */
static uint32_t calc_crc(unsigned char *message, int size)
{
    uint32_t crc = 0;
    int i;

    for (i=0; i < size; i++){
        if ((i < 0x10) || (i >= 0x18)) {
            crc = crctable[((crc ^ (message[i])) & 0xff)] ^ (crc >> 8);
        }
    }

    return crc;
}

/* Endian-safe functions to read/write a 32-bit little-endian integer */

static uint32_t get_uint32le(unsigned char* p)
{
    return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}

static void put_uint32le(unsigned char* p, uint32_t x)
{
    p[0] = x & 0xff;
    p[1] = (x >> 8) & 0xff;
    p[2] = (x >> 16) & 0xff;
    p[3] = (x >> 24) & 0xff;
}

/* A simple checksum - seems to be used by the TCC76x firmwares */
void telechips_encode_sum(unsigned char* buf, int length)
{
    uint32_t sum;
    int i;

    /* Set checksum field to 0 */
    put_uint32le(buf + 0x10, 0);

    /* Perform a simple sum, treating the file as a series of 32-bit
       little-endian integers */
    sum = 0;
    for (i=0; i < length; i+=4) {
        sum += get_uint32le(buf + i);
    }
    /* Negate the sum - this means that the sum of the whole file
       (including this value) will be equal to zero */
    sum = -sum;

    /* Set the checksum field */
    put_uint32le(buf + 0x10, sum);
}


/* Two reverse CRC32 checksums - seems to be used by the TCC77x firmwares */
void telechips_encode_crc(unsigned char* buf, int length)
{
    uint32_t crc1,crc2;

    /* Generate the CRC table */
    gentable(0x8001801BL);

    /* Clear the existing CRC values */
    put_uint32le(buf+0x10, 0);
    put_uint32le(buf+0x18, 0);

    /* Write the length */
    put_uint32le(buf+0x1c, length);

    /* Calculate the first CRC - over the entire file */
    crc1 = calc_crc(buf, length);

    /* What happens next depends on the filesize */
    if (length >= 128*1024)
    {
        put_uint32le(buf+0x18, crc1);

        crc2 = calc_crc(buf, 128*1024);
        put_uint32le(buf+0x10, crc2);
    } else {
        put_uint32le(buf+0x10, crc1);
    }
}

int main()
{
 FILE *fin,*fout;
 fin = fopen("X20.test","rb");
 fout = fopen("X20.bak","wb");
 unsigned char *F=new unsigned char[3000000];
 long i=0;
 while (!feof(fin))
 {
  F[i]=getc(fin);
  i++; 
 }
 telechips_encode_crc(F,2626096); //that number is the length of the file in bytes
 fwrite(F,1,2626096,fout);
 cout<<F;cin.get();
 fclose(fin);
 return 0;
}

--- End code ---

do you know what other means of checking the firmware does the x20 have? i'll scan the pcb of my player, as i've seen in the "how to start porting" section.

EDIT:
I'm F@#ING HAPPY RIGHT NOW! I managed to extract the firmware from the Insignia Updater v.1.105. With little modification and rehasing i managed to flash my X20. I think this is an important step. Here are some photos with the X20 with Insignia firmware.


By keenox, shot with DSC-P150 at 2008-04-25





LE:played a little with it... menus work fine, images as well. but there's one big problem. no sound... not on speakers, not on heaphones, not even in line output... oh... and i upgraded to insignia 1.200

LLE: switched back to iriver 1.07 firmware, as the insignia was of no use because of the sound problems. i got the taste of it and tempered the iriver firmware a little just to see if it works...

haden:
hey keenox.. glad to see that theres someone active here again..  could you explain the steps how you got about extracting the firmware and flashing it with  the new firmware?
 
I'm really keen on getting the rockbox to the x20.. i see lots of scope for this player.


 

keenox:
hey, i downloaded the insignia firmware updater and opened it with hex workshop. i looked for the first and last parts from the iriver firmware and extracted all in between to another file. then i copied the header from the iriver firmware and fixed the end of the file to look the same as the iriver firmware. another way is to download the rom file of the insignia firmware (search with google) and do the same things. it's actually simpler using the rom file because it's very similar to the original x20 firmware. then use the code i pasted in the post above using the desired filenames and the correct filesize in bytes to write the CRC sums so that the player will accept the firmware. then copy the file to the root of the player and disconnect it. it will upgrade the f/w in the normal way and when you will power it on you will have the insignia ui. to turn it back to x20 you have to follow a similar procedure using the original iriver f/w and the header and eof from the insignia rom file.

if you want some more details pm me and we shall chat on irc or yahoo messenger.

IF SOMEONE TRIES THIS I'M NOT RESPONSIBLE FOR ANY DAMAGE TO YOUR PLAYER.

i bricked my player trying to flash it using another player's firmware. now i had it replaced for a new one.

Chronon:
There's a wiki page for this port here:
http://www.rockbox.org/twiki/bin/view/Main/IriverX20Port

I pruned some posts in the interest of keeping discussion on topic.



*Oops.  :p

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version