EeeGen (Eee PC Gentoo)

Project Data
Name EeeGen (Eee PC Gentoo)
Version 0.1
Download N / A
Status Alpha
Last Update 2009-09-26

Introduction

The EeeGen project is an effort at creating an incredibly small, working distribution of the Gentoo Linux Distribution. This is being done using uClibc, and the current Gentoo Embedded project.

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) and 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 that I purchased during a recent Woot-Off on http://woot.com. This section will contain any and all information about the specs of this laptop as I discover more about them.

Processor

The processor is a Intel Pentium 900 MHz Celeron Mobile 353. The specs for which are:

Processor Spec Sheet
Model Name Intel Pentium Celeron Mobile ULV 353
Family Name Dothan-512 Ultra-Low Voltage
CPU MHz 900 MHz
Bus MHz 400 MHz
Cache Size 512 kb
Micro-architecture Pentium M
Extensions MMX SSE SSE2

Memory

Memory is comprised of DDR2 ram. The following are the specs:

Memory Spec Sheet
Type 200-Pin DDR2 SO-DIMM
Supported Speeds 400 (PC2 3200), 533 (PC2 4200), 677 (PC2 5300)
Slots [ [ SLOTS ] ]
Maximum Capacity [ [ MAXIMUM_CAPACITY (2 or 4 Gb?) ] ]

Hard Disk

<fixme>Fix this</fixme>

  • Hard Drive: 4GB SSD (Solid State Drive)

Video

<todo>Fix this</todo>

  • Display: 8.9” Display, 1024×600 resolution
  • Display Card: Intel UMA

Audio

<todo>Fix this</todo>

  • Audio: Hi-definition Audio intel-hda??
  • Stereo speaker
  • Built-in Mic

Networking

Wireless Networking Spec Sheet
Model Name [ [ MODEL_NAME ] ]
Manufacturer [ [ MANUFACTURER ] ]
Protocols 802.11 b/g
Wired Networking Spec Sheet
Model Name [ [ MODEL_NAME ] ]
Manufacturer [ [ MANUFACTURER ] ]

Power

The ASUS Eee PC 900 comes with the following power specs:

Battery Spec Sheet
Core Lithium-Ion
Operating Time 4 hrs
General Power Spec Sheet
Output 12V, 36W
Input 100-250V AC, 50/60 Hz universal

I/O and Peripherals

The following I/O and Peripheral jacks are present on the system:

  • 1 x SD / MMC (SDHC) card slot
  • 3 x USB ports
  • 1 x VGA-out port (D-Sub, 15-pin)
  • 1 x Headphone jack
  • 1 x Microphone jack
  • 1 x Ethernet jack (RJ45 10/100 Mbps)

Casing

The casing has the following specs:

Casing Spec Sheet
Color Black
Width 22.5 cm
Height 17.0 cm
Depth 2 cm ~ 3.38 cm
Weight 0.99 kg

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

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 various purposes

mkdir -p ${EEEGEN_DIR}/build

Install Stage 3

Download / unpack a stage 3 tarball

First, go to the gentoo mirrors page and download a stage 3 tarbal from experimental/embedded/x86

Then untar it to the build directory

tar -jxvf stage3*.tar.bz2 -C ${EEEGEN_DIR}/build/

Chroot into the Build System

Bind all of the appropriate directories to the build system:

mount -o bind /proc ${EEEGEN_DIR}/proc
mount -o bind /sys ${EEEGEN_DIR}/sys
mkdir -p ${EEEGEN_DIR}/usr/portage
mount -o bind /usr/portage ${EEEGEN_DIR}/usr/portage
mount -o bind /usr/portage/distfiles ${EEEGEN_DIR}/usr/portage/distfiles

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

cp -L /etc/resolv.conf ${EEEGEN_DIR}/etc/

You should be ready to chroot now.

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 Profile 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.

Open the file.

nano /etc/make.conf

It will look something like this as a default:

# 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="-Os -mtune=i386 -pipe"
CXXFLAGS="${CFLAGS}"
# LDFLAGS is unsupported.  USE AT YOUR OWN RISK!
LDFLAGS="-Wl,-O1"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="i386-gentoo-linux-uclibc"

For the sake of making things easy, I would recommend changing/adding the values to make the file resemble the following:

CFLAGS="-Os -pipe -march=i686 -fno-ident -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="i386-pc-linux-uclibc"
MAKEOPTS="-j2"

ACCEPT_KEYWORDS="~x86"
FEATURES="ccache buildpkg"
UCLIBC_CPU="686"
PKGDIR="${PORTDIR}/packages/uclibc"

Here is an explanation for the added/modified lines above:

  • CFLAGS
    1. -march=i686 is just a way of telling the GCC compiler to make generic optimizations for a i686-class processor (generally safe for any x86 architecture these days). THIS WILL BE CHANGED TO “pentium-m” ONCE WE ARE ON THE EEEPC, AT WHICH POINT WE WILL RE-COMPILE FOR OPTIMIZATIONS FOR PENTIUM-M
    2. -fomit-frame-pointer tells GCC to not use a register for stack tracing, which we won't need as we will be leaving out any sort of debugging for the sake of space.
    3. -fno-ident prevents the inclusion of GCC version information in binaries. Saves a few MB of space.
  • CXXFLAGS
    1. It is generally good practice to set the CXXFLAGS equal to the CFLAGS unless you have good reason not to.
  • CHOST
    1. Just leave this for now
  • MAKEOPTS
    1. -j2 tells make that we can run up to two jobs simultaneously
  • ACCEPT_KEYWORDS
    1. ~x86 allows us to install all of the latest software available (good idea as uclibc is unstable anyway)
  • FEATURES
    1. ccache tells the system that we will be using the ccache system to cache our compiles to make recompiling faster.
    2. buildpkg tells the system to use pre-built packages when possible.
  • UCLIBC_CPU
    1. 686 informs the uClibc library to make optimizations for the i686 architecture. If this is not set, uClibc will be very generic and also very bulky.
  • PKGDIR
    1. This is used to tell portage to store packages for this build in a separate location from the default.

