View on GitHub

1.2 Gentoo - Setup of chroot

Download this project as a .zip file Download this project as a tar.gz file

1.2 Gentoo - Setup of chroot

Overview

Next we're going to set things up within the chroot
From this point onwards it's assumed that your already inside the chroot within /mnt/gentoo

General Configuration

Setup the Timezone

Lets setup our local timezone
I'm using British time here

ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/Europe/London /etc/localtime
echo "Europe/London" > /etc/timezone
date

Setup the Gentoo profile

To list all gentoo profiles available
I'm already using the default one which is default/linux/arm/13.0/armv7a

eselect profile list

Setup the Hostname

Lets setup the hostname

nano -w /etc/conf.d/hostname
<change the host name in the config and save>

Setting up fstab

To setup fstab (make sure you in the chroot)
Because I'm using a USB disk here

nano -w /etc/fstab

/dev/mmcblk0p5          /boot           vfat            defaults        0 2
/dev/sda3               /               ext4            noatime         0 1
/dev/sda2               none            swap            sw              0 0

Set the root password

Within the chroot we want to setup the root password

passwd
<enter a new password for root>

Setup keymaps

In my case I want a british keymap so we edit /etc/conf.d/keymaps

ls /usr/share/keymaps/i386/qwerty
nano -w /etc/conf.d/keymaps

<set keymap="uk">

Inittab Setup

Edit the /etc/inittab file in the gentoo install
comment out the line under Serial Consoles

nano -w /etc/inittab

#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100

Setting up make.conf

For gcc 4.8 we need to change the CFLAGS setting within /etc/portage/make.conf

There may be better cflag settings for the rpi2, but I think these are the best ones so far

nano -w /etc/portage/make.conf

CFLAGS="-O2 -pipe -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
CXXFLAGS="${CFLAGS}"

Setup sys logger and cron deamon

Lets install some packages and set them to run at boot

emerge syslog-ng
emerge vixie-cron
emerge logrotate
rc-update add syslog-ng default
rc-update add vixie-cron default

Setup networking

Install Networking Packages

Since we're going to want dhcp / wireless support later on

emerge dhcpcd
emerge wireless-tools
emerge wpa_supplicant
emerge linux-firmware
rc-update add sshd default

Wpa Supplicant Config

If your using wpa for wireless (most people do) we first need to tell the setup to use wpa_supplicant in preference

nano -w /etc/conf.d/net

# Prefer wpa_supplicant over wireless-tools
modules="wpa_supplicant"

Now for the wpa_supplicant.conf file

cp /usr/share/doc/wpa_supplicant-2.4-r3/wpa_supplicant.conf.bz2 /etc/wpa_supplicant
cd /etc/wpa_supplicant/
bzip2 -d wpa_supplicant.conf.bz2
nano -w wpa_supplicant.conf

Comment out all the network sections at the bottom except for one, and use that to connect
see this Link for an example setup

WLan Symbolic Link

Lets create a symbolic link for the network

cd /etc/init.d
ln -s net.lo net.wlan0
rc-update add net.wlan0 default

Other Commands

some rebooting and fiddling may be required to get this to work later on
Once your booted directly into gentoo try the following if your having problems

iwconfig
ifconfig wlan0 up