Gentoo Installation

From A110 Wiki

Jump to: navigation, search

Contents

Goals

This HowTo explains how to put a basic Gentoo installation onto the One A110.

If you want a shortcut: burn the current [[pentoo]] image on CD, then follow the instructions on the CD to quickly make a bootable usb-stick. it runs nicely on the IL1. type "emerge xf86-video-openchrome" for X support (use --buildpkg --fetchonly --usepkg in some way to save time later).


Considerations

Gentoo is based on the idea to compile every software for the hardware that is used. This allows optimization for the CPU as well as fine-tuned adaption to individual needs by choosing the right USE-flags (see Gentoo Handbook for details). On the downside, Gentoo needs quite a lot of ressources in terms of CPU power and disk space.

Nevertheless, the possibility to compile all software using the right compiler flags helps to get most out of slow CPUs while at the same moment conserving memory by optimization for space. Both is quite essential for a limited system such as the A110.

Therefore, the idea is as follows:

  • Put a basic Gentoo system on the A110
  • Move everything that is just needed for installation of packages onto another filesystem that is only mounted on demand
  • Restrict packages and files on the SSD of the A110 to the minimum

Assumptions

This is not a HowTo in the sense that is explains every single step. Instead, it is assumed that the reader is familiar with basic Linux- and Gentoo procedures. Therefore, it gives guidelines instead of step-by-step-descriptions.

Basic Installation

The actual installation is done in the following way:

  • Get a bootable Gentoo medium. This could be either a minimal Gentoo installation-CD inside an USB CDROM drive or an USB-Stick with a copy of the minimal Gentoo installation-CD - create it, e.g., following the instructions from http://www.byteclub.net/wiki/Gentoo_live using up-to-date images (those from 2008).
  • Boot the A110
  • Make a Backups. The method described in the Wiki works perfect from a Gentoo installation image - you just have to mount another medium such as NFS or USB-drive
  • Make a basic stage3-install. Use the following CFLAGS in your /etc/make.conf in order to support the features of the C7-M cpu as well as optimization for space:
CFLAGS="-march=i686 -mmmx -msse -msse2 -msse3 -Os -pipe -fomit-frame-pointer"
  • Once finished, boot into your new installation and make sure basic functions are supported. As a starting point for the kernel you can use my kernel configuration which I use for the kernel version 2.6.25-gentoo-r6.
  • Choose a second medium for the installation system and mount it to, e.g., /a110. This can be a NFS share as well as a USB drive.
  • Boot again from installation medium and copy your whole installation to the second medium.
  • Boot the A110 and mount your medium to /a110
  • Erase /usr/portage, /var/cache and /var/db and replace them by links to the appropriate directories in /a110
  • create an executable file enterchroot somewhere in your path with the content
#!/bin/bash
mount /a110
mount /usr/portage
mount -t proc proc /a110/proc
chroot /a110 /bin/bash
umount /a110/proc
  • Adopt that script to your needs
  • Create a second executable file cleanpkg with
#!/bin/bash
mount /a110
mount /usr/portage
emerge -C binutils man man-pages gcc autoconf automake 
rm -rf /usr/share/man
rm -rf /usr/share/doc
rm -rf /usr/share/info
mkdir -p /usr/lib/gcc/i686-pc-linux-gnu/4.1.2
cd /a110/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/
tar cpsf - `ls | grep -v include` | ( cd /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/ ; tar xvpsf - )
  • Adopt that script to your needs
  • Run cleanpkg. This erases the compiler, all man/doc/info-files and some other tools only needed for emerging.
  • Add a feature line to /a110/etc/make.conf
FEATURES="parallel-fetch buildpkg"
  • enter the installation systems chroot by enterchroot
  • run
$ emerge -e world
  • This creates all packages using our compile flags inside the installation system and creates binary packages for the real system
  • leave chroot by Ctrl-d
  • Run
$ emerge -Ke world
  • This repeats the previous step on the real system
  • Clean up the real system by cleanpkg
  • Now we have everything set up in order to install whatever package we want to install (see next section).

Installing software

In order to install a package, you have to do:

  • Connect your second medium
  • Mount it and chroot into the installation system:
$ enterchroot
  • Install whatever software the usual gentoo way. It is recommended to run emerge -p <whatever> first in order to see what happens and to adopt USE flags in order to safe space
  • After installation is done, leave chroot by Ctrl-d. The installation system should be still mounted after that
  • Do emerge -K <whatever>. As we share the /usr/portage between the real system and the instaaltion system, this uses the compiled binary packages from the installation system without stressing the internal SSD. In fact, all compilation takes place on the installation systems medium and does not affect the SSD.
  • Optionally: Repeat cleanpkg to erase newly installed unnecessary files. Sometimes, packages reinstall the compiler that we have to erase that way.

Further considerations

After installing, the Gentoo on A110 behaves similar to other distributions. I do not use unionfs, squashfs, LVM or similar, I just run an uncompressed ext2 with mount options noatime,nodiratime on the SSD. Due to the option to install exactly what you need compiled for our CPU and with our USE-flags we save a lot of space. As an example, I have 1.3 GB in use and have installed (only big, mayor packages):

  • OpenOffice 2.4.1
  • Firefox
  • Thunderbird
  • Emacs
  • Complete TeTeX-distrivution
  • Xorg
  • Windowmaker as Windowmanager
  • Xpdf
  • many more small packages

On the hardware side, I followed instructions from that Wiki to setup

  • LCD using binary via driver (works out of the box on Gentoo)
  • Wireless using ndiswrapper (the other approaches are too slow and too unreliable)
  • SD using the patch for 2.6.25

Overall, the system runs very smooth and feels much faster than the original Ubuntu-Installation


Optimizations

The Via C7-M is not the fastest CPU in the world. Therefore, it takes hours to days to compile big packages such as openoffice. To avoid that, it is a good idea to mount and chroot your installation system from another fast system with a processor that has at least the features of the C7-M, especially SSE3 (that means everything starting from Pentium 4 at the intel side and later socket 939 K8 on the AMD side - /proc/cpuinfo must contain pni) and make all installation operations there. That way, the A110 must only perform binary installations which are very fast. I have done that using a vmware instance that mounted my NFS-share containing the installation system.

On the other hand, a lot of packages still creates a lot of not really needed files - especially we do not need any include files on the A110. Therefore, the cleanpkg script can be developed much further to erase more of that - my guess is that we can at least safe another 100 MB that way.