summaryrefslogtreecommitdiff
path: root/bootloader/x1000/boot.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-19 13:54:25 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-03-24 23:40:07 +0000
commitfbe9e4ac10001f931b2f3b9898e3292d36e8cc7c (patch)
treea2508a2e40e21f4591d971e4c3952ada50c59882 /bootloader/x1000/boot.c
parent41a8b874d2f088896cfaebecdff81c4b98f65a2a (diff)
downloadrockbox-fbe9e4ac10001f931b2f3b9898e3292d36e8cc7c.tar.gz
rockbox-fbe9e4ac10001f931b2f3b9898e3292d36e8cc7c.zip
x1000: bootloader: refactor splash/splash2
Allow the use of printf formatting and multiple lines of text using newlines in the string. Change-Id: I65919bf29c16c34c38cf3995e02d2ddbbaa4bdf3
Diffstat (limited to 'bootloader/x1000/boot.c')
-rw-r--r--bootloader/x1000/boot.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/bootloader/x1000/boot.c b/bootloader/x1000/boot.c
index d6dfd4a193..60fb864d19 100644
--- a/bootloader/x1000/boot.c
+++ b/bootloader/x1000/boot.c
@@ -43,14 +43,14 @@ void boot_rockbox(void)
43 43
44void shutdown(void) 44void shutdown(void)
45{ 45{
46 splash(HZ, "Shutting down"); 46 splashf(HZ, "Shutting down");
47 power_off(); 47 power_off();
48 while(1); 48 while(1);
49} 49}
50 50
51void reboot(void) 51void reboot(void)
52{ 52{
53 splash(HZ, "Rebooting"); 53 splashf(HZ, "Rebooting");
54 system_reboot(); 54 system_reboot();
55 while(1); 55 while(1);
56} 56}
@@ -70,13 +70,13 @@ static int read_linux_args(const char* filename)
70 size_t max_size; 70 size_t max_size;
71 int handle = core_alloc_maximum("args", &max_size, &buflib_ops_locked); 71 int handle = core_alloc_maximum("args", &max_size, &buflib_ops_locked);
72 if(handle <= 0) { 72 if(handle <= 0) {
73 splash(5*HZ, "Out of memory"); 73 splashf(5*HZ, "Out of memory");
74 return -2; 74 return -2;
75 } 75 }
76 76
77 int fd = open(filename, O_RDONLY); 77 int fd = open(filename, O_RDONLY);
78 if(fd < 0) { 78 if(fd < 0) {
79 splash2(5*HZ, "Can't open args file", filename); 79 splashf(5*HZ, "Can't open args file\n%s", filename);
80 ret = -3; 80 ret = -3;
81 goto err_free; 81 goto err_free;
82 } 82 }
@@ -84,7 +84,7 @@ static int read_linux_args(const char* filename)
84 /* this isn't 100% correct but will be good enough */ 84 /* this isn't 100% correct but will be good enough */
85 off_t fsize = filesize(fd); 85 off_t fsize = filesize(fd);
86 if(fsize < 0 || fsize+1 > (off_t)max_size) { 86 if(fsize < 0 || fsize+1 > (off_t)max_size) {
87 splash(5*HZ, "Arguments too long"); 87 splashf(5*HZ, "Arguments too long");
88 ret = -4; 88 ret = -4;
89 goto err_close; 89 goto err_close;
90 } 90 }
@@ -96,7 +96,7 @@ static int read_linux_args(const char* filename)
96 close(fd); 96 close(fd);
97 97
98 if(rdres != (ssize_t)fsize) { 98 if(rdres != (ssize_t)fsize) {
99 splash(5*HZ, "Can't read args file"); 99 splashf(5*HZ, "Can't read args file");
100 ret = -5; 100 ret = -5;
101 goto err_free; 101 goto err_free;
102 } 102 }
@@ -191,7 +191,7 @@ void boot_of_helper(uint32_t addr, uint32_t flash_size, const char* args)
191 void* jump_addr = core_get_data(handle); 191 void* jump_addr = core_get_data(handle);
192 uint32_t entry_addr = mips_linux_stub_get_entry(&jump_addr, img_length); 192 uint32_t entry_addr = mips_linux_stub_get_entry(&jump_addr, img_length);
193 if(entry_addr >= 0xa0000000 || entry_addr < 0x80000000) { 193 if(entry_addr >= 0xa0000000 || entry_addr < 0x80000000) {
194 splash2(5*HZ, "Kernel patch failed", "Please send bugreport"); 194 splashf(5*HZ, "Kernel patch failed\nPlease send bugreport");
195 return; 195 return;
196 } 196 }
197 197
@@ -216,7 +216,7 @@ void boot_of_player(void)
216#if defined(OF_PLAYER_ADDR) 216#if defined(OF_PLAYER_ADDR)
217 boot_of_helper(OF_PLAYER_ADDR, OF_PLAYER_LENGTH, OF_PLAYER_ARGS); 217 boot_of_helper(OF_PLAYER_ADDR, OF_PLAYER_LENGTH, OF_PLAYER_ARGS);
218#else 218#else
219 splash(HZ, "Not supported"); 219 splashf(HZ, "Not supported");
220#endif 220#endif
221} 221}
222 222
@@ -225,6 +225,6 @@ void boot_of_recovery(void)
225#if defined(OF_RECOVERY_ADDR) 225#if defined(OF_RECOVERY_ADDR)
226 boot_of_helper(OF_RECOVERY_ADDR, OF_RECOVERY_LENGTH, OF_RECOVERY_ARGS); 226 boot_of_helper(OF_RECOVERY_ADDR, OF_RECOVERY_LENGTH, OF_RECOVERY_ARGS);
227#else 227#else
228 splash(HZ, "Not supported"); 228 splashf(HZ, "Not supported");
229#endif 229#endif
230} 230}