Marat Radchenko edited this page Jan 8, 2014 · 6 revisions


I assume you know how to partition and format your SD card. If not, Gentoo isn't likely a distro of your choice.

So, create a separate partition 2GB at least (mmcblk1p3 in my case) for Gentoo and a separate one for swap (I used mmcblk1p2).

Install bootmenu (you can also install later bootmenu versions, but it is out of scope of this document):

git clone
cd bootmenu
git checkout 5da6d47108e99cff5b52540c103df9602b9b109d -b tmp

Create /etc/bootmenu.d/gentoo.item with content similar to this:

ITEM_NAME="Gentoo (external SD, partition 3)"
ITEM_MODULES="mbcache ext2 softcursor bitblit font fbcon"  # for ext2
#ITEM_MODULES="mbcache jbd ext3 softcursor bitblit font fbcon"  # for ext3

NOTE: You may need to symlink /usr/bin/evkey to /usr/sbin/evkey in the initfs for this to work!

Download & install framebuffer console modules

tar -xvzf modules-2.2007.50-2-custom.tar.gz
mount -o rw,remount /mnt/initfs
cp drivers/video/console/* /mnt/initfs/lib/modules/`uname -r`/
mount -o ro,remount /mnt/initfs

Alternatively, you could build them yourself or use custom kernel with framebuffer builtin. Anyway, this is also out of scope.

Now format your Gentoo partition (ext3 can cause problems on SD cards, so ext2 is recommended) & swap:

mkfs.ext2 /dev/mmcblk1p3
mkswap /dev/mmcblk1p2

Create a mountpoint:

mkdir /mnt/gentoo

Load kernel modules if required:

insmod /mnt/initfs/lib/modules/`uname -r`/mbcache.ko
insmod /mnt/initfs/lib/modules/`uname -r`/ext2.ko
#insmod /mnt/initfs/lib/modules/`uname -r`/jbd.ko
#insmod /mnt/initfs/lib/modules/`uname -r`/ext3.ko

Mount Gentoo partition:

mount -t ext3 -o noatime /dev/mmcblk1p3 /mnt/gentoo/

Untar stage3 tarball (download it first from Resources section, if you haven't done that already):

tar -xvjpf stage3-armv6j*.tar.bz2 -C /mnt/gentoo

Create some useful devices (will be needed later, when booting):

cp -a /dev/null /mnt/gentoo/dev/
cp -a /dev/console /mnt/gentoo/dev/

Prepare supporting stuff & chroot into Gentoo:

mount -t proc proc /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
cp -L /etc/resolv.conf /mnt/gentoo/etc/
chroot /mnt/gentoo/ /bin/bash
env-update && source /etc/profile

OK, you're inside Gentoo (only chroot yet, but wait a bit). No more changes will be performed outside of chroot after this point.

Set root password by running passwd.

Edit /etc/fstab: change ROOT to /dev/mmcblk1p3, SWAP to /dev/mmcblk1p2. Set pass to 0 for root fs (this is required because of some bug in stock kernel that prevents remounting of root partition for performing fsck) or, alternatively, install baselayout-2.

Install nit-bootmenu-compat from n8x0 overlay.

Run rc-update add nit-boot-basics boot.

Edit /etc/inittab and comment out s0 serial console.

Hard-mask >sys-fs/udev-141.9999 and install the now-latest available; newer versions do not work on kernels as old as 2.6.21 (Maemo Diablo's kernel).

That's it, reboot your tablet and choose Gentoo bootmenu item. If you're lucky, it'll boot.