Skip to content
Permalink
Browse files
Raspberry Pi support (also unified UDEV and EVDEV support)
  • Loading branch information
gabomdq committed Sep 28, 2013
1 parent b9a2230 commit 9ceed73db4d35abac19aee1d162a28b745f621ce
@@ -0,0 +1,48 @@
================================================================================
SDL2 for Raspberry Pi
================================================================================

Requirements:

Raspbian (other Linux distros may work as well).

================================================================================
Features
================================================================================

* Works without X11
* Hardware accelerated OpenGL ES 2.x
* Sound via ALSA
* Input (mouse/keyboard/joystick) via EVDEV
* Hotplugging of input devices via UDEV

================================================================================
Raspbian Build Dependencies
================================================================================

sudo apt-get install libudev-dev libasound2-dev

You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
OpenGL ES 2.x, it usually comes pre installed, but in any case:

sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev

================================================================================
No HDMI Audio
================================================================================

If you notice that ALSA works but there's no audio over HDMI, try adding:

hdmi_drive=2

to your config.txt file and reboot.

Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062

================================================================================
Notes
================================================================================

* Building has only been tested natively (i.e. not cross compiled). Cross
compilation might work though, feedback is welcome!
* No Text Input yet.
@@ -896,12 +896,16 @@ EOF
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
case `sed -n '/^Hardware/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
BCM2708) MANUFACTURER=raspberry;;
*) MANUFACTURER=unknown;;
esac
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabihf
fi
fi
exit ;;
@@ -22028,6 +22028,21 @@ fi
case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
case "$host" in
*-raspberry-linux*)
# Raspberry Pi
ARCH=linux
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
CFLAGS="$CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
SDL_LIBS="$SDL_LIBS $RPI_LDFLAGS"

if test x$enable_video = xyes; then
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
fi
;;
*-*-linux*) ARCH=linux ;;
*-*-uclinux*) ARCH=linux ;;
*-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
@@ -22151,6 +22166,14 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
have_timers=yes
fi
# Set up files for udev hotplugging support
if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"
fi
# Set up files for evdev input
if test x$use_input_events = xyes; then
SOURCES="$SOURCES $srcdir/src/input/evdev/*.c"
fi
;;
*-*-cygwin* | *-*-mingw32*)
ARCH=win32
@@ -2343,6 +2343,21 @@ dnl Set up the configuration based on the host platform!
case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
case "$host" in
*-raspberry-linux*)
# Raspberry Pi
ARCH=linux
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
CFLAGS="$CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
SDL_LIBS="$SDL_LIBS $RPI_LDFLAGS"

if test x$enable_video = xyes; then
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
fi
;;
*-*-linux*) ARCH=linux ;;
*-*-uclinux*) ARCH=linux ;;
*-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
@@ -2450,6 +2465,14 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
have_timers=yes
fi
# Set up files for udev hotplugging support
if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"
fi
# Set up files for evdev input
if test x$use_input_events = xyes; then
SOURCES="$SOURCES $srcdir/src/input/evdev/*.c"
fi
;;
*-*-cygwin* | *-*-mingw32*)
ARCH=win32
@@ -259,6 +259,7 @@
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_WINDOWS
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_RPI
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR

0 comments on commit 9ceed73

Please sign in to comment.