@html_text_substitution=readme.txt|<a href="../readme.html">readme.txt</a>
@html_text_substitution=docs/build/unix.txt|<a href="unix.html">docs/build/unix.txt</a>
@external-css=../allegro.css
@document_title=Allegro Linux-specific information
@<pre>
     ______   ___    ___
    /\  _  \ /\_ \  /\_ \
    \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___ 
     \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
      \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
       \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
	\/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
				       /\____/
				       \_/__/


		 Linux-specific information.

	 See readme.txt for a more general overview.

   Also see docs/build/unix.txt for general Unix information.
@</pre>



@heading
General notes

   On Linux you have two different system drivers -- one for running using 
   X, and one for running without X. For information on the X version, and 
   instructions telling how to install Allegro and compile your programs on 
   a Unix system, see <tt>docs/build/unix.txt</tt>. This file only describes the
   Linux console routines.

   Normally the X version is used in preference to the console version, if 
   an X server is contactable (this means that your programs will use X if 
   you launch them from inside X, and otherwise use the console). You can 
   change this using your config file if you like, or by configuring 
   <tt>--without-x</tt>.



@heading
Installing Allegro

   See <tt>docs/build/unix.txt</tt>: this process is identical for the console and X
   versions.



@heading
Using Allegro

   Some parts of Linux console Allegro need root privileges. Others don't. 
   Specifically, the VGA, mode-X and VBE/AF graphics drivers do. The fbcon 
   driver doesn't. Also, if you intend to run a program from something which 
   isn't a VT (e.g. an xterm (but not using the X version), a remote login, 
   a screen session) then you need to either own a (free) console numbered 
   from 1 to 15 or to have root privileges.

   If you want a program to run with privileges even though the user running 
   it is not root, make root own the binary and set the suid bit:
<textblock>
      # chown root.allegro exhello
      # chmod 4770 exhello
<endblock>
   That makes the executable be owned by root and group `allegro'. It's 
   readable, writable and executable by root and people in that group. Also, 
   when it runs, it has root privileges. For that reason, it's not 
   executable by the general public. Put trusted users into group `allegro'.

   You might prefer to use `4750' instead of `4770' -- then people in the 
   group cannot write to the binary.

   Allegro will drop the privileges almost immediately after initialisation, 
   using `seteuid'. This means that you can still get the permissions back 
   later on. Allegro needs to be able to regain the privileges if you intend 
   to call `<code>allegro_init</code>' again in the future. If this isn't the case, you
   can completely give up the privileges using `<code>setuid(getuid());</code>' -- then
   they are lost for good.

   Security note: If you don't do this, any buffer overflows are a severe 
   security problem. In any case, you should take great care when allowing 
   random people to execute third-party programs suid root.

   If, as root, you run `<tt>make suid</tt>', it will do this to all of the programs
   generated -- the demo game, the examples, the tests, etc.



@heading
Notes on drivers

   This section contains Linux-specific notes on the drivers available.
<blockquote><dl>
   <dt><b>System:</b></dt><dd>
      On initialisation, Allegro will try to get a certain amount of
      control over the console. This doesn't generally require root
      privileges, but if the program isn't being run from a plain VC (e.g.
      it's running from within X or screen), Allegro must try to allocate
      a spare VC and move the program to it. This requires a free console
      we can read from and write to; unless the user has allocated some,
      we need to be root here.
      
      Display switching is possible; all of Allegro's modes are supported.
      The default is <tt>SWITCH_PAUSE</tt>. <tt>SWITCH_BACKGROUND</tt> will only work if the
      application takes special precautions.</dd>

   <dt><b>Graphics:</b></dt><dd>
      Linux Allegro supports standard VGA and mode-X by direct writes to 
      the video card. You need root privileges for this to work.
      
      It also supports fbcon, for which you do not need privileges, but 
      you do need a recent kernel, correctly configured.
      
      The VBE/AF system does require root privileges. Note it is not built by
      default and hasn't been tested in a long time. Basically, you should
      not bother with it. But if you insist, you need to get a VBE/AF driver
      that works in Linux -- the FreeBE/AF project has two at present, but
      the project itself hasn't been ported to Linux. You can just copy out
      the driver binaries, though. Put the appropriate driver into
      `<tt>/usr/local/lib</tt>', `<tt>/usr/lib</tt>', `<tt>/lib</tt>' or
      `<tt>/</tt>', filename `<tt>vbeaf.drv</tt>' -- or put it anywhere you
      like, specifying the location in the config file as for the DOS
      version.
      
      For security reasons, the VBE/AF driver binary must be owned by root
      and only writable by root. You really don't want to load and execute 
      user-specified binary code in a privileged program.
      
      The SVGAlib driver should be fairly stable and fast now, and can use
      most of the video modes that SVGAlib provides. It requires root
      privileges if your version of SVGAlib requires them.</dd>

   <dt><b>Sound:</b></dt><dd>
      The ALSA drivers support both the older 0.5.x version of the ALSA API
      as well as the newer 0.9.x+ series. Support for the older API will be
      dropped later.</dd>

   <dt><b>Keyboard:</b></dt><dd>
      The keyboard driver uses the kernel mapping tables to map scancodes
      to character codes and key functions, so your keyboard mapping
      should be fine without special configuration in the setup program.</dd>

   <dt><b>Joystick:</b></dt><dd>
      To compile Allegro with joystick support you must have a 2.2.* or newer
      kernel, i.e. with kernel-based joystick support. Look for
      <tt>/usr/src/linux/include/linux/joystick.h</tt>. You shouldn't have to
      actually configure the kernel with joystick support though, you just
      need that header file.
      
      Similarly, to run Allegro programs with joystick support you must have
      configured joystick support into the kernel. You also need to create
      the device file <tt>/dev/input/js0</tt>, if it's not already there.
      
      See <tt>/usr/src/linux/Documentation/joystick.txt</tt> for details.</dd>

   <dt><b>Mouse:</b></dt><dd>
      Currently Linux Allegro supports PS/2 and Microsoft mice directly, 
      and other mouse types via GPM. To use GPM you must turn on its 
      `repeater' feature, where it copies all mouse activity to the FIFO 
      <tt>/dev/gpmdata</tt>. Edit your init scripts and add the `<tt>-R</tt>' option. The
      GPM driver can also be used with native Mouse Systems mice by 
      changing the `<tt>mouse_device</tt>' variable in the config file.
      
      When using the PS/2 Intellimouse protocol, it is necessary to
      explicitly put the mouse into wheel mode, which requires Allegro
      to have write permissions to the device.

      There is now also a input events-based driver which reads events from
      <tt>/dev/input/eventN</tt>.</dd>
</dl></blockquote>
