summaryrefslogtreecommitdiffstats
path: root/flash/extract
diff options
context:
space:
mode:
Diffstat (limited to 'flash/extract')
-rw-r--r--flash/extract/README5
-rw-r--r--flash/extract/extract.c147
-rw-r--r--flash/extract/extract.dsp100
3 files changed, 0 insertions, 252 deletions
diff --git a/flash/extract/README b/flash/extract/README
deleted file mode 100644
index 6f1934906e..0000000000
--- a/flash/extract/README
+++ /dev/null
@@ -1,5 +0,0 @@
-(c) 2003 by Jörg Hohensohn
-
-This tool extracts the firmware image out of an original Archos ROM dump,
-like created with the Rockbox debug->dump feature.
-The extracted image can then be used to compose a dual-boot firmware.
diff --git a/flash/extract/extract.c b/flash/extract/extract.c
deleted file mode 100644
index 2389f9290e..0000000000
--- a/flash/extract/extract.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2003 by Jörg Hohensohn
- *
- * Tool to extract the scrambled image out of an Archos flash ROM dump
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#define UINT8 unsigned char
-#define UINT16 unsigned short
-#define UINT32 unsigned long
-
-#define IMAGE_HEADER 0x6000 // a 32 byte header in front of the software image
-#define IMAGE_START 0x6020 // software image position in Flash
-
-
-// place a 32 bit value into memory, big endian
-void Write32(UINT8* pByte, UINT32 value)
-{
- pByte[0] = (UINT8)(value >> 24);
- pByte[1] = (UINT8)(value >> 16);
- pByte[2] = (UINT8)(value >> 8);
- pByte[3] = (UINT8)(value);
-}
-
-
-// read a 32 bit value from memory, big endian
-UINT32 Read32(UINT8* pByte)
-{
- UINT32 value = 0;
-
- value |= (UINT32)pByte[0] << 24;
- value |= (UINT32)pByte[1] << 16;
- value |= (UINT32)pByte[2] << 8;
- value |= (UINT32)pByte[3];
-
- return value;
-}
-
-
-// entry point
-int main(int argc, char* argv[])
-{
- FILE* pInFile;
- FILE* pOutFile;
- UINT8 aHeader[6];
- UINT8 aImage[256*1024];
- UINT32 i;
- UINT32 uiSize, uiStart;
- UINT16 usChecksum = 0;
-
- if (argc < 2)
- {
- printf("Extract the software image out of an original Archos Flash ROM dump.\n");
- printf("Result is a scrambled file, use the descramble tool to get the binary,\n");
- printf(" always without the -fm option, even if processing an FM software.\n\n");
- printf("Usage: extract <flash dump file> <output file>\n");
- printf("Example: extract internal_rom_2000000-203FFFF.bin archos.ajz\n");
- exit(0);
- }
-
- pInFile = fopen(argv[1], "rb");
- if (pInFile == NULL)
- {
- printf("Error opening input file %s\n", argv[1]);
- exit(1);
- }
-
- if (fread(aImage, 1, sizeof(aImage), pInFile) != sizeof(aImage))
- {
- printf("Error reading input file %s, must be 256kB in size.\n", argv[1]);
- fclose(pInFile);
- exit(2);
- }
- fclose(pInFile);
-
- // find out about the type
- uiStart = Read32(aImage + 8);
- uiSize = Read32(aImage + 12); // booted ROM image
- if (uiStart == 0x02000100 && uiSize > 20000)
- { // Player has no loader, starts directly with the image
- uiStart = 0x0100;
- }
- else
- { // Recorder / FM / V2 Recorder
- uiStart = IMAGE_START;
- uiSize = Read32(aImage + IMAGE_HEADER + 4); // size record of header
- }
-
- // sanity check
- if (uiSize > sizeof(aImage) - uiStart || uiSize < 40000)
- {
- printf("Error: Impossible image size %d bytes.\n", uiSize);
- exit(3);
- }
-
- // generate checksum
- for (i=0; i<uiSize; i++)
- {
- UINT8 byte;
- byte = aImage[uiStart + i];
- byte = ~((byte >> 1) | ((byte << 7) & 0x80)); /* poor man's ROR */
- usChecksum += byte;
- }
-
- // make header
- Write32(aHeader + 2, usChecksum); // checksum in 5th and 6th byte
- Write32(aHeader, uiSize); // size in first 4 bytes
-
- pOutFile = fopen(argv[2], "wb");
- if (pOutFile == NULL)
- {
- printf("Error opening output file %s\n", argv[2]);
- exit(4);
- }
-
- if (fwrite(aHeader, 1, sizeof(aHeader), pOutFile) != sizeof(aHeader)
- || fwrite(aImage + uiStart, 1, uiSize, pOutFile) != uiSize)
- {
- printf("Write error\n");
- fclose(pOutFile);
- exit(5);
- }
-
- fclose(pOutFile);
-
- return 0;
-}
diff --git a/flash/extract/extract.dsp b/flash/extract/extract.dsp
deleted file mode 100644
index e10281a829..0000000000
--- a/flash/extract/extract.dsp
+++ /dev/null
@@ -1,100 +0,0 @@
-# Microsoft Developer Studio Project File - Name="extract" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=extract - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "extract.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "extract.mak" CFG="extract - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "extract - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "extract - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "extract - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "extract - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "extract - Win32 Release"
-# Name "extract - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\extract.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project