diff options
Diffstat (limited to 'bootloader/gigabeat.c')
-rw-r--r-- | bootloader/gigabeat.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c index d82ee971d9..a466f9498f 100644 --- a/bootloader/gigabeat.c +++ b/bootloader/gigabeat.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "power.h" | 18 | #include "power.h" |
19 | #include "file.h" | 19 | #include "file.h" |
20 | #include "button-target.h" | 20 | #include "button-target.h" |
21 | #include "bootsplash-gigabeat.h" | ||
22 | 21 | ||
23 | extern void map_memory(void); | 22 | extern void map_memory(void); |
24 | 23 | ||
@@ -143,11 +142,23 @@ int load_rockbox(const char* file_name, unsigned char* buf, int buffer_size) | |||
143 | return len; | 142 | return len; |
144 | } | 143 | } |
145 | 144 | ||
145 | char buf[256]; | ||
146 | |||
147 | void display_instructions(void) | ||
148 | { | ||
149 | lcd_setfont(FONT_SYSFIXED); | ||
150 | lcd_puts(0, line++, "Hold MENU when booting for rescue mode."); | ||
151 | lcd_puts(0, line++, " \"VOL+\" button to restore original kernel"); | ||
152 | lcd_puts(0, line++, " \"A\" button to load original firmware"); | ||
153 | line++; | ||
154 | snprintf(buf, sizeof(buf), "FRAME %x TTB %x", FRAME, TTB_BASE); | ||
155 | lcd_puts(0, line++, buf); | ||
156 | lcd_update(); | ||
157 | } | ||
146 | 158 | ||
147 | void * main(void) | 159 | void * main(void) |
148 | { | 160 | { |
149 | int i; | 161 | int i; |
150 | char buf[256]; | ||
151 | struct partinfo* pinfo; | 162 | struct partinfo* pinfo; |
152 | unsigned short* identify_info; | 163 | unsigned short* identify_info; |
153 | unsigned char* loadbuffer; | 164 | unsigned char* loadbuffer; |
@@ -156,31 +167,25 @@ void * main(void) | |||
156 | int rc; | 167 | int rc; |
157 | int(*kernel_entry)(void); | 168 | int(*kernel_entry)(void); |
158 | 169 | ||
159 | lcd_init(); | ||
160 | bool show_bootsplash = true; | 170 | bool show_bootsplash = true; |
161 | 171 | ||
162 | if(GPGDAT & 2) | 172 | if(GPGDAT & 2) |
163 | show_bootsplash = false; | 173 | show_bootsplash = false; |
164 | 174 | ||
165 | if(!show_bootsplash) { | 175 | if(!show_bootsplash) { |
166 | lcd_setfont(FONT_SYSFIXED); | 176 | lcd_init(); |
167 | lcd_puts(0, line++, "Hold MENU when booting for rescue mode."); | 177 | display_instructions(); |
168 | lcd_puts(0, line++, " \"VOL+\" button to restore original kernel"); | ||
169 | lcd_puts(0, line++, " \"A\" button to load original firmware"); | ||
170 | line++; | ||
171 | snprintf(buf, sizeof(buf), "FRAME %x TTB %x", FRAME, TTB_BASE); | ||
172 | lcd_puts(0, line++, buf); | ||
173 | lcd_update(); | ||
174 | sleep(2*HZ); | 178 | sleep(2*HZ); |
175 | } else | 179 | } |
176 | memcpy(FRAME, bootsplash, LCD_WIDTH*LCD_HEIGHT*2); | ||
177 | if(GPGDAT & 2) { | 180 | if(GPGDAT & 2) { |
181 | lcd_init(); | ||
178 | lcd_puts(0, line++, "Entering rescue mode.."); | 182 | lcd_puts(0, line++, "Entering rescue mode.."); |
179 | lcd_update(); | 183 | lcd_update(); |
180 | go_usb_mode(); | 184 | go_usb_mode(); |
181 | while(1); | 185 | while(1); |
182 | } | 186 | } |
183 | if(GPGDAT & 0x10) { | 187 | if(GPGDAT & 0x10) { |
188 | lcd_init(); | ||
184 | load_original = true; | 189 | load_original = true; |
185 | lcd_puts(0, line++, "Loading original firmware..."); | 190 | lcd_puts(0, line++, "Loading original firmware..."); |
186 | lcd_update(); | 191 | lcd_update(); |
@@ -192,6 +197,20 @@ void * main(void) | |||
192 | snprintf(buf, sizeof(buf), "disk_mount_all: %d", i); | 197 | snprintf(buf, sizeof(buf), "disk_mount_all: %d", i); |
193 | lcd_puts(0, line++, buf); | 198 | lcd_puts(0, line++, buf); |
194 | } | 199 | } |
200 | if(show_bootsplash) { | ||
201 | int fd = open("/bootsplash.raw", O_RDONLY); | ||
202 | if(fd < 0) { | ||
203 | show_bootsplash = false; | ||
204 | lcd_init(); | ||
205 | display_instructions(); | ||
206 | } | ||
207 | else { | ||
208 | read(fd, lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT*2); | ||
209 | close(fd); | ||
210 | lcd_update(); | ||
211 | lcd_init(); | ||
212 | } | ||
213 | } | ||
195 | /* hold VOL+ to enter rescue mode to copy old image */ | 214 | /* hold VOL+ to enter rescue mode to copy old image */ |
196 | /* needs to be after ata_init and disk_mount_all */ | 215 | /* needs to be after ata_init and disk_mount_all */ |
197 | if(GPGDAT & 4) { | 216 | if(GPGDAT & 4) { |