update INSTALLATION.md

This commit is contained in:
jochen 2021-11-05 22:56:41 +00:00
parent 9b977ff204
commit 9f3e00f093

View File

@ -1,47 +1,221 @@
# Installation guide
# Installation
## Raspberry Pi
## Flash image
After experiencing bluetooth issues using the default debian based Raspberry Pi image, we switched to the Arch Linux ARM image.
### Format sd-card
[Installation guide](https://archlinuxarm.org/platforms/armv6/raspberry-pi)
1. Start fdisk to partition the SD card:\
`fdisk /dev/sdX`
2. At the fdisk prompt, delete old partitions and create a new one:
- Type o. This will clear out any partitions on the drive.
- Type p to list partitions. There should be no partitions left.
- Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +200M for the last sector.
- Type t, then c to set the first partition to type W95 FAT32 (LBA).
- Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
- Write the partition table and exit by typing w.
3. Create and mount the FAT filesystem:
Identify your sd-card
```
mkfs.vfat /dev/sdX1
mkdir boot
mount /dev/sdX1 boot
$ fdisk -l
```
4. Create and mount the ext4 filesystem:
Start fdisk to partition the SD card: (Don't forget to replace the sdX with your sd-card drive letter)
```
mkfs.ext4 /dev/sdX2
mkdir root
mount /dev/sdX2 root
$ fdisk /dev/sdX
```
5. Download and extract the root filesystem (as root, not via sudo):
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)
```
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root
sync
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
```
6. Move boot files to the first partition:\
`mv root/boot/* boot`
7. Unmount the two partitions:
`umount boot root`
8. Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
9. Use the serial console or SSH to the IP address given to the board by your router.
- Login as the default user alarm with the password alarm.
- The default root password is root.
10. Initialize the pacman keyring and populate the Arch Linux ARM package signing keys:
Boot your raspberry pi and login with `alarm`/`alarm` (root user pwd is `root`)
Change your hostname
``` shell
$ nano /etc/hostname
```
pacman-key --init
pacman-key --populate archlinuxarm
```
``` 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.