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). The image was created immediately following a deep world update by russK. There is only one version of the gentoo image (previous image had two versions). The image supports ppc kuroboxes and linkstations. 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.

+

What is Gentoo Linux? Gentoo Linux is a distribution of Linux that emphasizes customization. Read more about Gentoo at [http://www.gentoo.org/ gentoo.org].<ref>Gentoo and the 'g' logo are trademarks of Gentoo Foundation Inc. This site is not part of the Gentoo project and is not directed or managed by Gentoo Foundation, Inc.</ref>

+

+

Using this method you can install an entire Gentoo image on your PowerPC-based (PPC) Linkstation or Kurobox, 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, and is the only version of the Gentoo image now required (the previous install image had two versions). The only requirement is that your box must have a U-Boot that boots to a 2.6 kernel and supports dtb, e.g., U-Boot 1.2 (''see below''). The new 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 U-Boot for the Kurobox and Linkstation from ''linuxnotincluded'', the submission of the Linkstation patches to kernel.org by ''lyakh'', and the 2.4.33.3 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 ==

== Preparing for Install ==

−

=== UBoot ===

+

=== U-Boot 1.2 ===

−

The steps for installing uboot will not be detailed here. It is recommended that you have uboot installed prior to installing the gentoo image. 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). The instructions for installing UBoot are [[Kurobox support in stock 2.6 kernels| 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. That's what I did.

+

It is recommended that you have U-Boot 1.2 installed ''prior'' to installing the Gentoo image due to the dtb requirement. The instructions for installing U-Boot 1.2 are [[Kurobox support in stock 2.6 kernels| 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 U-Boot 1.2 pre-built and ready to flash in the downloads section (for the HG: [http://downloads.nas-central.org/LSHG_PPC/Bootloader/Uboot/Precompiled/u-boot-lsppchg-flash-1.2.0-r2.bin here]). '''Please be careful doing this upgrade.'''

−

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

+

The rest of these instructions assume you have a working U-Boot 1.2.

=== Download needed files ===

=== Download needed files ===

−

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

+

You will need to download the Gentoo image, the EM mode utilities, and the latest Portage tree.

* For the latest portage snapshot, use a gentoo mirror near you (see [http://www.gentoo.org/main/en/mirrors.xml Gentoo Mirror]), and navigate to the portage "snapshots", I use ibiblio for example [http://distro.ibiblio.org/pub/linux/distributions/gentoo/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2].

+

* For the latest Portage snapshot, use a Gentoo mirror near you (see [http://www.gentoo.org/main/en/mirrors.xml Gentoo Mirror]), and navigate to the Portage 'snapshots'. I use ibiblio for example [http://distro.ibiblio.org/pub/linux/distributions/gentoo/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2].

=== Install EM mode utilities ===

=== 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 typically is set up to boot to EM mode by hitting "s <return>", and then entering "run emboot" at the prompt.

+

Now we need to switch the box to EM mode<ref>For further details on EM mode see the [[Frequently Asked Questions#What_is_EM_mode.3F]].</ref>. There are a variety of ways to do this two of which are described below:

+

* 1: From the U-Boot 1.2 boot menu type 'run emboot', or if using foonas-em 'run fooflboot', then wait for the box to boot.

+

* 2: Turn on your box, wait a few seconds, then press the Power button three times (you should now see the Disk Full LED start to repeat a three flash pattern). This is EM mode. Now wait for the box to boot. A YouTube video showing this method is [http://uk.youtube.com/watch?v=pTPrrUYd8O8 here.]

−

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).

The binaries from EM_mode_binaries.tar.gz should already be included but it was reported that bzip2 was missing. This means you'll need to install the EM_mode_binaries and set the date as described below.

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

+

+

then login to LS/Kuro using a [[w:TELNET#TELNET_clients|telnet client]].

Kroutoshikou KURO-BOX (IETSUNA)

Kroutoshikou KURO-BOX (IETSUNA)

Line 29:

Line 52:

KURO-BOX-EM login: root

KURO-BOX-EM login: root

Password: ''kuro'' (''kuroadmin'' on HG)

Password: ''kuro'' (''kuroadmin'' on HG)

+

----

+

+

−

Change to the root and untar the binaries.

+

Change to the root and untar the binaries:

# cd /

# cd /

# tar xvzf /tmp/EM_mode_binaries.tar.gz

# tar xvzf /tmp/EM_mode_binaries.tar.gz

Line 41:

Line 67:

#

#

−

Check and set the date.

+

Check and set the date ('date MMDDhhmm[[CC]YY]' will set the date):

# date

# date

Fri Feb 1 12:37:03 JST 2006

Fri Feb 1 12:37:03 JST 2006

Line 51:

Line 77:

Note: The /etc/fstab file that comes with the Gentoo image is configured to work with a simple [[Hard Drive|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 /etc/fstab file that comes with the Gentoo image is configured to work with a simple [[Hard Drive|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 kurobox 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.

+

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''. [http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml?part=1&chap=4#doc_chap2 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).

Run fdisk and create partitions. The image uses three partitions: ''sda1'' for ''/'', ''sda2'' for the swap space, ''sda3'' for ''/datafiles''. [http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml?part=1&chap=4#doc_chap2 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).

Line 58:

Line 84:

(to match the fstab supplied in the image, you will need to create 3 partitions, 1=~10G, 2=~512M, 3=rest-of-drive)

(to match the fstab supplied in the image, you will need to create 3 partitions, 1=~10G, 2=~512M, 3=rest-of-drive)

−

Once the partitions are created we format the partitions. Here we format the first partition on /dev/hda (the hard drive is /dev/hda).

+

Once the partitions are created we format the partitions. Here we format the first partition on /dev/hda (the hard drive is /dev/hda):

# mke2fs -j /dev/hda1

# mke2fs -j /dev/hda1

mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09

mke2fs 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09

Line 85:

Line 111:

# mke2fs -j /dev/hda3

# mke2fs -j /dev/hda3

−

<div id=swap>Next we create the swap space</div>

+

<div id=swap>Next we create the swap space:</div>

# mkswap /dev/hda2

# mkswap /dev/hda2

Setting up swapspace version 1, size = 518184960 bytes

Setting up swapspace version 1, size = 518184960 bytes

Line 93:

Line 119:

=== Mount new partitions ===

=== 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.

+

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

# mkdir /gentoo

# mount -t ext3 /dev/hda1 /gentoo

# mount -t ext3 /dev/hda1 /gentoo

(if you created any other partitions to be mounted under /, you should mkdir and mount them now)

(if you created any other partitions to be mounted under /, you should mkdir and mount them now)

+

+

Create a directory for uploading the tarballs through ftp:

+

# mkdir /gentoo/tarballs

+

# chmod ugo+wx /gentoo/tarballs

=== Extracting the Image ===

=== 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.

+

Use your FTP client to upload the Gentoo image (gentoo-20071104-uboot.tar.bz2) to the /gentoo/tarballs 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

+

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

# cd /gentoo

# cd /gentoo

−

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

+

# tar xvjf tarballs/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 ===

=== 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

+

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

−

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

+

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

# cd /gentoo/usr

# cd /gentoo/usr

−

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

+

# tar xvjf /gentoo/tarballs/portage-latest.tar.bz2

−

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

+

Once the snapshot is untarred, we are finished with the tarballs so we can remove them from the disk:

# cd /gentoo

# cd /gentoo

−

# rm portage-latest.tar.bz2

+

# rm -r tarballs

== Configure Network ==

== Configure Network ==

−

Next we configure the network.

+

Next we configure the network:

=== /etc/conf.d/hostname ===

=== /etc/conf.d/hostname ===

−

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

+

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

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

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

=== /etc/conf.d/net ===

=== /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.

+

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

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

Line 146:

Line 172:

=== /etc/resolv.conf ===

=== /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.

+

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

# vi /gentoo/etc/resolv.conf

Line 154:

Line 180:

nameserver 127.0.0.1

nameserver 127.0.0.1

−

== You may want to get a kernel now ==

+

== Configure Settings for the Kernel ==

−

The gentoo image provides a kernel and dtb files in /boot. 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.

+

If you want to use the kernel supplied in the image, you can skip this section as long as your U-Boot is configured to load the kernel "boot/vmlinux.UBoot", and the appropriate dtb file as shown below. If you want to use a different kernel you should place it in gentoo/boot now and configure U-Boot accordingly. Note, the kernel supplied with the image disables the AVR watchdog at bootup and sets up the AVR device at /dev/ttyS0. The legacy kernels (kernels from baulub, javascout, and nowadays available through andre's webinstaller) typically have the AVR device at /dev/ttyS1 and do not disable the AVR watchdog. The [[AVR_watch-dog_daemon for Linkstation]] package (avr_evtd from the overlay) is present in the image however, which sends a keepalive signal to the watchdog, so you should not have to worry about resets (but you should move the daemon from the default runlevel to the boot runlevel). If you use a legacy kernel you must adjust a few things to account for the AVR device and also for the PATA vs. IDE driver.

−

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

+

These items must be changed if you use a legacy kernel:

+

* /etc/fstab: change /dev/sda to /dev/hda

+

* /etc/inittab: change ttyS1 to ttyS0

+

* /etc/conf.d/avr_evtd: change ttyS0 to ttyS1 and /dev/sda to /dev/hda

+

* /etc/conf.d/rc: change ttyS0 to ttyS1

+

* /etc/conf.d/local.stop: change ttyS0 to ttyS1

+

+

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

# # (umount any partitions you may have mounted if you departed from the provided fstab)

# # (umount any partitions you may have mounted if you departed from the provided fstab)

Line 183:

Line 216:

# echo -n &quot;OKOK&quot; &gt; /dev/fl3

# echo -n &quot;OKOK&quot; &gt; /dev/fl3

−

and then restart the system

+

and then restart the system:

# shutdown -r now

# shutdown -r now

−

Wait a few minutes and then log onto your kuro/LS with putty or ssh. The first time the system boots it will take about 3 minutes as it needs to generate the certificates used by sshd.

+

Wait a few minutes and then log onto your Kuro/LS with putty or ssh. The first time the system boots it will take about 3 minutes as it needs to generate the certificates used by sshd.

Login as '''root''' with the password: '''kuroadmin'''.

Login as '''root''' with the password: '''kuroadmin'''.

Line 194:

Line 227:

== Post Installation Tasks ==

== Post Installation Tasks ==

−

First we set the root password and create a new user who is a member of wheel so they can su to root.

+

First we set the root password and create a new user who is a member of wheel so they can su to root:

−

kurobox ~ # cd /

+

# cd /

−

kurobox # passwd

+

# passwd

New UNIX password:

New UNIX password:

Retype new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

passwd: password updated successfully

−

kurobox # useradd dtaylor -m -G users,wheel -s /bin/bash

+

# useradd dtaylor -m -G users,wheel -s /bin/bash

−

kurobox # passwd dtaylor

+

# passwd dtaylor

New UNIX password:

New UNIX password:

Retype new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

passwd: password updated successfully

−

kurobox #

+

#

−

Now would be a good time to update everything. Let's sync the overlay with the svn server:

+

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:

−

# layman -S

+

# 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 step, but to be sure you have the latest portage tree, you can do this:

+

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

# emerge --sync

−

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

+

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

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

# 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. To really update everything, use this command:

+

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

# emerge --update --deep world

Line 254:

Line 291:

=== /etc/conf.d/local.stop ===

=== /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:

+

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 off the power or start a reset. The following code is in the /etc/conf.d/local.stop file:

#AVR_DEVICE should come from /etc/rc.conf

#AVR_DEVICE should come from /etc/rc.conf

Line 404:

Line 441:

[I--] [ ] virtual/libintl-0 (0)

[I--] [ ] virtual/libintl-0 (0)

[I--] [ ] www-servers/apache-2.2.6 (2)

[I--] [ ] www-servers/apache-2.2.6 (2)

+

+

=== 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 ===

=== kernel ===

Line 409:

Line 449:

# emerge gentoo-sources

# emerge gentoo-sources

−

# cp /boot/config /usr/src/linux

+

# cp /boot/config /usr/src/linux/.config

# cd /usr/src/linux

# cd /usr/src/linux

# make oldconfig

# make oldconfig

Line 415:

Line 455:

# make uImage && make modules && make modules_install

# make uImage && make modules && make modules_install

−

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

+

Then copy the uImage file to /boot/vmlinux.UBoot or the appropriate name for your U-Boot:

+

+

# cp arch/powerpc/boot/uImage /boot/vmlinux.UBoot

+

+

And finally compile your .dtb file:

+

+

# cd /boot

+

# dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts

+

# cp arch/powerpc/boot/dts/kuroboxHG.dts /boot/

+

+

=== 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.

+

+

'''---> To see how to fix this, see [http://forum.buffalo.nas-central.org/viewtopic.php?p=44327#p44327 this forum message].'''

=== distcc ===

=== 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 [http://www.gentoo.org/doc/en/cross-compiling-distcc.xml this howto] to set it up.

+

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 emerges. See [http://www.gentoo.org/doc/en/cross-compiling-distcc.xml this howto] to set it up.

== Troubleshooting ==

== 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".

+

=== U-Boot Output on netcat ===

+

To see the U-Boot output through netcat, your PC should have an IP address on the same subnet as the uboot setup. If you went with the typical setup, you should set your PC to 192.168.11.149. See the wiki page on netcat and uboot: [[NetCat-A UBoot-Friendly Network Utility]]. If you have a linux PC, use a command like "ifconfig eth0:EM 192.168.11.149". This will give you a second IP address for your ethernet interface. If you have a Windows PC, you will have to set the IP address through the properties on the network interface. Then use the nc command like this:

+

+

nc -u -p 6666 -v -v 192.168.11.150 6666

+

+

You should see something like the following in the nc window during bootup. Note it says it is loading the kernel file "Loading 0:1:boot/vmlinux.UBoot". Also note it says it uncompresses the kernel ok and that it is loading the flat device tree:

rtc-rs5c372 0-0032: setting the system clock to 2007-11-11 11:59:41 (1194782381)

+

linkstation: disarming the AVR watchdog:

+

kjournald starting. Commit interval 5 seconds

+

EXT3-fs: mounted filesystem with ordered data mode.

+

VFS: Mounted root (ext3 filesystem) readonly.

+

Freeing unused kernel memory: 148k init

+

+

=== boot.msg ===

+

If you cannot find the box on the network, try the fallback IP address 192.168.11.150.

−

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.

+

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. If you don't have a file called boot.msg, look harder at the netcat output, perhaps the kernel is not successfully booting.

If you are still having trouble, post a message to the forums at [http://forum.nas-central.org/ forum.nas-central.org].

If you are still having trouble, post a message to the forums at [http://forum.nas-central.org/ forum.nas-central.org].

+

== Submitting Bugs and Issues ==

+

If you cannot get a question or problem resolved in the forums, please submit bugs/issues reports in mantis at nas-central.org here: [http://bugtracker.nas-central.org/ Bugtracker].

+

----

+

<references/>

{{Template:Articles|Kurobox|Gentoo}}

{{Template:Articles|Kurobox|Gentoo}}

Latest revision as of 04:37, 6 February 2009

Current Gentoo Image Date: 2007/11/04

What is Gentoo Linux? Gentoo Linux is a distribution of Linux that emphasizes customization. Read more about Gentoo at gentoo.org.[1]

Using this method you can install an entire Gentoo image on your PowerPC-based (PPC) Linkstation or Kurobox, 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, and is the only version of the Gentoo image now required (the previous install image had two versions). The only requirement is that your box must have a U-Boot that boots to a 2.6 kernel and supports dtb, e.g., U-Boot 1.2 (see below). The new 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 U-Boot for the Kurobox and Linkstation from linuxnotincluded, the submission of the Linkstation patches to kernel.org by lyakh, and the 2.4.33.3 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

U-Boot 1.2

It is recommended that you have U-Boot 1.2 installed prior to installing the Gentoo image due to the dtb requirement. The instructions for installing U-Boot 1.2 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 U-Boot 1.2 pre-built and ready to flash in the downloads section (for the HG: here). Please be careful doing this upgrade.

The rest of these instructions assume you have a working U-Boot 1.2.

Download needed files

You will need to download the Gentoo image, the EM mode utilities, and the latest Portage tree.

Install EM mode utilities

Now we need to switch the box to EM mode[2]. There are a variety of ways to do this two of which are described below:

1: From the U-Boot 1.2 boot menu type 'run emboot', or if using foonas-em 'run fooflboot', then wait for the box to boot.

2: Turn on your box, wait a few seconds, then press the Power button three times (you should now see the Disk Full LED start to repeat a three flash pattern). This is EM mode. Now wait for the box to boot. A YouTube video showing this method is here.

For Linkstations with Kernel 2.4.17 or 2.4.20 (Stock firmimg.bin)

You need to install the 2.4.33.3 firmimg.bin which features telnet/ftp like the Kurobox one does. Look to Uboot_firmimg.bin_ppc for installation instructions.

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

The binaries from EM_mode_binaries.tar.gz should already be included but it was reported that bzip2 was missing. This means you'll need to install the EM_mode_binaries and set the date as described below.

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)

Create a directory for uploading the tarballs through ftp:

# mkdir /gentoo/tarballs
# chmod ugo+wx /gentoo/tarballs

Extracting the Image

Use your FTP client to upload the Gentoo image (gentoo-20071104-uboot.tar.bz2) to the /gentoo/tarballs 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 tarballs/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/tarballs 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/tarballs/portage-latest.tar.bz2

Once the snapshot is untarred, we are finished with the tarballs so we can remove them from the disk:

# cd /gentoo
# rm -r tarballs

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

Configure Settings for the Kernel

If you want to use the kernel supplied in the image, you can skip this section as long as your U-Boot is configured to load the kernel "boot/vmlinux.UBoot", and the appropriate dtb file as shown below. If you want to use a different kernel you should place it in gentoo/boot now and configure U-Boot accordingly. Note, the kernel supplied with the image disables the AVR watchdog at bootup and sets up the AVR device at /dev/ttyS0. The legacy kernels (kernels from baulub, javascout, and nowadays available through andre's webinstaller) typically have the AVR device at /dev/ttyS1 and do not disable the AVR watchdog. The AVR_watch-dog_daemon for Linkstation package (avr_evtd from the overlay) is present in the image however, which sends a keepalive signal to the watchdog, so you should not have to worry about resets (but you should move the daemon from the default runlevel to the boot runlevel). If you use a legacy kernel you must adjust a few things to account for the AVR device and also for the PATA vs. IDE driver.

These items must be changed if you use a legacy kernel:

/etc/fstab: change /dev/sda to /dev/hda

/etc/inittab: change ttyS1 to ttyS0

/etc/conf.d/avr_evtd: change ttyS0 to ttyS1 and /dev/sda to /dev/hda

/etc/conf.d/rc: change ttyS0 to ttyS1

/etc/conf.d/local.stop: change ttyS0 to ttyS1

The kernel supplied in the image 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 off 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:

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 emerges. See this howto to set it up.

Troubleshooting

U-Boot Output on netcat

To see the U-Boot output through netcat, your PC should have an IP address on the same subnet as the uboot setup. If you went with the typical setup, you should set your PC to 192.168.11.149. See the wiki page on netcat and uboot: NetCat-A UBoot-Friendly Network Utility. If you have a linux PC, use a command like "ifconfig eth0:EM 192.168.11.149". This will give you a second IP address for your ethernet interface. If you have a Windows PC, you will have to set the IP address through the properties on the network interface. Then use the nc command like this:

nc -u -p 6666 -v -v 192.168.11.150 6666

You should see something like the following in the nc window during bootup. Note it says it is loading the kernel file "Loading 0:1:boot/vmlinux.UBoot". Also note it says it uncompresses the kernel ok and that it is loading the flat device tree:

boot.msg

If you cannot find the box on the network, try the fallback IP address 192.168.11.150.

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. If you don't have a file called boot.msg, look harder at the netcat output, perhaps the kernel is not successfully booting.