diff options
Diffstat (limited to 'firmware/target/mips')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/boot-x1000.c | 29 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_x1000/boot-x1000.h | 3 |
2 files changed, 32 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_x1000/boot-x1000.c b/firmware/target/mips/ingenic_x1000/boot-x1000.c index d3e6eb35d7..3ba060ffc4 100644 --- a/firmware/target/mips/ingenic_x1000/boot-x1000.c +++ b/firmware/target/mips/ingenic_x1000/boot-x1000.c | |||
@@ -102,6 +102,35 @@ void x1000_boot_rockbox(const void* source, size_t length) | |||
102 | while(1); | 102 | while(1); |
103 | } | 103 | } |
104 | 104 | ||
105 | void x1000_boot_linux(const void* source, size_t length, | ||
106 | void* load, void* entry, const char* args) | ||
107 | { | ||
108 | size_t args_len = strlen(args); | ||
109 | |||
110 | disable_irq(); | ||
111 | |||
112 | /* --- Beyond this point, do not call into DRAM --- */ | ||
113 | |||
114 | void* safe_mem = (void*)X1000_IRAM_END; | ||
115 | |||
116 | /* copy argument string to a safe location */ | ||
117 | char* args_copy = safe_mem + 32; | ||
118 | iram_memmove(args_copy, args, args_len); | ||
119 | |||
120 | /* generate argv array */ | ||
121 | char** argv = safe_mem; | ||
122 | argv[0] = NULL; | ||
123 | argv[1] = args_copy; | ||
124 | |||
125 | iram_memmove(load, source, length); | ||
126 | commit_discard_idcache(); | ||
127 | |||
128 | typedef void(*entry_fn)(long, char**, long, long); | ||
129 | entry_fn fn = (entry_fn)entry; | ||
130 | fn(2, argv, 0, 0); | ||
131 | while(1); | ||
132 | } | ||
133 | |||
105 | void rolo_restart(const unsigned char* source, unsigned char* dest, int length) | 134 | void rolo_restart(const unsigned char* source, unsigned char* dest, int length) |
106 | { | 135 | { |
107 | (void)dest; | 136 | (void)dest; |
diff --git a/firmware/target/mips/ingenic_x1000/boot-x1000.h b/firmware/target/mips/ingenic_x1000/boot-x1000.h index 620d7de89a..9faba649b5 100644 --- a/firmware/target/mips/ingenic_x1000/boot-x1000.h +++ b/firmware/target/mips/ingenic_x1000/boot-x1000.h | |||
@@ -47,6 +47,9 @@ enum { | |||
47 | 47 | ||
48 | void x1000_boot_rockbox(const void* source, size_t length) | 48 | void x1000_boot_rockbox(const void* source, size_t length) |
49 | __attribute__((section(".icode"))); | 49 | __attribute__((section(".icode"))); |
50 | void x1000_boot_linux(const void* source, size_t length, | ||
51 | void* load, void* entry, const char* args) | ||
52 | __attribute__((section(".icode"))); | ||
50 | 53 | ||
51 | /* Note: these functions are inlined to minimize SPL code size. | 54 | /* Note: these functions are inlined to minimize SPL code size. |
52 | * They are private to the X1000 early boot code anyway... */ | 55 | * They are private to the X1000 early boot code anyway... */ |