ivories.org | gentoo on the nokia n810

Installing/Running Gentoo on the Nokia N810

This document is very out of date, and will not be updated. I've destroyed two n810's (though both destructions had nothing to do with Gentoo :) and won't be purchasing any more of them. Please see slonopotamus's EXCELLENT work which has taken this project past points I would never have achieved with functioning hardware ... http://slonopotamus.org/gentoo-on-n8x0


This is a work in progress.
For laughs and historical value,
original attempt documented at: www.ivories.org/blog
Questions/comments are welcome. Email fauxmight@n.c
(see domain name in your browser :)

Current todo list: 2008.12.15

Mon Dec 15 09:34:28 CST 2008

BETTER (read "working") KEYBOARD, FUNCTIONAL WIRELESS, AND A NEW KERNEL

Today's update is credited to the fine folks at #maemo. I *may* have figured these bits out eventually (as in months down the road), but they got me going a good bit quicker on these parts with a couple of pointers. Hats off to you gentlemen.

First off, I've switched from the Maemo kernel to the Linux-OMAP kernel with the N8x0 patches and the stlc45xx open source WLAN module. This allows us freedom from the 2.6.21 kernel -- no more patching for old-ABI/EABI problems, and along with this change, we get a proper FN key (yea for digits).
Ok, so that's what you'll get, now howto:

You shouldn't *need* any of the modules but if you make modules intentionally and don't know how to get them where they need to go, write me, I'll walk you through it. If you want to skip some work, here's my kernel. As usual, I make no promises that it won't run away with your teenage daughter, step on your petunias, or melt your N810 into dead, blue cacodemon eye-goo. Interestingly this new kernel completely ignores the initfs partition though it does not overwrite it. (There was some experimentation not worth describing here that validates that claim.)

Next up, stlc45xx, the open source WLAN module:

Here's my stlc45xx.ko built against the kernel described above. Same lack of guarantee as always. There are several ways you could go about getting this onto your N810 at this point. I had a 2G removable miniSD card I was moving between devices, mounting, unounting and copying. You could set up USB networking (described in the stlc45xx README). You could also flash your kernel back and forth and copy things to the Gentoo partition from Maemo. That's up to you.

3826.arm
You need one more thing to make this work: the 3826.arm firmware file from your maemo install. Even though this is a pain in the neck to go back and find, I really can't post it here for download. I'm fairly confident that it's not freely (as in speechly) redistributable. You'll need to access the original initfs partition of Maemo, and copy usr/lib/hotplug/firmware/3826.arm to /lib/firmware on the Gentoo partition. In a running Maemo install, the 3826.arm file is softlinked in several places, notably /lib/firmware.

modules.dep
Handmake a modules.dep file. There's probably a "righter" way to do this. Please enlighten me.
"echo /lib/modules/`uname -r`/stlc45xx.ko > /lib/modules/`uname -r`/modules.dep"

Modprobe it and play!
You should now be able to successfully insert the kernel module and set things up with ifconfig, iwconfig, wpa_supplicant and so forth. I'm not gonna give you my samples on this one for what should be obvious reasons, but drop me a line if you need some help. I got full WPA support for CCMP (AES) encryption on a hidden SSID and also WPA2-PEAP-MSCHAPv2 radius to work with wpa_supplicant. I did have to emerge wpa_supplicant and wireless tools from my Gentoo chroot inside Maemo.

Next orders of business


Sat Dec 13 16:34:55 CDT 2008

This is a complete restart of the Gentoo on n810 project that I originally started here. It's much simpler than all that, so here we go:

