abi>>forums (http://www.anythingbutipod.com/forum/index.php)
-   Samsung R0 Rockbox / Mods (http://www.anythingbutipod.com/forum/forumdisplay.php?f=255)
-   -   Porting Rockbox to YP-R0 (FAQ in the 1st post) (http://www.anythingbutipod.com/forum/showthread.php?t=58642)

slade 10-26-2010 02:52 PM

Porting Rockbox to YP-R0 (FAQ in the 1st post)
EDIT lebellium January, 21st 2013: LightROM 4.6

Useful links:

How to install Rockbox?
-New firmware 2.51 dualboot:

-New LightROM 4.6 (Rockbox-only!)

-Old firmware 2.30 dualboot (not recommended):
  • Download the modded firmware 2.30 and install it like any official firmware (put the R0.R0M file at the root of the R0 and turn the player on)
    Modded Firmware 2.30 is based on the modded firmware 2.20 and therefore provides the same advantages and features (Safe Mode and DRK in case of brick, UI customization etc....see here for more info about the fw 2.20). Besides, it adds the Rockbox bootloader as well as the auto-shutdown when you disconnect the R0 from the computer in Safe Mode.
  • Download this zip archive and extract it. Just put the rockbox_loader.sh and si4709.ko files at the root of the R0, i.e where all main folders are (Music, Pictures, Videos etc)
  • Download the latest Rockbox build (this link is updated at every commit). Extract the archive and put the .rockbox folder at the root of the R0.
  • By default the Samsung app loads first. To load Rockbox you have to press & hold the central key during the boot (screen with the Samsung logo). To load Rockbox first by default, put an empty file named autostart_RB at the root of the device. You can also download it here. IMPORTANT: Rockbox can only load if the device is fully off and not in standby mode. To turn it fully off, just press reset.

Is it safe to install Rockbox?
If you follow carefully all the steps above, there is no risk. The Modded Firmware 2.30 or 2.51 is no more no less dangerous than the latest stock firmware 1.25, the original features and bugs are still present. The improvements have been carefully tested.

How to uninstall Rockbox?
You don't want Rockbox anymore? :( Just delete the .rockbox folder as well as the loader file and that's it! We advise you to keep the firmware 2.30 or 2.51 though, particularly for the Safe Mode.

Install Rockbox themes for R0
The R0 has been showing up on the official theme page for a few months now: http://themes.rockbox.org/index.php?target=samsungypr0. As themes are only sorted by screen resolution, any theme for another 240*320 target (Sansa Fuze+, Toshiba Gigabeat etc) is theoretically compatible.
You can find my theme lebellium Samsung-like especially designed for the R0 on the official website here or on ABI here.

The R0 displays "system checking" at every startup before loading Rockbox. How to get rid of that?
First you have to start the Samsung app instead of Rockbox after the "system checking". Then turn off the device (only press the power button for 2-3 seconds) and press the reset hole. Power it on and you'll see the annoying "system checking" has gone!

I don't find my songs using the Rockbox file browser. Where are they?
On the main menu go to Files>mnt. Then you can see several directories: media0=internal memory, media1="neo-ghost" hidden memory and mmc=microSD.
You can start file browsing at a specific folder. For example if you want to start the browsing in the Music folder of the internal memory, just go to Files>mnt>media0 and make a long press on the "select" button when you are on the "Music" folder. In the context menu select "Start File Browser here". That's it!


Originally Posted by slade
Hello Everybody, as may be already seen in the other thread. I am starting my attempt to port the yp-r0 to rockbox. It is indeed a difficult task and I am grateful for everybody wanting to help on this.

Just a short outline on how far I am at the moment:
  • gathered almost all drivers needed to compile rockbox itself
  • able to extract the firmware thanks to the other post
  • now working on poking with bootloader
  • the only option i see so far is to compile a custom zImage with rockbox kernel and creating own cramfs with rockbox but Sysdata.bin ist still a pain as we dont know how to extract it yet to replace with rockbox

basically its either completly replacing the firmware which is not what I really intend or to poke around and try to abuse a bootloader to dual boot both system which infact would be the nicer way to do it.

Anyway if you think you have the time and skills to help please let me know.


slade 10-28-2010 06:57 AM


please register if you want to join the dev team.

Thank you!

dfkt 10-28-2010 07:09 AM

I think you mean you want to port Rockbox to the R0, not vice versa.

Why did you make your own forum for the porting attempt? It might be more useful if you just posted on the official Rockbox forums and wiki instead. That way developers involved in Rockbox development could help, and the info would all be in one centralized location. Starting your own forum for that port might not make that much sense, in my opinion - it just adds clutter and fragmentation to the available info.

nik1105 10-28-2010 07:17 AM

Its good to have one forum for developers, where they can keep all their boring stuff and it also will keep this forum clean, but all the progress will be published here and on the Rockbox web site, and of course its porting Rockbox to R0, not vice versa.

saratoga 10-28-2010 07:43 AM

Its probably just going to be 1 or 2 people working on a port, so just using email or gtalk seems like a better solution.

slade 10-28-2010 08:14 AM

Yep its basically just a dev forum one trackers what needs to be done to have it between the dev.
the progress will be posted on rockbox and also a lot of other stuff once we get to the point where its needed.

slade 11-01-2010 11:44 AM

just as i promised to keep you updated.

We were able to extract SYSDATA.bin today and I am currently looking through all the files. As for now we are getting closer to uncover how the player itself works.

What happend so far:
- Cracked the Player open to figure out hardware
- Extraced Firmware v1.22 to its 4 contents
- able to mount cram_fs containing kernel and filesystem
- figured out most of the mount path within player starting
- were able to extract sysdata.bin
- mboot.bin gives us some knowledge on how update progress is started AND that Upgrade.sh in Sysdata.bin is used to finalize upgrade
- mboot.bin still gives me troubles on how to modify it and be able to manipulate boot process
- maybe compiling new kernel and chain a bootloader after mboot bin is the way to go but still needs research

I am currently flashing the YP-R0 to a custom kernel with modified rc.start script. If it works I should be able to start custom scripts from flash. I will get back once I flashed it.

slade 11-01-2010 02:25 PM

Great News I proudly present the output of the first script I ran. I can now manage to run every script I want simply connecting the MP3 Player to my computer and changing the customscript.sh in the root folder :)
That means I will make a copy of the System Root Drive and copy it to the 8GB flash.

This just makes my day :)
here is the the first script I ran (cat /proc/cpuinfo > cpu.txt)


Processor        : ARMv6-compatible processor rev 3 (v6l)
BogoMIPS        : 530.84
Features        : swp half thumb fastmult vfp edsp java
CPU implementer        : 0x41
CPU architecture: 7
CPU variant        : 0x0
CPU part        : 0xb76
CPU revision        : 3
Cache type        : write-back
Cache clean        : cp15 c7 ops
Cache lockdown        : format C
Cache format        : Harvard
I size                : 16384
I assoc                : 4
I line length        : 32
I sets                : 128
D size                : 16384
D assoc                : 4
D line length        : 32
D sets                : 128

Hardware        : Freescale MX37 3-Stack Board
Revision        : 37000
Serial                : 24120805D6046206


Maybe someone could help me looking through the filesystem
I would really appreciate it. We need to find something concerning bootloader!

Thank you!

lebellium 11-01-2010 02:53 PM

Hopefully, other people will get interested in this port and will help you :)

