Skip to content
slonopotamus edited this page Feb 8, 2011 · 6 revisions

Booting

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).

Download bootmenu and unpack it.

There's a bug in bootmenu.conf (it doesn't handle FBMODE option), so apply bootmenu-1.5-2-fbmode.patch to fix it or checkout bootmenu from garage where it is already applied.

You'll need to create /etc/bootmenu.d/gentoo.item with content similar to this:

ITEM_NAME="Gentoo (external SD, partition 3)"
ITEM_ID="gentoo"
ITEM_DEVICE="${EXT_CARD}p3"
ITEM_MODULES="mbcache ext2 softcursor bitblit font fbcon"  # for ext2
#ITEM_MODULES="mbcache jbd ext3 softcursor bitblit font fbcon"  # for ext3
ITEM_FSTYPE="ext2"
ITEM_FSOPTIONS="noatime,ro"
ITEM_FBMODE="auto"
ITEM_LINUXRC="linuxrc"

Then install bootmenu. This procedure (and consequences) are out of scope of this document.

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

wget http://fanoush.wz.cz/maemo/modules-2.2007.50-2-custom.tar.gz
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.

Clone this wiki locally