1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>
Allegro Linux-specific information
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" title="Default" type="text/css" href="../allegro.css"></head><body bgcolor=white text=black link="#0000ee" alink="#ff0000" vlink="#551a8b">
<pre>
______ ___ ___
/\ _ \ /\_ \ /\_ \
\ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
\ \ __ \ \ \ \ \ \ \ /'__`\ /'_ <tt>`\/\`'</tt>__\/ __`\
\ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
\ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
\/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
/\____/
\_/__/
Linux-specific information.
See <a href="../readme.html">readme.txt</a> for a more general overview.
Also see <a href="unix.html">docs/build/unix.txt</a> for general Unix information.
</pre>
<p><br>
<h1><a name="General notes">General notes</a></h1>
<p>
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><a href="unix.html">docs/build/unix.txt</a></tt>. This file only describes the
Linux console routines.
<p>
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).
<p>
Unless you have specific needs, we recommend using the X version. The Linux
console port is not enabled by default. It never worked that well and there
is no real interest in it any more. We may remove it in a future release.
<p><br>
<h1><a name="Installing Allegro">Installing Allegro</a></h1>
<p>
See <tt><a href="unix.html">docs/build/unix.txt</a></tt>: this process is identical for the console
and X versions.
<p>
You must set the CMake option WANT_LINUX_CONSOLE to enable the console
version, as it is not built by default.
<p><br>
<h1><a name="Using Allegro">Using Allegro</a></h1>
<p>
Some parts of Linux console Allegro need root privileges. Others don't.
Specifically, the VGA and mode-X 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.
<p>
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:
<blockquote class="text"><pre>
# chown root.allegro exhello
# chmod 4770 exhello
</pre></blockquote>
That makes the executable be owned by root and group <tt>`allegro'</tt>. 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 <tt>`allegro'</tt>.
<p>
You might prefer to use <tt>`4750'</tt> instead of <tt>`4770'</tt> -- then people in the
group cannot write to the binary.
<p>
Allegro will drop the privileges almost immediately after initialisation,
using <tt>`seteuid'</tt>. 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 <tt>`<code>allegro_init</code>'</tt> 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.
<p>
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.
<p>
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.
<p><br>
<h1><a name="Notes on drivers">Notes on drivers</a></h1>
<p>
This section contains Linux-specific notes on the drivers available.
<blockquote><dl>
<p>
<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.
<p>
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>
<p>
<dt><b>Graphics:</b></dt><dd>
Linux Allegro supports standard VGA by direct writes to the video card.
You need root privileges for this to work.
<p>
It also supports fbcon, for which you do not need privileges, but
you do need a recent kernel, correctly configured.
<p>
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>
<p>
Note: Allegro used to have a mode-X driver, but it does not work as of
4.4.0. Someone may restore it in the future, but it's likely.
<p>
<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>
<p>
<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.
<p>
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.
<p>
See <tt>/usr/src/linux/Documentation/joystick.txt</tt> for details.</dd>
<p>
<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
<tt>`repeater'</tt> 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>`<tt>mouse_device</tt>'</tt> variable in the config file.
<p>
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.
<p>
There is an input events-based driver which reads events from
<tt>/dev/input/eventN</tt>.</dd>
</dl></blockquote>
</body>
</html>
|