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.
We will obviously be needing a host system to build our base, as
Thus, these are the host specs that I will be using:
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
There are a few things that need to be addressed for the Eee PC to function properly.
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 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.
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}
We will also want to create a few extra directories for build and release purposes.
mkdir -p ${EEEGEN_DIR}/build
Now we begin by installing a basic system based on the prebuilt stage 3 tarballs available in the various gentoo mirrors.
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
sudo tar -jxvf stage3*.tar.bz2 -C ${EEEGEN_DIR}/build/
You can then remove the stage file.
rm stage3*.tar.bz2
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"
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
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
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
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"
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=""
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"
The next step is to compile a kernel for our Eee PC.
We want to use the gentoo-patched kernel sources, so download/install them:
emerge -av gentoo-sources
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
Once you have successfully configured the kernel, you are now ready to build it!
ARCH="x86" make ARCH="x86" make modules_install
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
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