Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion export-image/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ ALIGN="$((4 * 1024 * 1024))"
# some overhead (since actual space usage is usually rounded up to the
# filesystem block size) and gives some free space on the resulting
# image.
ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)"
ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 500 * 1024 * 1024) / 1" | bc)"

BOOT_PART_START=$((ALIGN))
BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN))
ROOT_PART_START=$((BOOT_PART_START + BOOT_PART_SIZE))
ROOT_PART_SIZE=$(((ROOT_SIZE + ROOT_MARGIN + ALIGN - 1) / ALIGN * ALIGN))
IMG_SIZE=$((BOOT_PART_START + BOOT_PART_SIZE + ROOT_PART_SIZE))
echo IMG_SIZE is $IMG_SIZE in $IMG_FILE

truncate -s "${IMG_SIZE}" "${IMG_FILE}"

Expand Down
4 changes: 4 additions & 0 deletions stage0/00-configure-apt/files/sources.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
deb http://deb.debian.org/debian RELEASE main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ RELEASE-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian RELEASE-updates main contrib non-free non-free-firmware

# needed for libfluidsynth2:arm64
deb http://deb.debian.org/debian bullseye main

# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
#deb-src http://deb.debian.org/debian RELEASE main contrib non-free non-free-firmware
#deb-src http://deb.debian.org/debian-security/ RELEASE-security main contrib non-free non-free-firmware
Expand Down
3 changes: 3 additions & 0 deletions stage1/00-boot-files/files/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ disable_overscan=1
# Run as fast as firmware / board allows
arm_boost=1

# enable high usb port power for booting from thumb drive for development
usb_max_current_enable=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
Expand Down
12 changes: 12 additions & 0 deletions stage2/00-dummy-packages/01-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

apt update && apt-get -y install equivs
export DEB_BUILD_OPTIONS="nocheck"
export DPKG_DEB_COMPRESSOR=gzip
equivs-build files/jack-dummy.ctl
cp jack-dummy_1.9.22_all.deb ${ROOTFS_DIR}/

on_chroot << EOF
dpkg -i /jack-dummy_1.9.22_all.deb
rm /jack-dummy_1.9.22_all.deb
EOF
12 changes: 12 additions & 0 deletions stage2/00-dummy-packages/files/jack-dummy.ctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Section: misc
Priority: optional
Standards-Version: 4.5.0

Package: jack-dummy
Version: 1.9.22
Maintainer: dummy <you@example.com>
Architecture: all
Provides: libjack-jackd2-0, libjack-jackd2-dev, jackd2
Description: Dummy JACK package to satisfy dependencies
This package provides JACK development/runtime dependencies without installing JACK.

7 changes: 4 additions & 3 deletions stage2/01-sys-tweaks/00-packages
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ unzip zip p7zip-full
file git
kms++-utils
python3-venv
virtualenv python3-pip python3-dev python3-zeroconf build-essential libasound2-dev libjack-jackd2-dev
zlib1g-dev cmake gperf intltool ladspa-sdk libarmadillo-dev libavahi-gobject-dev liblilv-dev libjpeg-dev
virtualenv python3-pip python3-dev python3-zeroconf build-essential libasound2-dev
zlib1g-dev cmake gperf intltool ladspa-sdk libarmadillo-dev libavahi-gobject-dev libjpeg-dev
libavcodec-dev libavutil-dev libbluetooth-dev libboost-dev libeigen3-dev libfftw3-dev libglib2.0-dev libglibmm-2.4-dev
libgtk2.0-dev libgtkmm-2.4-dev liblrdf0-dev libsamplerate0-dev libsigc++-2.0-dev libsndfile1-dev libzita-convolver-dev
libzita-resampler-dev lv2-dev p7zip-full python3-all python3-setuptools libreadline-dev zita-alsa-pcmi-utils
libzita-resampler-dev lv2-dev p7zip-full python3-all python3-setuptools libreadline-dev zita-alsa-pcmi-utils
dnsmasq iptables python3-smbus liblo-dev python3-liblo libzita-alsa-pcmi-dev authbind rcconf libfluidsynth-dev lockfile-progs
libfluidsynth2
5 changes: 5 additions & 0 deletions stage2/01-sys-tweaks/00-packages-nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
cifs-utils
rpicam-apps-lite
mkvtoolnix
meson
ninja-build
libserd-dev
libsord-dev
libsratom-dev
1 change: 1 addition & 0 deletions stage2/05-pistomp/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

