Gentoo Linux

From MarcsHomepage
Revision as of 21:43, 17 April 2006 by Marc Saric (talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)

Gentoo Linux on Small Systems

Gentoo-Linux can be automatically built from scratch with your own compiler-settings.

To run a small and fast system, it is vital to keep the memory-footprint of executables down to minimize memory-usage and loading-time.

This would be even true if you would have to sacrifice some performance for that (remember, what happens to performance if your dear old PC has to start swapping things out to it's hard disk), especially if you want to have a desktop machine (programs being opened and closed much more frequently than on a server).

The following snippet is the /etc/make.conf of the system I built based on Gentoo Linux 2004.2. The computer is intended as a desktop machine, therefore not much server-software would be installed, just word-processing, spreadsheet and web-browsing-tools and a decent desktop-environment, which could be used by someone not CLI-literate (i.e. a Windows-person (sort of)).

Probably the USE-Flags could be a bit more optimized, but overall the system runs fine.


CFLAGS="-Os -pipe -march=pentium2 -fomit-frame-pointer -fforce-mem
        -fforce-addr -mfpmath=387 -mmmx -mno-align-stringops"
CHOST="i586-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="apm arts alsa crypt cups dga encode gd gdbm gnome gpm gtk
     gtk2 gtkhtml imlib java jpeg kde lesstif libwww mad mmx motif
     mozilla mpeg ncurses nls oggvorbis oss pam pdflib perl png
     python qt readline sdl slang spell ssl svga tcltk tcpd
     tetex tiff truetype usb wmf wxwindows x86 X xml2 xmms zlib"
GENTOO_MIRRORS="http://gentoo.inode.at/ ftp://gentoo.inode.at/source/ 
                http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"

Explanation of CFLAGS

A full listing of all compiler options with explanations can be found on the GCC-homepage.

  • -Os -Optimize for small binary-size. Obviously the CFLAG which should be used on a memory-strapped system.
  • -pipe -Use pipes rather than temporary files for communication between the various stages of compilation. Not really neccessary.
  • -march=pentium2 -Optimize for the CPU-architecture of the machine, you would have to change this according to the CPU of your own machine.
  • -fomit-frame-pointer -Don't keep the frame pointer in a register for functions that don't need one.
  • -fforce-mem -Force memory operands to be copied into registers before doing arithmetic on them. This produces better code by making all memory references potential common subexpressions. This is not a size- but a speed-optimization. Leave out, if you think, that you don't need this.
  • -fforce-addr -Force memory address constants to be copied into registers before doing arithmetic on them. This may produce better code just as -fforce-mem may. This is not a size- but a speed-optimization. Leave out, if you think, that you don't need this.
  • -mfpmath=387 -Generate floating point arithmetics for selected FPU, as my PII does not have SSE, this ought to be ok. Change according to your own FPU.
  • -mmmx -Enable MMX-support, again depends on the CPU of your system.
  • -mno-align-stringops -Reduces code size and improves performance in case the destination is already aligned. You loose a potential speed-optimization here.

Explanation of USE-Flags

For a list of USE-flags with explanations, see the Gentoo-homepage.

  • apm -enable APM-support. As my old PII had no working ACPI, this is the way to go if you want to use power-saving-options.
  • arts -enable support for ARTS, the KDE-multimedia and sound daemon (now deprecated with the most recent version of KDE).
  • alsa -enable ALSA-support.
  • crypt -enable crypt-support.
  • cups -enable the Common Unix Printing System for easy printer-setup and administration.
  • dga -enable dga.
  • encode -enable decode-support.
  • gd -enable gd-support.
  • gdbm -enable gdbm-support.
  • gnome -enable Gnome-support, disable if you are shure that you don't want Gnome-apps.
  • gpm -enable gpm-support.
  • gtk -enable gtk-support.
  • gtk2 -enable gtk2-support.
  • gtkhtml -enable gtkhtml-support.
  • imlib -enable imlib-support.
  • java -enable Java-support.
  • jpeg -enable libJPEG-support.
  • kde -enable KDE-support (disable if you are shure that you don't want KDE-apps.
  • lesstif -enable motif-support.
  • libwww -enable libwww-support.
  • mad -enable mad-support.
  • mmx -enable mmx-support (only makes sense if your CPU has a MMX-extension available (my PII has)).
  • motif -enable Motif-support.
  • mozilla -enable Mozilla-support.
  • mpeg -enable mpeg-support.
  • ncurses -enable ncurses-support.
  • nls -enable NLS-support.
  • oggvorbis -enable Ogg/Vorbis-support.
  • oss -enable OSS-support, this might probably be deactivated if you have a Kernel 2.6 and want to use ALSA exclusively.
  • pam -enable PAM-support.
  • pdflib -enable PDFlib-support.
  • perl -enable Perl-support (might be a good idea even if you do not plan to program in Perl).
  • png -enable PNG-support.
  • python -enable Python-support (might be a good idea even if you do not plan to program in Python).
  • qt -enable qt-support (needed for KDE among others).
  • readline -enable readline-support.
  • sdl -enable SDL-support.
  • slang -enable slang-support.
  • spell -enable spell-support.
  • ssl -enable ssl-support.
  • svga -enable svga-support, comes in handy for a high-res console.
  • tcltk -enable Tcl/Tk-support.
  • tcpd -enable tcpd-support
  • tetex -enable tetex-support, can probably be ommited if you don't want to use LaTeX.
  • tiff -enable libTIFF-support.
  • truetype -enable TrueType-support -a must.
  • usb -enable USB-support, also a must.
  • wmf -enable WMF-support.
  • wxwindows -enable WxWidgets-support.
  • x86 -enable x86-extensions.
  • X -enable X-support, a must for a desktop-machine.
  • xml2 -enable XML-support.
  • xmms -enable XMMS-support.
  • zlib -enable ZLIB-support.

A Stage 1-installation took about 3 days on the above-mentioned machine (only using the CPU available in that system) and the result was a small and quite fast and responsive installation which can be booted from 256 MB RAM and which does not start swapping even if some applications are being loaded on top of Gnome.

Glitches and things I should have done different

Early on I decided against Kernel 2.6 and in favour of Kernel 2.4, which led to some trouble with the sound (no ALSA-support in the kernel) and automounting of devices (remember, this should be a computer for people with little or no experience, i.e. it should be small, clean and easy to use). Probably a Kernel 2.6, ALSA, Gnome/udev-based system would have been the better choice.

Stability issues with Abiword -the Abiword-version available for my system shows stability issues (frequent crashes during text-editing). I haven't found the reason for this, but probably an upgrade to the most recent version (2.2 at the time of writing this page) might solve the problem.

English-only, no help -some Linux software is not localized, and some packages shipped with Gentoo 2004.2 ignore the locale which has been selected for the default user (Firefox 1.0 for example, Open-Office even has to be recompiled with the correct language, which is a pain). Many software-packages miss a good documentation geared towards beginners.

Although this is not a big issue for a power-user, it definitely is a show-stopper for people without much computing-experience.

Final words

Overall the system works as it should and is more stable, more secure and more up-to-date and cheaper than a Windows NT 4 installation would be.