= makarov = * RPi Zero W * RPi OS buster Lite (based on Debian 10.10) * `Linux makarov 5.10.17+ #1421 Thu May 27 13:58:02 BST 2021 armv6l GNU/Linux` * Located wherever I take it <> == Build notes == * Setup new install, configure wifi, enable ssh * raspi-config, set locale and timezone and hostname * setup your SSH keys for login * apt update, full-upgrade and reboot * apt install git vim lsof * setup vim config {{{ # /etc/vim/vimrc.local syntax on set background=dark set modeline set scrolloff=3 set mouse= set ttymouse= filetype plugin indent on }}} Now the hardware support, I stole bits of this from Mopidy's install docs. * apt install -y python3-rpi.gpio python3-spidev python3-pip * Enable SPI {{{ raspi-config nonint do_spi 0 }}} * Setup the Pirate Audio hat by appending to `/boot/config.txt` {{{ # Pirate Audio config gpio=25=op,dh dtoverlay=hifiberry-dac }}} Now reboot and cross your fingers. == network == Static DHCP assignment in IOT VLAN, it should have minimal access privileges, it literally only needs web access. No IPv6 apart from usual linklocal stuff. == services == * SSH * Some avahi junk I should probably disable == apps == * `muzak` systemd unit plays music, running as the `pi` user * `frontpanel` systemd unit manages the LCD and button inputs === Muzak app === Runs mpv with a playlist of Youtube links, super basic. Audio goes out through an I2S soundcard. Playlist loops forever as you'd expect. Playlist and extra stuff is in /home/pi === Frontpanel app === A python script with some basic GPIO interfacing, controls mpv by talking to its JSON-IPC socket. Displays images and UI on the LCD screen. == Optimisation == Aim to disable as much stuff as possible, to reduce CPU load and boot times. Try to disable: * bluetooth * `dtoverlay=disable-bt` in config.txt * `systemctl disable hciuart --now` * `systemctl disable bluetooth` * reboot then `apt purge bluez bluez-firmware` * apt-daily-upgrade * `echo 'APT::Periodic::Enable "0";' > /etc/apt/apt.conf.d/10periodic` * ModemManager * `apt purge modemmanager` * `apt autoremove -y` * avahi-daemon.service * `systemctl disable avahi-daemon.service --now` * Does this work? `systemctl disable avahi-daemon.socket` * dhcpcd * add `noarp` to the config to make it boot faster * Remove the Mopidy stuff that I installed {{{ systemctl disable mopidy --now for i in spi i2c gpio video ; do deluser mopidy $i ; done # as root: pip3 uninstall mopidy-youtube Mopidy-PiDi Mopidy-Local mopidy-raspberry-gpio pip3 uninstall mopidy_autoplay mopidy_mobile mopidy_muse musicbrainzngs apt purge mopidy rm -rf /var/lib/mopidy # Mark gstreamer plugins to be kept now that mopidy is gone apt install gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-alsa \ gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio \ gstreamer1.0-x python3-gst-1.0 rm /etc/apt/sources.list.d/mopidy.list apt-key del 271D2943 }}} == Read only system == Make the filesystems read-only, as much as possible. Refer to this: https://medium.com/@andreas.schallwig/make-your-raspberry-pi-file-system-read-only-raspbian-buster-c558694de79 {{{ apt purge triggerhappy systemctl disable console-setup apt purge logrotate apt install busybox-syslogd apt purge rsyslog systemctl stop dphys-swapfile.service apt purge dphys-swapfile apt autoremove -y }}}