install -m 644 files/services/*.service ${ROOTFS_DIR}/usr/lib/systemd/system/
install -m 644 files/jackdrc ${ROOTFS_DIR}/etc/
install -m 644 files/jack-env.sh ${ROOTFS_DIR}/etc/profile.d/
install -m 500 files/80 ${ROOTFS_DIR}/etc/authbind/byport/

mkdir -p "${ROOTFS_DIR}/etc/systemd/system/alsa-restore.service.d"
Expand Down
59 changes: 37 additions & 22 deletions stage2/05-pistomp/02-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,53 @@ mkdir -p /home/${FIRST_USER_NAME}/tmp
cd /home/${FIRST_USER_NAME}/tmp

export NOOPT=true
git clone --recursive https://github.com/falkTX/Hylia.git
[ ! -d Hylia ] && git clone --recursive https://github.com/falkTX/Hylia.git
cd Hylia
make
make install
cd ..

git clone https://github.com/micahvdm/jack2.git
[ ! -d jack2 ] && git clone --branch v1.9.22 https://github.com/jackaudio/jack2.git
cd jack2
./waf configure
./waf build
./waf install
cd ..

git clone https://github.com/micahvdm/browsepy.git
# jack-example-tools provides jack_load/jack_unload v4
# Alternative source:
#[ ! -d jack-example-tools ] && git clone --branch 4 https://github.com/jackaudio/jack-example-tools.git
[ ! -d jack-example-tools ] && git clone --branch debian/4-4 https://salsa.debian.org/multimedia-team/jack-example-tools.git
cd jack-example-tools
meson setup --prefix=/usr/local build
ninja -C build
meson install -C build
cd ..

# debian 13 will include python3-lilv liblilv-dev
[ ! -d lilv-0.24.12 ] && \
wget http://download.drobilla.net/lilv-0.24.12.tar.bz2 && \
tar xvf lilv-0.24.12.tar.bz2
cd lilv-0.24.12
./waf configure --prefix=/usr/local --no-utils --no-bash-completion --pythondir=/usr/local/lib/python3.11/dist-packages
./waf build
./waf install
cd ..

[ ! -d browsepy ] && git clone https://github.com/micahvdm/browsepy.git
cd browsepy
pip3 install ./
cd ..

git clone https://github.com/micahvdm/mod-host.git
[ ! -d mod-host ] && git clone https://github.com/mod-audio/mod-host
cd mod-host
# This project has no tags - using the repo head from 2025-12-27
git checkout af11901d9d3ab02631b463853bd16d7881c4e7ca
make
make install
cd ..

git clone https://github.com/TreeFallSound/mod-ui.git
[ ! -d mod-ui ] && git clone https://github.com/TreeFallSound/mod-ui.git
cd mod-ui
chmod +x setup.py
cd utils
Expand All @@ -42,38 +64,31 @@ cp -r default.pedalboard /home/${FIRST_USER_NAME}/data/.pedalboards
sed -i -e 's/collections.MutableMapping/collections.abc.MutableMapping/' /usr/local/lib/python3.11/dist-packages/tornado/httputil.py
cd ..

git clone https://github.com/BlokasLabs/amidithru.git
[ ! -d amidithru ] && git clone https://github.com/BlokasLabs/amidithru.git
cd amidithru
sed -i 's/CXX=g++.*/CXX=g++/' Makefile
make install
cd ..

git clone https://github.com/micahvdm/touchosc2midi.git
[ ! -d touchosc2midi ] && git clone https://github.com/BlokasLabs/touchosc2midi.git
cd touchosc2midi
pip3 install ./
cd ..

