1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2011 by amaury Pouly
12 * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
13 * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ****************************************************************************/
29 #include "gcc_extensions.h"
31 #include "backlight.h"
32 #include "button-target.h"
41 void main(void) NORETURN_ATTR
;
44 unsigned char* loadbuffer
;
46 void(*kernel_entry
)(void);
63 error(EATA
, ret
, true);
65 while(!disk_init(IF_MV(0)))
66 panicf("disk_init failed!");
68 while((ret
= disk_mount_all()) <= 0)
70 error(EDISK
, ret
, true);
73 printf("Loading firmware");
75 loadbuffer
= (unsigned char*)DRAM_ORIG
; /* DRAM */
76 buffer_size
= (int)(loadbuffer
+ DRAM_SIZE
- TTB_SIZE
);
78 while((ret
= load_firmware(loadbuffer
, BOOTFILE
, buffer_size
)) < 0)
80 error(EBOOTFILE
, ret
, true);
83 kernel_entry
= (void*) loadbuffer
;
84 //cpucache_invalidate();
87 printf("ERR: Failed to boot");