diff --git a/image/Dockerfile b/image/Dockerfile new file mode 100644 index 0000000..e89920b --- /dev/null +++ b/image/Dockerfile @@ -0,0 +1,63 @@ +FROM ubuntu:22.04 + +# Prevent interactive prompts during package installation +ENV DEBIAN_FRONTEND=noninteractive + +# Install Yocto build dependencies +RUN apt-get update && apt-get install -y \ + gawk \ + wget \ + git \ + diffstat \ + unzip \ + texinfo \ + gcc \ + build-essential \ + chrpath \ + socat \ + cpio \ + python3 \ + python3-pip \ + python3-pexpect \ + xz-utils \ + debianutils \ + iputils-ping \ + python3-git \ + python3-jinja2 \ + python3-subunit \ + zstd \ + liblz4-tool \ + file \ + locales \ + libacl1 \ + sudo \ + vim \ + less \ + tree \ + && rm -rf /var/lib/apt/lists/* + +# Set up locale +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +# Create non-root user for Yocto builds (Yocto doesn't like running as root) +RUN useradd -m -s /bin/bash yocto && \ + echo "yocto ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +# Set working directory +WORKDIR /workspace + +# Change ownership of workspace to yocto user +RUN chown -R yocto:yocto /workspace + +# Switch to yocto user +USER yocto + +# Set up git configuration (required for Yocto) +RUN git config --global user.name "Yocto Builder" && \ + git config --global user.email "yocto@builder.local" + +# Default command to start interactive shell +CMD ["/bin/bash"] \ No newline at end of file diff --git a/image/Implementation_plan.md b/image/Implementation_plan.md new file mode 100644 index 0000000..3a7afcf --- /dev/null +++ b/image/Implementation_plan.md @@ -0,0 +1,68 @@ +# Yocto FCB1010 Looper System - Implementation Guide + +## Project Overview + +Build a minimal, real-time Linux system for an audio looper pedal using Yocto Project. The system boots from initramfs only for maximum speed, includes RT kernel patches, and supports over-the-air updates via SWUpdate with A/B partitioning. + +**Key Requirements:** +- x64 hardware (NUC-class) +- Static IP: 192.168.0.50 +- SSH access with public key authentication +- USB live installer that can dd copy to disk +- A/B partition scheme for reliable updates +- RT kernel with PREEMPT_RT +- JACK audio stack +- SWUpdate for OTA updates + +## Architecture Decisions + +**Boot Strategy:** EFI boot → initramfs-only (no rootfs mounting) +**Network:** WiFi with static IP, credentials baked into image +**Updates:** SWUpdate web interface + SSH API access +**Installation:** USB boot → SSH → dd copy entire USB to target disk +**Partition Layout:** EFI boot partition with initramfs-A.cpio.gz and initramfs-B.cpio.gz + +## Yocto Implementation Approach + +**Custom Layer Structure:** +Create meta-looper with recipes for kernel config (RT patches), network setup (static IP + WiFi), SSH keys, audio stack (JACK), and two image types: main system (initramfs) and USB installer. + +**Build Configuration:** +- MACHINE = "genericx86-64" +- Kernel: linux-yocto with RT features +- Minimal install, not Pokey distribution + +## Key Implementation Points + +**Kernel:** Enable PREEMPT_RT, high-res timers, and audio subsystem. Use kernel fragment files (.cfg) to configure RT options. + +**Networking:** Create recipes for wpa_supplicant.conf and network interfaces with static IP. Include WiFi credentials at build time. + +**SSH:** Recipe to install public key to root's authorized_keys during image build. + +**SWUpdate:** Configure for A/B updates, web interface on port 8080, and integration with systemd-boot for partition switching. + +**USB Installer:** Second image that boots live system with installation script. Script partitions target disk, creates EFI boot partition, and dd copies the installer image to create installed system. + +## Running +The build and testing platform is built in Docker. A Compose file is used to script the separate targets: +- docker compose run disk-image +- docker compose run qemu-server +- docker compose run push-update +- docker compose run ssh-client + +The compose file mounts the proper directories for cache, output, ... It also forwards the proper ports for qemu. + +## Testing Strategy for AI Agent + +**QEMU Testing:** Use runqemu with network forwarding to test SSH, networking, and SWUpdate functionality. QEMU supports graphics for GUI testing and USB forwarding for hardware validation. + +**Build Validation:** Verify initramfs size (<200MB), boot time (<10 seconds), and RT kernel configuration. Test static IP assignment and SSH key authentication. + +**Update Testing:** Create test SWUpdate packages and verify A/B switching works correctly. Test both web interface and SSH-based update deployment. + +**Audio Validation:** Confirm JACK installation, RT scheduling capabilities with cyclictest, and audio device detection. + +**Installation Testing:** Boot USB installer in QEMU, SSH in, run installation script on virtual disk, then boot installed system to verify complete workflow. + +The implementation should focus on creating minimal, working recipes that can be tested incrementally in QEMU before hardware deployment. Each component (kernel, network, SSH, audio, updates) should be testable independently. \ No newline at end of file diff --git a/image/docker-compose.yml b/image/docker-compose.yml new file mode 100644 index 0000000..c515265 --- /dev/null +++ b/image/docker-compose.yml @@ -0,0 +1,19 @@ +services: + yocto: + build: . + container_name: fcb-looper-yocto + working_dir: /workspace + volumes: + # Mount workspace for persistent development + - ./workspace:/workspace + # Mount downloads cache to avoid re-downloading sources + - ./yocto-downloads:/workspace/downloads + # Mount sstate cache for faster builds + - ./yocto-sstate:/workspace/sstate-cache + # Mount output directory + - ./output:/workspace/output + environment: + - TERM=xterm-256color + stdin_open: true + tty: true + command: /bin/bash \ No newline at end of file