Archive:Raspberry Pi Gentoo Linux Installation

From JMK Wiki
Jump to: navigation, search

create partitions

fdisk /dev/mmcblk0

n, p, 1, <enter>, +128M, t, c, a, 1
n, p, 2, <enter>, <enter>, t, 2, 8e
p
w

partitions

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      264191      131072    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          264192    15654911     7695360   8e  Linux LVM

create pv

pvcreate /dev/mmcblk0p2

create vg

vgcreate rpi /dev/mmcblk0p2

create lvs

lvcreate -L384M -nswap /dev/rpi
lvcreate -l100%FREE -ngentoo /dev/rpi

vgs

  VG         #PV #LV #SN Attr   VSize   VFree
  rpi          1   2   0 wz--n-   7.34g     0

lvs

  LV        VG         Attr     LSize   Pool Origin Data%  Move Log Copy%  Convert
  gentoo    rpi        -wi-a---   6.96g
  swap      rpi        -wi-a--- 384.00m

create filesystems

mkfs.vfat -nboot /dev/mmcblk0p1
mkswap -Lswap /dev/rpi/swap
mkfs.ext4 -Lgentoo /dev/rpi/gentoo

create and mount mountpoints

mkdir -p /mnt/gentoo
mount /dev/rpi/gentoo /mnt/gentoo
mkdir -p /mnt/gentoo/boot
mount /dev/mmcblk0p1 /mnt/gentoo/boot

stage3 check for latest stage3 at http://gentoo.osuosl.org/releases/arm/autobuilds/current-stage3-armv6j_hardfp/

cd /tmp/
wget -O stage3-armv6j_hardfp.tar.bz2 http://gentoo.osuosl.org/releases/arm/autobuilds/current-stage3-armv6j_hardfp/stage3-armv6j_hardfp-20131128.tar.bz2
tar xjvpf stage3-armv6j_hardfp.tar.bz2 -C /mnt/gentoo/

portage

cd /tmp/
wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
tar xjvpf portage-latest.tar.bz2 -C /mnt/gentoo/usr

firmware

