Gentoo Logo

Gentoo on the Genesi EFIKA MX Smartbook

Content:

1.  Overview

Feel free to ask for help on IRC in #gentoo-embedded, or even in #efika on Freenode. There is also the www.powerdeveloper.org forums where there are a lot of great and helpful people! On IRC I can be found as steev, and I'm not against private messages, however it is *always* easier to ask a question in a public channel rather than ask in private as I may not be around and someone may be around who can help!

I've been a Gentoo developer since November 2005, so if I skip something, please let me know, I'm working on getting this into a publicly available document on Gentoo's infrastructure since more and more people are showing interest in it.

2.  Requirements

For these instructions, I am going to assume a user is booted off the onboard PATA SSD, and installing to an SD card. I'd suggest a minimum of 8GB, although the EfikaMX does support up to 32GB (note: I have issues with Patriot 32GB cards, and I'd *highly* recommend something like the SanDisk Ultra 8GB Class 10 SD card. I have a few Class 10's, but that one is quite literally the only one that I would ever remotely call fast! Although it IS expensive, I believe mine cost me anywhere from 40-80 dollars!

To be able to install Gentoo, you'll need the following:

  • An EFIKA MX Smartbook
  • A working internet connection
  • An SD Card
  • Time!
  • (Optional) A USB stick (I prefer to keep portage/distfiles/building off the onboard pata/sdcards)

3.  SD card setup

Overview

If you are in Ubuntu on the machine, you will want to insert your SD card into the slot, and then open a terminal and unmount the partitions (if any) that get mounted automatically.

I prefer to do the rest of these steps as root. In Ubuntu, the easiest step is to run sudo su -, and then enter your password.

Partitioning and formatting the SD card

You will want to make at least 2 partitions, 1 for /boot and 1 for /. /boot can be ext2, ext3, or vfat. I prefer ext2 myself, although some people say ext3 is better in case of having to power it down for some reason and it getting corrupted. I suggest ext4 for /.

4.  Installing Gentoo

Download and extracting stage3

We need an armv7a-unknown-linux-gnueabi stage3 for best performance, available under the releases/arm/autobuilds directory in your favorite mirror

Mount the second partition of the SD card and extract the stage3 you downloaded.

Code Listing 4.1: Mounting the partition and extracting the stage3

(Make sure you're root)
# mkdir /mnt/p2
# mount /dev/mmcblk0p2 /mnt/p2

(Extract the stage3, it may take a while)
# tar xjpf stage3-armv7a-20101118.tar.bz2 -C /mnt/p2

Entering the new environment

Code Listing 4.2: Bind-mounting and entering the new environment

# mount -o bind /dev /mnt/dev
# mount -t proc proc /mnt/proc
(if you use a usb stick for portage, etc. mount them here)
# cp -L /etc/resolv.conf /mnt/etc
# chroot /mnt /bin/bash 
(the /bin/bash isn't necessarily needed, but it tells it to use /bin/bash 
from inside the chroot as opposed to the one from the host system)

Setup the new system

Once you are inside the chroot, it's the usual steps of an install, setting up the date (e.g. cp /usr/share/zoneinfo/America/Chicago /etc/localtime ), setting hostname, setting password.

We need to edit /etc/fstab and add the different partitions, as well as their mount points and fs types. We also need to edit /etc/inittab and /etc/securetty.

Code Listing 4.3: Editing inittab and securetty

# nano -w /etc/inittab /etc/securetty

In /etc/inittab you want to find the line that says s0 and change the ttyS0 9600 to ttymxc0 115200 (that is the console on an EfikaMX) In /etc/securetty you want to find the line that says ttyS0 and change it to ttymxc0. If you don't, you won't be able to login as root over serial console (this may not be required by you, but it is there for completeness)

And then sync portage.

Obtaining/building the kernel

Once that is done, you will want to emerge u-boot-tools as it will be needed for creating a kernel uImage, as well as generating the boot.scr file.

Code Listing 4.4: Emerging u-boot-tools

# emerge u-boot-tools

You can get the latest kernel source from git, via Genesi's kernel repository at git://gitorious.org/efikamx/linux-kernel.git

Code Listing 4.5: Cloning the kernel git repo

(We move to the appropiate directory for storing kernels
# cd /usr/src
(This can take a very long time)
# git clone git://gitorious.org/efikamx/linux-kernel.git

Once the repository that contains the kernel is cloned, we configure the kernel. We'll use a default config specially designed for the device, however its an Ubuntu-focused config, so it has a lot of extra, unneeded options to get a minimal system.

Code Listing 4.6: Configuring the kernel

(We use the default config as a base)
# make mx51_efikamx_defconfig

(You could run menuconfig for adding/removing special options, but the default config should work)

Code Listing 4.7: Compiling the kernel

(This can take a very long time)
# make

(This creates a kernel image U-Boot understands)
# make uImage

Code Listing 4.8: Compiling/installing kernel modules

# make modules_install

Installing the kernel

Code Listing 4.9: Installing the kernel

# cp arch/arm/boot/uImage /boot/uImage

At this point, we've got a kernel built, and installed, along with the modules and firmware needed.

Now you will need the boot.scr file. This is just a boot script, which is used by u-boot (like Grub for embedded machines, but typically without the pretty menus ;) ) to know what commands to send to the kernel.

http://wiki.debian.org/EfikaMX#DefaultU-BootEnvironment explains it well, as well as giving a decent sample file. Just scroll down to "Sample boot script for new U-Boot on Smartbook and Smarttop" and either copy and paste, or use it for inspiration.

Code Listing 4.10: Creating the boot script

# cd /boot
# nano -w boot.script
(paste from the debian wiki)

Note that I don't personally use anything like plymouth, or fbsplash (I don't believe fbsplash even works on ARM, but I could be wrong) so my boot.scr's bootargs looks something like below, and I'll explain the options afterwards:

