245 lines
4.3 KiB
Markdown
245 lines
4.3 KiB
Markdown
# Installation
|
|
|
|
## Flash image
|
|
|
|
### Format sd-card
|
|
|
|
Identify your sd-card
|
|
```
|
|
$ fdisk -l
|
|
```
|
|
|
|
Start fdisk to partition the SD card: (Don't forget to replace the sdX with your sd-card drive letter)
|
|
```
|
|
$ fdisk /dev/sdX
|
|
```
|
|
|
|
Type o\
|
|
Type p\
|
|
Type n, then p, then 1, then ENTER, then type +200M\
|
|
Type t, then c\
|
|
Type n, then p, then 2, then ENTER twice\
|
|
Exit by typing w
|
|
|
|
Execute the following script to mount the newly created partitions, download and copy the image. (Don't forget to replace the sdX with your sd-card drive letter)
|
|
|
|
```
|
|
mkfs.vfat /dev/sdX1 &&
|
|
mkdir boot &&
|
|
mount /dev/sdX1 boot &&
|
|
mkfs.ext4 /dev/sdX2 &&
|
|
mkdir root &&
|
|
mount /dev/sdX2 root &&
|
|
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz &&
|
|
bsdtar -xpf ArchLinuxARM-rpi-4-latest.tar.gz -C root &&
|
|
sync &&
|
|
mv root/boot/* boot &&
|
|
umount boot root
|
|
```
|
|
|
|
Boot your raspberry pi and login with `alarm`/`alarm` (root user pwd is `root`)
|
|
|
|
Change your hostname
|
|
``` shell
|
|
$ nano /etc/hostname
|
|
```
|
|
|
|
``` shell
|
|
# /etc/hostname
|
|
noxbox-me
|
|
```
|
|
|
|
``` shell
|
|
$ nano /etc/hosts
|
|
```
|
|
|
|
``` shell
|
|
# /etc/hosts
|
|
127.0.1.1 noxbox-me
|
|
```
|
|
|
|
``` shell
|
|
$ ip link show
|
|
$ ip link set wlan0 up
|
|
$ nano /etc/wpa_supplication/wpa_supplicant-wlan0.conf
|
|
```
|
|
|
|
``` shell
|
|
# /etc/wpa_supplication/wpa_supplicant-wlan0.conf
|
|
ctrl_interface=/run/wpa_supplicant
|
|
update_config=1
|
|
```
|
|
|
|
Enable WiFi
|
|
|
|
``` shell
|
|
$ wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
|
|
$ wpa_cli
|
|
> interface wlan0
|
|
> add_network
|
|
> set_network 0 ssid "my-network"
|
|
> set_network 0 psk "my-password"
|
|
> enable_network 0
|
|
> save_config
|
|
> quit
|
|
```
|
|
|
|
``` shell
|
|
$ systemctl enable wpa_supplicant@wlan0.service
|
|
$ systemctl start wpa_supplicant@wlan0.service
|
|
$ systemctl enable dhcpcd
|
|
$ systemctl start dhcpcd
|
|
$ nano /boot/config.txt
|
|
```
|
|
|
|
``` shell
|
|
# /boot/config.txt
|
|
dtparam=audio=on
|
|
|
|
dtoverlay=vc4-kms-v3d
|
|
dtparam=krnbt=on
|
|
|
|
initramfs initramfs-linux.img followkernel
|
|
```
|
|
|
|
``` shell
|
|
$ reboot
|
|
$ su root
|
|
$ pacman-key --init
|
|
$ pacman-key --populate archlinuxarm
|
|
$ pacman -Syu
|
|
$ pacman -S sudo
|
|
$ visudo
|
|
```
|
|
|
|
``` shell
|
|
alarm ALL=(ALL) NOPASSWD: ALL
|
|
```
|
|
|
|
`[Optional]`
|
|
``` shell
|
|
$ ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime
|
|
```
|
|
|
|
``` shell
|
|
$ pacman -S bluez bluez-utils pulseaudio-bluetooth
|
|
$ groupadd --system pulse
|
|
$ useradd --system -g pulse -G audio,lp --home-dir /var/run/pulse pulse
|
|
$ groupadd --system pulse-access
|
|
$ nano /etc/systemd/system/pulseaudio.service
|
|
```
|
|
|
|
``` shell
|
|
# /etc/systemd/system/pulseaudio.service
|
|
|
|
[Unit]
|
|
Description=PulseAudio Daemon
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|
|
[Service]
|
|
Type=notify
|
|
PrivateTmp=true
|
|
ExecStart=/usr/bin/pulseaudio --system --realtime --disallow-exit --log-target=journal
|
|
```
|
|
|
|
``` shell
|
|
$ nano /etc/pulse/daemon.conf
|
|
```
|
|
|
|
``` shell
|
|
# /etc/pulse/daemon.conf
|
|
|
|
; system-instance = no
|
|
system-instance = yes
|
|
```
|
|
``` shell
|
|
$ nano /etc/pulse/system.pa
|
|
```
|
|
|
|
``` shell
|
|
# /etc/pulse/system.pa
|
|
|
|
# existing config change:
|
|
load-module module-udev-detect tsched=0
|
|
|
|
# new config entries
|
|
load-module module-bluetooth-discover
|
|
load-module module-bluetooth-policy
|
|
```
|
|
|
|
``` shell
|
|
$ systemctl enable pulseaudio
|
|
$ systemctl start pulseaudio
|
|
$ systemctl --global mask pulseaudio.socket
|
|
$ pacman -S alsa-utils
|
|
$
|
|
```
|
|
|
|
`[Optional]`
|
|
``` shell
|
|
$ pacman -S alsa-utils
|
|
$ aplay /usr/share/sounds/alsa/Side_Left.wav
|
|
```
|
|
|
|
``` shell
|
|
$ nano /etc/bluetooth/main.conf
|
|
```
|
|
|
|
``` shell
|
|
# /etc/bluetooth/main.conf
|
|
|
|
[Policy]
|
|
AutoEnable=true
|
|
```
|
|
|
|
``` shell
|
|
$ nano /etc/bluetooth/audio.conf
|
|
```
|
|
|
|
``` shell
|
|
# /etc/bluetooth/audio.conf
|
|
|
|
[General]
|
|
Enable=Source,Sink,Media
|
|
```
|
|
|
|
``` shell
|
|
$ systemctl enable bluetooth
|
|
$ systemctl start bluetooth
|
|
```
|
|
|
|
``` shell
|
|
$ bluetoothctl
|
|
> discoverable on
|
|
> pairable on
|
|
```
|
|
|
|
Now connect your device with the noxbox raspberry pi. Don't forget to confirm in bluetoothctl twice.
|
|
|
|
Now you can stream some songs on your noxbox.
|
|
|
|
# Install services
|
|
|
|
First run the deploy script to upload the services to your raspberry pi:
|
|
|
|
```shell
|
|
chmod +x ./deploy.sh
|
|
./deploy.sh -u USERNAME -h HOST_IP
|
|
```
|
|
|
|
Now login to your raspberry pi and execute the following as sudo:
|
|
|
|
```shell
|
|
~/audio-box/install.sh
|
|
```
|
|
|
|
Check the following to see if the services are running correctly
|
|
|
|
```shell
|
|
ls -la /data/services/i2c-amp-control # Should contain node_modules and index.js
|
|
ls -la /etc/systemd/system/i2c-amp-control.service # Should exist
|
|
journalctl -fu i2c-amp-control # Should show log messages when volume buttons are pressed
|
|
```
|