Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50625 Library:50543 in /sites/rockbox.org/flyspray/adodb/drivers/adodb-mysqli.inc.php on line 108 FS#12063 : Android: put resources on SD card



FS#12063 - Android: put resources on SD card

Attached to Project: Rockbox
Opened by Dominik Riebeling (bluebrother) - Thursday, 14 April 2011, 17:50 GMT
Last edited by Dominik Riebeling (bluebrother) - Sunday, 04 September 2011, 19:13 GMT
Task Type Patches
Category Settings
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Rockbox on Android brings various resources (themes, languages) packaged into a file libmisc.so that is extracted on first start. These resources have quite some size and occupy internal memory. This patch is a (trivial) proof of concept to store parts (everything but codecs and rocks) on the SD card instead of using the internal memory.

There is a lot missing and there is no error handling. If Rockbox is about to store parts of its resource files on SD card it should check for the SD card before extracting or starting. Also, I have no idea if this breaks things as it is right now -- loading themes, languages and fonts works.

For me this change frees around 5MiB data memory. Manually removing libmisc.so after extraction gains around 3 MiB which in total brings Rockbox memory consumption down to 7.5MiB from 15MiB (480x800px device). Since you need to store your music somewhere I think it's feasible to require an SD card to be present for running Rockbox.
This task depends upon

Closed by  Dominik Riebeling (bluebrother)
Sunday, 04 September 2011, 19:13 GMT
Reason for closing:  Accepted
Additional comments about closing:  An extended / reworked version has been committed as r30430. Create a file /rockbox/rockbox-info.txt on the SD card to make Rockbox extract its resources to the card. Since that file is part of Rockbox this will keep the extraction location even between reinstalls.
Comment by Dominik Riebeling (bluebrother) - Friday, 15 April 2011, 14:19 GMT
Fix Rockbox extracting libmisc.so every time it starts.
Comment by Steve (TheBashar) - Thursday, 12 May 2011, 04:07 GMT
Some phones have non-trivial amounts of internal storage, so I wouldn't like to see having an SD card inserted as a requirement. However, on my spartan budget smartphone internal storage is nearly exhausted so I would love to have this as an option.
Comment by Jonathan Gordon (jdgordon) - Thursday, 12 May 2011, 04:14 GMT
How does this work on phones that dont have an sdcard? is /sdcard symlinked to some other directory?

My personal preference is still adding a rbutil activity to the binary which downloads libmisc.so on request/first run so the apk is half the size (the apk is stpred twice IIRC so a 7MB apk turns out to 15MB used space in / )
Comment by Dominik Riebeling (bluebrother) - Thursday, 12 May 2011, 19:32 GMT
Personally I'd really like to avoid extracting libmisc.so at all and instead being able to use it directly but I guess this is simply not possible. Another idea I've tried it to remove libmisc.so after extracting but haven't succeeded (haven't investigated that too much, maybe a permission problem?)

As for /sdcard: I've ased on IRC about this and from my understanding I can expect any Android device to have a /sdcard path. We shouldn't take this for granted though, and as I said I consider the patch more of a proof of concept. It might also be a good idea to change theme graphics from bmp to a different format (png?) for Android since the bmp files require a lot of space.
Comment by Bryan Childs (GodEater) - Saturday, 04 June 2011, 11:26 GMT
Personally I don't feel this is a problem we should be trying to solve.

Android offers the ability to move applications to the sdcard natively, and there are non-native solutions which allow you to re-map the internal storage to the sdcard anyway.

Any other opinions?
Comment by Dominik Riebeling (bluebrother) - Saturday, 04 June 2011, 20:20 GMT
Updated patch.

- Uses credits.rock to determine if libmisc.so needs to get extracted again. This means that you can force extracting libmisc.so by simply deleting the application settings from the Android applications menu.
- Set the timestamp of the checked file to the same as libmisc.so. This avoids problems caused by different time zones configured on build PC and Android device.

Bryan: A2SD doesn't solve this issue because:
- the lib data won't get moved so libmisc.so stays on the internal memory
- it doesn't move the user settings to the SD card.
Basically, the two memory hogs libmisc.so and the data extracted from it will still be on the internal memory. The file that gets moved to the SD card is the apk file (/data/app/org.rockbox-1.apk)