Code Listing 4.11: boot.scrip example

setenv bootargs console=tty1 console=${console} root=/dev/mmcblk0p2 rootwait rw rootfstype=ext4;

  • ${console} is a variable set up in u-boot, and it is basically a shortcut for ttymxc0,115200.
  • rootwait will tell the system to wait for the root device to become available.
  • rootfstype=ext4 is mostly a cosmetic thing. It simply lets the kernel know to use ext4 as the rootfs, and doesn't print 3 lines about unsupported filesystem options.

Once you've written out your boot.script (note that we use a different name because we use mkimage to "compile" the script into something that u-boot can handle), you compile it with the sample line they give below the sample boot.scr file.

Code Listing 4.12: Converting boot.script to boot.scr

# mkimage -A arm -O linux -a 0 -e 0 -T script -C none -n "EfikaMX Boot Script" -d boot.script boot.scr

If you then run file against boot.scr, you should see something similar to the following :

Code Listing 4.13: Running file /boot/boot.scr

$ file /boot/boot.scr
/boot/boot.scr: u-boot legacy uImage, , Linux/ARM, Script File (Not
compressed), 447 bytes, Tue Mar 15 23:24:09 2011, Load Address:
0x00000000, Entry Point: 0x00000000, Header CRC: 0x1BC25E5E, Data CRC:
0x0212F84C

(Optional) Emerging additional software

Since we assume wireless, you will want to install a dhcp client, and wpa_supplicant, if you're going to connect to a WPA(etc) wireless network, otherwise wireless-tools should be fine.

Code Listing 4.14: Emerging needed tools for wireless network

# emerge dhcpcd wpa_supplicant

You can add any other additional software you can think of at this point, system logger, cron, so on and so forth...

Finishing installation

Once you have all of the above, we SHOULD be okay to reboot. So exit the chroot, unmount partitions, leave the SD card in the SD card slot, and reboot the Efika MX. If all went well, after just a short pause, you should see the wonderful Gentoo openrc-based init system start up... and leave you at a login prompt to enjoy your wonderful new EfikaMX with the awesomeness that is Gentoo!

5.  Thanks



Print

Page updated February 17, 2011

Summary: This guide shows you how to install Gentoo on the Genesi EFIKA MX Smartbook.

Raúl Porcel
Author

Stephen Klimaszewski
Slacker

Donate to support our development efforts.

Copyright 2001-2012 Gentoo Foundation, Inc. Questions, Comments? Contact us.