summaryrefslogtreecommitdiff
path: root/bootloader/x1000/boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/x1000/boot.c')
-rw-r--r--bootloader/x1000/boot.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/bootloader/x1000/boot.c b/bootloader/x1000/boot.c
index 6719375151..ca69e2e057 100644
--- a/bootloader/x1000/boot.c
+++ b/bootloader/x1000/boot.c
@@ -24,6 +24,7 @@
24#include "system.h" 24#include "system.h"
25#include "kernel.h" 25#include "kernel.h"
26#include "power.h" 26#include "power.h"
27#include "linuxboot.h"
27#include "boot-x1000.h" 28#include "boot-x1000.h"
28 29
29void boot_rockbox(void) 30void boot_rockbox(void)
@@ -50,3 +51,47 @@ void reboot(void)
50 system_reboot(); 51 system_reboot();
51 while(1); 52 while(1);
52} 53}
54
55/*
56 * WARNING: Original firmware can be finicky.
57 * Be careful when modifying this code.
58 */
59
60static __attribute__((unused))
61void boot_of_helper(uint32_t addr, uint32_t flash_size, const char* args)
62{
63 struct uimage_header uh;
64 size_t img_length;
65 int handle = load_uimage_flash(addr, flash_size, &uh, &img_length);
66 if(handle < 0)
67 return;
68
69 gui_shutdown();
70
71 x1000_dualboot_load_pdma_fw();
72 x1000_dualboot_cleanup();
73 x1000_dualboot_init_clocktree();
74 x1000_dualboot_init_uart2();
75
76 x1000_boot_linux(core_get_data(handle), img_length,
77 (void*)uimage_get_load(&uh),
78 (void*)uimage_get_ep(&uh), args);
79}
80
81void boot_of_player(void)
82{
83#if defined(OF_PLAYER_ADDR)
84 boot_of_helper(OF_PLAYER_ADDR, OF_PLAYER_LENGTH, OF_PLAYER_ARGS);
85#else
86 splash(HZ, "Not supported");
87#endif
88}
89
90void boot_of_recovery(void)
91{
92#if defined(OF_RECOVERY_ADDR)
93 boot_of_helper(OF_RECOVERY_ADDR, OF_RECOVERY_LENGTH, OF_RECOVERY_ARGS);
94#else
95 splash(HZ, "Not supported");
96#endif
97}