Gentoo Installation on the Bifferboard

Disclaimer: May contain lapses in procedure and is definitely a work in progress.

Many optimizations can take place on top of these instructions. The whole point of this document is to get people to the point where they can get an easy and just plain working Gentoo installation. The user must have a RS232 interface setup for this installation to be of value. If you dont, you'll need to know how to setup a SSH daemon in Gentoo's boot configuration.

For the kernel, you can use the bzImage attached below. If you need custom hardware or features such as Iptables, you need to recompile the kernel of choice. Although gentoo uses kernels different than 2.6.27.7 in its kernel sources, so far I have had no problems with this. I can post further directions later if anyone needs them on how to install iptables or how I installed my rt73 wifi adapter.

Instructions:

**Get the Gentoo minimal install X86 cd image and burn this image to a CD. The most reasonable way to get this CD is through bittorrent (Try isohunt.com). Gentoo.org may also host this CD image. The file should be less than 100Megs.

**This step may be unneeded due to the fact that a Gentoo installation

consists of just downloading a stage and portage, then chrooting into

the new system.

Boot your PC from this CD. After some time you should be looking at a

command line.

Partition (fdisk) and format (mke2fs) your usb like so:

Keep in mind you will need a fairly large USB stick. 2 Gigs is too

small, I would recommend at least 4 gigs.

/dev/sda1 == SWAP (128MB), /dev/sda2 == ext3

**A good reference from here on out is the Gentoo Handbook..

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1

Now lets install Gentoo onto the USB. Mount your new ext3 filesystem

like so:

#mount /dev/sda2 /mnt/gentoo

#cd /mnt/gentoo

Now download the stage3 file and Portage to this partition. You can

see how to do this in the Gentoo handbook. An example would be:

#wget http://www.gtlib.gatech.edu/pub/gentoo/snapshots/portage-latest.tar.bz2

#wget http://www.gtlib.gatech.edu/pub/gentoo/releases/x86/2008.0/stages/sta...

Now extract these files:

#tar xvjpf stage3-*.tar.bz2

#tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

These commands obviously will take a while (probably 5-10 minutes)

now run:

#mirrorselect -i -o >> /mnt/gentoo/etc/make.conf

and select a mirror or mirrors of choice. This is the mirror in which

all of your portage installations will derive. Portage (for beginners)

is basically a package installer. Assuming you wanted firefox you

would just type 'emerge firefox'

For this I recommend HTTP GeorgiaTech. (I live in southern California

and this mirror has always been fast and stable for me. If you live

across the pond your mileage may vary)

Now lets chroot into your USB installation: All of this is straight

out of the Gentoo handbook.

#cp -L /etc/resolv.conf /mnt/gentoo/etc/

#mount -t proc none /mnt/gentoo/proc

#mount -o bind /dev /mnt/gentoo/dev

#chroot /mnt/gentoo /bin/bash

#env-update

#source /etc/profile

#export PS1="(chroot) $PS1"

So now you're operating inside of your USB's environment. This means

you can emerge what you want/need on your Bifferboard installation.

First things first- You need to update and sync your portage tree:

#emerge --sync

After this process is complete, it will may ask you to update portage

by typing 'emerge portage'. Go ahead and do that if it requires it.

Now, lets tweak Gentoo so it will work on the Bifferboard.

First, you'll need dhcpcd so your ethernet connection will work

easily.

#emerge dhcpcd

#nano /etc/conf.d/clock

If you want to, you can also set your timezone. In my case, since I live in California mine looks like this.

TIMEZONE="PST8PDT"

For more details see:

http://sites.google.com/site/bifferboard/Home/howto/set-correct-time

Now lets TRY and fix the hwclock problem. This fix is still kind of sketchy and if anyone runs into problems, post them to the forum.

The problem is caused by the Bifferboard's lack of a stable internal clock which causes error messages. Without this change you will

see: "/etc/conf.d has a modification time in the future!!" errors.Another problem that occurs is the endless fsck loops.

#nano /etc/init.d/checkroot

Needs to be modified in two places.

1.

    1. start() {

    2. local retval=0

    3. ## MODIFICATION

    4. date -s "$(/sbin/dumpe2fs -h /dev/sda2 | grep "Last mount time:" | sed s/"Last mount time: *"//)"

    5. # END OF MODIFICATION

    6. if [[ ! -f /fastboot && -z ${CDBOOT} ]] \

2. (at the very bottom)

    1. # Remove stale backups

    2. rm -f /etc/mtab~ /etc/mtab~~

    3. fi

    4. ## MODIFICATION

    5. touch /etc/conf.d/*

    6. touch /etc/rc.conf

    7. touch /etc/init.d/*

    8. ## END OF MODIFICATION

    9. }

Now lets configure your filesystem table so Gentoo doesnt try to load

partitions you don't have.

#nano /etc/fstab

Your file should look like this. Note /dev/BOOT is commented out

#/dev/BOOT /boot ext2 noauto,noatime 1 2

/dev/sda2 / ext3 noatime 0 1

/dev/sda1 none swap sw 0 0

also comment out

#/dev/cdrom

#/dev/fd0

Now lets add your serial line so you can use your serial console to

access the command line.

#nano /etc/inittab

Make sure it looks like this under SERIAL CONSOLES

# SERIAL CONSOLES

s1:12345:respawn:/sbin/agetty 115200 ttyS0 vt100

You can also comment out the following lines:

# TERMINALS

#c1:12345:respawn:/sbin/agetty 38400 tty1 linux

#c2:2345:respawn:/sbin/agetty 38400 tty2 linux

#c3:2345:respawn:/sbin/agetty 38400 tty3 linux

#c4:2345:respawn:/sbin/agetty 38400 tty4 linux

#c5:2345:respawn:/sbin/agetty 38400 tty5 linux

#c6:2345:respawn:/sbin/agetty 38400 tty6 linux

Make sure securetty has ttyS0

#cat /etc/securetty

if it doesnt have ttyS0, nano it in.

Lets change the root password so you dont get locked out when you try

and boot the bifferboard.

#passwd

Copy Biffero's kernel module additions onto your Gentoo installation.

You can find these files attached to the Slackware installation

directions.

#cp -r /your/directory/here/2.6.27.7-biff /mnt/gentoo/lib/modules

This is it, go ahead and cd all the way out of /mnt/gentoo and umount

the USB

#cd /

#umount /mnt/gentoo

Plug your usb into the Bifferboard and boot it up!

Once somebody completes this, can you please upload the entirety of

your USB ext3 partition somewhere? It will be a huge file though,

thats the problem.

Further Notes:

1. If you want to run a custom script on boot, add it to /etc/conf.d/

local.start

2. A hwclock skew issue still exists, I plan on fixing it and adding the details to this page once I fix it.

(8-8-2009)

3. Modified /etc/init.d/checkroot. It seems this has at least half solved the clock problem. (8-9-2009).

3. Future additions to this page may include: A Beginners Guide to adding hardware support to kernel and creating modules

Written by RonRaleb on 8-8-2009

Credits to Bifferos for the attachments