forked from len0rd/rockbox
Added H300 to the fwpatcher utility
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7969 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d2779e5f3a
commit
88a2a8a53a
5 changed files with 40 additions and 11 deletions
|
@ -44,7 +44,7 @@ $(TARGET): $(OBJS)
|
||||||
$(TARGETU): $(OBJSU)
|
$(TARGETU): $(OBJSU)
|
||||||
$(CC) $(LDFLAGS) $(OBJSU) -o $@
|
$(CC) $(LDFLAGS) $(OBJSU) -o $@
|
||||||
|
|
||||||
resource.o: resource.rc bootloader-h100.bin bootloader-h120.bin rockbox.ico
|
resource.o: resource.rc bootloader-h100.bin bootloader-h120.bin bootloader-h300.bin rockbox.ico
|
||||||
$(WINDRES) -v $< $@
|
$(WINDRES) -v $< $@
|
||||||
|
|
||||||
iriveru.o: iriver.c iriver.h
|
iriveru.o: iriver.c iriver.h
|
||||||
|
|
5
tools/fwpatcher/h300sums.h
Normal file
5
tools/fwpatcher/h300sums.h
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/* Checksums of firmwares for ihp_300 */
|
||||||
|
/* order: unpatched, patched */
|
||||||
|
|
||||||
|
/* 1.28eu */
|
||||||
|
{"0b2083d37f24899b82d21a14d2b38060", "937c0a745227281da62e41da78efcfe8"},
|
|
@ -56,15 +56,21 @@ static struct sumpairs h120pairs[] = {
|
||||||
#include "h120sums.h"
|
#include "h120sums.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* precalculated checksums for H320/H340 */
|
||||||
|
static struct sumpairs h300pairs[] = {
|
||||||
|
#include "h300sums.h"
|
||||||
|
};
|
||||||
|
|
||||||
HICON rbicon;
|
HICON rbicon;
|
||||||
HFONT deffont;
|
HFONT deffont;
|
||||||
HWND controls[CTL_NUM];
|
HWND controls[CTL_NUM];
|
||||||
|
|
||||||
/* begin mkboot.c excerpt */
|
/* begin mkboot.c excerpt */
|
||||||
|
|
||||||
unsigned char image[0x200000 + 0x220 + 0x200000/0x200];
|
unsigned char image[0x400000 + 0x220 + 0x400000/0x200];
|
||||||
|
|
||||||
int mkboot(TCHAR *infile, TCHAR *outfile, unsigned char *bldata, int bllen)
|
int mkboot(TCHAR *infile, TCHAR *outfile, unsigned char *bldata, int bllen,
|
||||||
|
int origin)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
|
@ -101,7 +107,7 @@ int mkboot(TCHAR *infile, TCHAR *outfile, unsigned char *bldata, int bllen)
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
memcpy(image + 0x220 + 0x1f0000, bldata, bllen);
|
memcpy(image + 0x220 + origin, bldata, bllen);
|
||||||
|
|
||||||
f = _tfopen(outfile, TEXT("wb"));
|
f = _tfopen(outfile, TEXT("wb"));
|
||||||
if(!f) {
|
if(!f) {
|
||||||
|
@ -110,13 +116,13 @@ int mkboot(TCHAR *infile, TCHAR *outfile, unsigned char *bldata, int bllen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch the reset vector to start the boot loader */
|
/* Patch the reset vector to start the boot loader */
|
||||||
image[0x220 + 4] = image[0x1f0000 + 0x220 + 4];
|
image[0x220 + 4] = image[origin + 0x220 + 4];
|
||||||
image[0x220 + 5] = image[0x1f0000 + 0x220 + 5];
|
image[0x220 + 5] = image[origin + 0x220 + 5];
|
||||||
image[0x220 + 6] = image[0x1f0000 + 0x220 + 6];
|
image[0x220 + 6] = image[origin + 0x220 + 6];
|
||||||
image[0x220 + 7] = image[0x1f0000 + 0x220 + 7];
|
image[0x220 + 7] = image[origin + 0x220 + 7];
|
||||||
|
|
||||||
/* This is the actual length of the binary, excluding all headers */
|
/* This is the actual length of the binary, excluding all headers */
|
||||||
actual_length = 0x1f0000 + bllen;
|
actual_length = origin + bllen;
|
||||||
|
|
||||||
/* Patch the ESTFBINR header */
|
/* Patch the ESTFBINR header */
|
||||||
image[0x20c] = (actual_length >> 24) & 0xff;
|
image[0x20c] = (actual_length >> 24) & 0xff;
|
||||||
|
@ -216,16 +222,24 @@ int PatchFirmware(int series, int table_entry)
|
||||||
DWORD blsize;
|
DWORD blsize;
|
||||||
int i;
|
int i;
|
||||||
struct sumpairs *sums;
|
struct sumpairs *sums;
|
||||||
|
int origin;
|
||||||
|
|
||||||
/* get pointer to the correct bootloader.bin */
|
/* get pointer to the correct bootloader.bin */
|
||||||
switch(series) {
|
switch(series) {
|
||||||
case 100:
|
case 100:
|
||||||
res = FindResource(NULL, MAKEINTRESOURCE(IDI_BOOTLOADERH100), TEXT("BIN"));
|
res = FindResource(NULL, MAKEINTRESOURCE(IDI_BOOTLOADERH100), TEXT("BIN"));
|
||||||
sums = &h100pairs[0];
|
sums = &h100pairs[0];
|
||||||
|
origin = 0x1f0000;
|
||||||
break;
|
break;
|
||||||
case 120:
|
case 120:
|
||||||
res = FindResource(NULL, MAKEINTRESOURCE(IDI_BOOTLOADERH120), TEXT("BIN"));
|
res = FindResource(NULL, MAKEINTRESOURCE(IDI_BOOTLOADERH120), TEXT("BIN"));
|
||||||
sums = &h120pairs[0];
|
sums = &h120pairs[0];
|
||||||
|
origin = 0x1f0000;
|
||||||
|
break;
|
||||||
|
case 300:
|
||||||
|
res = FindResource(NULL, MAKEINTRESOURCE(IDI_BOOTLOADERH300), TEXT("BIN"));
|
||||||
|
sums = &h300pairs[0];
|
||||||
|
origin = 0x3f0000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
resload = LoadResource(NULL, res);
|
resload = LoadResource(NULL, res);
|
||||||
|
@ -246,7 +260,7 @@ int PatchFirmware(int series, int table_entry)
|
||||||
TEXT("Error"), MB_ICONERROR);
|
TEXT("Error"), MB_ICONERROR);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (!mkboot(name1, name2, bootloader, blsize)) {
|
if (!mkboot(name1, name2, bootloader, blsize, origin)) {
|
||||||
MessageBox(NULL, TEXT("Error in patching"),
|
MessageBox(NULL, TEXT("Error in patching"),
|
||||||
TEXT("Error"), MB_ICONERROR);
|
TEXT("Error"), MB_ICONERROR);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -380,8 +394,16 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
else {
|
else {
|
||||||
table_entry = intable(md5sum_str, &h100pairs[0],
|
table_entry = intable(md5sum_str, &h100pairs[0],
|
||||||
sizeof(h100pairs)/sizeof(struct sumpairs));
|
sizeof(h100pairs)/sizeof(struct sumpairs));
|
||||||
if (table_entry >= 0)
|
if (table_entry >= 0) {
|
||||||
series = 100;
|
series = 100;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
table_entry =
|
||||||
|
intable(md5sum_str, &h300pairs[0],
|
||||||
|
sizeof(h300pairs)/sizeof(struct sumpairs));
|
||||||
|
if (table_entry >= 0)
|
||||||
|
series = 300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (series == 0) {
|
if (series == 0) {
|
||||||
MessageBox(NULL, TEXT("Unrecognised firmware"), TEXT("Fail"), MB_OK);
|
MessageBox(NULL, TEXT("Unrecognised firmware"), TEXT("Fail"), MB_OK);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#define IDI_RBICON 101
|
#define IDI_RBICON 101
|
||||||
#define IDI_BOOTLOADERH100 102
|
#define IDI_BOOTLOADERH100 102
|
||||||
#define IDI_BOOTLOADERH120 103
|
#define IDI_BOOTLOADERH120 103
|
||||||
|
#define IDI_BOOTLOADERH300 104
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
IDI_RBICON ICON "rockbox.ico"
|
IDI_RBICON ICON "rockbox.ico"
|
||||||
IDI_BOOTLOADERH100 BIN "bootloader-h100.bin"
|
IDI_BOOTLOADERH100 BIN "bootloader-h100.bin"
|
||||||
IDI_BOOTLOADERH120 BIN "bootloader-h120.bin"
|
IDI_BOOTLOADERH120 BIN "bootloader-h120.bin"
|
||||||
|
IDI_BOOTLOADERH300 BIN "bootloader-h300.bin"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue