Contents

Where can I download the latest release of OpenDingux?

The latest stable release can be downloaded on the OpenDingux Releases page.

How to enable double buffering?

Using SDL

To enable double buffering on your own app, it's as easy as adding one flag to your SDL_SetVideoMode() function:

SDL_Surface *s = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE | SDL_DOUBLEBUF);

Note that double buffering requires hardware surfaces, so you do need to use SDL_HWSURFACE instead of SDL_SWSURFACE.

When a program that uses single buffering finishes a frame, it can call either SDL_UpdateRect or SDL_Flip, but when using double buffering it must use SDL_Flip.

Why does my application fail to start?

If your application fails to start on OpenDingux, and works fine on legacy Dingux kernel, you may need to adapt your source code.

There are four main issues you may encounter:

  • your program uses /dev/mem, which has been disabled on OpenDingux. The main use of that file on legacy kernels was to change the CPU frequency. Your program shouldn't have to change the frequency; it wouldn't be very portable. The users can choose the frequency directly from GMenu2X.
  • Your program uses /proc/jz, which also has been removed. That non-standard directory was present on Ingenic's kernel, on which booboo's is based on. It did allow to change settings like backlight brightness. Now that the power switch daemon takes care of all those settings, your application shouldn't have to mess with them.
  • Your program uses OSS directly for the sound. OSS has been deprecated for years, recent apps really shouldn't use it. It has been disabled on OpenDingux.
  • Your program uses SDL for the sound, but has been compiled statically with an old build of SDL. You should never compile your apps statically, but rather dynamically. Statically linked app are compiled with the flag -static on GCC's command line; just remove that flag and re-compile your app.

How to port applications which use OSS for the sound?

OpenDingux does not support OSS anymore. Thus, it is necessary to modify the applications using OSS. For that task, we introduced a library named libAO, which will make porting your application almost trivial. LibAO is a generic interface, that your app can use to output sound on different sound systems, including OSS, ALSA, SDL, PulseAudio...

Porting your application to libAO is fairly easy; only three small parts of your code needs to be modified.

First, initialization of the sound system:

  • OSS:
int fd = open("/dev/dsp", O_WRONLY);
  • libAO:
#include <ao/ao.h>

ao_device *ao_dev;
ao_initialize();

Then, we set the parameters (channels, frequency...) we want:

  • OSS:
ioctl(fd, SNDCTL_DSP_SPEED, &rate);
ioctl(fd, SNDCTL_DSP_SETFMT, &bits);
ioctl(fd, SNDCTL_DSP_STEREO, &stereo);
  • libAO:
ao_sample_format ao = { bits, rate, stereo+1, AO_FMT_LITTLE, NULL, };
ao_dev = ao_open_live(ao_default_driver_id(), &ao, NULL);

That last piece of code is executed when you want to output samples data:

  • OSS:
write(fd, buff, len);
  • libAO:
ao_play(ao_dev, buff, len);

Compile your application with -lao, and voila! Your OSS-only app is now able to use libAO, and will gladly work on OpenDingux.

My app does not work correctly when launched from the NAND

OpenDingux has read-only access to the NAND. Perhaps your application assumes it can write to its installation location? This is a bad practice, please write to the user's home directory ($HOME) instead.

My app does not use all of that, and it's still crashing

You can use the "strace" command to see the system calls the application does before crashing. Often a crash is a result of an improperly handled error, so look for calls that return non-success error codes and check how the source deals with that.

What are the best flags to use when compiling?

The JZ4740 does not have a lot of dcache (16kB) and icache (16kB). As such, it's generally a bad idea to increase the size of the binary using flags like -funroll-loops.

Here are optimization flags that should work well on the dingoo:

CFLAGS = -O2 -fomit-frame-pointer -ffunction-sections -ffast-math -fsingle-precision-constant -G0
LDFLAGS = -Wl,--gc-sections

The following flags are for C++ only; they can bring some performance, or some instability.

CPPFLAGS = -fno-exceptions -fno-rtti

The following flags are very experimental on MIPS. They can bring some performance, but can also be a real bottleneck. Use with caution.

CFLAGS = -flto -fwhole-program
LDFLAGS = $(CFLAGS)

Do I need a specific toolchain?

If you want to use libraries that are included with OpenDingux and not in the legacy Dingux, such as LibAO, you need to install the OpenDingux toolchain. If you want to target both OpenDingux and legacy Dingux, you can use booboo's toolchain.