* Make the Gigabeat S bootloader a bit more interesting: it looks for the first firmware file it finds on the second partition and attempts to load it. Loading fails to get past the splash screen though.

* Make the main binary compile.
To send a firmware file, use mtp-sendfile. To update you'll need to delete the previous firmware file, as files are named sequentially and the first one is loaded.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15836 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-11-27 15:40:29 +00:00
parent 1dff29a9d6
commit c2ca8c710c
5 changed files with 51 additions and 12 deletions

View file

@ -28,6 +28,7 @@
#include "kernel.h"
#include "thread.h"
#include "ata.h"
#include "dir.h"
#include "fat.h"
#include "disk.h"
#include "font.h"
@ -47,6 +48,10 @@
#include <stdarg.h>
char version[] = APPSVERSION;
char buf[MAX_PATH];
char basedir[] = "/Content/0b00/00/"; /* Where files sent via MTP are stored */
char model[5];
int (*kernel_entry)(void);
void main(void)
{
@ -54,6 +59,7 @@ void main(void)
printf("Hello world!");
printf("Gigabeat S Rockbox Bootloader v.00000001");
kernel_init();
printf("kernel init done");
int rc;
rc = ata_init();
@ -62,8 +68,10 @@ void main(void)
reset_screen();
error(EATA, rc);
}
printf("ata init done");
disk_init();
printf("disk init done");
rc = disk_mount_all();
if (rc<=0)
@ -71,24 +79,48 @@ void main(void)
error(EDISK,rc);
}
printf("Congratulations!");
while(1);
/* Look for the first valid firmware file */
struct dirent_uncached* entry;
DIR_UNCACHED* dir;
int fd;
dir = opendir_uncached(basedir);
while ((entry = readdir_uncached(dir)))
{
if (*entry->d_name != '.')
{
snprintf(buf, sizeof(buf), "%s%s", basedir, entry->d_name);
fd = open(buf, O_RDONLY);
if (fd >= 0)
{
lseek(fd, 4, SEEK_SET);
rc = read(fd, model, 4);
close(fd);
if (rc == 4)
{
model[4] = 0;
if (strcmp(model, "gigs") == 0)
break;
}
}
}
}
#if 0
printf("Firmware file: %s", buf);
printf("Loading firmware");
loadbuffer = (unsigned char*) 0x100;
buffer_size = (unsigned char*)0x400000 - loadbuffer;
unsigned char *loadbuffer = (unsigned char *)0x88000000;
int buffer_size = 1024*1024;
rc = load_firmware(loadbuffer, BOOTFILE, buffer_size);
rc = load_firmware(loadbuffer, buf, buffer_size);
if(rc < 0)
error(EBOOTFILE, rc);
error(buf, rc);
if (rc == EOK)
{
kernel_entry = (void*) loadbuffer;
rc = kernel_entry();
}
#endif
while (1);
}

View file

@ -70,7 +70,7 @@ INPUT(target/sh/crt0.o)
#define IRAMORIG 0x00000000
#define IRAMSIZE 0x4000
#elif CONFIG_CPU==IMX31L
#define DRAMORIG (0x80000000 + STUBOFFSET)
#define DRAMORIG (0x88000000 + STUBOFFSET)
#define IRAMORIG 0x1FFFC000
#define IRAMSIZE 0x4000
#else

View file

@ -150,7 +150,12 @@ int disk_mount(int drive)
/* The Elio's hard drive has no partition table and probing for partitions causes
Rockbox to crash - so we temporarily disable the probing until we fix the
real problem. */
for (i=0; volume != -1 && i<4; i++)
#ifdef TOSHIBA_GIGABEAT_S
i = 1; /* For the Gigabeat S, we mount the second partition */
#else
i = 0;
#endif
for (i; volume != -1 && i<4; i++)
{
#ifdef MAX_LOG_SECTOR_SIZE
int j;

View file

@ -6,7 +6,7 @@
#define TOSHIBA_GIGABEAT_S 1
/* For Rolo and boot loader */
#define MODEL_NUMBER 19
#define MODEL_NUMBER 21
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP

View file

@ -30,6 +30,8 @@ static inline void udelay(unsigned int usecs)
while (EPITCNT1 > stop);
}
#define __dbg_hw_info(...) 0
#define __dbg_ports(...) 0
#define HAVE_INVALIDATE_ICACHE
static inline void invalidate_icache(void)