Efika

Introduction
The Efika is a small computer produced by Genesi that consists of a PPC32 SoC ("system on a chip") with some extra hardware. Right now, this is not an end user oriented device, but a standalone motherboard and development tool for other projects. So this page aims not to be an installation guide, but mainly:


 * 1) A collection of pointers on how to get Gentoo GNU/Linux running on the Efika.
 * 2) Collection of links to other hardware of interest to people doing development on the Efika (Like cases, psu's, riser cards, etc.)

USB Boot
You can use a USB stick to boot a kernel and start a Gentoo installcd environment. From this environment you can install Gentoo as described in the Gentoo Handbook.

Getting the necessary stuff
First you need a 64 MB or larger USB stick. Next you need a Gentoo PPC minimal installation CD. You can find this image on any Gentoo mirror. And last you need a kernel image that includes an initramfs as generated with the genkernel tool. The initramfs contains the init scripts to find and start the installcd environment. You can create such a kernel image yourself with genkernel --genzimage using efika-sources as kernel sources or you can fetch a prebuild kernel image from here.

Preparing the USB stick
The minimal CD has two files you need to copy to the USB stick. Copy the files 'image.squashfs' and 'livecd' to the USB stick. If your USB stick has a FAT filesystem you will have to rename 'image.squashfs' to something that conforms to the 8.3 naming convention, for example 'squashfs.img'. If your USB stick has an ext2 filesystem the 8.3 filename restriction doesn't apply. You copy the kernel image to the USB stick as well. Let's name the kernel image 'efika'. Just make sure the names you use in the boot command are the same as the names of the files on the USB stick.

Booting the USB stick
The Efika will see the USB stick as hd0:0. You can boot the USB stick with the following boot command:

If you are going to use the USB stick a lot for booting you may want to consider copying the 'menu' file from the minimal CD to the USB stick and editing it to create an entry for the boot command(s) you're using. You should then be able to boot the USB stick with:

You should get a menu with the entry (or entries) you created and be able to boot the selected entry.

Once you're booted into the installcd environment you can prepare the hard disk (if you have one) and install Gentoo (or some other Linux distribution) on it.

Netboot + NFS root
There are a few things you'll need to do to netboot the Efika.

Setting Up the TFTP Server
First, you'll need to set up a tftp server. I recommend tftp-hpa. I run mine from one of my Gentoo machines in my LAN. You can install it with:

You will need to put a kernel image in /tftproot so that the Efika can fetch it over the network. There's a pre-compiled image available in the Kernel section below.

Setting Up the NFS root
First you need to setup your main system to serve files via NFS, there are some guides out there, but here you have a very quick guide:


 * 1) In the server kernel setup under File systems ---> Network File Systems activate "NFS file system support" and "NFS server support". Rebuild the kernel and either load the modules or reboot.
 * 2) emerge -av net-fs/nfs-utils
 * 3) rc-update add nfs default
 * 4) /etc/init.d/nfs start

The NFS server is now running with no filesystem being exported. We will get back to this latter.

Next, you'll want to set up a nfsroot. I recommend using the 2006.1 ppc uclibc stage3 for this. You'll need a machine that's already set up as an NFS server. This won't be covered here. Create a directory for your nfsroot and extract the stage3 tarball to it.

You now have your basic nfsroot. You'll still need to make a few modifications to it in order to make it bootable. The first thing you'll need to do is modify the /etc/fstab. Leave the BOOT, ROOT, and SWAP lines commented out. Add a line for your nfsroot.

Next, you'll need to set up the serial console. You can skip this section if you have a video card and keyboard, but it's probably still a good idea in case something goes wrong. You'll need to add an entry to /etc/securetty for 'ttyPSC0'. Then, edit the /etc/inittab to match the following. Comment out the cX lines, uncomment the s0 line, and edit it to match the serial settings for the Efika.

This stage3 tarball contains devfs instead of udev. Devfs does not work with newer 2.6.x kernels, but there is a static /dev to get you started. You'll have to switch to udev once you have the EFIKA booted. Until then, you'll need to create the /dev/ttyPSC0 device by hand so your serial console works.

You may also want to set up dropbear to start on boot. You can do that with the following.

Of course, once you get your board booted, you'll probably want to be able to login. You'll need to set a root password. You can do this by manually inserting a password hash for the 'root' user into /etc/shadow. It's the value between the first and second colon.) You can also just blank it to create a blank password temporarily (not recommended).

Finally, when you export this directory via NFS, you'll need to add something similar to your /etc/exports file (on the main system, not in the nfsroot directory).