slade 11-02-2010 10:25 AM

I will release the Script- able firmware with instructions on how to use and very important what not to do. After I make some clean ups and writing a reboot feature. What that means is that the customscript.sh which is created on the 8/16gb flash will be erased from its content leaving a blank shell script after it has been called.
Call it a safety feature, because scripts will be started right after initial boot BEFORE application or USB Transfer drivers are loaded. Making any bogus script very dangerous. With this adjustment scripts will be empty right after pushing reset button and doing a regular boot.

Thats why I will take sometime to make it almost fool proof to use.

the script which is being used is the rc.local script which is called within rc.start ->



BLABLA regular content of rc.local script

#This is calling the script on 8GB Flash - running parallel to rest of bootupscript via & operator at the end -> should get rid of most errors like waiting for script to finish which never finishes (also creates errorlog on flash called scriptrun.log)
/bin/sh /mnt/media0/customscripts.sh > /mnt/media0/scriptrun.log 2>&1 &
#Clear customscript.sh right after being called so it can only be called once
echo "#!/bin/sh" > /mnt/media0/customscript.sh

Once I packed the new firmware and tested it I will create a documentation and release it with the new firmware (which is based on v1.22)

lestatar 11-02-2010 11:27 AM

Oh man, oh man...I truly wish you well on this endeavor. A RB enabled Samsung R0/R1 would prolly push me over the edge to grab one if I can as I quite like the sexy form factor....