git clone https://github.com/micahvdm/mod-midi-merger.git
[ ! -d mod-midi-merger ] && git clone https://github.com/mod-audio/mod-midi-merger
cd mod-midi-merger
# This project's cmake forces the install prefix to /usr for some reason, so disable that
# so that CMAKE_INSTALL_PREFIX can be used.
sed -i 's/^[[:space:]]*set(CMAKE_INSTALL_PREFIX[[:space:]]*\/usr)/# &/' CMakeLists.txt
[ -d build ] && rm -rf build
mkdir build && cd build
cmake ..
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
make install
cd ..
cd ../..

git clone https://github.com/moddevices/mod-ttymidi.git
[ ! -d mod-ttymidi ] && git clone https://github.com/moddevices/mod-ttymidi.git
cd mod-ttymidi
make install
cd ..

wget http://download.drobilla.net/lilv-0.24.12.tar.bz2
tar xvf lilv-0.24.12.tar.bz2
cd lilv-0.24.12

./waf configure --prefix=/usr/local --static --static-progs --no-shared --no-utils --no-bash-completion --pythondir=/usr/local/lib/python3.11/dist-packages
./waf build
./waf install
cd ..

EOF

2 changes: 1 addition & 1 deletion stage2/05-pistomp/03-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd /home/${FIRST_USER_NAME}/tmp

#patch -b -N -u /usr/local/lib/python3.11/dist-packages/touchosc2midi/advertise.py -i advertise.diff

patch -b -N -u /etc/NetworkManager/NetworkManager.conf -i NetworkManager.conf.diff
[ ! -f /etc/NetworkManager/NetworkManager.conf.orig ] && patch -b -N -u /etc/NetworkManager/NetworkManager.conf -i NetworkManager.conf.diff

dpkg -i linux-headers-6.1.54-rt15-v8+_6.1.54-rt15-v8+-2_arm64.deb
dpkg -i linux-libc-dev_6.1.54-rt15-v8+-2_arm64.deb
Expand Down
2 changes: 1 addition & 1 deletion stage2/05-pistomp/04-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ chmod +x /etc/jackdrc
chown jack:jack /etc/jackdrc
chmod 500 /etc/authbind/byport/80
chown ${FIRST_USER_NAME}:${FIRST_USER_NAME} /etc/authbind/byport/80
rm /etc/profile.d/bash_completion.sh
rm -f /etc/profile.d/bash_completion.sh

EOF
3 changes: 3 additions & 0 deletions stage2/05-pistomp/files/config_pistomp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ gpu_mem=16
disable_overscan=1
disable_splash=1

# enable high usb port power for booting from thumb drive for development
usb_max_current_enable=1

[pi3]
kernel=vmlinuz-6.1.54-rt15-v8+
# initramfs initrd.img-6.1.54-rt15-v8+
Expand Down
1 change: 1 addition & 0 deletions stage2/05-pistomp/files/jack-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export JACK_PROMISCUOUS_SERVER=jack
4 changes: 2 additions & 2 deletions stage3/01-pistomp/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install -m 644 /home/${FIRST_USER_NAME}/pi-stomp/setup/services/hotspot/usr/lib/
chown -R ${FIRST_USER_NAME}:${FIRST_USER_NAME} /usr/lib/pistomp-wifi

# USB automounter
sudo dpkg -i /home/${FIRST_USER_NAME}/pi-stomp/setup/services/usbmount.deb
dpkg -i /home/${FIRST_USER_NAME}/pi-stomp/setup/services/usbmount.deb

# Plugins
mkdir -p /home/${FIRST_USER_NAME}/tmp
Expand All @@ -69,7 +69,7 @@ exit 0
EOF

# Version info
software_version=$(sudo git --work-tree ${ROOTFS_DIR}/home/pistomp/pi-stomp --git-dir ${ROOTFS_DIR}/home/pistomp/pi-stomp/.git describe --dirty="*" --always)
software_version=$(git --work-tree ${ROOTFS_DIR}/home/pistomp/pi-stomp --git-dir ${ROOTFS_DIR}/home/pistomp/pi-stomp/.git describe --dirty="*" --always)
build_tag=$(git --work-tree $BASE_DIR --git-dir $BASE_DIR/.git describe --dirty="*" --always)
build_date=$(date +"%y%m%d")
printf '{"build-tag": "%s", "build-date": "%s", "software-version": "%s"}' $build_tag $build_date $software_version > ${ROOTFS_DIR}/home/pistomp/.osbuild
Expand Down
28 changes: 14 additions & 14 deletions stage3/02-cleanup/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,42 @@ echo "=== Cleaning ${ROOTFS_DIR} before image export ==="