And now restart NFS so that it catches the newly exported directory.

Booting
Now we get to the fun part...actually booting the Efika. When you power up the Efika, you should get the OF (OpenFirmware) prompt.

You'll need to prepare the board for netbooting. I set the Efika's IP for tftp (does not need to be the same as the Efika will use once booted) and the tftp server's IP address in NVRAM (instead of specifying them in the boot command):

You can then fetch the kernel and start the boot process with the following.

If the above command does not work (as it does for some) try the following:

The 'boot' command tells OF to load a kernel and 'eth' tells is that we're loading it via tftp (eth for ethernet). 'kernel_efika' is the name of the kernel image that you placed in /tftproot on your tftp server earlier. The 'console=ttyPSC0' parameter tells the kernel where to send the console output (the serial port in this case). 'ip=dhcp' tells the kernel to get an IP address via DHCP (for nfsroot). 'panic=10' tells the kernel to reboot after 10 seconds in the case of a panic. The normal value for this is 180 seconds, but some of us are too impatient for that. The last 2 parameters specify the nfsroot.

If all goes well, you should see the following. You should know what to do here :)

Enjoy!

Hard Drive install
The easiest way to install into an hard drive is to use the Net install to have a basic system, and then to attach the hard drive to another machine, create your partitions and copy the installation over. The following command assumes two things:


 * 1) sda1 is your /boot partition (must be ext2)
 * 2) sda2 is your / partition

To boot with this setup.

Auto Boot
First, you will have to set the default boot device. As an example, for partition 1 of the ATA disk:

Then to choose the boot file and parameters

And then to have the system auto-boot with these settings:

If you want to set the amount of time the Efika will wait for input before autobooting (time is in milliseconds)

make.conf
The following is from my nfsroot setup using a 2006.1 ppc uclibc stage3:

The -Os optimizes the same as -O2 but removes from flags that can increase the size of the binary. If binary size is not an issue you can use -O2. It also performs further optimizations designed to reduce code size which can cause problems for some packages. (See more at the GCC optimization manual )

GNAP
GNAP stands for Gentoo Network Appliance and is a project that helps developers build stage 4 system's for embedded system's. Gentoo developer BaSS and others are working on a Efika profile. Also in the long run the project would like to be able to provide pre-built packages for some of the more used software.

Kernel
There is now an Efika overlay available. The overlay currently has a pre-patched set of sources for the Efika, based on gentoo-sources-2.6.19-r1, called efika-sources. You can either grab these files manually using subversion, or you can use the layman utility to add the Efika overlay to your system. The latest version already comes with the sound patch and a default .config with most of the options you'll need.

To manually build a Linux kernel for the Efika, some extra patches are needed for the 2.6.19 vanilla tree:


 * 1) The efika-specific patches against 2.6.19-rc6 from Efika.de
 * 2) The patch to fix an OOPS that occurs during boot that appeared sometime between 2.6.19-rc6 and 2.6.19 from the LKML
 * 3) The sound driver done by tnt_ as well the fix to the Efika device tree ATTENTION. This driver is pre-alpha code. It will probably not ruin your hardware but then again.......

These patches are gathered together in the efika-patches tarball on humpbacks dev space.

Alternatively, if you don't want to build the kernel and don't mind not having sound, you can just grab the pre-compiled kernel created by agaffney. It has everything required to get the board up and running compiled into the kernel and no modules at all. It supports ATA, ethernet, serial, USB (although, there aren't really any drivers for USB devices), NFS client, nfsroot, kernel-level IP auto-configuration (bootp, dhcp, and rarp), and many other goodies. You can get the kernel and config from agaffney's devspace.

Swap space and Network filesystems
If we are using Gentoo we will need to build packages. If we want to build on the Efika and are using root over NFS and have no local disk attached to the Efika we need to setup some way to have more memory.

One way is to use swap over nfs with the help of loopback devices. BIG FAT WARNING If you think swap is slow, swap over NFS with the current Network driver is Super Slow


 * 1) Create the swap file: dd if=/dev/zero of=/var/swap bs=1k count=Xk where X stands for the number of MB your swap should be.
 * 2) Format the swap file using the mkswap command.
 * 3) Initialise a loopback device using the swap file: losetup /dev/loop0 /var/swap.
 * 4) Active the swap with: swapon /dev/loop0

TODO: Have the losetup running at startup.