mkdir -p /mnt/gentoo/usr/local/src/rpi
cd /mnt/gentoo/usr/local/src/rpi
git clone --depth 1 git://github.com/raspberrypi/firmware/
cp -r /mnt/gentoo/firmware/boot/* /mnt/gentoo/boot/
cp -r /mnt/gentoo/firmware/modules /mnt/gentoo/lib/

kernel

cd /mnt/gentoo/usr/local/src/rpi
git clone --depth 1 git://github.com/raspberrypi/linux/
cd /mnt/gentoo/usr/local/src/rpi/linux

crossdev

emerge -av sys-devel/crossdev

configure crossdev (see http://www.mobileapes.com/gentoo/crossdev#TOC-Convert-etc-portage-package.keywords-to-a-directory.)

crossdev -S -v -t armv6j-hardfloat-linux-gnueabi
crossdev -S -v -oO /usr/local/portage/ --g 4.8.1 -t armv6j-hardfloat-linux-gnueabi

configure kernel (replace 3.10.9999 with your version of the kernel)

cd /usr/src/src/rpi/linux
make ARCH=arm bcmrpi_defconfig
make ARCH=arm CROSS_COMPILE=/usr/bin/armv6j-hardfloat-linux-gnueabi- menuconfig

kernel configuration

General setup  --->
   [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
       [*] Support initial ramdisks compressed using gzip (NEW)
Device Drivers  --->
   Multiple devices driver support (RAID and LVM)  --->
       <*> Device mapper support 
           <*> Crypt target support
           <*> Snapshot target
           <*> Mirror target
       <*> Multipath target
           <*> I/O Path Selector based on the number of in-flight I/Os
           <*> I/O Path Selector based on the service time

compile the kernel, copy the modules and kernel

make ARCH=arm CROSS_COMPILE=/usr/bin/armv6j-hardfloat-linux-gnueabi- -j3
make ARCH=arm CROSS_COMPILE=/usr/bin/armv6j-hardfloat-linux-gnueabi- modules_install INSTALL_MOD_PATH=/mnt/gentoo
cp arch/arm/boot/zImage /mnt/gentoo/boot/linux-3.10.27-raspberrypi-jmk+

cmdline.txt config.txt initrd.cpio.gz menu.lst

/mnt/gentoo/etc/fstab

# <fs>				<mountpoint>		<type>		<opts>											<dump/pass>
/dev/mmcblk0p1			/boot			auto		defaults,noatime,noauto									1	2
/dev/rpi/swap			none			swap		sw,noauto										0	0
/dev/rpi/gentoo			/			ext4		defaults,noatime,noauto									0	1

/mnt/gentoo/etc/shadow

root:*:10770:0:::::
<pre>

remove star

root::10770:0::::: </pre>

/mnt/gentoo/etc/conf.d/hostname

hostame="rpi"

/mnt/gentoo/etc/conf.d/net (dhcp)

# eth0
config_eth0="dhcp"

/mnt/gentoo/etc/conf.d/net (static)

# eth0
config_eth0="192.168.0.30/24
             2a01:368:e10d::30/64"
routes_eth0="default via 192.168.0.1
             default via 2a01:368:e10d::1"

/mnt/gentoo/etc/init.d/net.eth0

cd /mnt/gentoo/etc/init.d/
ln -s net.lo net.eth0

/mnt/gentoo/etc/resolv.conf

search jmk.hu
nameserver 192.168.0.1

/mnt/gentoo/etc/conf.d/modules

modules="ipv6 snd-bcm2835"

INIT: Id "s0" respawning too fast

nano -w /mnt/gentoo/etc/inittab
#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100

set timezone

cp /mnt/gentoo/usr/share/zoneinfo/Europe/Budapest /mnt/gentoo/etc/localtime
echo "Europe/Budapest" > /mnt/gentoo/etc/timezone

secure ssh daemon

ServerKeyBits 4321
PermitRootLogin no
PermitEmptyPasswords no
AllowUsers cyla

umount

umount /mnt/gentoo/boot 
umount /mnt/gentoo

boot login as root

set up root password

passwd

clock skew

rc-update

disable hwclock, add swclock

rc-update del hwclock boot
rc-update add swclock boot

add a new group and user

groupadd -g 1000 cyla
useradd -d /home/cyla -g 1000 -G cyla,wheel -m -s /bin/bash -u 1000 cyla
passwd cyla

start sshd

/etc/init.d/sshd start
rc-update add sshd default

goto Raspberry Pi Gentoo Distcc Setup

upddate portage repository

emerge --sync

install screen

emerge -av app-misc/screen

emerge some usefull stuff

emerge -av sys-fs/lvm2 app-admin/syslog-ng sys-process/vixie-cron app-portage/layman dev-vcs/subversion dev-vcs/git app-portage/eix app-misc/mc net-analyzer/munin app-portage/gentoolkit

create local portdir

mkdir -p /usr/local/portage

update layman.conf

overlays  : http://www.gentoo.org/proj/en/overlays/repositories.xml
            http://overlay.jmk.hu/repositories.xml

add jmk-layout to layman

layman -a jmk-overlay

update make.conf

PORTDIR_OVERLAY="/usr/local/portage"
source /var/lib/layman/make.conf"

start services

rc-config start lvm
rc-config start syslog-ng
rc-config start vixie-cron
rc-config start munin-node

set services to start at boot

rc-update add lvm boot
rc-update add syslog-ng default
rc-update add vixie-cron default
rc-update add munin-node default

copy some settings and ssh keys

cd ~
scp -r thelma:/home/cyla/.cache ./.cache
scp -r thelma:/home/cyla/.config ./.config
scp -r thelma:/home/cyla/.local ./.local
scp -r thelma:/home/cyla/.ssh ./.ssh

make sure that the ssh keys are not world readable

set encoding to utf-8

nano /etc/locale.gen
locale-gen
echo "LANG=\"en_US.UTF-8\"" > /etc/env.d/02locale



raspberry userland

mkdir -p /usr/local/src/rpi
cd /usr/local/src/rpi
git clone --depth 1 git://github.com/raspberrypi/userland/
cd /usr/local/src/rpi/userland
./buildme
echo "/opt/vc/lib" > /etc/ld.so.conf.d/06vmcs.conf
ldconfig




update the kernel

emerge -av =sys-kernel/raspberrypi-sources-3.10.9999
cd /usr/src/linux
zcat /proc/config > .config
make CC="distcc armv6j-hardfloat-linux-gnueabi-gcc" -j4
make CC="distcc armv6j-hardfloat-linux-gnueabi-gcc" -j4 modules_install
mount /boot
cp arch/arm/boot/zImage /boot/linux-3.10.27-raspberrypi-jmk+






/usr/local/portage

mkdir /usr/local/portage/metadata/
echo 'masters = gentoo' > /usr/local/portage/metadata/layout.conf

omxplayer

Get .pc files from https://git.collabora.com/cgit/user/pq/android-pc-files.git/tree/pkgconfig?h=raspberrypi move them into /opt/vc/lib/pkgconfig set PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig

/usr/local/portage/media-video/omxplayer

scp -r cyla@mir:/mnt/nfs/rpi-gentoo/usr/local/portage/media-video/omxplayer/* /usr/local/portage/media-video/omxplayer/

packages.keywords

media-video/ffmpeg			~arm
media-video/omxplayer			**

packages.unmask

media-video/ffmpeg

emerge

emerge -av omxplayer