# Gentoo for EeePC

Name:
Gentoo for EeePC
Tags:
linux, gentoo, eeepc
Description:
A Gentoo Linux install for the Asus EeePC
Last Update:
2011-08-25

## Introduction

The EeeGen project is an effort at creating an incredibly small, working distribution of the Gentoo Linux Distribution.

I was originally going to use an offshoot of the EmGen project, tweaked for an Eee PC, but it seems that the EmGen project is rather outdated, and there were several difficulties with compatibility with newer portage and old Embedded Gentoo tar-balls. Hence, I will be doing all of this from scratch and seeing where it ends up.

### Host Specifications

We will obviously be needing a host system to build our base, as

1. my Eee PC hasn't come yet (and I'm antsy)
2. compilations will be much faster on my host machine than on the 900mhz celeron.

Thus, these are the host specs that I will be using:

• Gentoo OS (amd64/10.0 Profile)
• Pentium Core 2 Duo T9400 @ 2.53 GHz
• 4 GB RAM

### EEE PC Specifications

The Eee PC that this will be placed on will be an ASUS Eee PC 900.

Detailed specifications on this device are being documented on the following subpage: specs

### Strategies

There are a few things that need to be addressed for the Eee PC to function properly.

• We only have 4G of drive space, so we need to reduce the amount of space the OS takes
• The hard drive is a SSD, so we only want to reduce the amount of writing we will be doing
• We need an easy way to upgrade the system, considering that we are trying to reduce writes

### Goals

There are several goals that I will hope to accomplish in this project with my resulting Eee PC system. The requirements are as follows:

• The finished system should be a minimal desktop system with the following amenities:
• Enlightenment E17 window manager with EComp compiz support
• Framebuffer support
• General programming support for C/C++ (Code::Blocks), Java (Eclipse), and C# (MonoDevelop)
• Web browsing support provided through firefox or chrome
• The finished system should take up no more than 75% of the 4GB hard disk.
• The finished system should be easily upgradable using portage.

## Environment Setup

The first thing we will do is set up a build environment which will be used to build our actual system. This build environment will have to be built once and from then on can be used to create various versions of the EeeGen system.

### Create the Base Directory

First, be sure to create a directory that will be the base for your build system. This system should fulfill the space requirements.

export EEEGEN_DIR=/path/to/eeegen
mkdir -p ${EEEGEN_DIR} Throughout this document the EEEGEN_DIR environment variable will be used in all scripts. Please make sure this is properly set to the base of your build system. We will also want to create a few extra directories for build and release purposes. mkdir -p${EEEGEN_DIR}/build

## Install the Base System

Now we begin by installing a basic system based on the prebuilt stage 3 tarballs available in the various gentoo mirrors.

### Download / unpack a stage 3 tarball

First, go to the gentoo mirrors page and download a stage 3 tarball from releases/x86/autobuilds/current-stage3-i686.

Then untar it to the build directory

This step needs to be run as root in order to maintain proper permissions when unpacking the tar archive!
sudo tar -jxvf stage3*.tar.bz2 -C ${EEEGEN_DIR}/build/ You can then remove the stage file. rm stage3*.tar.bz2 ### Chroot into the Build System Bind all of the appropriate directories to the build system: sudo mount -t proc none${EEEGEN_DIR}/build/proc
sudo mount -t sysfs none ${EEEGEN_DIR}/build/sys sudo mount -o bind /dev${EEEGEN_DIR}/build/dev
sudo mkdir -p ${EEEGEN_DIR}/usr/portage sudo mount -o bind /usr/portage${EEEGEN_DIR}/build/usr/portage

Next we copy the /etc/resolv.conf file so that we maintain internet connectivity.

sudo cp -L /etc/resolv.conf ${EEEGEN_DIR}/build/etc/ You should be ready to chroot now. sudo chroot${EEEGEN_DIR}/build/ /bin/bash --login

Now that you are within the chroot, you need to update the environment variables in your system.

env-update
source /etc/profile

It is also a good idea to modify your prompt so that you don't accidentally type commands into your host system that were meant for your build system.

export PS1="(eeegen-build) $PS1" ### Edit Make Information Now that we are in the build system, we need to update some common configuration information to ensure that the build goes alright. The /etc/make.conf file is one of the most important files on any Gentoo system. It sets all of the environment variables to use when installing packages. For the sake of making things easy, I would recommend changing/adding the values to make the file resemble the following: CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer" CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
MAKEOPTS="-j2"

USE="${USE} aac acpi alsa apm" USE="${USE} bzip2"
USE="${USE} cairo cjk crypt cups curl" USE="${USE} dbus directfb dri"
USE="${USE} esd extras" USE="${USE} fbcon fbcondecor ffmpeg flac foomaticdb"
USE="${USE} gif git gles glut gmp gnutls gtk gzip" USE="${USE} ipv6"
USE="${USE} jabber java javascript jpeg" USE="${USE} libnotify lzma lzo"
USE="${USE} matroska midi mime mms mmx mng mono mp3 mp4 mpeg mplayer msn" USE="${USE} ncurses nls nptl nsplugin ntp"
USE="${USE} offensive ogg openal opengl" USE="${USE} pdf png posix pulseaudio"
USE="${USE} quicktime" USE="${USE} raw rss"
USE="${USE} samba sasl sdl sockets socks5 sound spell sqlite sqlite3 sse sse2 ssl subversion svg syslog" USE="${USE} taglib tcl theora threads tiff timidity truetype"
USE="${USE} udev unicode urandom usb" USE="${USE} vorbis"
USE="${USE} wifi win32codecs wmf" USE="${USE} X x264 xcb xcomposite xft xml xmpp xpm xsl xv xvfb xvid"
USE="${USE} zip zlib" USE="${USE} -gnome -kde"