Day to day usage
Updating the base system can be a challenging task, specially for large packages as GLIBC and GCC. So a binary repository has been setup. This repo contains more than just the system packages; many more packages are there to help you have an updated Gentoo installation. Just add to /etc/make.conf:

Now just emerge --sync; emerge -ga system. For the extra available packages visit: http://tinderbox.dev.gentoo.org/html/default-linux/ppc-efika/

PSU
If you have such a small system you probably want a small PSU. And considering that the full system with hard drive will only eat 10W (you have to add a bit more in case of a AGP card) you for sure do not need a giant 400W PSU.


 * 1) Mini-box produces the world's smallest ATX power supply's. In fact they are so small you might mistake them for the ATX connector. If you live in the UK you can buy them from ICP for relatively little.
 * 2) Morex produces very small PSU's, but European shops that sell these in quantities of just one or two are hard to find. In the Netherlands you can order them from Saland Automatisering and Picco Computers. In the UK you can find them at mini-itx.com and in France at www.thinkitx.com.

Case
Efika dedicated cases, or links to mods done one mini-ATX cases.


 * using an external 5.25" enclosure (i.e. for USB CD/DVD drives) for an Efika case
 * another case modification with German text.
 * Gentoo's Pieter van den Abeele made a case out of the cardboard box the Efika came in..
 * Dennis Clarke at LiveWire/Blastware has produced a case specifically for the Efika which is available on the Genesi Store separately or in the Open Client product.
 * There are some other case designs in the works..

Compact Flash Card Adapters
CFDISK.2G from PC Engines works great with most CF-ATA cards and microdrives. PC Engines sell direct, or there are lots of resellers worldwide (Mini-Box is a good example, you can order one with your PicoPSU :)

AD44MIDE2CF from Addonics should allow using two CF adapters - perhaps one flash and one microdrive. Whether this works on Efika has yet to be tested but there is nothing stopping the master and slave device being detected. It definitely works around the cable length issues with the Efika ATA controller. It has been tested by James and Jacob at Directron (product page)and works fine in both the single- and dual-card models. Please note, it is very easy to reverse the orientation of this adapter - it will seem that it does not "fit". However, just turn it upside down and it will be fine.

PCI Riser cards
If you use and test a PCI riser card that allows to lay down a PCI card, post some info here.

These PCI risers from Adex Electronics should work fine (at least these specific part codes). The links are to OrbitMicro, and specify PCI risers which will hang OVER the Efika board (as the AGP riser does) at various heights, with a 3.3V key.

This one is suitable for low profile cards and roughly matches the height of the standard Efika AGP riser (center height is approx 2.5mm too short, but that's close enough for an LP PCI card to fit the slot in the Efika Open Client case with only a little stress on the riser):


 * PCITX4-5-B5-A3

Then, In order of increasing height


 * PCITX4-6-B5-A3 (may not clear ethernet port)
 * PCITX4-1-B5-A3
 * PCITX4-4-B5-A3

Testing (thanks Pieter) and the datasheets and enquiries to the manufacturer confirm they will work. If you need another configuration you can quickly create the part code - for example, PCITX4-6-B3-A5 will be a short adapter with the slot facing away from the Efika.

For all other manufacturers you can just ask for a 3.3V PCI riser with the slot on the "A" side to hang over the board, or "B" side to hang away from the board.

Adex have a European Distributor at Hytec Electronics Ltd.


 * Hytec Electronics

Another Adex reseller with shop fronts in the U.S. and Canada is CriticalCable, who according to Paul Whittaker in Australia, provide cheaper international shipping options to southern hemisphere destinations than Orbit Micro.


 * CriticalCable

DO NOT REVERSE PCI RISERS EVEN IF THEY HAVE A UNIVERSAL CONNECTOR

Active PCI Risers (multiple PCI slots)
Active risers supporting more than one slot with 3.3V operation seem to be rare these days, but a 64-bit riser - while excessively long compared to an Efika - will always work as they are always 3.3V.

'Do not' use riser cards designed for ITX boards even if they claim to be "active" - they actually use some questionable logic on-board to derive and split interrupt signals over multiple cards. They only work on the ITX boards because the PCI bus controller and connections are well known and have well-known quirks. The Efika slot will not support this logic - it will either be unreliable, or not work at all.

Real 'active' risers will have a large PCI host bridge chip on them. They are easy to spot.

Currently the Efika firmware does not implement PCI bridging properly and will produce a broken device tree node. However devices behind the bridge should be correctly configured by the bridge, and with manual tweaking it should be possible to correct any missing interrupt properties. Hopefully this will be fixed in future revisions.