# 1. Remove cached package files
echo "→ Clearing APT cache..."
sudo rm -rf "${ROOTFS_DIR}/var/cache/apt/archives/"*.deb || true
sudo rm -rf "${ROOTFS_DIR}/var/lib/apt/lists/"* || true
rm -rf "${ROOTFS_DIR}/var/cache/apt/archives/"*.deb || true
rm -rf "${ROOTFS_DIR}/var/lib/apt/lists/"* || true

# 2. Remove package documentation (but keep man pages)
echo "→ Removing /usr/share/doc (keeping licenses)..."
sudo find "${ROOTFS_DIR}/usr/share/doc" -mindepth 1 -type d -exec rm -rf {} + 2>/dev/null || true
sudo find "${ROOTFS_DIR}/usr/share/doc" -type f ! -name 'copyright' -delete || true
find "${ROOTFS_DIR}/usr/share/doc" -mindepth 1 -type d -exec rm -rf {} + 2>/dev/null || true
find "${ROOTFS_DIR}/usr/share/doc" -type f ! -name 'copyright' -delete || true

# 3. Prune locale data except English
echo "→ Removing non-English locales..."
sudo find "${ROOTFS_DIR}/usr/share/locale" -mindepth 1 -maxdepth 1 \
find "${ROOTFS_DIR}/usr/share/locale" -mindepth 1 -maxdepth 1 \
! -name 'en' ! -name 'en_GB' ! -name 'en_US' -exec rm -rf {} + || true

# 4. Clear system logs
echo "→ Removing logs..."
sudo rm -rf "${ROOTFS_DIR}/var/log/"* || true
rm -rf "${ROOTFS_DIR}/var/log/"* || true

# 5. Clear temporary files
echo "→ Clearing /tmp and /var/tmp..."
sudo rm -rf "${ROOTFS_DIR}/tmp/"* "${ROOTFS_DIR}/var/tmp/"* || true
rm -rf "${ROOTFS_DIR}/tmp/"* "${ROOTFS_DIR}/var/tmp/"* || true

# 6. Remove cache directories from common applications
echo "→ Removing miscellaneous caches..."
sudo rm -rf "${ROOTFS_DIR}/var/cache/"* || true
sudo rm -rf "${ROOTFS_DIR}/home/"*/.cache || true
sudo rm -rf "${ROOTFS_DIR}/root/.cache" || true
rm -rf "${ROOTFS_DIR}/var/cache/"* || true
rm -rf "${ROOTFS_DIR}/home/"*/.cache || true
rm -rf "${ROOTFS_DIR}/root/.cache" || true

# 7. Zero out free space inside the staged filesystem to help xz
#echo "→ Zero-filling free space for better compression..."
#MNT=$(mktemp -d)
#sudo mount -o loop,offset=$(( $(fdisk -l "${ROOTFS_DIR}/../image.img" | awk '/^Device/{getline; print $2}') * 512 )) \
#mount -o loop,offset=$(( $(fdisk -l "${ROOTFS_DIR}/../image.img" | awk '/^Device/{getline; print $2}') * 512 )) \
# "${ROOTFS_DIR}/../image.img" "$MNT" 2>/dev/null || true
#if mountpoint -q "$MNT"; then
# sudo dd if=/dev/zero of="$MNT/zero.fill" bs=1M || true
# sudo rm "$MNT/zero.fill"
# sudo umount "$MNT"
# dd if=/dev/zero of="$MNT/zero.fill" bs=1M || true
# rm "$MNT/zero.fill"
# umount "$MNT"
#else
# echo " (skipping zero-fill, no image mounted yet)"
#fi
Expand Down