Godspeed and thank you for your efforts!!! :D
cheering from the wings...

slade 11-02-2010 04:02 PM

For Anyone who wants to try here is the source code of my program to extract sysdata.bin

be aware it still needs some manual adjustments. everytime it stops it hits one of the 0x30 byte filename heaser. so jump to the next file and adjust offset and subtract offset from while argument i.

Feel Free to modify and maybe contribute back with fully automated script


package extractor;

import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

public class ExtractFiles {

        * @param args
        public static void main(String[] args) {
                // TODO Auto-generated method stub
                String filename= "/home/a/Desktop/SYSDATA.bin";
                try {
                        //readFile(filename, "");
                } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                } catch (IOException e) {
                        // TODO Auto-generated catch block

        private static void buildtree(String filename) throws IOException {
                RandomAccessFile access = new RandomAccessFile(filename, "r");
                int offset [] = new int [4];
                int len[] = new int [4];
                String savefilename = "";
                //Setting Start offset since Structure is not clear in beginning yet.
                for (int i=0; i<(0xFBDC-0xF4DC);i++) {
        //                for (int i=0; i<(0x26B-0x238);i++) {
                        //Loop for each Filename extract
                        //System.out.println("Current Offset:"+access.getFilePointer());       
                        //System.out.println("Current calculated offset: "+(i+3444));
                        //System.out.println("Seeking Offset");
                        System.out.println("New Offset:"+access.getFilePointer());
                        boolean check = false;
                        for (int j=0; j<1;j++) {
                                        //Loop for Filename
                                        for (int k=0; k<0x2C;k++) {
                                        for (int l= 0; l < 4; l++) {
                                                offset [l] = access.readUnsignedByte();
                                        for (int m=0;m<4;m++) {
                                                len[m] = access.readUnsignedByte();
                        //        System.out.println((Integer.toHexString(offset[3])+""+Integer.toHexString(offset[3])+""+Integer.toHexString(offset[3])));
                readFile(filename, savefilename, Integer.parseInt(Integer.toHexString(offset[3])+Integer.toHexString(offset[2])+Integer.toHexString(offset[1])+Integer.toHexString(offset[0]),16), Integer.parseInt(Integer.toHexString(len[3])+Integer.toHexString(len[2])+Integer.toHexString(len[1])+Integer.toHexString(len[0]),16));
                System.out.println( "Extracted successfully:\t\t" + savefilename);
                if (access.readUnsignedByte() == 0 || access.readUnsignedByte() == 0 || access.readUnsignedByte() == 0) {
                                System.out.println("Current Offset Seeking :"+access.getFilePointer());
                        } else
                                System.out.println("New Filename Found");
                                System.out.println("Current Offset:"+access.getFilePointer());
                                check = true;

        public static void readFile(String filename, String savefile, int off, int len) throws FileNotFoundException,IOException {
                RandomAccessFile access = new RandomAccessFile(filename, "r");
                RandomAccessFile write = new RandomAccessFile("/home/a/Desktop/SysData_X/"+savefile, "rw");
                Byte b;
                //int off = 0x071118;
                //int len = 0x027CDE;
                System.out.println("Given ReadOffset :"+off);
                                for (int i =0; i<len;i++) {

nik1105 11-03-2010 04:12 AM

In order to get systata.bin you have to unpack firmware file, i think we will make it public avaliable. And if somemeone want to experiment with sysdata.bin, he has to figure out why there are 3 types of records inside header and how the folders tree is stored in the header.

slade 11-03-2010 01:07 PM

You can download the modified firmware which is able to run script here:


Here are the steps to make it work and some Instructions:
  • Place R0.ROM on root of player like any other firmware upgrade
  • before you disconnect create a file called "customscript.sh" on root of player
  • I adivse using Linux to create and edit shell scripts I think Windows will work too but I didnt test it.
  • reboot player wait for firmware upgrade to finish
  • as in orginal firmware make sure to switch back to MSC before plugging to the PC to avoid any other problems
  • edit your customscript.sh as you want to. On the bottom of this post is a script you could use to check if everything was successful

Here is the first script you could run if you want to test it:

cat /proc/cpuinfo > /mnt/media0/cpu.txt

to tell you the structure :
/mnt/media0 <-- your 8GB or 16GB Flash with all your files
/mnt/media1 <-- is internal Data with Samsung Application you see when the player is running

/ <-- root filesystem everybody who ever used Linux will understand


There is a safety feature which will protect you when you run a bogus script and the player is not responding -> wait for at least 2 minutes. push reset button -> every script you run will be deleted and replaced with a dummy script so if you will have to write the script again if you want to use it again after every reboot of the player.
I will release another firmware without this security feature in a few but I advise everybody to test scripts with this firmware and if you want a permanent change upgrade to the other firmware. There is also the possibilty to update the /etc/rc.start script. But this is for proffesional users only.

Scripting on the player means a powerful way to change the linux running on the player and to be able to customize it any way you want.

Update Process List

  PID  Uid        VSZ Stat Command
    1 root      2076 SW  init               
    2 root            SW< [kthreadd]
    3 root            SW< [ksoftirqd/0]
    4 root            SW< [watchdog/0]
    5 root            SW< [events/0]
    6 root            SW< [khelper]
  53 root            SW< [kblockd/0]
  56 root            SW< [cqueue/0]
  60 root            SW< [mxc_spi.2]
  64 root            SW< [kseriod]
  77 root            SW< [kmmcd]
  107 root            SW  [pdflush]
  108 root            SW  [pdflush]
  109 root            SW< [kswapd0]
  147 root            SW< [aio/0]
  231 root            SW< [kondemand/0]
  299 root      2076 RW  sh /mnt/media0/script.sh
  302 root      2080 SW  -sh
  306 root      59992 SW  /usr/local/bin/r0 Application AppMain
  309 root      1336 SW  /usr/local/bin/USBSrv
  320 root      2252 RW  ps aux

Looks like r0 is the main application running the entire application you see. I'll take a look at it!

marklord 11-04-2010 08:31 AM


Originally Posted by slade (Post 511896)
You can download the modified firmware which is able to run script here:

It seems to work well :)

I just tried this customscript.sh script:

ls -lR /mnt/media1/ > /mnt/media0/list.txt

This is the result (file list.txt):

drwxr-xr-x    3 root    root        4096 Jan  1  2009 Db
drwxr-xr-x    2 root    root        4096 Jan  1  2009 Debug
-rwxr-xr-x    1 root    root      716800 Nov  4  2010 EntryList.ent
-rwxr-xr-x    1 root    root        2604 Nov  4  2010 Favorites.ent
drwxr-xr-x    2 root    root        4096 Jan  1  1980 Lib
drwxr-xr-x    2 root    root        4096 Jan  1  1980 Nv
drwxr-xr-x    2 root    root        4096 Feb 15 10:38 Pictures
----------    1 root    root      131072 Jan  1  1980 RFS_LOG.LOG
drwxr-xr-x    2 root    root        4096 Jan  1  2009 RecordedList
drwxr-xr-x    2 root    root        4096 Jul 11 05:48 Registry
drwxr-xr-x    3 root    root        4096 Jan  1  1980 data

drwxr-xr-x    2 root    root        4096 Jun  6 23:17 R0db

-rwxr-xr-x    1 root    root      5193728 Nov  4  2010 Ace.dat
-rwxr-xr-x    1 root    root      3145728 Nov  4  2010 Ace.log
-rwxr-xr-x    1 root    root        8192 Apr  7 02:47 Tmp11
-rwxr-xr-x    1 root    root        32768 May 29 08:55 Tmp2
-rwxr-xr-x    1 root    root        8192 Apr  7 01:27 Tmp9

-rwxr-xr-x    1 root    root        1621 Jan  1  2009 MuonConfig.txt



-rwxr-xr-x    1 root    root      307200 Jun 11  2010 MySkin.raw



drwxr-xr-x    2 root    root        4096 Jan  1  2009 drm

-rwxr-xr-x    1 root    root        3306 Jan  1  2009 devcerttemplate.dat
-rwxr-xr-x    1 root    root          40 Jan  1  2009 priv.dat

Thanks for the great work, Slade :)

lestatar 11-04-2010 09:45 AM

Jeez....you guys are really scaring me - in a damnably good way.

Awesome guys - THANK YOU.... :D

slade 11-04-2010 10:44 AM

just for your info:
scripts will be launched while booting there is a little way to trick it:

create another .sh script on the root of the player.
i called it myscript.sh
do the following in customscript:


sh /mnt/media0/myscript.sh &

in myscript :

sleep 20
#Replace by any other command -> now the command will be launched after application is launched!
ps aux > /mnt/media0/process.txt

Also I tried many ways now to brick it even creating new folders on the player and try to mount some stuff.
Never ran into problems I still advise NOT to delete or change any files in there.
Also cp command runs great but cp -R seems to make it crash so don't use cp -R copy folders one by one using cp /file/* its the safest way to do it.

For anyone who wants to help.

I was hoping you could also help to figure out where the sysdata.bin files are. so far I have not been able to find them so I guess its a new mount somewhere else maybe even just a program /usr/local/bin/r0 calls by the way some programms to read and write on /dev/afe and someplace else (you can see it in hexeditor).
I hope we could figure out a way to change files in sysdata.bin to customize skins and layout. that would be cool for modders.
and on the the other hand I will try to compile rockbox as an application instead of porting drivers. since we have a linux we should be able to do that. there is a thread in rockbox forums under new ports: running rockbox as application.

Update 2
Found something interesting:

Filesystem 1M-blocks Used Available Use% Mounted on
/dev/bml2 35 35 0 100% /
/dev/stl2 64 5 59 8% /mnt/media1
/dev/stl3 7578 268 7310 4% /mnt/media0

The Chief 11-04-2010 01:59 PM

May be this document can help - http://www.samsung.com/global/busine...ting_Guide.pdf .

slade 11-04-2010 03:58 PM

Thanks for the Link this is very interesting and also a very annoying thing to know ;) As I am not sure if there is any driver for this on rockbox ... which means I would have to write the driver myself.

Btw. I never posted the link but here it is:

This is most of the content of Sysdata.bin extracted no folder structure unfortunately
pw: rockbox_port

I figured out how Sysdata.bin works. It is fairly simple.
I am currently writing a program to extract the entire thing even with folder structure.
If anyone out there knowing Java I could need some help to get it done faster ;).
Also I am sure we can replace files in Sysdata.bin like pictures and Stuff but I wouldn't suggest to replace bigger files. We don't know if there's any room left on the player for a bigger sysdata.bin and we don't know what would happen. But for smaller files it shouldn't be a problem but this would mean I would have to write another program which again takes time so for now I will just stick with extraction as there is some files I'd like to see how they are organized.

Update 2
I think we will skip porting Rockbox firmware and instead porting Rockbox as an application. Rockbox application is exactly the same but using drivers from the main system instead of the rewritten drivers for the rockbox firmware. Since we are running a linux already on our player we can use the rockbox firmware natively as an application. All I would need to do in theory is to compile the SDL Libraries for our linux kernel and make a new Kernelimage then port rockbox application and compile it as well. This will take some time but I think we do have a fairly good Chance of seeing Rockbox in a few weeks/months on our beloved YP-R0. Since its basically a two man show at the moment I would really like if someone has the time to give me a hand as it is a lot of work.

Have a good day guys! I'll keep you updated on the progress!

Nikolaus 11-04-2010 06:54 PM

These are really great news! I would love to see Rockbox on the R0!
Unfortunately I can't code so I can't really help with the port but to say "Thumbs up!"

All times are GMT -5. The time now is 08:14 AM.