Using this method, you can install an entire Gentoo image complete with portage and overlay in about 15 minutes (actually with downloading and unpacking I think it might be more like 30 - 45 minutes).

These instructions are admittedly kurobox centric, however PPC linkstations should work with the image as well. Please add to or correct these instructions to make them work for both platforms if you find anything missing or confusing.

The image was created immediately following a deep world update. There is only one version of the gentoo image (previous image had two versions). The only requirement is that your box must have uboot that boots a 2.6 kernel. The 1.2 uboot that supports a dtb is preferred, and in fact the image includes a 2.6.22 kernel and dtb file, generated from gentoo-sources.

Origins of the Gentoo Image

A Little History

(please fill in missing info, I don't mean to leave anyone out)
This gentoo image has its roots in the kurobox.com forums, probably dating back to 2005 or so. jgmdean kicked off the project and TGL and others in the forums made valuable contributions. With the advent of uboot for the kurobox and linkstation from linuxnotincluded, the submission of the linkstation patches to kernel.org by lyakh, and the firmimg.bin for EM mode by mindbender, the gentoo image is now thriving again with support for both PPC linkstations and kuroboxes.

Preparing for Install

UBoot

It is recommended that you have uboot installed prior to installing the gentoo image. linuxnotincluded, the author of the uboot port to PPC linkstations and kuroboxes, has documented the steps for building uboot on his website here: uboot for the linkstation. This gentoo image is not very useful for testing the RAM build and flashing the ROM build unfortunately because the binaries in the image are linked with glibc 2.6 (and therefore will not run under a 2.4 kernel). Additionally, the kernel provided in this image requires dtb support, a feature provided in uboot 1.2. The instructions for installing 1.2 UBoot are here on the wiki. You don't have to build the kernel as it shows in the instructions if you don't want to since there is a kernel supplied in the gentoo image. Also, you may be able to find a 1.2 uboot pre-built and ready to flash in the downloads section (for the HG: here, and the HD: here).

Please be careful.

The rest of these instructions assume you have a working 1.2 uboot.

Download needed files

You will need to download the gentoo image, the EM mode utilities, and the latest portage tree.

Install EM mode utilities

Switch the box to EM mode (see the Frequently Asked Questions for details on how to do this). Note, uboot 1.2 , if connected to the uboot shell via netcat, typically is set up to boot to EM mode by hitting "s <return>", and then entering "run emboot" at the prompt. you can also use the so called "minimal-console" to boot to EM mode. Watch this video tutorial describing this:

2.4.17/2.4.20 linkstations (Stock firmimg.bin)

If you already have installed uboot then you need to install the firmimg.bin which features telnet/ftp like the kurobox one does.
Look [[1]] for installation instructions.

2.4.33.3 firmimg.bin (Kurobox/KuroboxHG/LS1/HG/HS)

The binaries from EM_mode_binaries.tar.gz should be included. it was reported that bzip2 was missing, so install the EM_mode_binaries and set the date as described below.

2.4.17/2.4.20 Kurobox / Kurobox HG (Stock firmimg.bin)

After it boots to EM mode, use any FTP client to upload EM_mode_binaries.tar.gz to /tmp on the Kuro (hint: Windows may change the extension of the file when you download it from the internet).

Partitioning & Formating the HDD

Note: The /etc/fstab file that comes with the Gentoo image is configured to work with a simple hard drive partitioning scheme. If you want to use a different partitioning scheme you must edit /etc/fstab accordingly. The flash contains the standard visual editor, vi. Instructions for using vi are available at http://www.cs.colostate.edu/helpdocs/vi.html.

Note: the image is prepared for use with an instream 2.6 kernel, which uses the PATA driver, or /dev/sda, for the hard drive. When running under a 2.4 kernel or a legacy 2.6 kernel with out-of-stream patches, the drive is /dev/hda. Keep that in mind when creating the partitions and editing the fstab file.

Run fdisk and create partitions. The image uses three partitions: sda1 for /, sda2 for the swap space, sda3 for /datafiles. This section from the Gentoo Handbook explains how to prepare your hard disk (create partitions). For most users, 10gb for / on sda1 and is adequate (the image consumes around 1.4G when freshly installed). 512mb is good for a swap space on sda2 and use the remainder for /datafiles on sda3. However, you can decide which way you want to break up your hard disk. Remember you need to mount all of the drives (except the swap and /datafiles) before you untar the image (More on that later).

Install Gentoo Image

Mount new partitions

This will allow us to create the gentoo system on the hard drive instead of in the flash ram disk. We will create the directoy /gentoo and mount /dev/hda1 there.

# mkdir /gentoo
# mount -t ext3 /dev/hda1 /gentoo
(if you created any other partitions to be mounted under /, you should mkdir and mount them now)

Extracting the Image

Use your FTP client to upload the gentoo image (gentoo-20071104-uboot.tar.bz2) to the /gentoo directory on the kuro/LS.

Then, back at the EM-mode prompt, change directories to /gentoo and untar the image in what will be our root directory

# cd /gentoo
# tar xvjf gentoo-20071104-uboot.tar.bz2

Once the image is untarred, we can delete the image from /gentoo

# rm gentoo-20071104-uboot.tar.bz2

Extracting the portage snapshot

Again, use your ftp client to upload the portage snapshot (portage-latest.tar.bz2) to the /gentoo directory on the kuro/LS

Then, back at the EM-mode prompt, untar the snapshot into the usr directory

# cd /gentoo/usr
# tar xvjf /gentoo/portage-latest.tar.bz2

Once the snapshot is untarred, we can delete it from /gentoo

# cd /gentoo
# rm portage-latest.tar.bz2

Configure Network

Next we configure the network.

/etc/conf.d/hostname

If you want to change the hostname now, edit this file

# vi /gentoo/etc/conf.d/hostname

/etc/conf.d/net

If you want to use DHCP, you can skip this step as the image is configured for DHCP. Note, that if DHCP fails, the box will fallback to the well-known IP address of 192.168.11.150.

# vi /gentoo/etc/conf.d/net

The Gentoo Handbook Section 4 explains how to configure the settings for various options. The /etc/conf.d/net file supplied in the image looks like this:

# This configuration will use DHCP for eth0 but fallback to the
# well-known 192.168.11.150 if DHCP fails
config_eth0=(
"dhcp"
)
fallback_eth0=(
"192.168.11.150/24"
)

/etc/resolv.conf

You may have to configure your DNS servers in resolv.conf file according to your network. If you stick to DHCP, you generally don't have to edit the file, as it will be generated by dhcpcd upon bootup.

# vi /gentoo/etc/resolv.conf

The file supplied in the image looks like this:

nameserver 127.0.0.1

You may want to get a kernel now

The gentoo image provides a kernel and dtb files in /boot. Your uboot should be configured to boot the kernel listed below (vmlinux.UBoot), unless you supply your own kernel and configure uboot appropriately. If you want to use a different kernel, you should place it in /boot now and configure uboot appropriately. Note, the kernel supplied with the image disables the AVR watchdog at bootup, so the image assumes this is taken care of. If your kernel does not do this, you need to provide it somehow, otherwise your box will be reset after 5 minutes by the watchdog. This issue has been noted in bugtracker, and a package to disable the AVR watchdog should become available soon.

The kernel supplied was built from gentoo-sources. The uname -a looks like:

Now would be a good time to update everything. Let's sync the overlay with the svn server. First, I suggest optionally backing up the installed overlay:

# cd /usr/local/portage/layman
# cp -r ls-wiki ../ls-wiki.bak

Then sync the overlay with the subversion server:

# layman -S

Since we used the latest portage snapshot, you can probably skip this next step, but to be sure you have the latest portage tree, you can sync it now with this command:

# emerge --sync

Then, you should check what packages are out of date with a command like this:

# emerge --pretend --update --deep world

This will show you what packages are out-of-date since the image was created. I always like to do --pretend to see what it's going to do before doing it for real (some people may prefer to use --ask instead of --pretend to avoid waiting if the update is chosen). To really update everything, use this command:

# emerge --update --deep world

Last, if anything was updated and portage says we need to update our config files we run etc-update. Don't do this blindly as you can easily break your brand new system. You need to understand what the configuration files mean and choose what lines you want to edit. On the other hand, the box is plain vanilla at this point so the configuration files supplied with the updated packages are probably ok to accept.

# etc-update

That's it. You're done. If you are new to Gentoo, check out the Gentoo Handbook "Where to go from here?". Also, you should consider going to the Administrate Your Gentoo System page and installing some system utilities (note, the last time I checked, that page on the wiki was woefully obsolete - there are no bin packages available for this image so don't bother with the PORTAGE_BINHOST setting).

Notes on initial configuration

/etc/localtime

The timezone in the image is set for New York, or EST/EDT. If you live in a different timezone, you should change this link. Look for your timezone in /usr/share/zoneinfo/ and then create a link to your desired timezone:

Check your setting with the 'date' command. Also if you need to change the clock, use the 'hwclock' command. You also may want to emerge the ntp package to set your clock in sync with Internet time servers.

/etc/conf.d/clock

There is a timezone setting in this file as well. You can set the timezone to the same one as the link above.

# vi /etc/conf.d/clock
(set the TIMEZONE to something like TIMEZONE="America/New_York")

/etc/rc.conf

This file contains a setting for the AVR device. Since the image contains a kernel that uses /dev/ttyS0 for the AVR device, the file contains a line like this:

AVR_DEVICE=/dev/ttyS0

/etc/conf.d/local.stop

This file is run whenever the box is shutting down for halt or reboot. There is a little bit of code in this file such that if "shutdown -r now" or "shutdown -h now" is run from the command line, the AVR is told to turn of the power or start a reset. The following code is in the /etc/conf.d/local.stop file:

layman

The image is taking advantage of the noteworthy layman package for managing the overlay. This provides the ability to download updates from the nas-central/linkstationwiki subversion server at sourceforge. This is a very powerful utility, but perhaps should not be trusted blindly. I suggest making a backup of the /usr/local/portage/layman/ls-wiki directory tree after the first install and each time before using the "layman -S" command. Also, check occasionally in the forums at nas-central.org (in Software Development (ppc)) and kurobox.com (under the gentoo project [these two forums should eventually merge into one at nas-central]) for announcements regarding new packages that may be added to the overlay.

kernel

The kernel provided in the image was built from gentoo-sources. Then, to keep the image size smaller, the gentoo-sources package was unmerged and removed after the kernel was built. If you want to build a new kernel for some reason, you can do something like the following:

Then copy the uImage file to /boot/vmlinux.UBoot or the appropriate name for your uboot.

shutdown/reboot 5-minute delay

The box takes 5 minutes to perform a shutdown (power off) or reboot. This
seems to be a feature with the AVR (if anyone knows how to improve this,
let us know - the stock implementation did not seem to take this long). I
believe it in fact does not take half this time to actually complete shutting
down, so if you are really impatient, you can probably just cycle the
power after about 3 minutes and be ok. Note, if you have installed a lot
of services the shutdown process could take longer so beware.

distcc

Running gentoo on the LS/kurobox works great, but compiling is slow. If you have a x86 or other more capable CPU running linux, it can help significantly to run distcc on the more capable CPU and enable the LS/kurobox to offload some of the work for big emerge's. See this howto to set it up.

Troubleshooting

If you cannot find the box on the network, try the fallback IP address 192.168.11.150. Set your PC to 192.168.11.149 to try the connection. If you have a linux PC, use a command like "ifconfig eth0:EM 192.168.11.149".

If you still cannot find the box on the network, try to shutdown the box by holding the power button for about 3 seconds. The Power LED should start blinking to indicate the box is going to shut down. If the Power LED does not start blinking, you will probably have to pull the power cord. Go back to EM mode and mount the /dev/hda1 partition. Look in the var/log directory for a file called boot.msg. This file is created during the boot process. It may give you some clues as to what is going on. Note, this file is created because /etc/conf.d/rc has RC_BOOTLOG="yes" and the image has emerged app-admin/showconsole.