diff --git a/CLAUDE.md b/CLAUDE.md index d72a63f828..6d138fd23b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,6 +36,14 @@ mkdir build-sim && cd build-sim && ../tools/configure mkdir build-ipod && cd build-ipod && ../tools/configure ``` +### Docker Build (iPod Video) +For reproducible builds without installing toolchains locally: +```bash +make build # Build firmware +make clean # Remove output +``` +Artifacts are placed in `output/` (rockbox.ipod and rockbox.zip). + ## Testing There is no formal unit test framework. Testing is done through: diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..cab7e27e77 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# +# Root Makefile for Docker-based builds +# +# Usage: +# make - Show help +# make build - Build Rockbox for iPod Video (via Docker) +# make clean - Remove build artifacts + +.PHONY: help build clean + +help: + @echo "Rockbox Docker Build" + @echo "" + @echo "Usage:" + @echo " make build - Build Rockbox for iPod Video 5.5G (via Docker)" + @echo " make clean - Remove build artifacts from output/" + @echo "" + @echo "Artifacts are placed in output/" + @echo "" + @echo "For other targets or manual builds, see docs/README" + +build: + ./tools/docker_ipodvideo/build.sh build + +clean: + ./tools/docker_ipodvideo/build.sh clean diff --git a/TODO.md b/TODO.md deleted file mode 100644 index c6e7b0a4ef..0000000000 --- a/TODO.md +++ /dev/null @@ -1,38 +0,0 @@ -Building this project is probably quite fussy. - -Improve the portability and reliability of this project's build process by: -* creating a Dockerfile that stands up an ideal build machine for this project -* adding a build command that builds the Rockbox file(s) using the aforementioned Dockerfile -* neatly outputs all relevant build artifacts to a gitignored build directory -* include a clean command (or update the existing one) to clean up the build dir - -## Clarified Requirements - -### Target Device -- iPod Video 5.5th generation (30GB/60GB/80GB models) -- Configure option: `22|ipodvideo` -- Target macro: `IPOD_VIDEO` -- Output file: `rockbox.ipod` (plus `rockbox.zip` containing the full installation package) - -### Toolchain -- ARM cross-compiler: `arm-elf-eabi-gcc` version 9.5.0 -- Binutils version 2.38 -- Built via `tools/rockboxdev.sh` with option "A" (ARM) -- The toolchain should be pre-installed in the Docker image for faster subsequent builds - -### Build System Dependencies -Required packages for building the toolchain: -- gcc, g++, make, patch, automake, libtool, autoconf, flex, bison -- xz, bzip2, gzip (for archive extraction) -- texinfo (provides makeinfo) -- perl (required by configure script) -- wget or curl (for downloading toolchain sources) -- libgmp-dev, libmpfr-dev, libmpc-dev, libisl-dev (GCC build dependencies) - -### Build Artifacts -Only output what's needed to install on the iPod: -- `rockbox.zip` - The main installation package (unzip to iPod root) -- `rockbox.ipod` - The firmware binary - -### Build Wrapper -Use existing Makefile conventions in the repository. If modifying any Makefiles, update relevant documentation (CLAUDE.md, docs/README, etc.). \ No newline at end of file diff --git a/docs/README b/docs/README index 665078545f..9b6a1f233f 100644 --- a/docs/README +++ b/docs/README @@ -62,3 +62,19 @@ directories and create a setup for each target: $ ../tools/configure Questions anyone? Ask on the mailing list or on IRC. We'll be happy to help you! + +Docker Build (iPod Video) +------------------------- + +If you have Docker installed, you can build for iPod Video without installing +any toolchains: + + $ make build + +This builds the firmware in a Docker container and places the artifacts in +output/. To clean up: + + $ make clean + +The first build takes longer as it creates the Docker image with the ARM +toolchain. Subsequent builds are faster. diff --git a/tools/docker_ipodvideo/Dockerfile b/tools/docker_ipodvideo/Dockerfile new file mode 100644 index 0000000000..8b240fcd9c --- /dev/null +++ b/tools/docker_ipodvideo/Dockerfile @@ -0,0 +1,38 @@ +FROM debian:12 + +WORKDIR /home/rb +ENV HOME=/home/rb + +# Install build dependencies +RUN apt update && \ + DEBIAN_FRONTEND=noninteractive apt install -y \ + build-essential \ + git \ + perl \ + curl \ + texinfo \ + flex \ + bison \ + bzip2 \ + gzip \ + zip \ + patch \ + automake \ + libtool \ + libtool-bin \ + autoconf \ + libmpc-dev \ + gawk \ + wget && \ + rm -rf /var/lib/apt/lists/* + +# Clone rockbox and build ARM toolchain +RUN git clone git://git.rockbox.org/rockbox + +RUN cd /home/rb/rockbox && \ + RBDEV_PREFIX=/opt/toolchain ./tools/rockboxdev.sh --target="a" + +# Add toolchain to PATH +ENV PATH="/opt/toolchain/bin:$PATH" + +WORKDIR /src diff --git a/tools/docker_ipodvideo/build.sh b/tools/docker_ipodvideo/build.sh new file mode 100755 index 0000000000..1ef02de807 --- /dev/null +++ b/tools/docker_ipodvideo/build.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# +# Docker build script for iPod Video (5.5th gen) +# +# Usage: +# ./build.sh [build|clean] +# +# build - Build rockbox.ipod and rockbox.zip (default) +# clean - Remove output directory +# + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROCKBOX_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +IMAGE_NAME="rockbox-ipodvideo" +OUTPUT_DIR="$ROCKBOX_ROOT/output" + +usage() { + echo "Usage: $0 [build|clean]" + echo "" + echo " build - Build rockbox.ipod and rockbox.zip (default)" + echo " clean - Remove output directory" + exit 1 +} + +build_image() { + echo "Building Docker image '$IMAGE_NAME'..." + docker build -t "$IMAGE_NAME" "$SCRIPT_DIR" +} + +ensure_image() { + if ! docker image inspect "$IMAGE_NAME" >/dev/null 2>&1; then + build_image + fi +} + +do_build() { + ensure_image + mkdir -p "$OUTPUT_DIR" + + echo "Building Rockbox for iPod Video..." + docker run --rm \ + -v "$ROCKBOX_ROOT:/src:ro" \ + -v "$OUTPUT_DIR:/output" \ + "$IMAGE_NAME" \ + /bin/bash -c ' + set -e + # Copy source to writable location (build modifies tools/) + cp -a /src /rockbox + mkdir -p /rockbox/build + cd /rockbox/build + ../tools/configure --target=22 --type=N + make -j$(nproc) + make zip + cp -v rockbox.ipod /output/ + cp -v rockbox.zip /output/ + ' + + echo "" + echo "Build complete! Artifacts in: $OUTPUT_DIR" + ls -la "$OUTPUT_DIR" +} + +do_clean() { + echo "Cleaning output directory..." + rm -rf "$OUTPUT_DIR" + echo "Done." +} + +case "${1:-build}" in + build) + do_build + ;; + clean) + do_clean + ;; + -h|--help|help) + usage + ;; + *) + echo "Error: Unknown command '$1'" + usage + ;; +esac