Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Draft Funtoo Install on RPI/Configure

From Funtoo
Jump to navigation Jump to search

Configure Your System

There are two ways to approach configuration. Here we alter files and symlinks in $SYSROOT/etc directly from the operating system we are working under to do the install. This is most flexible. Further configuration using Funtoo tools can be done on the pi itself once it is booted.

Alternatively, we could also chroot into $SYSROOT using QEMU with translation of arm binaries in the stage3 to the architecture of the machine you are working to do the install. Then one can install packages, edit files and use rc-update directly to set up services using Funtoo provided services directly with the stage3.

Set Up Mount Points

Alter $SYSROOT/etc/fstab as follows. We remove the swap, and alter the storage device name and partition file types. We also remove the /dev/cdrom device.

   Warning

No swap is configured. If you need to control out of memory conditions (e.g. when compiling chromium) you need to configure a swap parition or use No results. A partition must also be created and formatted on the device (probably on the sd card, but usb block memory devices can be used if necessary).

   $SYSROOT/etc/fstab
/dev/mmcblk0p1  /boot   vfat    noauto,noatime  1 2
/dev/mmcblk0p2  /       ext4    noatime         0 1

Most of the following examples use No results to present the simple subsitutions in a simple form.

root # sed -i "s/\/dev\/sda1.*/\/dev\/mmcblk0p1 \/boot vfat defaults 0 2/" ${SYSROOT}/etc/fstab
root # sed -i "s/\/dev\/sda2.*//" ${SYSROOT}/etc/fstab
root # sed -i "s/\/dev\/sda3.*/\/dev\/mmcblk0p2 \/ ext4  defaults 0 1/" ${SYSROOT}/etc/fstab
root # sed -i "s/\#\/dev\/cdrom.*//" ${SYSROOT}/etc/fstab

Set Up Root Password

Here we interactively add a root password to log in with to $SYSROOT/etc/shadow.

root # sed -i "s|root\:\*|root\:`(openssl passwd -1)`|" $SYSROOT/etc/shadow

Set Up Networking

We add dhcpcd as a default runlevel service.

root # ln -sf /etc/init.d/dhcpcd ${SYSROOT}/etc/runlevels/default

Set Up SSH Access

If you want to ssh to the board as root, you need to allow it explicitly and we add sshd as a default runlevel service.

root # echo "PermitRootLogin yes" >> ${SYSROOT}/etc/ssh/sshd_config
root # ln -sf /etc/init.d/sshd ${SYSROOT}/etc/runlevels/default~

Set Up the Software Clock

Let's set up the software clock. This is Raspberry Pi specific, and due to its lack of a stock RTC chipset. This has ramifications for maintaining the correct time via a pacakge like No results, net-misc/ntp. or net-misc/chrony. A simple solution is using No results to set the time at startup.

root # ln -sf /etc/init.d/swclock ${SYSROOT}/etc/runlevels/boot
root # rm ${SYSROOT}/etc/runlevels/boot/hwclock
root # mkdir -p ${SYSROOT}/lib/rc/cache
root # touch ${SYSROOT}/lib/rc/cache/shutdowntime

Disable Serial Console Access

Let's prevent serial consoles from spawning. If you have a need for this, you'll be able to set it up yourself.

root # sed -i "s/s0\:.*/\#&/" ${SYSROOT}/etc/inittab

Link to Accelerated Video Libraries

You must add /opt/vc/lib to $LD_LIBRARY_PATH in the shell, or use the env-update functionality of Funtoo if you want to link against these firmware libraries. This is critical if you want to do any accelerated graphics or gpu level work. Here we add an entry to the appropriate configuration file which env-update will pick up whenever we source /etc/profile.

root # echo "LDPATH=\"/opt/vc/lib\"" > ${SYSROOT}/etc/env.d/99vc

If you want to try building native vc4 acceleration with media-libs/mesa you must unmask the appropriate USE flags at the profile level and VIDEO_CARDS="vc4" in make.conf.

root # cat > /etc/portage/profile/portage.use.mask << EOF
root ##i##media-libs/mesa -video_cards_vc4~
root ##i##x11-libs/libdrm -video_cards_vc4
root ##i##EOF

If /var/log/Xorg.0.log is flooded with messages of the following type:

(EE) modeset(0): Failed to get GBM bo for flip to new front.
(EE) modeset(0): present flip failed

the workaround is to disable the PageFlip parameter for the modesetting driver.

To do this, as a root user create a file 20-displaylink.conf under /usr/share/X11/xorg.conf.d/ with the following content:~

   $SYSROOT/usr/share/X11/xorg.conf.d/20-displaylink.conf
Section "Device"
  Identifier "DisplayLink"
  Driver "modesetting"
  Option "PageFlip" "false"
EndSection~~

Configure the Boot Parameters

root # cat > ${SYSROOT}/boot/cmdline.txt << EOF
root ##i## dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
root ##i## EOF

Next: Install the Firmware