Gentoo on the SheevaPlug

This is how I installed Gentoo on the SheevaPlug:
First I’ve made some preparations to decrease overall installation time:
- Setup a cross-compiling suite for the SheevaPlug.
You can compile the Linux kernel parallel to installing GNU/Gentoo. - Get an USB drive or SD flash card.
Although the Linux kernel will be written to flash we will install Gentoo on that external device.
Of course you could install the latter on flash, too. Just stop following the instructions when it says “eix-sync” or “emerge –sync” and use /dev/mtdblock2 (jffs2 filesystem, though) where it says /dev/sda2.
Applies analogously to SD card installation. - Make sure you can network boot the SheevaPlug.
You could boot the pre-installed Debian and even skip compiling a new kernel, though.
Step 0: boot an installation system
Either boot the pre-installed Linux or network boot the SheevaPlug. I have done the latter.
Make sure you have access to the internet and /dev/null is writable by all:
# if eth0 doesn't work, try eth1 ifconfig eth0 192.168.1.13 up # check whether the nameserver is correct nano /etc/resolv.conf # provide the IP of your router route add default gw 192.168.1.1 chmod a+rw /dev/null
Step 1: prepare the destination medium
x means press Enter, leave out what is behind the octothorpe (#):
fdisk /dev/sda p d n 1 x +2GB # /dev/sda1, SWAP n 2 x +8GB # /dev/sda2, ROOT n 3 x +300MB # /dev/sda3, LOG n 4 x x # /dev/sda4, PORTAGE t 1 82 # SWAP a 2 # BOOT w mkswap /dev/sda1 swapon /dev/sda1 mkfs.ext3 -L ROOT /dev/sda2 mkfs.ext3 -L LOG /dev/sda3 mkfs.ext2 -j -N 2000000 -L PORTAGE /dev/sda4
If you happen to install on a SD card, replace ext3 by ext2. The filesystem journal will be often maintained at one storage-cell of the card wearing it out, what in turn will cause filesystem corruption. Therefore I advice using the unjournalled ext2 in that case.
Step 2: extract a Gentoo tarball
You can find Gentoo tarballs with a basic system (called stage 3) at the Gentoo mirrors’ page, descending into releases/arm/current-stage3/armv5tel-softfloat-linux-gnueabi/ e.g. here or there. Select a tarball, copy its link.
mount /dev/sda2 /mnt/gentoo cd /mnt/gentoo wget -O - http://...the-link.../stage3-armv5tel-20100220.tar.bz2 | tar -xjp
This will extract the tarball immediately, i.e. as it gets downloaded without storing it on the plug.
Step 3: chroot into Gentoo
Create folders for the remaining partitions (sda1 is swap, sda2 is root!) and insert their list into /etc/fstab:
mount -t proc none /mnt/gentoo/proc mount -o bind /dev /mnt/gentoo/dev mount /dev/sda3 /mnt/gentoo/var/log mkdir -p /mnt/gentoo/usr/portage mount /dev/sda4 /mnt/gentoo/usr/portage mkdir -p /mnt/gentoo/var/tmp mount --bind /tmp /mnt/gentoo/var/tmp mount --bind /tmp /mnt/gentoo/tmp cp -L /etc/resolv.conf /mnt/gentoo/etc/ chroot /mnt/gentoo /bin/bash env-update source /etc/profile export PS1="(chroot) $PS1" nano /etc/fstab
You can see my fstab here.
After that (still in chroot) we will select profile, the languages our system will run and chose suitable compile settings for the architecture:
cd /etc ln -snf ../usr/portage/profiles/default/linux/arm/10.0 /etc/make.profile nano locale.gen ln -s portage/make.conf nano make.conf
Here you can download my locale.gen and make.conf. Just remember to remove feature distcc because we have not installed it yet.
Step 4: kernel and preparations for first boot
You should have already compiled an kernel by now. See this post for configuration file and how to do it. Of course, you could use the pre-installed kernel, but I have not tested whether that will work.
Compile and copy the Linux kernel as described to your SheevaPlug.
Unless you like the serial console, have SSH be run on system startup. Don’t forget to set a root password:
passwd rc-update add sshd default nano /etc/conf.d/local.start nano -w /etc/inittab # (Uncomment the line and replace 9600 by 115200 so it reads:) s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100 # (remove all conventional TTYs) nano -w /etc/conf.d/hostname cp /usr/share/zoneinfo/Europe/Berlin localtime
Step 5: fetch ebuilds and packages
If you installed Gentoo on the system flash and if you have no dedicated device for portage, skip this step.
You will have to install a DHCP client by hand or configure static IP. Else we will utilize portage for former:
emerge --oneshot eix eix-update eix -cI emerge udhcp nano /etc/conf.d/net # ... cd /etc/init.d ln -s net.lo net.eth1
See my net file. Remember to replace 192.168.1.2 by your nameserver in case it didn’t already get provided by DHCP.
On some SheevaPlugs – even of the same revision – eth0 is eth1, therefore I make that additional softlink in the last line.
I tend to grab the portage overlays from my workstation. But you can also skip this:
mkdir -p /usr/local/overlays cd /usr/local/overlays rsync -azuv -e ssh 192.168.1.6://usr/local/overlays/* /usr/local/overlays/
Step 6: exit chroot environment and restart the SheevaPlug
exit cd / umount /mnt/gentoo/usr/portage umount /mnt/gentoo/var/log umount /mnt/gentoo/var/tmp umount /mnt/gentoo/tmp umount /mnt/gentoo/proc umount /mnt/gentoo/dev umount /mnt/gentoo exit
Step 7: set boot parameters
You’re almost done. The last thing is to tell the SheevaPlug to boot Linux and the latter to use the correct root device. Therefore reset (or shutdown -r now) your plug and get into the u-boot shell:
setenv bootcmd usb start\;nand read 0x01000000 0x00100000 0x00400000\;setenv bootargs $(console) root=/dev/sda2 rootdelay=10\; bootm 0x01000000 saveenv reset
Keep yor fingers crossed. Linux kernel should boot into GNU/Gentoo on /dev/sda2 (or your SD card, if you changed /dev/sda; or the vintage Debian if you changed it into /dev/mtdblock2).
Now you could install distcc for distributed cross-compiling and customize your Gentoo Linux!















Follow me on Twitter
For booting the pre-installed Debian you have – according to documentation – type this into the bootloader:
If you wish to mount the partition with pre-installed Debian, do this:
Hi Mark,
I’ve found your postings invaluable to getting Gentoo up and running on my new sheevaplug. Should step 7 should have the $(console) replaced with the console you want to use ie, console=ttyS0,115200.
James, you’re right. Thanks. I will correct that in the post on a future iteration.
BTW, have a look on my Portage configuration files (for unmaskings and the such) and Gentoo Binhost for the SheevaPlug. Hopefully it will spare you a lot of compile-time, because using it Portage will pull pre-compiled packages if they match.
Hi Mark.
Thank your for the instructions. I managed to install Gentoo on a SDHC card, but then I ran into some problems when trying to merge a Java VM. It always ends in demanding some non-satisfiable dependencies:
IcedTea6-bin (which only exists for x86/x86_64)
antlr (which needs previous a version of antlr that is not contained in the stage3)
So I just wanted to ask you about you experience on Java and the SheevaPlug.
(I’m sorry for possible duplicate postings due to my confusion about blocked scripts)
sb, (please use a meaningfull name or alias, thanks) I did only run OpenJDK and that from IBM on the SheevaPlug. There were no such dependencies pulled in.
Try to mask the packages you mentioned (
/etc/portage/package.mask) so alternatives are used. Make sure whatever requires Java does not depend on a particular vendor or version, but on “virtual/jre”. Then portage will be able to route to a JRE which can actually be compiled.Suggestion for change to instructions above:
3.cd /usr/src/linux
might read
3.cd /usr/src/linux/linux-2.6.31.12 (or whatever version your oneshot emerge installed)
(This blog post has been updated today.)
James, I double-checked that – script console exists in uboot and therefore we can use its output by calling
$(console). But you’re right, it can be omitted.John, your comment applies to this related blog post. Will incorporate your suggestion there.
[...] also Gentoo on the SheevaPlug for more [...]
I think you have a typo in the partition layout part. The type for swat partition should be 82 not 85
Kai, you’re right. Corrected. Thank you!