Skip to content

Installing on Alpine Linux

Alejandro Zeise edited this page Feb 11, 2021 · 13 revisions

In Progress

0. Enable Community repository

Open /etc/apk/repositories and uncomment the community repository lines. Make sure it's not the edge ones, just the normal community ones.

Then

apk update
apk upgrade

0a. Expand Filesystem and create swapfile

If you're not running in diskless mode then skip to the next step. Since diskless mode leaves us with running the system from RAM, we'll need to temporarily expand the filesystem and create a swapfile so we have enough memory to complete compiling and installing packages.

Create the swapfile. Assuming your drive that holds apk-cache and lbu-data is at /media/sda1, change this to whatever is specific to your installation

dd if=/dev/zero of=/media/sda1/swapfile bs=1M count=784
mkswap /media/sda1/swapfile
swapon /media/sda1/swapfile

If your root filesystem tmpfs is less than 480MB, Expand filesystem to 480MB (this is temporary until next reboot):

mount -o remount,size=480M /

1. Install Build Dependencies

The following dependencies are required for building bluealsa.

apk add fdk-aac fdk-aac-dev bluez-dev alsa-lib-dev dbus-dev glib-dev sbc-dev git build-base gcc autoconf automake libtool

2. Compile Bluealsa

A more in-depth instruction page can be seen here. However, for our purposes, this will suffice:

git clone https://github.com/Arkq/bluez-alsa
cd bluez-alsa
autoreconf --install --force
./configure --enable-ofono --enable-aac
make
make install

If you're running diskless mode you'll need to tell lbu about bluealsa and then commit those changes. You can do it like this:

lbu inc /usr/bin/bluealsa
lbu inc /usr/bin/bluealsa-aplay
lbu inc /usr/lib/alsa-lib

3a. Remove unnecessary packages

We don't need the following packages anymore so we can remove them:

apk del autoconf automake 

3b. Install Runtime Dependencies

apk add python3 python3-dev py3-pip alsa-utils ofono dbus dbus-openrc dbus-libs bluez bluez-libs alsa-lib alsa-tools glib sbc cairo-dev gobject-introspection gobject-introspection-dev

4. Install RaspberryLink

Install raspberrylink using Pip. No-binary is needed due to wheel distributions not supporting absolute paths for data files:

pip3 install --no-binary :all: raspberrylink

4a. Include directories to lbu

If you're not running in diskless mode then skip to the next step.

Include the following:

lbu inc /usr/lib/python3.8/site-packages
lbu inc /opt/raspberrylink
lbu inc /usr/bin/raspilink-server
lbu inc /usr/bin/raspilink-agent

5. Remove Unnecessary packages

apk del build-base gcc alsa-lib-dev bluez-dev dbus-dev git glib-dev gobject-introspection-dev python3-dev sbc-dev

6. Copy and enable OpenRC services

First copy the OpenRC script from /opt/raspberrylink:

cp /opt/raspberrylink/service-files/raspberrylink /etc/init.d/
chmod +x /etc/init.d/raspberrylink

Then enable the following:

rc-update add bluetooth
rc-update add ofono
rc-update add dbus
rc-update add raspberrylink

7. Final Touches on diskless systems

lbu by default exclude /etc/init.d so we need to tell it to include our raspberrylink service file:

lbu inc /etc/init.d/raspberrylink

In order for bluetooth to remember paired devices a link needs to be created from /var/lib/bluetooth to the storage device. An init script is included to automatically do this on boot. Copy the script over to /etc/init.d:

cp /opt/raspberrylink/service-files/raspberrylink-diskless-init /etc/init.d
lbu inc /etc/init.d/raspberrylink-diskless-init
rc-update add raspberrylink-diskless-init

You'll need to open the file using a text editor and change the "STORAGE_DEVICE_PATH" variable to be the path to your mounted storage device, as it might be different. Make sure to create the directory if it doesn't exist.

NOTICE: If the filesystem for the storage device is FAT then it won't work, BlueZ won't be able to create the directories that contain data of remembered paired devices (since they will use non-alphanumeric characters). As a result, try to use F2FS or another filesystem that will work instead.

Now the last-device cache file in the configuration file should be changed in /etc/raspberrylink-server.conf At the end of the file, change the auto-reconnect-cache-file entry to point to a file on your persistent storage device. For example, if your device is mounted to /media/sda1 then the value would be /media/sda1/raspberrylink-last-device

Then finally commit everything that has been done so far: lbu commit

8. Configuration

There's a couple things that need to be checked and/or set in the configuration file, which is detailed on the configuration page. Make sure to lbu commit when done editing the configuration file if your system is running in diskless mode.

You may need to apply this fix for call-support