forked from len0rd/rockbox
Onda VX747: add dual-boot capability + make it possible to permanently 'stick' Rockbox to your DAP
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21919 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1dc0c46d93
commit
cf9935d636
8 changed files with 146 additions and 24 deletions
|
@ -44,6 +44,7 @@ meizu_m6sp.c
|
||||||
meizu_m3.c
|
meizu_m3.c
|
||||||
#elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777)
|
#elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777)
|
||||||
ondavx747.c
|
ondavx747.c
|
||||||
|
show_logo.c
|
||||||
#elif defined(CREATIVE_ZVx)
|
#elif defined(CREATIVE_ZVx)
|
||||||
creativezvm.c
|
creativezvm.c
|
||||||
#elif CONFIG_CPU==AS3525
|
#elif CONFIG_CPU==AS3525
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
#if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \
|
#if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \
|
||||||
|| defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) \
|
|| defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) \
|
||||||
|| defined(PHILIPS_SA9200) || (CONFIG_CPU == AS3525) || defined(COWON_D2) \
|
|| defined(PHILIPS_SA9200) || (CONFIG_CPU == AS3525) || defined(COWON_D2) \
|
||||||
|| defined(MROBE_100) || defined(PHILIPS_HDD1630) || defined(MROBE_500)
|
|| defined(MROBE_100) || defined(PHILIPS_HDD1630) || defined(MROBE_500) \
|
||||||
|
|| defined(ONDA_VX747)
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
#else
|
#else
|
||||||
bool verbose = true;
|
bool verbose = true;
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
|
|
||||||
|
extern int show_logo(void);
|
||||||
|
|
||||||
static void show_splash(int timeout, const char *msg)
|
static void show_splash(int timeout, const char *msg)
|
||||||
{
|
{
|
||||||
reset_screen();
|
reset_screen();
|
||||||
|
@ -84,9 +86,52 @@ static void usb_mode(void)
|
||||||
reset_screen();
|
reset_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void boot_of(void)
|
static int boot_of(void)
|
||||||
{
|
{
|
||||||
/* Do nothing atm */
|
int fd, rc, len, i, checksum = 0;
|
||||||
|
void (*kernel_entry)(int, void*, void*);
|
||||||
|
|
||||||
|
/* TODO: get this from the NAND flash instead of SD */
|
||||||
|
fd = open("/ccpmp.bin", O_RDONLY);
|
||||||
|
if(fd < 0)
|
||||||
|
return EFILE_NOT_FOUND;
|
||||||
|
|
||||||
|
lseek(fd, 4, SEEK_SET);
|
||||||
|
rc = read(fd, (char*)&len, 4); /* CPU is LE */
|
||||||
|
if(rc < 4)
|
||||||
|
return EREAD_IMAGE_FAILED;
|
||||||
|
|
||||||
|
len += 8;
|
||||||
|
printf("Reading %d bytes...", len);
|
||||||
|
|
||||||
|
lseek(fd, 0, SEEK_SET);
|
||||||
|
rc = read(fd, (void*)0x80004000, len);
|
||||||
|
if(rc < len)
|
||||||
|
return EREAD_IMAGE_FAILED;
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
for(i=0; i<len; i++)
|
||||||
|
checksum += ((unsigned char*)0x80004000)[i];
|
||||||
|
|
||||||
|
*((unsigned int*)0x80004000) = checksum;
|
||||||
|
|
||||||
|
printf("Starting the OF...");
|
||||||
|
|
||||||
|
/* OF requires all clocks on */
|
||||||
|
__cpm_start_all();
|
||||||
|
|
||||||
|
disable_interrupt();
|
||||||
|
__dcache_writeback_all();
|
||||||
|
__icache_invalidate_all();
|
||||||
|
|
||||||
|
for(i=8000; i>0; i--)
|
||||||
|
asm volatile("nop\n");
|
||||||
|
|
||||||
|
kernel_entry = (void*) 0x80004008;
|
||||||
|
kernel_entry(0, "Jan 10 2008", "15:34:42"); /* Reversed from the SPL */
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
@ -102,12 +147,9 @@ int main(void)
|
||||||
font_init();
|
font_init();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
button_init();
|
button_init();
|
||||||
adc_init();
|
|
||||||
backlight_init();
|
backlight_init();
|
||||||
|
|
||||||
reset_screen();
|
show_logo();
|
||||||
printf(MODEL_NAME" Rockbox Bootloader");
|
|
||||||
printf("Version "APPSVERSION);
|
|
||||||
|
|
||||||
rc = storage_init();
|
rc = storage_init();
|
||||||
if(rc)
|
if(rc)
|
||||||
|
@ -119,15 +161,28 @@ int main(void)
|
||||||
rc = button_read_device();
|
rc = button_read_device();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(rc)
|
||||||
|
verbose = true;
|
||||||
|
|
||||||
if(rc & BUTTON_VOL_UP)
|
if(rc & BUTTON_VOL_UP)
|
||||||
usb_mode();
|
usb_mode();
|
||||||
else if(button_hold())
|
|
||||||
boot_of();
|
if(verbose)
|
||||||
|
reset_screen();
|
||||||
|
printf(MODEL_NAME" Rockbox Bootloader");
|
||||||
|
printf("Version "APPSVERSION);
|
||||||
|
|
||||||
rc = disk_mount_all();
|
rc = disk_mount_all();
|
||||||
if (rc <= 0)
|
if (rc <= 0)
|
||||||
error(EDISK,rc);
|
error(EDISK,rc);
|
||||||
|
|
||||||
|
if(button_hold())
|
||||||
|
{
|
||||||
|
rc = boot_of();
|
||||||
|
if(rc < 0)
|
||||||
|
printf("Error: %s", strerror(rc));
|
||||||
|
}
|
||||||
|
|
||||||
printf("Loading firmware");
|
printf("Loading firmware");
|
||||||
rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000);
|
rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000);
|
||||||
if(rc < 0)
|
if(rc < 0)
|
||||||
|
|
|
@ -81,8 +81,13 @@
|
||||||
/* LCD dimensions */
|
/* LCD dimensions */
|
||||||
#define CONFIG_LCD LCD_ONDAVX747
|
#define CONFIG_LCD LCD_ONDAVX747
|
||||||
|
|
||||||
|
#ifdef BOOTLOADER /* OF requires landscape */
|
||||||
|
#define LCD_WIDTH 400
|
||||||
|
#define LCD_HEIGHT 240
|
||||||
|
#else
|
||||||
#define LCD_WIDTH 240
|
#define LCD_WIDTH 240
|
||||||
#define LCD_HEIGHT 400
|
#define LCD_HEIGHT 400
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LCD_DEPTH 16 /* 16bit colours */
|
#define LCD_DEPTH 16 /* 16bit colours */
|
||||||
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
||||||
|
|
|
@ -8,7 +8,7 @@ STARTUP(target/mips/ingenic_jz47xx/crt0.o)
|
||||||
|
|
||||||
#define DRAMSIZE ((MEMORYSIZE-4) * 0x100000)
|
#define DRAMSIZE ((MEMORYSIZE-4) * 0x100000)
|
||||||
|
|
||||||
#define DRAMORIG 0x80404000
|
#define DRAMORIG 0x80E04000
|
||||||
#define IRAMORIG 0x80000000
|
#define IRAMORIG 0x80000000
|
||||||
#define IRAMSIZE 16K
|
#define IRAMSIZE 16K
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,12 @@
|
||||||
.set noat
|
.set noat
|
||||||
|
|
||||||
#ifdef BOOTLOADER
|
#ifdef BOOTLOADER
|
||||||
/* These will get filled in scramble */
|
/* These will get filled in by scramble */
|
||||||
.word 0 /* Unknown */
|
.word 0 /* Empty */
|
||||||
.word 0 /* Filesize */
|
.word 0 /* Filesize */
|
||||||
|
|
||||||
/* Relocate bootloader */
|
/* Relocate bootloader */
|
||||||
la t0, (_loadaddress-0x400000)
|
la t0, (_loadaddress-0xE00000)
|
||||||
la t1, _loadaddress
|
la t1, _loadaddress
|
||||||
la t2, _bootend
|
la t2, _bootend
|
||||||
_relocate_loop:
|
_relocate_loop:
|
||||||
|
|
16
tools/configure
vendored
16
tools/configure
vendored
|
@ -2105,8 +2105,8 @@ fi
|
||||||
plugins="yes"
|
plugins="yes"
|
||||||
swcodec="yes"
|
swcodec="yes"
|
||||||
toolset=$genericbitmaptools
|
toolset=$genericbitmaptools
|
||||||
boottool="cp"
|
boottool="$rootdir/tools/scramble -ccpmp"
|
||||||
bootoutput="rockboot.vx747"
|
bootoutput="ccpmp.bin"
|
||||||
# architecture, manufacturer and model for the target-tree build
|
# architecture, manufacturer and model for the target-tree build
|
||||||
t_cpu="mips"
|
t_cpu="mips"
|
||||||
t_manufacturer="ingenic_jz47xx"
|
t_manufacturer="ingenic_jz47xx"
|
||||||
|
@ -2127,8 +2127,8 @@ fi
|
||||||
plugins="" #FIXME
|
plugins="" #FIXME
|
||||||
swcodec="yes"
|
swcodec="yes"
|
||||||
toolset=$genericbitmaptools
|
toolset=$genericbitmaptools
|
||||||
boottool="cp"
|
boottool="$rootdir/tools/scramble -ccpmp"
|
||||||
bootoutput="rockboot.vx767"
|
bootoutput="ccpmp.bin"
|
||||||
# architecture, manufacturer and model for the target-tree build
|
# architecture, manufacturer and model for the target-tree build
|
||||||
t_cpu="mips"
|
t_cpu="mips"
|
||||||
t_manufacturer="ingenic_jz47xx"
|
t_manufacturer="ingenic_jz47xx"
|
||||||
|
@ -2149,8 +2149,8 @@ fi
|
||||||
plugins="yes"
|
plugins="yes"
|
||||||
swcodec="yes"
|
swcodec="yes"
|
||||||
toolset=$genericbitmaptools
|
toolset=$genericbitmaptools
|
||||||
boottool="cp"
|
boottool="$rootdir/tools/scramble -ccpmp"
|
||||||
bootoutput="rockboot.vx747p"
|
bootoutput="ccpmp.bin"
|
||||||
# architecture, manufacturer and model for the target-tree build
|
# architecture, manufacturer and model for the target-tree build
|
||||||
t_cpu="mips"
|
t_cpu="mips"
|
||||||
t_manufacturer="ingenic_jz47xx"
|
t_manufacturer="ingenic_jz47xx"
|
||||||
|
@ -2171,8 +2171,8 @@ fi
|
||||||
plugins="" #TODO
|
plugins="" #TODO
|
||||||
swcodec="yes"
|
swcodec="yes"
|
||||||
toolset=$genericbitmaptools
|
toolset=$genericbitmaptools
|
||||||
boottool="cp"
|
boottool="$rootdir/tools/scramble -ccpmp"
|
||||||
bootoutput="rockboot.vx777"
|
bootoutput="ccpmp.bin"
|
||||||
# architecture, manufacturer and model for the target-tree build
|
# architecture, manufacturer and model for the target-tree build
|
||||||
t_cpu="mips"
|
t_cpu="mips"
|
||||||
t_manufacturer="ingenic_jz47xx"
|
t_manufacturer="ingenic_jz47xx"
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
int iaudio_encode(char *iname, char *oname, char *idstring);
|
int iaudio_encode(char *iname, char *oname, char *idstring);
|
||||||
int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc);
|
int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc);
|
||||||
|
int ccpmp_encode(char *iname, char *oname);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -375,8 +376,7 @@ int main (int argc, char** argv)
|
||||||
oname = argv[3];
|
oname = argv[3];
|
||||||
return ipod_encode(iname, oname, 3, true); /* Firmware image v3 */
|
return ipod_encode(iname, oname, 3, true); /* Firmware image v3 */
|
||||||
}
|
}
|
||||||
else if(!strncmp(argv[1], "-creative=", 10))
|
else if(!strncmp(argv[1], "-creative=", 10)) {
|
||||||
{
|
|
||||||
if(!strcmp(argv[2], "-no-ciff"))
|
if(!strcmp(argv[2], "-no-ciff"))
|
||||||
{
|
{
|
||||||
creative_enable_ciff = false;
|
creative_enable_ciff = false;
|
||||||
|
@ -405,6 +405,11 @@ int main (int argc, char** argv)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(!strcmp(argv[1], "-ccpmp")) {
|
||||||
|
iname = argv[2];
|
||||||
|
oname = argv[3];
|
||||||
|
return ccpmp_encode(iname, oname);
|
||||||
|
}
|
||||||
else if(!strncmp(argv[1], "-mi4", 4)) {
|
else if(!strncmp(argv[1], "-mi4", 4)) {
|
||||||
int mi4magic;
|
int mi4magic;
|
||||||
char model[4] = "";
|
char model[4] = "";
|
||||||
|
@ -824,3 +829,58 @@ int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CCPMP_SIZE 0x500000
|
||||||
|
int ccpmp_encode(char *iname, char *oname)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
int length;
|
||||||
|
FILE *file;
|
||||||
|
unsigned char *outbuf;
|
||||||
|
|
||||||
|
file = fopen(iname, "rb");
|
||||||
|
if (!file) {
|
||||||
|
perror(iname);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fseek(file,0,SEEK_END);
|
||||||
|
length = ftell(file);
|
||||||
|
|
||||||
|
fseek(file,0,SEEK_SET);
|
||||||
|
|
||||||
|
outbuf = malloc(CCPMP_SIZE);
|
||||||
|
|
||||||
|
if ( !outbuf ) {
|
||||||
|
printf("out of memory!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = fread(outbuf, 1, length, file);
|
||||||
|
if(len < (size_t)length) {
|
||||||
|
perror(iname);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
/* Clear the tail area to 0xFF */
|
||||||
|
memset(&outbuf[length], 0xFF, CCPMP_SIZE - length);
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
int2le(length, &outbuf[0x4]);
|
||||||
|
|
||||||
|
file = fopen(oname, "wb");
|
||||||
|
if (!file) {
|
||||||
|
perror(oname);
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = fwrite(outbuf, 1, CCPMP_SIZE, file);
|
||||||
|
if(len < (size_t)length) {
|
||||||
|
perror(oname);
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue