diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-09-09 11:20:20 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-09-09 11:20:20 +0000 |
commit | 9db22efd1fe133d7477fb7ceb6ded745dc889cdc (patch) | |
tree | 3618bcafee34be52d6bac212daf5e19ab843cadd | |
parent | c9f6858de83ec5a15e4d4bdf78185cbca231e5bf (diff) | |
download | rockbox-9db22efd1fe133d7477fb7ceb6ded745dc889cdc.tar.gz rockbox-9db22efd1fe133d7477fb7ceb6ded745dc889cdc.zip |
Firmware "hacker" code for the e200r install so the full bootloader rom doesnt need to be written.
Requires a custom version of e200tool which isnt available yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14654 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/Makefile | 4 | ||||
-rw-r--r-- | bootloader/SOURCES | 4 | ||||
-rw-r--r-- | bootloader/main-e200r-installer.c | 119 | ||||
-rw-r--r-- | firmware/boot.lds | 2 | ||||
-rw-r--r-- | firmware/export/config-e200.h | 3 | ||||
-rw-r--r-- | firmware/target/arm/crt0-pp-bl.S | 3 | ||||
-rwxr-xr-x | tools/configure | 10 |
7 files changed, 142 insertions, 3 deletions
diff --git a/bootloader/Makefile b/bootloader/Makefile index 342cdc5861..4c63cfea18 100644 --- a/bootloader/Makefile +++ b/bootloader/Makefile | |||
@@ -18,7 +18,7 @@ ifdef DEBUG | |||
18 | CFLAGS += -g | 18 | CFLAGS += -g |
19 | endif | 19 | endif |
20 | 20 | ||
21 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - ) | 21 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) |
22 | DIRS = . | 22 | DIRS = . |
23 | 23 | ||
24 | ifdef APPEXTRA | 24 | ifdef APPEXTRA |
@@ -50,7 +50,7 @@ endif | |||
50 | dep: $(DEPFILE) | 50 | dep: $(DEPFILE) |
51 | 51 | ||
52 | $(LINKFILE): $(LDS) | 52 | $(LINKFILE): $(LDS) |
53 | $(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@ | 53 | $(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) $(DEFINES) -E -P $(ROMBUILD) - >$@ |
54 | 54 | ||
55 | $(MAXOUTFILE): | 55 | $(MAXOUTFILE): |
56 | $(SILENT)echo '#include "config.h"' > $(MAXINFILE) | 56 | $(SILENT)echo '#include "config.h"' > $(MAXINFILE) |
diff --git a/bootloader/SOURCES b/bootloader/SOURCES index 5d82e57309..2de38930ea 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES | |||
@@ -6,7 +6,11 @@ ipod.c | |||
6 | gigabeat.c | 6 | gigabeat.c |
7 | #elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \ | 7 | #elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \ |
8 | defined(SANSA_E200) || defined(SANSA_C200) | 8 | defined(SANSA_E200) || defined(SANSA_C200) |
9 | #ifdef E200R_INSTALLER | ||
10 | main-e200r-installer.c | ||
11 | #else | ||
9 | main-pp.c | 12 | main-pp.c |
13 | #endif | ||
10 | #elif defined(ELIO_TPJ1022) | 14 | #elif defined(ELIO_TPJ1022) |
11 | tpj1022.c | 15 | tpj1022.c |
12 | #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) | 16 | #elif defined(IAUDIO_X5) || defined(IAUDIO_M5) |
diff --git a/bootloader/main-e200r-installer.c b/bootloader/main-e200r-installer.c new file mode 100644 index 0000000000..9b977ca538 --- /dev/null +++ b/bootloader/main-e200r-installer.c | |||
@@ -0,0 +1,119 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing | ||
13 | * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach | ||
14 | * | ||
15 | * All files in this archive are subject to the GNU General Public License. | ||
16 | * See the file COPYING in the source tree root for full license agreement. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #include <stdio.h> | ||
23 | #include <stdlib.h> | ||
24 | #include "common.h" | ||
25 | #include "cpu.h" | ||
26 | #include "file.h" | ||
27 | #include "system.h" | ||
28 | #include "kernel.h" | ||
29 | #include "lcd.h" | ||
30 | #include "font.h" | ||
31 | #include "ata.h" | ||
32 | #include "button.h" | ||
33 | #include "disk.h" | ||
34 | #include "crc32-mi4.h" | ||
35 | #include <string.h> | ||
36 | #include "i2c.h" | ||
37 | #include "backlight-target.h" | ||
38 | |||
39 | /* Bootloader version */ | ||
40 | char version[] = APPSVERSION; | ||
41 | |||
42 | #define START_SECTOR_OF_ROM 1 | ||
43 | #define ROMSECTOR_TO_HACK 63 | ||
44 | #define HACK_OFFSET 498 | ||
45 | #define KNOWN_CRC32 0x5a09c266 | ||
46 | char knownBytes[] = {0x00, 0x24, 0x07, 0xe1}; | ||
47 | char changedBytes[] = {0xc0, 0x46, 0xc0, 0x46 }; | ||
48 | void* main(void) | ||
49 | { | ||
50 | int i; | ||
51 | int btn; | ||
52 | int num_partitions; | ||
53 | int crc32; | ||
54 | char sector[512]; | ||
55 | struct partinfo* pinfo; | ||
56 | chksum_crc32gentab (); | ||
57 | |||
58 | system_init(); | ||
59 | kernel_init(); | ||
60 | lcd_init(); | ||
61 | font_init(); | ||
62 | button_init(); | ||
63 | i2c_init(); | ||
64 | __backlight_on(); | ||
65 | |||
66 | lcd_set_foreground(LCD_WHITE); | ||
67 | lcd_set_background(LCD_BLACK); | ||
68 | lcd_clear_display(); | ||
69 | |||
70 | btn = button_read_device(); | ||
71 | verbose = true; | ||
72 | |||
73 | lcd_setfont(FONT_SYSFIXED); | ||
74 | |||
75 | printf("Rockbox e200R installer"); | ||
76 | printf("Version: %s", version); | ||
77 | printf(MODEL_NAME); | ||
78 | |||
79 | i=ata_init(); | ||
80 | disk_init(IF_MV(0)); | ||
81 | num_partitions = disk_mount_all(); | ||
82 | if (num_partitions<=0) | ||
83 | { | ||
84 | error(EDISK,num_partitions); | ||
85 | } | ||
86 | pinfo = disk_partinfo(1); | ||
87 | printf("--- Partition info ---"); | ||
88 | printf("start: %x", pinfo->start); | ||
89 | printf("size: %x", pinfo->size); | ||
90 | printf("type: %x", pinfo->type); | ||
91 | printf("reading: %x", (START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK)*512); | ||
92 | ata_read_sectors(IF_MV2(0,) | ||
93 | pinfo->start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK, | ||
94 | 1 , sector); | ||
95 | crc32 = chksum_crc32 (sector, 512); | ||
96 | printf("--- Hack Status ---"); | ||
97 | printf("Sector checksum: %x", crc32); | ||
98 | |||
99 | if ((crc32 == KNOWN_CRC32) && | ||
100 | !memcmp(§or[HACK_OFFSET], knownBytes, | ||
101 | sizeof(knownBytes)/sizeof(*knownBytes))) | ||
102 | { | ||
103 | |||
104 | memcpy(§or[HACK_OFFSET], changedBytes, | ||
105 | sizeof(changedBytes)/sizeof(*changedBytes)); | ||
106 | ata_write_sectors(IF_MV2(0,) | ||
107 | pinfo->start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK, | ||
108 | 1 , sector); | ||
109 | printf("Firmware Hacked"); | ||
110 | printf("Proceed to Step 2"); | ||
111 | } | ||
112 | else | ||
113 | printf("Unknown bootloader... aborted"); | ||
114 | GPIOG_OUTPUT_VAL &=~0x80; | ||
115 | |||
116 | while(1); | ||
117 | return NULL; | ||
118 | } | ||
119 | |||
diff --git a/firmware/boot.lds b/firmware/boot.lds index 0896e86fca..7f7bb9b12f 100644 --- a/firmware/boot.lds +++ b/firmware/boot.lds | |||
@@ -45,7 +45,9 @@ INPUT(target/sh/crt0.o) | |||
45 | #define FLASHSIZE 2M | 45 | #define FLASHSIZE 2M |
46 | #elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) | 46 | #elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) |
47 | #define DRAMORIG 0x10000000 | 47 | #define DRAMORIG 0x10000000 |
48 | #ifndef IRAMORIG | ||
48 | #define IRAMORIG 0x40000000 | 49 | #define IRAMORIG 0x40000000 |
50 | #endif | ||
49 | #define IRAMSIZE 0x20000 | 51 | #define IRAMSIZE 0x20000 |
50 | #define FLASHORIG 0x001f0000 | 52 | #define FLASHORIG 0x001f0000 |
51 | #define FLASHSIZE 2M | 53 | #define FLASHSIZE 2M |
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index fdcfa840eb..3bde3fc204 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h | |||
@@ -187,4 +187,7 @@ | |||
187 | #define DEFAULT_REC_LEFT_GAIN 23 | 187 | #define DEFAULT_REC_LEFT_GAIN 23 |
188 | #define DEFAULT_REC_RIGHT_GAIN 23 | 188 | #define DEFAULT_REC_RIGHT_GAIN 23 |
189 | 189 | ||
190 | #ifdef E200R_INSTALLER | ||
191 | #define IRAMORIG 0x40004000 | ||
192 | #endif | ||
190 | 193 | ||
diff --git a/firmware/target/arm/crt0-pp-bl.S b/firmware/target/arm/crt0-pp-bl.S index 4f50cac699..ef04eced30 100644 --- a/firmware/target/arm/crt0-pp-bl.S +++ b/firmware/target/arm/crt0-pp-bl.S | |||
@@ -51,7 +51,7 @@ start: | |||
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ | 53 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ */ |
54 | 54 | #ifndef E200R_INSTALLER | |
55 | /* 1 - Copy the bootloader to IRAM */ | 55 | /* 1 - Copy the bootloader to IRAM */ |
56 | /* get the high part of our execute address */ | 56 | /* get the high part of our execute address */ |
57 | ldr r7, =0xffffff00 | 57 | ldr r7, =0xffffff00 |
@@ -79,6 +79,7 @@ pad_skip: | |||
79 | 79 | ||
80 | /* 2 - Jump both CPU and COP there */ | 80 | /* 2 - Jump both CPU and COP there */ |
81 | ldr pc, =start_loc /* jump to the relocated start_loc: */ | 81 | ldr pc, =start_loc /* jump to the relocated start_loc: */ |
82 | #endif /* E200R_INSTALLER */ | ||
82 | 83 | ||
83 | start_loc: | 84 | start_loc: |
84 | 85 | ||
diff --git a/tools/configure b/tools/configure index 36295b5446..9cd3991e90 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -1424,6 +1424,9 @@ fi | |||
1424 | ifp7xx) | 1424 | ifp7xx) |
1425 | gdbstub="(G)DB stub, " | 1425 | gdbstub="(G)DB stub, " |
1426 | ;; | 1426 | ;; |
1427 | e200r|e200) | ||
1428 | gdbstub="(I)installer, " | ||
1429 | ;; | ||
1427 | *) | 1430 | *) |
1428 | ;; | 1431 | ;; |
1429 | esac | 1432 | esac |
@@ -1434,6 +1437,13 @@ fi | |||
1434 | option=`input`; | 1437 | option=`input`; |
1435 | 1438 | ||
1436 | case $option in | 1439 | case $option in |
1440 | [Ii]) | ||
1441 | appsdir='\$(ROOTDIR)/bootloader' | ||
1442 | apps="bootloader" | ||
1443 | extradefines="-DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections" | ||
1444 | bootloader="1" | ||
1445 | echo "e200R-installer build selected" | ||
1446 | ;; | ||
1437 | [Bb]) | 1447 | [Bb]) |
1438 | if test $t_manufacturer = "archos"; then | 1448 | if test $t_manufacturer = "archos"; then |
1439 | # Archos SH-based players do this somewhat differently for | 1449 | # Archos SH-based players do this somewhat differently for |