welcome: please sign in
Differences between revisions 1 and 8 (spanning 7 versions)
Revision 1 as of 2012-05-24 21:34:26
Size: 3015
Editor: MikeThompson
Comment:
Revision 8 as of 2012-06-16 22:33:55
Size: 3297
Editor: jerry.tk
Comment: Fixes for updated build.sh
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 5: Line 4:
I'm about to go to work in a minute, so please enjoy some terribly condensed instructions on how to build a superpowered Quake 3 in Raspbian, using Hexxeh's SD card image as a base. I've probably missed something important, but this should be a helpful start.  1. Make sure you're up-to-date:
 {{{
    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo rpi-update 192
}}}
  . Reboot.
Line 7: Line 12:
 1. Make sure you're up-to-date with everything (aptitude update; aptitude upgrade)
 1. Download the Quake 3 source code .tar.gz from here.
 1. As root, '''aptitude install gcc build-essential'''
 1. Also as root, '''aptitude install libsdl1.2debian libsdl-image1.2 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-net1.2 libsdl-net1.2-dev''' (this possibly includes unnecessary stuff and the occasional typo, but it worked...)
 1. Decompress your source .tar.gz and replace build.sh with the following: {{{
    #!/bin/bash
    # this script builds q3 with SDL
    # invoke with ./build.sh
    # or ./build.sh clean to clean before build
 1. Install required packages:
 {{{
    sudo apt-get install git gcc build-essential libsdl1.2-dev
}}}
Line 17: Line 17:
    # directory containing the ARM shared libraries (rootfs, lib/ of SD card)
    # specifically libEGL.so and libGLESv2.so
    ARM_LIBS=/opt/vc/lib
    SDL_LIB=lib
 1. Download the Quake 3 source code:
 {{{
    mkdir ~/src
    cd ~/src
    git clone https://github.com/raspberrypi/quake3.git
    cd quake3
}}}
Line 22: Line 25:
    # directory containing baseq3/ containing .pk3 files - baseq3 on CD
    BASEQ3_DIR="/home/${USER}/"
 1. Edit ''build.sh'' in ''quake3'' directory:
 {{{
    change line 8 to this: ARM_LIBS=/opt/vc/lib
    change line 16 to this: INCLUDES="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads"
    comment out line 19: #CROSS_COMPILE=bcm2708-
}}}
Line 25: Line 32:
    # directory to find khronos linux make files (with include/ containing
    # headers! Make needs them.)
    INCLUDE_DIR="/opt/vc/include"
 1. Do a '''./build.sh'''
Line 29: Line 34:
    # prefix of arm cross compiler installed
    # CROSS_COMPILE=bcm2708-
 1. Wait for compilation to finish, takes about 1 hour on RasPi.
Line 32: Line 36:
    CROSS_COMPILE=  1. Find copies of the following somewhere (other guides will show you) and place in '''build/release-linux-arm/baseq3: '''
  . '''pak0.pk3, pak1.pk3, pak2.pk3, pak3.pk3, pak4.pk3, pak5.pk3, pak6.pk3, pak7.pk3, pak8.pk3'''
Line 34: Line 39:
    # clean
    if [ $# -ge 1 ] && [ $1 = clean ]; then
       echo "clean build"
       rm -rf build/*
    fi
 1. Update your permissions for directFB access:
 {{{
    sudo usermod -a -G video [your_username]
}}}
  . Log out, log back in. This will allow you to run game as non-root. Works with other directFB/SDL based stuff, too.
Line 40: Line 45:
    # sdl not disabled
    make -j4 -f Makefile COPYDIR="$BASEQ3_DIR" ARCH=arm \
            CC=""$CROSS_COMPILE"gcc" USE_SVN=0 USE_CURL=0 USE_OPENAL=0 \
            CFLAGS="-DVCMODS_MISC -DVCMODS_OPENGLES -DVCMODS_DEPTH -DVCMODS_REPLACETRIG -I$INCLUDE_DIR" \
            LDFLAGS="-L"$ARM_LIBS" -L$SDL_LIB -lSDL -lvchostif -lvmcs_rpc_client -lvcfiled_check -lbcm_host -lkhrn_static -lvchiq_arm -lopenmaxil -lEGL -lGLESv2 -lvcos -lrt -lbcm_host -mfloat-abi=hard -mfpu=vfp"
 1. If you do not intend to keep Quake 3 source code, you may reorganize files as suggested by [[http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=6511&p=83593#p83593|this thread]] on RasPi Forum.
Line 46: Line 47:
    # copy the required pak3 files over
    # cp "$BASEQ3_DIR"/baseq3/*.pk3 "build/release-linux-arm/baseq3/"
}}}
 6. Do a '''./build.sh'''
 1. Wait.
 1. Wait a bit more. This is assuming I haven't made any mistakes in the guide.
 1. Find copies of the following somewhere (other guides will show you) and place in '''build/release-linux-arm/baseq3: pak0.pk3 pak1.pk3 pak2.pk3 pak3.pk3 pak4.pk3 pak5.pk3 pak6.pk3 pak7.pk3 pak8.pk3'''
 1. As root, run '''ioquake3.arm'''. Shoot things. (It should work as a non-root user when I figure out the necessary DirectFB incantations.)
 1. Run '''ioquake3.arm'''. Shoot things.
Line 56: Line 50:

== Troubleshooting ==
 * Compiling fails, complaining about missing {{{vcos_platform_types.h}}} file. See this issue in RasPi repository: https://github.com/raspberrypi/firmware/issues/34. (Build script was recently fixed to include correct path to missing header file. Do git pull.)

 * Game cannot find Broadcom libraries. As root do:
 {{{
    cd /etc/ld.so.conf.d/
    echo /opt/vc/lib >broadcomlib.conf
    ldconfig
}}}

 * If you get an error like "'''failed to open vchiq instance'''" you'll need to do as root:
 {{{
    echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules
    usermod -a -G video [your_username]
}}}
  . Or as one time temporary solution (until reboot):
 {{{
    chmod a+rw /dev/vchiq
}}}

 * If running as a non-root user and running from the console (non X11), then quake3 may bomb out with an error message like ''''SDL_Init()'''' ''''Unable to open mouse''''. You'll need to fix permissions so that non-root user can access /dev/input/mice and /dev/input/mouse0.
  . Create new file {{{/etc/udev/rules.d/99-input.rules}}}:
 {{{
    # file /etc/udev/rules.d/99-input.rules
    KERNEL=="mice", NAME="input/%k", MODE="664", GROUP="input"
    KERNEL=="mouse*", NAME="input/%k", MODE="664", GROUP="input"
}}}
  . Add a new group and add your user(s) to it:
 {{{
groupadd input
usermod -a -G input [your_username]
}}}
  . Log out, log back in.

Building Quake 3 in Raspbian

Documentation below pulled from the Raspbian Forum. Please update this page if errors in the build process are discovered.

  1. Make sure you're up-to-date:
        sudo apt-get update
        sudo apt-get dist-upgrade
        sudo rpi-update 192
    • Reboot.
  2. Install required packages:
        sudo apt-get install git gcc build-essential libsdl1.2-dev
  3. Download the Quake 3 source code:
        mkdir ~/src
        cd ~/src
        git clone https://github.com/raspberrypi/quake3.git
        cd quake3
  4. Edit build.sh in quake3 directory:

        change line 8 to this:  ARM_LIBS=/opt/vc/lib
        change line 16 to this: INCLUDES="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads"
        comment out line 19:    #CROSS_COMPILE=bcm2708-
  5. Do a ./build.sh

  6. Wait for compilation to finish, takes about 1 hour on RasPi.

  7. Find copies of the following somewhere (other guides will show you) and place in build/release-linux-arm/baseq3:

    • pak0.pk3, pak1.pk3, pak2.pk3, pak3.pk3, pak4.pk3, pak5.pk3, pak6.pk3, pak7.pk3, pak8.pk3

  8. Update your permissions for directFB access:
        sudo usermod -a -G video [your_username]
    • Log out, log back in. This will allow you to run game as non-root. Works with other directFB/SDL based stuff, too.
  9. If you do not intend to keep Quake 3 source code, you may reorganize files as suggested by this thread on RasPi Forum.

  10. Run ioquake3.arm. Shoot things.

Highly non-scientific testing (i.e. having played a normal-Debian build a few days ago) suggests framerate is quite dramatically improved. Go Raspbian!

Troubleshooting

  • Compiling fails, complaining about missing vcos_platform_types.h file. See this issue in RasPi repository: https://github.com/raspberrypi/firmware/issues/34. (Build script was recently fixed to include correct path to missing header file. Do git pull.)

  • Game cannot find Broadcom libraries. As root do:
        cd /etc/ld.so.conf.d/
        echo /opt/vc/lib >broadcomlib.conf
        ldconfig
  • If you get an error like "failed to open vchiq instance" you'll need to do as root:

        echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules
        usermod -a -G video [your_username]
    • Or as one time temporary solution (until reboot):
        chmod a+rw /dev/vchiq
  • If running as a non-root user and running from the console (non X11), then quake3 may bomb out with an error message like 'SDL_Init()' 'Unable to open mouse'. You'll need to fix permissions so that non-root user can access /dev/input/mice and /dev/input/mouse0.

    • Create new file /etc/udev/rules.d/99-input.rules:

        # file /etc/udev/rules.d/99-input.rules
        KERNEL=="mice", NAME="input/%k", MODE="664", GROUP="input"
        KERNEL=="mouse*", NAME="input/%k", MODE="664", GROUP="input"
    • Add a new group and add your user(s) to it:
    groupadd input
    usermod -a -G input [your_username]
    • Log out, log back in.