Once you have finished making the modifications, hit Ctrl+X, Y, and Enter to exit nano and save the modifications.

The /etc/make.profile file sets defaults for the /etc/make.conf file as well as some other settings. It is important to set it to the proper value for your build system. To view what it currently is, type:

ls -ld /etc/make.profile

This should be set to a generic x86 uClibc profile. To do so execute the following command:

ln -fns ../usr/portage/profiles/uclibc/x86 /etc/make.profile

It is generally a good idea to double check to make sure it worked:

ls -ld /etc/make.profile

Rebuild our CHOST

Now we will change our CHOST to i686-pc-linux-uclibc (as that is the system we are building to), but first we need to upgrade our toolchain (in this order):

emerge -uav linux-headers
emerge -uav uclibc
emerge -uav binutils
source /etc/profile
emerge -uav gcc
fix_libtool_files.sh 4.1.2
gcc-config 2
source /etc/profile

Now that we have an up-to-date toolchain, we can change our CHOST! So modify it in make.conf to look like this:

CHOST="i686-pc-linux-uclibc"

Now rebuild these packages:

emerge -av1 binutils
source /etc/profile
emerge -av1 gcc
source /etc/profile
emerge -av1 uclibc
etc-update

Lastly, we have to ensure that all of our change-overs work properly. I will not go over this here (as it's pretty straightforward) but simply direct to the section of Gentoo Linux Documentation - Changing the CHOST variable about “Verifying things work”.

Once the verification is done, we need to remerge libtool and fix any libraries that require it:

emerge -av1 libtool
/usr/share/gcc-data/i686-gentoo-linux-uclibc/4.4.1/fix_libtool_files.sh 4.4.1 --oldarch i386-pc-linux-uclibc

Libtool failed to install with automake problems, for me it was because my 1.10 slot of automake was not updated, so I ran the following first:

emerge -av1 =sys-devel/automake-1.10.2
emerge -av1 libtool

And lastly, we have to make sure that any broken packages are fixed:

Typically, after changing the CHOST variable, it is a good idea to remerge the whole system (emerge -e world), but we will be doing that later so right now we'll just do what we have to.

emerge -av =sys-apps/portage-2.1.6.7
etc-update
emerge -av1 python
emerge -av portage-utils
emerge -av1 `qfile /usr/lib/perl* -Cq | sort -u`

Update our system

I basically just updated the system bit by bit by running this:

emerge -uv1p system

And then installing all of the pieces separately:

emerge -uav1 %PKG%
Python causes problems

If you have problems with python, (specifically nis module failures), you have to disable NIS module manually:

<cod bash> cd /usr/portage/dev-lang/python ebuild python-(version).ebuild unpack nano /var/tmp/portage/dev-lang/python-(version)/work/Python-(version)/setup.py # search for “nis” and remove the two lines enabling it ebuild python-(version).ebuild compile ebuild python-(version).ebuild install ebuild python-(version).ebuild merge </code>

(Optional) Backup

Now it may be a good time to backup the system directory. From outside the CHROOT, execute the following:

cp -ax ${EEEGEN_DIR}/build ${EEEGEN_DIR}/build.tmp

This is a good idea to do, as we will be changing our march option to pentium-m, which may or may not be coherent with our host. If this destroys everything, we don't want to have a problem with it.

Rebuild for Penium-M

It is assumed that this section is run from within the chroot of our build system

Now we will begin to re-compile our entire system for the Pentium-M processor (as that is our target's processor.

Setup Alteration

First, change the march option of our make.conf option, so our CFLAGS definition should now look like this:

CFLAGS="-Os -pipe -march=pentium-m -fno-ident -fomit-frame-pointer"

Now we first will rebuild our toolchain in order to ensure the effects to take place:

Rebuild

emerge -av1 binutils linux-headers uclibc gcc

Now we rebuild our system

emerge -eav1 system

Then we once again rebuild world

emerge -eav1 world

Now we have our perfect system! It's time to install software!

Problems

If you have problems (such as Python being a bitch), then simply skip the package (noting it):

emerge --resume --skipfirst -av

And then fix it afterwords similarly to how we have in the past.

References

  • TinyGentoo - The HOWTO that this project is based on. Their idea was to create a system for a flash drive, I'd like to take it a bit further.
  • Embedded Gentoo - A tutorial on how to install Gentoo on an embedded device from stage 1. Also a strong foundation for this document.
  • Official Squashfs LZMA - Official site dedicated to using SquashFS with LZMA.
  • Linux Kernel Documentation - Provides a lot of useful information about how the Linux Kernel works.
  • Howto: Install Gentoo on an EeePC - Gave some interesting information about EeePC/Gentoo interaction.
 
project/eeegen.txt · Last modified: 2009/10/04 16:17 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki