| Project Data | |
|---|---|
| Name | EeeGen (Eee PC Gentoo) |
| Version | 0.1 |
| Download | N / A |
| Status | Alpha |
| Last Update | 2009-09-26 |
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.
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:
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.
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 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?) ] ] |
<fixme>Fix this</fixme>
<todo>Fix this</todo>
<todo>Fix this</todo>
| 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 ] ] |
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 |
The following I/O and Peripheral jacks are present on the system:
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 |
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
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 various purposes
mkdir -p ${EEEGEN_DIR}/build
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/
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"
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:
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
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
emerge -av1 =sys-devel/automake-1.10.2 emerge -av1 libtool
And lastly, we have to make sure that any broken packages are fixed:
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`
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%
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>
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.
Now we will begin to re-compile our entire system for the Pentium-M processor (as that is our target's processor.
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:
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!
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.