I recently needed a up-to-date stage for a Via Epia 500 system. Since the hardware is very limited, and the processor is an i486 system (basicly a pentium pro without some missing features) i tried the uClibc stage. The update process of the somewhat out-of-date stage3 tarballs was really pain in the ass, so here is a guide to update the tarball to a recent portage/uclibc:
The Goal
- A current portage (read: EAPI=2 capable)
- A current udev
- baselayout-2 and openrc
- python 2.6
- gcc 4.3+
Requirements
- Some free disk space
- Time, many time
- Strong nerves
- A lot of coffee
Step 1: Prepare the build environment
For this guide i use the following paths:
/mnt/work/chroots/gentoo32-i486-uclibc: The directory for the chroot
Now, lets get to work:
# change to working directory
cd /mnt/work/chroots/gentoo32-i486-uclibc
# fetch the most recent uclibc stage3 tarball
wget http://gentoo.j-schmitz.net/mirror/experimental/x86/embedded/stages/stage3-x86-uclibc-2008.0.tar.bz2
# Extract the tarball
tar xjpf stage3-x86-uclibc-2008.0.tar.bz2
# Remove the old tarball
rm stage3-x86-uclibc-2008.0.tar.bz2
# Mount some dirs for the chroot
mount -o bind /dev/ dev/
mount -t proc /proc/ proc/
mkdir usr/portage
mount -o bind /usr/portage/ usr/portage/
# now, chroot (remove linux32 if your host system is x86)
linux32 chroot . /bin/bash
env-update && source /etc/profile
export PS1="(uclibc-chroot) $PS1"
Step 2: Update the stage
The most important thing is to get a recent portage, since many ebuilds use EAPI-2. First, we have to update python. But python does not like the old gcc. So a newer gcc is required for python. But hey, gcc-4.3.4 fails due to a missing header file. So updating uclibc first....
# Unmask the latest uclibc
mkdir /etc/portage
echo "=sys-libs/uclibc-0.9.30.1-r1 ~x86" >> /etc/portage/package.keywords
emerge uclibc -av
# Now update gcc to 4.3.4
emerge gcc -va
# switch to the new gcc
gcc-config i386-gentoo-linux-uclibc-4.3.4
source /etc/profile
export PS1="(uclibc-chroot) $PS1"
# due to a bug in the python ebuild emerge python without docs
FEATURES="nodoc noinfo noman" emerge =dev-lang/python-2.4.6 -av
# update python to 2.5. You may have to update automake to 1.10.3. See bug #317705
# emerge -1va =sys-devel/automake-1.10.3
MAKEOPTS="-j1" emerge python -va
# run the python-updater and update all packages.
python-updater -p
# Make sure that you have updated all python libs before un-emerging the old python version!
emerge -C '<dev-lang/python-2.5'
# update python to 2.6.
emerge python -va
# run the python-updater
python-updater -p
# Make sure that you have updated all python libs before un-emerging the old python version!
emerge -C '<dev-lang/python-2.6'
# Finally, we can update portage
emerge portage -av1
# Emerge app-portage/gentoolkit to be able to run revdep-rebuild. You need an
# updated version of app-misc/realpath to get that work with uclibc (see
# http://bugs.gentoo.org/show_bug.cgi?id=300657)
# The new ebuild is in our overlay!
emerge -1va =app-misc/realpath-1.15-r1
emerge gentoolkit -va
# run a revdep-rebuild
revdep-rebuild -i -vp
# Now, update all we have:
emerge --newuse --update --deep world -va
# remove the old gcc
emerge -Cav '<sys-devel/gcc-4.3.4'
# and build the whole bunch again
for x in linux-headers uclibc binutils-config binutils gcc-config gcc uclibc binutils gcc system world; do emerge -v1 $x; done
# clean up the environment
revdep-rebuild -i -vp
emerge --depclean -vp
revdep-rebuild -i -vp
Step 3: Install newer versions of openrc/baselayout
Now we have an up-to-date system, but we want a newer openrc and baselayout. Unmask these packages in /etc/portage/package.keywords:
=sys-apps/baselayout-2.0.1 ~x86 =sys-apps/openrc-0.6.1-r1 ~x86
After that, emerge them and update the config files:
emerge openrc -av dispatch-conf
Step 4: Cleanup and creating a new tarball
At last, clean up all the temp directories leave the chroot and create a new tarball:
rm -rf /var/tmp/portage/* rm /tmp/* # (leave the chroot) umount dev/ proc/ usr/portage/ # create the new tarball tar cjf /tmp/gentoo-x86-uclibc-20100429.tar.bz2 .
And thats it! The updated stage3-tarball can be downloaded here.
Update: udev needs some extra work to run with uclibc. See comment #7 and #8 of Bug #272199