FEATURES="ccache"

CCACHE_DIR="/var/tmp/ccache"
CCACHE_SIZE="2G"

INPUT_DEVICES="evdev keyboard mouse"
VIDEO_CARDS="intel"

GENTOO_MIRRORS="http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ http://mirror.mcs.anl.gov/pub/gentoo/ http://gentoo.cites.uiuc.edu/pub/gentoo/ http://gentoo.mirrors.tds.net/gentoo http://gentoo.osuosl.org/"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"

Make sure the profile is set to the latest generic default/linux/x86/* profile:

eselect profile list

### System settings

#### Timezone

The timezone needs to be set, so copy the appropriate file from /usr/share/zoneinfo to /etc/localtime.

cp /usr/share/zoneinfo/CST6CDT /etc/localtime

#### fstab

We'll need the appropriate fstab setup before loading this system onto the Eee PC for the first time. In my case I have set up two partitions on my 4G solid state:

Device Mount point Type Size
/dev/sda1 / ext4 3.5G
/dev/sda2 (none) swap 512M

So I set up my /etc/fstab file to look like this:

# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

/dev/sda1               /               ext4            noatime         0 1
/dev/sda2               none            swap            sw              0 0

#### Hostname

For my device I name all of my devices after my favorite Anime characters, so I chose “rika” (after Furude Rika from Higurashi no Naku Koro Ni). Set this to your chosen value in /etc/conf.d/hostname:

# Set to the hostname of this machine
hostname="rika"

#### Hardware Clock

I want the hardware clock to sync with the system clock, so modify /etc/conf.d/hwclock to look like this:

# Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
# Greenwich Mean Time).  If that clock is set to the local time, then
# set CLOCK to "local".  Note that if you dual boot with Windows, then
# you should set it to "local".
clock="UTC"

# If you want to set the Hardware Clock to the current System Time
# (software clock) during shutdown, then say "YES" here.
# You normally don't need to do this if you run a ntp daemon.
clock_systohc="YES"

# If you want to set the system time to the current hardware clock
# during bootup, then say "YES" here. You do not need this if you are
# running a modern kernel with CONFIG_RTC_HCTOSYS set to y.
# Also, be aware that if you set this to "NO", the system time will
# never be saved to the hardware clock unless you set
# clock_systohc="YES" above.
clock_hctosys="YES"

# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here. Alpha users may wish to use --arc or --srm here.
clock_args=""

#### Locale

Next we set up our locale to be a unicode (UTF-8) locale:

First edit /etc/locale.gen to look something like this:

# /etc/locale.gen: list all of the locales you want to have on your system
#
# The format of each line:
# <locale> <charmap>
#
# Where <locale> is a locale located in /usr/share/i18n/locales/ and
# where <charmap> is a charmap located in /usr/share/i18n/charmaps/.
#
# All blank lines and lines starting with # are ignored.
#
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
#
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you.  After updating this file, you can simply run locale-gen
# yourself instead of re-emerging glibc.

en_US ISO-8859-1
en_US.UTF-8 UTF-8
ja_JP.EUC-JP EUC-JP
ja_JP.UTF-8 UTF-8
ja_JP EUC-JP
#en_HK ISO-8859-1
#en_PH ISO-8859-1
#de_DE ISO-8859-1
#de_DE@euro ISO-8859-15
#es_MX ISO-8859-1
#fa_IR UTF-8
#fr_FR ISO-8859-1
#fr_FR@euro ISO-8859-15
#it_IT ISO-8859-1

Then regen the locales:

locale-gen

And lastly set our locale to the utf-8 locale:

eselect locale set en_US.utf8
source /etc/profile
export PS1="(eeegen-build) \$PS1"

## Onto the Kernel!

The next step is to compile a kernel for our Eee PC.

### Install gentoo-sources

We want to use the gentoo-patched kernel sources, so download/install them:

emerge -av gentoo-sources

### Configure the Kernel

This is a little more difficult, especially since our host system is technically x86_64 architecture whereas the Eee PC we're targeting is x86. This means that when we tell the kernel we want to make a configuration, it tries to autodetect our arch and guesses wrong, so we'll need to tell it otherwise.

cd /usr/src/linux
ARCH="x86" make menuconfig

### Compile the Kernel + Modules

Once you have successfully configured the kernel, you are now ready to build it!

ARCH="x86" make
ARCH="x86" make modules_install

### Install the Kernel to /boot

Lastly we install our kernel to /boot for boottime!

cp .config /boot/x86-2.6.39-gentoo-r3.config
cp System.map /boot/x86-2.6.39-gentoo-r3.System.map
cp arch/x86/boot/bzImage /boot/x86-2.6.39-gentoo-r3.kernel

## Install System Applications

First install ccache, so we can reduce future compliation times.

emerge -av ccache

Next we install some necessary system applications and set them up:

emerge -av syslog-ng vixie-cron app-misc/screen grub squashfs-tools dhcpcd

Then set up some of the utilities.

rc-update add syslog-ng default
rc-update add vixie-cron default

Set the root password

passwd

## References

projects/linux/eeegen.txt · Last modified: 2014/05/13 12:36 (external edit)

© 2011 Austen Dicken | cvpcs.org