diff --git a/docs/baseline-footprint.md b/docs/baseline-footprint.md index 0aa2df2..c70f31f 100644 --- a/docs/baseline-footprint.md +++ b/docs/baseline-footprint.md @@ -97,11 +97,17 @@ fonts-* xfonts-* python3-pygame python3-tk ``` +### Systemd Services Kept (Bluetooth & WiFi stay on) + +| Service | Reason to Keep | +|---------|----------------| +| `bluetooth` | Wireless MIDI controllers, tuner apps | +| `wpa_supplicant` | WiFi for web UI, SSH, preset downloads | + ### Systemd Services Disabled | Service | Reason | |---------|--------| -| `bluetooth` | No BT on pedal | | `avahi-daemon` | No mDNS needed | | `triggerhappy` | We handle GPIO ourselves | | `ModemManager` | No modem | @@ -126,13 +132,6 @@ snd_usbmidi_lib snd_rawmidi snd_seq_device snd_hwdep -# (HDA Intel is x86 only, but harmless to list) - -# Bluetooth -bluetooth btusb btbcm - -# WiFi (wired-only mode) -brcmfmac brcmutil # Unused input devices joydev uvcvideo videobuf2_v4l2 @@ -142,6 +141,8 @@ r8152 # Realtek USB NIC xhci_pci # USB 3.0 ``` +**NOT blacklisted:** Bluetooth (`bluetooth`, `btusb`, `btbcm`) and WiFi (`brcmfmac`, `brcmutil`) — kept for wireless MIDI and web UI. + ## What We Keep ### Essential Packages diff --git a/docs/os-minimization-plan.md b/docs/os-minimization-plan.md new file mode 100644 index 0000000..12b232e --- /dev/null +++ b/docs/os-minimization-plan.md @@ -0,0 +1,32 @@ +## Problem +Strip the DietPi install down to the minimum footprint for the pedal. Profile baseline resource usage, then remove unnecessary packages and services. Target < 60MB idle RAM and < 500MB disk. + +## File scope +- `scripts/dietpi-postinstall.sh` — DietPi first-boot setup with minimal packages +- `scripts/minimize.sh` — identify and remove unused packages, disable unnecessary systemd services +- `scripts/build-minimal-image.sh` — take the stripped install and produce a flashable image +- `docs/baseline-footprint.md` — before/after resource comparisons + +## Approach +1. Install DietPi minimal (no desktop, no software options) +2. Install only what's needed: JACK, Python, PyTorch, cmake, GPIO libs, I2C tools +3. Run `systemd-analyze blame` to identify slow services +4. Disable: avahi, triggerhappy, ModemManager, systemd-resolved if not needed +5. **KEEP: bluetooth (for MIDI controllers, wireless tuner apps), wifi (for web UI, preset downloads)** +6. Use `dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rn` to find biggest packages, remove non-essentials +7. Strip kernel modules not needed (remove sound modules for hardware we don't have, etc.) +8. Document the removal process so it's repeatable +9. Build a minimal SD card image from the stripped install + +## Dependencies +Blocks on: Audio system setup (t_9deaa72c) — need JACK working first for baselines + +## Acceptance Criteria +- [ ] Baseline footprint documented (RAM + disk before/after) +- [ ] All unnecessary systemd services disabled +- [ ] Blutetooth and wifi preserved and functional +- [ ] Unused kernel modules removed +- [ ] No functionality lost — JACK, NAM, MIDI, GPIO, I2S all still work +- [ ] < 60MB idle RAM, < 500MB disk +- [ ] Repeatable minimize script committed to repo +- [ ] Boot time < 15 seconds to pedal ready \ No newline at end of file diff --git a/scripts/minimize.sh b/scripts/minimize.sh index a3c6521..6d64485 100755 --- a/scripts/minimize.sh +++ b/scripts/minimize.sh @@ -87,9 +87,7 @@ info "Step 1: Removing unnecessary packages..." # ── Packages we KNOW we don't need on a headless audio pedal ────────────── PACKAGES_TO_PURGE=( - # Bluetooth (no BT on a pedal) - bluez bluez-tools bluez-firmware pi-bluetooth - # Printing + # Printing (no USB printers on a pedal) cups cups-bsd cups-client cups-common cups-core-drivers cups-daemon cups-filters cups-ppdc cups-server-common # Avahi/mDNS (not needed for local audio) avahi-daemon avahi-autoipd avahi-utils @@ -183,7 +181,6 @@ fi info "Step 2: Disabling unnecessary systemd services..." SERVICES_TO_DISABLE=( - bluetooth avahi-daemon triggerhappy ModemManager @@ -239,14 +236,11 @@ blacklist snd_hda_intel blacklist snd_hda_codec blacklist snd_hda_core -# Bluetooth -blacklist bluetooth -blacklist btusb -blacklist btbcm +# Bluetooth — KEPT (wireless MIDI controllers, tuner apps) +# Do NOT blacklist bluetooth modules -# WiFi (wired-only mode) -blacklist brcmfmac -blacklist brcmutil +# WiFi — KEPT (web UI, SSH, preset downloads) +# Do NOT blacklist wifi modules # Unused input devices blacklist joydev