Techworld Australia recently caught up with some of the developers of Rockbox to discuss the open source project, which is designed to replace the firmware shipped on MP3 players and portable media players.
Open source systems running on handheld devices are hardly a niche category thanks in part to Google's Android mobile platform, which in Q3 2011 was the operating system for more than half of all smartphones sold worldwide. But Android is far from being the first open source OS for mobile devices.
Unlike Android, Rockbox doesn't benefit from the backing of a giant corporation like Google or the handset manufacturers that use the search giant's platform. But despite that, the open source project has lasted for over a decade and has managed to build a broad community of developers that continue to improve it.
Rockbox, created in 2000, is a system designed to replace the stock firmware shipped in MP3 and media players, adding extra features to new products and breathing new life into older ones. The project currently supports products from more than half a dozen manufacturers, including Apple, Archos, iRiver and Toshiba.
According to Rockbox's creator, Björn Stenberg, the project "started in the classic 'scratch an itch' way". Stenberg has been a professional embedded systems developer for two decades. "I became a UNIX geek in the early 1990s and discovered free software shortly after that."
The genesis of Rockbox was the purchase of an Archos MP3 player: "I and a few Haxx friends bought ourselves Archos Jukebox 6000 MP3 players in 2000. Since it used a non-standard USB protocol, it required a custom Windows driver to transfer files. Since I prefer using Linux, I started working on a Linux driver for it which was eventually included in mainline Linux 2.4.8.
"While we enjoyed our newfound ability to bring our record collection in our pockets (a radical notion back then), soon we started getting frustrated by the limitations and slowness of the Archos jukebox firmware."
These limitations include the length of playlists and the length of time it took to load them.
"Fortunately, the Archos Jukebox used firmware updates in the form of a plain binary archos.mod file that you copied to the root of the hard disk," Stenberg says. "At boot, the firmware would look for the file and load it if found. This, combined with the fact that the USB connection was fully handled in hardware, meant that there was basically no risk whatsoever of damaging or 'bricking' the player by feeding it a bad firmware file.
"So all we had to do was craft our own archos.mod file. How hard can it be?"
After taking the device apart and analysing its components, it was found to be using a Hitachi SH-7034 CPU. The next step was analysing the archos.mod firmware file. "It was obvious that it was not just a plain binary code file. It was purposefully obfuscated, challenge accepted!"
"After considerable head-scratching, and some help from friends, I was finally able to crack the obfuscation and published the source code to a descrambler on my home page," Stenberg says. "This allowed us to descramble and analyse the firmware file, and to begin creating our own replacement."
"After this point, more and more people gathered around the project and contributed code and insight. We have been fortunate to be able to attract many really skilled people."
Stenberg can't be certain about Rockbox's user base, as like all free and open source software that is very difficult to gauge, but version 3.9.1, released in 2011, was downloaded 110,000 times for the 34 targets it supported.
Rockbox offers what Stenberg describes as "a smorgasbord of features". These include drag-and-drop file transfer (some players require software from the vendor to be installed on a PC to add new media files), navigation using a directory browser, vastly increased format support (Rockbox supports more than 30 file formats, including MOD) and gapless playback. "This means that concert recordings or albums like The Dark Side of the Moon play uninterrupted, just like they are supposed to," Stenberg says.
"I believe the most common primary reasons for non-developers to install Rockbox are the wide range of supported codecs, Ogg Vorbis and FLAC seem to be very popular, the freedom to just copy files without requiring special software on the PC side and support for spoken menus," says Frank Gevaerts, a Belgian developer who participates in the Rockbox project.
Rockbox's spoken interface can read both menus and song titles aloud. "It's excellent for use in the car (not having to take your eyes off the road) but it's also very popular among blind and sight-impaired communities," Stenberg says.
Rockbox supports many more multimedia formats than any original firmware could possibly do, in a more efficient manner and, consequently, offers less power consumption. Also, the freedom of not being tied to an application like iTunes and the ability to just drag and drop files instead is a big plus in my opinion."
Rockbox "includes lots of useful plugins," says Mohamed Tarek, a developer from Egypt. "For example, I have read a complete 300-plus page books on my [Sansa] e250."
The system also supports theming, enabling users to customise the interface of their device, which can be downloaded from the Rockbox.org website. More importantly, you can play Doom.
The project has been careful to steer clear of legal trouble. "We have never distributed patched vendor firmwares or otherwise stepped on anyone's toes," according to Stenberg. Despite this, Rockbox has had some "legal adventures", "including game companies who claimed our plugins violated their 'game idea copyrights', a concept which does not exist".
The project has had some contact with hardware vendors, including some that have offered documentation, but these are exceptions. "The normal procedure for the vast majority of devices is having to reverse engineer how the hardware works so we can write driver code for them."
Rockbox continues to target new devices, the latest to be "blessed", Stenberg says, include a range of new Sandisk media players and the first device to be based on a Fuzhou Rockchip Electronics Company's Rockchip chip.
The challenge of new target devices is part of the appeal of the Rockbox project, according to some of the developers involved in the project. "It's a fun challenge to take the device apart and learn how they designed it," says Linus Nielsen Feltzing, a Swedish developer.
"You tend to ask yourself the question: 'How would I design it?', and it often turns out that they had designed it in much the same way that you would have. And when they haven't, you always want to know why. And then it sometimes turns out that they have made a mistake in their design!"
"Reverse engineering consumer electronics and putting your own firmware on them is challenging to start with," says Daniel Stenberg, Björn's brother, who along with Björn and Feltzing formed Haxx.
"Over time it's only grown to be even more challenging as over the years the companies involved have gotten more and more 'secret'. In the beginning you could actually read markers on chips in the devices and then search for the chips online and find data sheets for them that told us how to program them."
Now it can be hard to find public documentation for chips, with some chips rebranded or running encrypted firmware.
Community and longevity
Part of Rockbox's longevity, (a decade is a long time for an open source project, especially one without corporate backing) can be attributed to its policy of openness, Stenberg says.
From the very start of the project, Rockbox's developers have put a premium on openness. "Everything we do, including all email and IRC discussion, is published on our web page," Björn Stenberg says. "This gives newcomers a chance to read up on topics and get acquainted with people and technical details without depending as much on asking older developers, thus lowering the threshold to contributing."
Stenberg says that the project is "pretty good" about getting new developers involved: "We try to help people to help themselves to the code, and encourage discussion about patches and ports. We also welcome roughly one new committer per month, so the team is constantly growing. Of course, many bright minds come with matching luminous egos and at times our debates can run hot and passionate. But as long as the language is civil, I consider passion an asset."
"We have managed to build a great community, where we are not just hackers, but also good friends," Feltzing says. "We chat all day long, and also meet in person once in a while.
There are around 100 developers who make commits, and around 150 people on the #rockbox IRC channel on Freenode. The developers' mailing list gets 100 to 150 messages per month. In addition to the strength of the community, there is what Stenberg describes as a "moving target".
"The world of MP3 players is ever changing," Jonathan Gordon, an Australian Rockbox developer. "There are new players released all the time, taunting devs to port Rockbox to them. This means we have a moving target and a constant inflow of new challenges."
"There are lots of different areas to work on; from bootloaders and drivers, to codecs, games, applications and even themes and fonts," Tarek says.
"The community and hardware manufacturers putting out cheap MP3 players which are open just enough that motivated hackers can tinker and run code," Gordon explains.
"There isn't anything else in this niche," says Gevaerts. "Up until a few years ago there was the ipodlinux project, but they had very different goals (while Rockbox wants to provide the best possible audio player firmware, ipodlinux seems to have been about 'doing fun things with Linux on iPods'). This means that we don't have any real competition in attracting new developers. If people don't like the original firmware on their audio player, porting Rockbox to it is going to be much easier than writing their own firmware from scratch."
Rockbox's future: Android, Rockbox-as-an-application
The project's developers are also looking to adapt to a world in which MP3 players are increasingly discarded in favour of smartphones. In order to target these devices, the team has been looking at "Rockbox-as-an-application", or RaaA: "It's about building Rockbox as an app running on top of other operating systems, such as Android. Traditionally Rockbox has always been in control of the complete device, but as an app we are mere guests in another system. This requires a different approach in some areas."
"We already have Rockbox running well on Android and Maemo, but we have not made any public releases for them."
"A consequence of the RaaA effort is that we have to refactor some of our code to be more dynamic, generic and adaptable. For example, traditionally all Rockbox targets have had a fixed screen size and so the frame buffer and screen layout could be compile-time constants. But when we run as an app, our code has to be able to handle dozens of different screen sizes."
"We also have an ambition to take our 'golden core', the playback system and codecs, and break it out into a separate library that can be integrated into other programs. And this, in turn, will make it possible to create a 'proper' Java android app which is more integrated with the Android operating system than our current C port."
Find your next job with techworld jobs