MalcolmStagg.com
Home    Recent Work    Science Fair    About Me    Contact Me    Software

project bdp

Overview

Building custom apps is a good way to play around with your blu-ray player, and doesn't require modifying firmware as long as you can get access to the player to run code.

Building a Cross-Compiler

The first step to build code to run on your Blu-Ray player is to build a cross-compiler. Before doing this you may want to confirm which ARM processor your player is using. You can extract any executable file from your original firmware and in Linux run "readelf -all <executablename>". It will spit out an output which includes, at the end, the ARM version. To determine the kernel version, you can look at /lib/modules/[kernel version] on the player's firmware, or extract a kernel module (.ko) and run "modinfo <kernelmodulename>" on Linux. The BDP-S390 and BDP-S5100 use the ARMv6 processor and kernel version 2.6.35.

Raspberry Pi's also use the ARMv6 architecture, so there are plenty of good instructions online for getting a cross-compiler up and running.

I followed the instructions here to build a cross-compiler. I was using Ubuntu 10.04.4. It is possible to use a Cross-Compiler in Windows, but it seemed simpler to do it on Linux, and I figured there would likely be less issues with dependencies.

Please read that link for more details, but here are the basic steps:

  • Install libraries ( sudo apt-get install build-essential patch ncurses-dev subversion bison cvs flex gperf texinfo automake libtool )
  • Download and extract crosstool-ng
  • Configure and build crosstool-ng
  • Export path to crosstool-ng
  • Go to staging directory
  • Undocumented: I had to fix one of the files manually as documented here
  • ct-ng menuconfig
    • Experimental
    • Set prefix to your destination directory
    • Target arm
    • Little endian
    • Arch level: armv6 (apparently this is just required for C++11, but I figured it would be a good idea regardless)
    • Operating system: Linux (I selected kernel version 2.6.35 to match my player)
    • Binary utils newest stable version
    • C: Linaro newest stable version
    • C: Enable C++
  • ct-ng build
  • Wait (get a coffee or lunch :) )
  • Export path to cross-compiler

Building simple apps

I'm sure there's some way to fix this in the cross compiler configuration, but I need to use the linker option "-Wl,--dynamic-linker=/lib/ld-linux.so.3" to get it to use the correct linker library in the blu-ray player.

To try it out I build a simple hello world program:

#include <stdio.h>

int main() {
	printf("Hello World!\n");
	return 0;
}
	

Then to compile: arm-unknown-linux-gnueabi-gcc helloworld.c -Wl,--dynamic-linker=/lib/ld-linux.so.3 -o helloworld

For C++ code, use the same thing except arm-unknown-linux-gnueabi-g++

Copy helloworld to your USB key, plug it in, start telnet and after logging in, type /mnt/sda1/helloworld . You should see "Hello World!" on the console.

Building apps with a makefile

Makefiles vary a fair bit, but this syntax generally seems to work for me:

make CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ LDFLAGS="-Wl,--dynamic-linker=/lib/ld-linux.so.3"

or if you want to make it static (e.g. if dependencies are a problem):

make CC=arm-unknown-linux-gnueabi-gcc CXX=arm-unknown-linux-gnueabi-g++ LDFLAGS="-Wl,--dynamic-linker=/lib/ld-linux.so.3 --static"

Sometimes doing an "EXPORT CC=arm-unknown-linux-gnueabi-gcc" and likewise with LDFLAGS, before running make, may give different/better/worse results. It takes some playing around with.

With a configure script I've used:

configure --target=arm-linux CXX=arm-unknown-linux-gnueabi-g++ LDFLAGS="-Wl,--dynamic-linker=/lib/ld-linux.so.3"

Notes

The website here has good options to use with various packages you might want to cross-compile.

Also note that if your cross-compiler is not already set up to use your ARM version (e.g. ARMv6), you can define the version using -march=armv6 . With a makefile, you can add that using CFLAGS="-march=armv6".

Conclusion

You will need to:

  1. Build a cross-compiler
  2. Write some code
  3. Compile it
  4. Get the player to run it

DISCLAIMER

Downgrading has been successfully tested. That's all I can confirm. Modifying firmware is risky, may violate EULA agreements, and can potentially brick your Blu-Ray player. Please try this at your own risk!

Copyright © 2013-2014 Malcolm Stagg