Raspberry Pi

From Void Linux Wiki
Jump to: navigation, search

rootfs-install

Grab the latest rootfs for your device from http://repo.voidlinux.eu/live/current/

Make sure to check that sha256 is correct. The sha256 hash is stored in the sha256sums.txt file.

Preparing the SD card

The SD card must have at least 2 partitions, one as FAT (with partition type 0c!) for /boot and another one as ext4/f2fs for /; let's begin preparing the partitions and mounting them in a directory:

$ parted /dev/mmcblk0 <- change this to match your SD card

# Create the FAT partition of 256MB and make it bootable
(parted) mktable msdos
(parted) mkpart primary fat32 2048s 256MB
(parted) toggle 1 boot

# Create the rootfs partition until end of device
(parted) mkpart primary ext4 256MB -1
(parted) quit

Now let's create the filesystems in the SD card:

 $ mkfs.vfat /dev/mmcblk0p1 <- change this to match your SD card and FAT32 partition
 $ mkfs.ext4 -O ^has_journal /dev/mmcblk0p2 <- change this to match your SD card and ext4 partition

The -O ^has_journal option disables journaling on ext4 partition. It'll extend the life of your drive (usually Flash drives).

Preparing target rootfs directory

 $ mkdir rootfs
 # mount /dev/mmcblk0p2 rootfs/
 # mkdir rootfs/boot
 # mount /dev/mmcblk0p1 rootfs/boot

Unpack the rootfs into the target rootfs directory and sync to make sure files are written to storage:

 # tar xvfJp void-rpi-rootfs-latest.tar.xz -C rootfs
 # sync
Do not forget to unpack the rootfs as root and with the -p flag to set appropiate permissions.

The /boot partition must also be added to /etc/fstab:

 # echo '/dev/mmcblk0p1 /boot vfat defaults 0 0' >> rootfs/etc/fstab

Umount the SD card filesystems from target rootfs directory.

You can tweak kernel boot cmdline arguments in the rootfs/boot/cmdline.txt file.

Insert the SD card and test the Raspberry PI boots correctly, the root password is voidlinux.

First Boot

Set the system time

Before it is possible to install or upgrade packages (ex:xbps-install -Su), it is necessary to set the clock. The Raspberry Pi does not have a battery backed clock so you must set the time manually or you will see HTTPS certificate errors.

# date
Thu Jan  1 00:00:36 GMT 1970
# date -s "Fri Jan 13 11:19:58 PST 2017"

(note that time zones are recognized)

Network Time Protocol

Now that the time is set, you can install and enable NTP.

# xbps-install ntpd
# sv start ntpd

Note: To verify that ntpd is enabled on boot, check that /etc/runit/runsvdir/default/ntpd exists.

X11

At the very least this is the list of required packages:

# xbps-install -Sy xorg-minimal xf86-video-fbturbo

To install all X client applications:

# xbps-install -Sy xorg-apps

To install all X font packages:

# xbps-install -Sy xorg-fonts

As final step make sure the user running X is part of the groups audio and video.

ioquake3

Install the package via xbps-install(8):

# xbps-install -Sy ioquake-rpi

Copy .pk3 data files from original quake3 game or demo:

# For the system:
cp /path/quake3/*.pk3 /opt/ioquake3-rpi/baseq3/

# For just a normal user:
cp /path/quake3/*.pk3 ~/.q3a/baseq3/

If you do not have X installed just run SDL with the framebuffer video driver:

 $ SDL_VIDEODRIVER=fbcon SDL_NOMOUSE=1 quake3

Audio

To get the soundchip to work, add dtparam=audio=on to /boot/config.txt

Serial

Enable serial console logins

 # mkdir ~/rootfs
 # mount /dev/sdX2 ~/rootfs
 # ln -s /etc/sv/agetty-ttyAMA0 ~/rootfs/etc/runit/runsvdir/default
 # umount ~/rootfs

Notes:

  • See /boot/cmdline.txt for start-up configuration of serial port (device and baud)
  • See /etc/securetty for interfaces that allow root login, ttyAMA0 should already be listed.