path: root/firmware/include
diff options
authorWilliam Wilgus <>2017-02-10 13:53:46 +0100
committerAmaury Pouly <>2017-10-29 17:53:04 +0100
commite9de9c1452499d852c8b4ec75cde06520fe7c961 (patch)
treed1312cb9bfe439412806c8bdf09e19c5bb36a2a2 /firmware/include
parentefb71ed0ce6afee0643025f71e48eabca297d872 (diff)
Add boot from other volumes in bootloader on targets with HAVE_MULTIVOLUME
Adds the ability to load firmware from other drives on MULTIVOLUME targets Mihail Zenkov <> had posted a hard coded patch to allow this on several Sansa players, I made it more universal Redirect file rockbox_main.<name> should placed in root of drive you would like to be main, if this file empty or there a single slash '/' firmware will be loaded from /.rockbox in root of this drive If instead a /<*DIRECTORY*> is supplied in rockbox_main.<name> then firmware will be loaded from /<dir>/.rockbox/ NOTES* The directory can have multiple levels however.. leading slash MUST be included trailing slash can be omitted (eg. /test/.rockbox would be simply '/test' in the redirect file) Redirect file will not work on internal drive (whatever is default boot drive) Volume with the highest index containing redirect file will be loaded first. Firmware file is checked for boot data region, if missing, firmware image will not be loaded. On failure or if no redirect file is found load will fallback to internal drive Currently only Sansa Fuze+, Sansa Clip+, Sansa Clip Zip, Sansa Fuzev2, and Sansa Fuzev1 are implemented. Players (with HAVE_MULTIVOLUME) will need #define HAVE_BOOTDATA and #define BOOT_REDIR "rockbox_main.<name>" added to their config file boot_data is implemented in crt0.s file (See g#1552) ARM and IMX233 have aleady been implemented Once these conditions are met <HAVE_MULTIBOOT> will be defined by config.h Partitions on the drives are able to have a redirect as well. Change-Id: Iada3263919f6bcad7d0d7d8279b4239aafa07ee9
Diffstat (limited to 'firmware/include')
1 files changed, 17 insertions, 0 deletions
diff --git a/firmware/include/rb-loader.h b/firmware/include/rb-loader.h
index 86c5026af9..71b6e038aa 100644
--- a/firmware/include/rb-loader.h
+++ b/firmware/include/rb-loader.h
@@ -19,3 +19,20 @@
int load_firmware(unsigned char* buf, const char* firmware, int buffer_size);
+#ifdef HAVE_MULTIBOOT /* defined by config.h */
+/* Check in root of this <volume> for rockbox_main.<playername>
+ * if this file empty or there is a single slash '/'
+ * buf = '<volume#>/<rootdir>/<firmware(name)>\0'
+ * If instead '/<*DIRECTORY*>' is supplied
+ * addpath will be set to this DIRECTORY buf =
+ * '/<volume#>/addpath/<rootdir>/<firmware(name)>\0'
+ * On error returns Negative number or 0
+ * On success returns bytes from snprintf
+ * and generated path will be placed in buf
+ * note: if supplied buffer is too small return will be
+ * the number of bytes that would have been written
+ */
+int get_redirect_dir(char* buf, int buffer_size, int volume,
+ const char* rootdir, const char* firmware);