Showing posts with label squashfs. Show all posts
Showing posts with label squashfs. Show all posts

20081006

Linux-2.6.27-rc8 on the EEE 702

Although the Linux kernel version 2.6.27 has not yet been officially released, I was able to download, build and patch release-candidate-8 for my EEE PC with many notable improvements - most notably a working ath5k module. Correction: The Linux kernel version 2.6.27 was released 20081009 and you can read the changes here.

First of all, I was actually planning on using the 2.6.26-gentoo sources, which implemented the changes upstream that I had made for the 2.6.24-eee-r1 sources, because it already had the eeepc-laptop module sources included, and (limited) ath5k support.

However, when I tried to 'modprobe ath5k' with the 2.6.26-gentoo kernel, I encountered a nasty error message saying that the AR2425 chip is still under development (boo-urns!), and that support for the AR2425 chip would be included in the 2.6.27 sources. That made me revert back to my 2.6.24-eee-r1 linux kernel, but not for long!

Having never been the type to accept defeat so easily, I decided to use the vanilla-sources-2.6.27-rc8. The main difference between the vanilla and Gentoo sources are, that the Gentoo kernel sources (and subsequently the eee sources) are patched versions of the vanilla kernel, which include security fixes as well as various other features (SquashFS for example).

Now, I do need SquashFS for my squashed portage, but the security patches I could do without for the time being, until Kernel.org, and Gentoo, release their respective 2.6.27 kernel sources. Aside from that, I would need to compile external modules for the EEE pc, such as uvcvideo (webcam), eeepc-linux (Fan / CPU / FSB control).

Thanks to the inclusion of the eeepc-laptop sources, providing ACPI interfaces for all of the EEE PC Fn buttons, I could now omit the external asus-acpi module, as well as the quasi-proprietary ath_hal module provided with net-wireless/madwifi-ng.

Yes, that's right! Now the Atheros chipset on the EEE PC will work with the standard 'wext' wireless interface, allowing the unpatched version of NetworkManager to run seamlessly!!! Although I have switched to WICD since the last time I tried to use NetworkManager, but I thought I'd mention the changes anyway.

Here are a few patches that might be of interest:
eeepc-linux-2.6.27-rc8.patch
linux-2.6.27-rc8-squashfs3.4.patch
atl2-2.6.27-rc8.patch

All of these will work with sys-kernel/vanilla-sources-2.6.27_rc8.

Enjoy!

20080611

How-To: The Full Portage Tree on the EEE PC




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.