Fix minimize script: keep bluetooth+wifi, update baseline doc

This commit is contained in:
2026-06-08 00:23:01 -04:00
parent 39bac0b0cd
commit 9e6f23cdb0
3 changed files with 46 additions and 19 deletions
+9 -8
View File
@@ -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
+32
View File
@@ -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
+5 -11
View File
@@ -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