Title: Running Gentoo on the IFC6410

I recently acquired a IFC6410, a Qualcomm-based single board computer and decided to install Gentoo on it. There is some documentation available as part of the freedreno project. While this documentation was quite decent, I did run into some things that were not yet documented. This blog post will provide you will all the information to install Gentoo on the IFC6410 with the ability to get at least Network, X11 (HDMI), 3D and Audio working. As most of the instructions are quite generic, I hope the guide will be useful for those who prefer other distributions too.

The guide assumes that you have previous knowledge with Gentoo (or decent knowledge of Linux in general).

Overview

We will start by checking that you have the right tools for the job, both software and hardware. Software required will be covered in the guide when deemed necessary, so don't fear if you do not have, for example, fastboot installed.

Once we have verified you have the right tools, we will boot the device into the already-installed Android, to allow you to extract the firmware. (Although I plan to have the firmware available somewhere as well, but I am not sure if I can share it) The firmware can also be extracted without ever booting Android, but it's nice to see that the device boots up to something before you start hacking on it.

After that initial Android boot (which is optional), we will proceed with building a Linux kernel, creating a boot image using abootimg (compiled during this guide) and flash that image to the IFC6410. With the right boot parameters and a medium to boot from (with a base Gentoo install on it), we can boot to a working GNU/Linux. At this point it is also possible to extract the firmware from the Android image.

Once you have a working GNU/Linux, we will cover getting the hardware to actually do what you want by setting up the drivers properly. In most cases it may just work already, but ALSA (audio) may need some work, for example.

At the end of this guide you will hopefully have a working system with OpenGL 2.1, OpenGLES 2.0, working audio and network and more. I am currently using the IFC6410 as my primary desktop.

Tools

Software

  • A GCC compiler that can compile ARM binaries (If using Gentoo, this guide will tell you how to set one up)
  • Android utilities: fastboot (and optionally adb). Both are in the package dev-util/android-tools
  • dev-vcs/git

Hardware

Requirements:

  • IFC6410
  • Optionally, a RS232 serial. This is highly recommended, but not a must.
  • Optionally, a small heatsink. I found that at times the IFC6410 became a bit hot and decide Linux kernel devices to force-downclock the CPU making everything painfully slow. At this point I haven't attached the heatsink, but rather placed it on top of the SoC.
  • A few jumper wires (either to force the device into fastboot or to connect your RS232 serial). Most USB RS232 serial convertors work, but TTL serial will not work.

Starting the board

Follow instructions here to back up the firmware and to be able to boot a kernel with fastboot. We will build our own kernel, and then use the abootimg tool to create a kernel that the device can load.

Building a cross compiler

This guide assumes you already have a cross compiler set up; if you don't have one (and are using Gentoo), setting one up is a breeze. Just make sure that crossdev is installed:

emerge crossdev -a

Then, once it is installed:

crossdev -S -t armv7a-hardfloat-linux-gnueabi

Linux Kernel

Clone the kernel and check out the ifc6410-drm branch:

git clone https://github.com/freedreno/kernel-msm/
git checkout -t origin/ifc6410-drm

Create the defconfig:

CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm make ifc6410_rob_defconfig

Optionally change the kernel configuration:

CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm make menuconfig

And then build the kernel:

CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm make zImage modules
CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm INSTALL_MOD_PATH=/root/ifc/mods make modules_install

Creating a boot image (for fastboot)

We need to create a special image for the IFC to be able to boot our kernel.

Get abootimg:

git://gitorious.org/ac100/abootimg.git

First, extract Rob Clark's image:

wget http://people.freedesktop.org/%7Erobclark/f20/ifc6410-boot-f20.img
../abootimg/abootimg -x ifc6410-boot-f20.img

Assemble the boot image with your own kernel zImage and bootimg.cfg (just change "cmdline").

../abootimg/abootimg --create <image> -f bootimg.cfg -k zImage -r ../work/initrd.img

You don't need an initrd, but it looks like the tool refuses to create an image without it.

Booting the Kernel Image

Run:

fastboot boot <image>

Making the kernel change permanent

You can copy your kernel image to the device on-board storage, to have it boot your image by default. To do that, first resize the boot partition as in:

https://github.com/freedreno/freedreno/wiki/Ifc6410#resizing-boot-partition

And then issue:

fastboot flash boot <image>

Installing Gentoo

Unpack the stage3 to your favourite storage; can be a USB harddisk/stick or an MicroSD card. Set the serial in /etc/inittab to:

s0:12345:respawn:/sbin/agetty -L 115200 ttyHSL0 vt100

Drivers

So far I have tested:

  • Ethernet
  • Audio (PulseAudio)
  • Video output (HDMI at 1080p)
  • 3D acceleration (glxgears ; openarena)

Firmware

Place all firmware from http://releases.linaro.org/14.07/ubuntu/ifc6410 into /lib/firmware

Sound

Alsa:

gentoo-ifc ~ # find /usr/share/alsa/ucm/apq8064-tabla-snd-card/
/usr/share/alsa/ucm/apq8064-tabla-snd-card/
/usr/share/alsa/ucm/apq8064-tabla-snd-card/Analog-stereo.conf
/usr/share/alsa/ucm/apq8064-tabla-snd-card/apq8064-tabla-snd-card.conf
/usr/share/alsa/ucm/apq8064-tabla-snd-card/Digital-stereo.conf
  • Pulseaudio autodetects stuff nicely once UCM stuff is set up.

Video (3D)

Video:

In /etc/portage/make.conf;

VIDEO_CARDS="freedreno"
  • xf86-video-freedreno
  • media-libs/mesa[freedreno]

Issues

Network issues

I often got "Corrupt MAC" when using rsync/ssh/scp/sftp. The following "fixed" it, but I cannot comment on the exact effect. (Checksums of large file transfers seem to be OK after this command though. Note that it is not persistent and likely a driver related issue. It happened on all my three IFC6410s.)

ethtool -K eth0 tx off