1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 by Greg White
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
36 #include "backlight.h"
37 #include "backlight-target.h"
43 #include "rbunicode.h"
45 #include "mmu-imx31.h"
46 #include "lcd-target.h"
47 #include "avic-imx31.h"
50 char version
[] = APPSVERSION
;
52 char basedir
[] = "/Content/0b00/00/"; /* Where files sent via MTP are stored */
54 int (*kernel_entry
)(void);
59 printf("Hello world!");
60 printf("Gigabeat S Rockbox Bootloader v.00000001");
62 printf("kernel init done");
71 printf("ata init done");
74 printf("disk init done");
76 rc
= disk_mount_all();
82 /* Look for the first valid firmware file */
83 struct dirent_uncached
* entry
;
86 dir
= opendir_uncached(basedir
);
87 while ((entry
= readdir_uncached(dir
)))
89 if (*entry
->d_name
!= '.')
91 snprintf(buf
, sizeof(buf
), "%s%s", basedir
, entry
->d_name
);
92 fd
= open(buf
, O_RDONLY
);
95 lseek(fd
, 4, SEEK_SET
);
96 rc
= read(fd
, model
, 4);
101 if (strcmp(model
, "gigs") == 0)
108 printf("Firmware file: %s", buf
);
109 printf("Loading firmware");
111 unsigned char *loadbuffer
= (unsigned char *)0x0;
112 int buffer_size
= 1024*1024;
114 rc
= load_firmware(loadbuffer
, buf
, buffer_size
);
120 kernel_entry
= (void*) loadbuffer
;