Gentoo is often considered to be 'bloated' because the Portage tree takes up at least 500 MB on disk. Depending on the filesystem, that could mean that the usage can be sometimes up to 750 MB!
On a UMPC such as the EEE, with only very limited hard-disk space, 750 MB is far over the limit of acceptibility.
My first solution was simply to use a binary Gentoo system. The portage tree was not necessary as long as an internet connection was available and a suitable binary package repository was configured. That has actually been working incredibly well and I have no complaints yet whatsoever. However, I do occasionally like to
look into the portage tree for examples on creating ebuilds when I'm doing custom software packaging, so i thought it would be nice to have it wherever I can take my EEE.
Then someone on EEE-User mentioned using SquashFS for the Portage tree. This made absolute sense, because the Portage tree did not need to be updated frequently at all, and could easily be made read only. SquashFS enabled me to have the benefits of a source-based Gentoo distribution on my EEE but compressed the Portage tree from 700 MB to 42 MB !!!
The following 5 steps will demonstrate how easy it is to use Gentoo - even with it's "bloated" Portage tree - on the EEE PC.
Note: I performed these steps on a modified EEE PC with 2GB of physical RAM, which explains how I could mount 768MB of RAM as tmpfs. If you have less than 2GB of physical RAM, then I would suggest making the SquashFS Portage image on a regular desktop computer running Gentoo Linux.Step 1: Find a portage mirror
You can find all of the Gentoo mirrors on the
official Gentoo mirror list. I use
MIRROR="http://gentoo.mirrors.tera-byte.com"
Step 2: Install squashfs-tools
emerge -av1 squashfs-tools
Step 3: Download and Extract the Latest Portage Snapshot
mkdir -p /tmp/tmp2
mount -o size=768m -t tmpfs none /tmp/tmp2
wget -O - "${MIRROR}"/snapshots/portage-latest.tar.bz2 | tar xpvjf - -C /tmp/tmp2
Step 4: Create the SquashFS Image
mksquashfs /tmp/tmp2/portage /tmp/tmp2/portage.sqfs
mv /tmp/tmp2/portage.sqfs /usr
umount /tmp/tmp2
rmdir /tmp/tmp2
Step 5: Create init.d and conf.d entries to simplify or automate mounting
/etc/init.d/portage-squashfs:
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need localmount
}
checkopts() {
for var in "${MTPNT}"x "${PSQFS}"x; do
if [ "${var}" = "x" ]; then
eerror "one of the necessary variables was not defined"
return 1
fi
done
if [ "$(grep "squashfs" /proc/filesystems)" = "" ]; then
eerror "SquashFS is not supported by your kernel"
return 1
fi
if [ ! -e "${PSQFS}" ]; then
eerror "${PSQFS}: No such file or directory"
return 1
fi
if [ ! -d "${MTPNT}" ]; then
eerror "${MTPNT}: No such file or directory"
return 1
fi
}
start() {
local mtopts="-t squashfs -o loop,ro"
einfo "mounting ${PSQFS} at ${MTPNT}"
checkopts || ( eend 1; return 1 )
mount ${mtopts} ${PSQFS} ${MTPNT}
eend $?
}
stop() {
einfo "unmounting ${MTPNT}"
umount ${MTPNT}
}
# vim:ts=4
/etc/conf.d/portage-squashfs:
MTPNT=/usr/portage
PSQFS=/usr/portage.sqfs
Lastly, don't forget to make the init script runnable:
chmod +x /etc/init.d/portage-squashfs
Notes:
Extracting the portage tree and creating the SquashFS image in /tmp will work only if you have >= 1GB of RAM, approximately. I was using the EEE PC 8G, which comes with 1GB of RAM and there were no problems at all. Alternatively, if you have >= 800MB on your root device, then you could perform the operation there, but it would be much slower. If another desktop or laptop PC is available, a better alternative is to build the portage.sqfs file on the other machine and then copy it on to your EEE.
Also, it should go without saying that you will need to have root permissions to do this - use 'sudo -s'
You should also be aware, that this will make /usr/portage read-only. Therefore, in /etc/make.conf, set DISTDIR="/tmp/distdir" and PKGDIR="/tmp/binpkgs", or something similar.