Starting from Diablo Maemo install:
Partition and format AT LEAST the 2G internal MMC and 1 external MMC. (You'll need the second 2G for swap space). I did all my beginning compiling ON the n810. Cross-compiling WITH portage was just a little too much to swallow at one time, but if you want to go for that, here's some instructions from gentoo.

I used a cfdisk and an mke2fs I compiled in scratchbox. You can use what you like, but here's my binaries if you want them. Oh, I needed the tune2fs that's there, also because I wanted to set auto-fsck to never. (-i 0 and -c 0) Portage tree is giant set of files and default ext2 for a 2G filesystem didn't have enough inodes, so when I mke2fs'd, I invoked it with "-i 4096". That allowed a sufficient number of files on a 2G stick for portage tree. In general, these methods work. I really, really recommend getting a larger SD card to do this kind of foolishness, but it CAN work like this.

Okay, now if you're using the Maemo kernel, as opposed to the linux-omap patches, (I'm trying these right now, but don't have info to report yet) you'll NEED to patch the kernel and flash it. You'll keep your Maemo file-system intact, and Maemo will still be happy with the modified kernel. The trouble is Gentoo ARM stages are old-ABI, and the Maemo (Diablo) kernel is 2.6.21. This kernel does NOT properly handle non-EABI binaries without patching. You can:

  1. Patch the Maemo sources in scratchbox (I did)
  2. Get linux-omap kernel working (I will ... eventually)
  3. Wait for Maemo to get a post-2.6.25 (upstream) kernel

If you decide to go for method 1, some info is here on Debian's bug page. Basically, the kernel *THINKS* it's handling non-EABI binaries correctly, and in many cases it does. However, in several instances - notably any use of the 'find' command, it barfs, and badly. The patch is included in that bug page noted above. It's really not a Debian bug; it's a kernel issue. Unfortunately, since the Maemo kernel is already so heavily patched, I found I had to hand-edit the kernel sources while referring to this patch. At the end, though I flashed that kernel back onto the n810 (flasher -k /path/to/your/scratchbox/compiled/kernel) and it worked (for certain definitions of "worked"). Here's someinformation on Maemo kernel hacking.

If you're daring (and you trust I'm not trying to blow up your device, which I will make no promise is or is not the case), you can just use my kernel config. It has some other very small modifications to it: ext2/ext3/nfsv3-client support are all built in rather than modules, and I've got my frame-buffer console (CONFIG_FRAMEBUFFER_CONSOLE=y) so I can see things load (also there's a Maemo bit that normally overrides the frame buffer that I turned OFF: CONFIG_FB_OMAP_MANUAL_UPDATE). I *think* those are the only mods, but again, will not promise.

You'll next need the bootmenu installer from the Deblet Project. I used this installer, and after it completed, I ran the "Install Bootmenu" from the Utilities folder. (I think... The 810 I did this on has a fracture screen and is almost completely black. Touch screen works, but display is pretty much gone. Everything that I *can* do from ssh, I do. I have a second n810, but that's my voip phone ... and my only phone, at the moment ... but I've got a number throught ipkall, which is awesome; I digress.)
Once I had bootmenu installed, I made a /etc/bootmenu.d directory and then placed this entry into the bootmenu.d subdir. If you put your gentoo files in some place other than the first partition on the internal SD card, you'll have to modify that .item file.

Ok, now you've got things set up, but you don't have the gentoo files yet, so let's do that: get the tarball for stage3 armv4l and one for a latest portage snapshot. I put those on an nfs shared mount, but I think you'll have the space for them on the ext2 fs. You WILL need to delete them ASAP if you do that. There will not be enough space to build gcc later on.

Back in Maemo (outside the gentoo chroot), run refresh_bootmenu.d and say "yes" to adding the gentoo item. Let it reboot. Tinker in a native gentoo on your n810. This is a VERY primitive system, I know, and it needs alot of work to be useable. We'll get there :)

Things I plan to do and/or need to learn more about:

I whipped this "howto" up very quickly after talking with some folks at #maemo. It seemed there was more interest in the project than I expected. If there are errors or ommissions, I will try to fix it up.
Feel free to send me any questions/comments: fauxmight@n.c (see domain in address bar). I'm also *occasionally* on #maemo on freenode (either christendoc or fauxmight).