NOTE I no longer run gentoo on my EEE
I am now using Ubuntu 8.04. The main reason for my change was that emerging packages was too much of a pain. I was not satisfied with the following solution, and you probably won't be either. I have stopped updating this page so it is probably out of date.
This page describes how I got Gentoo set up and running on my EEE Pc
Basics
I installed Gentoo on an 8 Gig SDHC card. I did not want to remove the default OS, until I was really sure I wanted to. Also, because the EEE is not particularly fast, I decided I wanted to do all the building on my main desktop machine, an Intel Q6600 machine (much faster).
You need to perform the following steps as root. Otherwise there are permissions problems when trying to rsync the system onto the EEE. There may be a way around this, however as the files are going to owned by root on the EEE, there does not seem to be a really compelling reason to be a non-root user on the host machine.
Install a basic system on the host machine
Follow the basic Gentoo Handbook, however instead of booting a live cd and partitioning a disk, install within a directory on the host machine. I used /root/eee. Because of this change, you can probably skip to Chapter 5. In this case instead of installing into /mnt/gentoo, use /root/eee. We'll setup the SD card later.
I will add notes when my instructions deviate from the Handbook's instructions or to provide useful tips.
Install Stage 3
Install portage
Configure the compiler options
Processor optimization
The EEE runs a Pentium-M processor. These are the optimization flags I use for my system:
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /etc/make.conf.example for a more detailed example.
CFLAGS="-O2 -march=pentium-m -pipe"
CXXFLAGS="${CFLAGS}"
# This should not be changed unless you know exactly what you are doing. You
# should probably be using a different stage, instead.
CHOST="i686-pc-linux-gnu"
chroot into the new system
Change directory to the root of the new system (/root/eee) and execute the following commands:
(you'll probably end up memorizing them)
mount -t proc none proc mount -o bind /dev dev chroot . /bin/bash env-update source /etc/profile
The first two commands mount the pseudo file systems, the chroot make it appear as though /root/eee is the root, /, of the filesystem. The last two commands setup the environment in the new system.
You will execute these instructions whenever you want to enter the new system.
Update portage
Set up the kernel
Following the instructions listed here, install the ebuild for the modified EEE kernel source. Configure and build your new kernel.
If your host machine is a different architecture than the EEE (mine is x86_64) then you need to add the ARCH=i386 when executing make
make ARCH=i386 menuconfig make ARCH=i386 make ARCH=i386 install
If you are like me a dislike initramfs and modules, you can reconfigure the kernel to build most of the options into the kernel instead of loading them as modules.
To boot off an SD card, you must build USB mass storage support into the kernel.
Hardware Notes (as of eee-sources-2.6.23-r3)
- Audio: Intel HD Audio. There is some extra effort needed to get this working.
- Framebuffer: Intel 830M/845G/852GM/855GM/865G/915G/945G
- Direct Rendering Manager: Intel 830M, 845G, 852GM, 855GM, 865G (i915 driver)
- Network: Atheros L2 Fast Ethernet
Setup fstab
On start up, I mount the root drive on the SD card, /dev/sdb1.
/dev/sdb1 / ext2 noatime 0 1
The only other drives I mount are all tmpfs. These are RAM disks. I mount them in locations that are written too frequently. This should reduce the number of writes to the SD card, thus extending its life. However, I've upgraded my EEE to 2 Gigs of RAM, so you may not want to do this with a 512Mb system.
Configure your Network
Set your root password
Create your user accounts
Never use your root account as your default account! root should only be used for system maintenance.
Install System Tools
Filesystem Tools
The wisdom of the crowd is to use a non-journalling file system. Apparently journalling file systems write to the media more, which means it will wear out faster. In the end, this means using ext2. So install the appropriate tools.
Install a Boot Loader
I have used both LILO and GRUB. LILO was the only choice for a long time. However I now believe that GRUB is better. In particular LILO would often get confused if you changed the disks installed on your system. This would make the system unbootable, requiring you have a boot disk. With GRUB, even if the hard drive order changes you can still boot using the GRUB command line interface.
Emerge GRUB
Reboot?
This is where we start to deviate from the Handbook. You now need to transfer your system over to your EEE.
We are going to user rsync to do this. This means you'll need to have rsync installed on your desktop and EEE. It is probably also useful to have ssh installed with an sshd server running on your desktop.
To install rsync on the EEE you can use synaptic, or download the source from here.
Configure the SD Card
Boot up your EEE and put in the SD card. Start a terminal, and if the SD card was automatically mounted, unmount it.
umount /media/MMC-SD/partition1
Make sure you know which device corresponds to the SD card. For me, and most users, the SD card is /dev/sdb To double check this, insert the card and allow the EEE to automatically mount it.
If you run
mount
you will get a list of all the mounted devices. The SD card is mounted under /media/MMC-SD/partition1
We are now going to format the SD card. This will erase all the data on the disk, so make sure there is nothing you care about stored there.
Follow the instructions in the Gentoo Handbook: Preparing the disks. You may not want to configure a swap partition. I did not have a separate boot partition either. This means that I only made one partition for the whole card, /dev/sdb1.
Now you can mount the card, lets say at /media/sdb1.
mount /dev/sdb1 /media/sdb1
Now we are going to rsync the files from the desktop machine to the EEE. I am not a rsync wizard, so I'm not 100% sure that everything I describe here is necessary. On the desktop, I added an entry to my /etc/rsync.conf file for the EEE directory
# /etc/rsyncd.conf
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
use chroot = yes
#read only = yes
# Simple example for enabling your own local rsync server
#[gentoo-portage]
# path = /usr/portage
# comment = Gentoo Portage tree
# exclude = /distfiles /packages
[eee]
path = /root/eee
uid = root
gid = root
This should create an alias eee that maps to the /root/eee directory in which we installed the gentoo image.
I wrote the following script to automate this copying for me. Notice the two rsync lines. The one that is commented out can be used when you are chroot'ed into the system, or once the system is up and running. The other one will be used while setting the machine up. This also tunnels the rsync over ssh.
#!/bin/bash EXCFILE=/tmp/exclude echo "/usr/portage /usr/src /var/cache /var/tmp /proc /dev " >> $EXCFILE #rsync -avz -e ssh --exclude-from=$EXCFILE root@hostname:eee/ / rsync -avz -e ssh --exclude-from=$EXCFILE root@hostname:eee/ . cat $EXCFILE rm $EXCFILE
Copy this script onto your system, and call it rsync-update.
Change directory to the root of the SD Card, /media/sdb1 and run the script. This should copy all the necessary system files over, excluding stuff that we don't want.
- /usr/portage: The portage database, unnecessary on the eee, as we won't be building there.
- /usr/src: the kernel sources.
- /var/cache: cached data.
- /var/tmp: temporary data, including emerge build data
- /proc: virtual file system
- /dev: virtual file system
Now, there are some important files that won't be copied that you need to create. You'll need a /dev/console and /dev/null to boot, they can be created as follows:
cd dev mknod console c 5 1 mknod null c 1 3
Grub Setup
The Gentoo Handbook describes how to set up GRUB. You have already installed it, so you just need to configure it.
Here is my grub.conf
default 0 timeout 10 title=Gentoo root (hd0,0) kernel /boot/vmlinuz root=/dev/sdb1 rootdelay=5 loop pci=assign-busses irqpoll vga=0F03
There are a few important bits here. root is (hd0,0). This is because when we boot, we will tell the bios to boot of the SD card, thus the bios will make that the first drive. However the device is still /dev/sdb once the kernel is up and running. Also, the rootdelay=5 is necessary because the kernel needs a little bit of time to detect the presence of the SD card.
Installing GRUB in the MBR
Note: here we use hd1. hd1 is the SD card when we have booted into the EEE's installed OS.
grub> root (hd1,0) (Specify where your /boot partition resides) grub> setup (hd1) (Install GRUB in the MBR) grub> quit (Exit the GRUB shell)
Reboot!
Now we should be should be ready to reboot. When I was doing this set up, I noticed that occasionally it appears as though the EEE shut down without properly unmounting the SD card, so make sure to explicitly unmount the SD card.
umount /dev/sdb1
before rebooting.
When the white EEE bios screen appears press and hold the ESC key down. This should open a boot device selection menu. Select the card reader. If you used my grub.conf, you should now see the grub selection menu. You can either press enter or wait 10 seconds.
If I've written these instructions well enough, you should now successfully boot a brand new gentoo install on your EEE.
Notes
- You can install more software on the desktop machine and use the same rsync-update script to pull those changes over.
- If you have problems with /dev/sdb1 needing to be checked on every boot (getting the not cleanly unmounted) error, try adding
eject /dev/sdb
- to /etc/init.d/halt.sh after:
ebegin "Remounting remaining filesystems readonly"
mount_worked=0
if ! mount_readonly ; then
if ! mount_readonly ; then
# If these things really don't want to remount ro, then
# let's try to force them to unmount
if ! mount_readonly u ; then
mount_worked=1
fi
fi
fi
eend ${mount_worked}
eject /dev/sdb
- It seems the EEE may not properly flush the writes to the card before shutting down.