Enable serial access
Since the Vendotto server has no keyboard or screen interface [at least no visible ones], it is necessary to get some kind of terminal working before changing the kernel and network parameters [otherwise, it would be just too easy to lock oneself out]. In order to enable access via the serial port of the Vendotto machine, the following changes are necessary:
- add
ttyS0 to /etc/securetty
- add
2:2345:respawn:/sbin/getty ttyS0 9600 linux to /etc/inittab
- add
serial=0,9600n8 to /etc/lilo.conf
- add
append="console=ttyS0,9600n8" to each boot entry in /etc/lilo.conf
Now it is possible to connect another computer via nullmodem cable and use minicom [or terminal.exe, if you have to] to choose a kernel at the lilo bootprompt. The boot messages will be put on the serial port as well. If the kernel was compiled with serial support [the installed 2.2.21 kernel was], logging into a shell via the serial port is also possible.
Diskspace
The Vendotto server comes with 40 GB hard disk. The hda1 partition is mounted on / , but it has only 256 MB capacity. Since there is no /usr partition, there are only about 30 MB free on hda1. hda3, on the other hand, has 36 GB and is mounted on /share. We create a /share/hotspot directory into which we will put all built binaries and hotspot-relevant configuration files.
Building the toolchain
Fortunately, the vendotto linux installation depends on the redhat package manager. Although
/etc/redhat-release says "Release 1.14.4-TN (Tofutti)", the binary RPMs for redhat linux 6.x work with the installed packages most of the time. They can be found at
ftp.redhat.com.
As the default installation does not include any compilers or binutils, we have to set up a working toolchain first. This is accomplished by installing the following packages:
- glibc-devel-2.1.3-15.i386.rpm
- kernel-headers-2.2.14-5.0.i386.rpm
- compat-binutils-5.2-2.9.1.0.23.1.i386.rpm
- compat-egcs-5.2-1.0.3a.1.i386.rpm
- bison-1.28-5.i386.rpm
- flex-2.5.4a-9.i386.rpm
- make-3.77-6.i386.rpm
Now, we can compile stuff. But since the linux kernel requires the gnu c compiler, we have to compile gcc and the corresponding binutils first. For this, we need the files
- binutils-2.10.1.tar.gz
- gcc-2.95.3.tar.gz
Both are available at
gnu.org.
More information on building gcc can be found
here.
Building the binutils is rather straightforward:
./configure --prefix=/share/hotspot && make && sudo make install
should do the trick.
Compiling the compiler is a little bit more complicated. First, we have to create an object directory in the same place as the source directory. Then, from this object directory we run
../gcc-2.95.3/configure --srcdir=../gcc-2.95.3/ --with-gnu-as=/share/hotspot/bin/as --with-gnu-ld=/share/hotspot/bin/ld --enable-threads=posix --prefix=/share/hotspot --host=i586-intel-linux
Now we can build the compiler with
make LANGUAGES="c c++"
The next step is letting the gnu compiler compile itself, this is done by
make bootstrap LANGUAGES="c c++"
after that,
sudo make install LANGUAGES="c c++"
installs the compiler.
Now we can remove the compat-binutils and compat-egcs packages since they are no longer needed. because gcc was installed to
/share/hotspot/, we have to create symlinks in
/usr/bin pointing to the corresponding binaries in
/share/hotspot/bin. With this, we at last have the means to build our own kernel and tools.
Building the linux kernel
Building the kernel is not much of a problem since the hardware used in the Vendotto Server is well supported by the linux kernel. The only problem is that the installed ncurses library does not work with the menuconfig make target, so we have to use
make config [which sucks].
Download
linux-2.4.20.tar.gz from
kernel.org. Since we want to use the hostap drivers ofr the prism chip, we also need to download
hostap-driver-0.1.2.tar.gz from
hostap.epitest.fi. After extracting both tarballs, we apply the hostap driver patches to the kernel from the linux source tree with
patch -p1 < ../hostap-driver-0.1.2/kernel-patches/hostap-linux-2.4.20.patchand
cp ../hostap-driver-0.1.2/driver/modules/hostap*.[ch] drivers/net/wireless
the actual configuration of the kernel has to look like this:
autoconf.h.
after having configured the kernel,
make dep && make bzImage && make modules && make modules_install
build the kernel and modules.
Building the apache http daemon
First, we need to build the openssl library if we want to be able to serve web pages over https.
openssl-0.9.7c.tar.gz can be found at
openssl.org. Build and install openssl with
./config --openssldir=/share/hotspot/ && make && sudo make install
next, we get
httpd-2.0.48.tar.gz from
apache.org.
to build apache, we use
./configure --prefix=/share/hotspot --with-ssl=/share/hotspot/ --enable-ssl --sysconfdir=/share/hotspot/etc --enable-rewrite/ && make && sudo make install
We add a dedicated user for the http daemon with
sudo useradd www
and change
/share/hotspot/etc/httpd.conf to contain the following lines:
User www
Group www
the http daemon can now be started with
/share/hotspot/bin/apachectl start
Building the mysql database server
We use
mysql-4.0.16.tar.gz, available from
mysql.com.
we build the mysql database via
./configure --prefix=/share/hotspot --enable-thread-safe-client --without-innodb --without-isam --without-bench --datadir=/share/hotspot/var/db && make && sudo make install
Note that there is a
bug in the mysql autoconf script which falsely complains about Gethostbyname_r() arguments while in reality it requires a working c++ compiler.
Now, we have to add a mysql user with
sudo useradd mysql
We also need to
sudo chown mysql:mysql /share/hotspot/var/db
We copy the file
/share/hotspot/share/mysql/my-small.cnf to
/share/hotspot/etc/my.cnf and change it to contain the following lines:
[client]
socket= /share/hotspot/tmp/mysql.sock
[server]
socket= /share/hotspot/tmp/mysql.sock
The mysql daemon can now be started with
sudo /share/hotspot/bin/mysqld_safe --pid-file=/share/hotspot/var/db/mysql.pid
Finally, we do a
ln -s /share/hotspot/etc/my.cnf /share/hotspot/var/my.cnf
Building the php interpreter
Having set up the web and database server, the last step is building the php engine. We use
php-4.3.3.tar.gz from
php.net.
To build it,
./configure --prefix=/share/hotspot --with-apxs2=/share/hotspot/bin/apxs --with-mysql=/share/hotspot/ --with-gnu-ld --with-gnu-as --sysconfdir=/share/hotspot/etc && make && sudo make install
We copy the file
src/php-4.3.3/php.ini-dist from the php source directory to
/share/hotspot/etc/php.ini and change the file to contain the line
mysql.default_socket = /share/hotspot/tmp/mysql.sock
finally, we do
ln -s /share/hotspot/etc/php.ini /share/hotspot/lib/php.ini
Building the PCMCIA tools
It took a few tries to get the WLAN hardware working with the new kernel. Although the cause for this was not having enabled ISA support with
#define CONFIG_ISA 1 in the kernels autoconf.h, i installed a new pcmcia toolset before, thinking this was the cause of the problems. So of course i have no idea wether the kernel and hostap drivers work with the originally installed pcmcia tools. To build a new set of pcmcia tools, load
pcmcia-cs-3.2.7.tar.gz from
sourceforge.net.
Building the hostap daemon
In order to setup an access point, we build the hostap daemon from
hostapd-0.1.0 which can be found at
hostap.epitest.fi. We also need the linux wireless tools
wireless_tools.26.tar.gz from
Jean Tourrilhes. Both are build by
make, the resulting binaries have to be moved to
/share/hotspot/sbin.
Building the netfilter frontend iptables
In order to use the enhanced capabilities of the 2.4.x linux netfilter framework, we have to use iptables instead of the already installed ipchains.
iptables-1.2.9.tar.gz can be found at
netfilter.org.