File size: 1,838 Bytes
d177e5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Build a CM5 image of reachy-mini-os, inside Docker: for a CM5 swapped into the
# Reachy Mini Wireless carrier (the stock robot ships a CM4). Usage: see README.md.
FROM debian:bookworm

# pi-gen build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
      ca-certificates git git-lfs curl \
      quilt parted debootstrap zerofree zip dosfstools e2fsprogs fdisk \
      libarchive-tools libcap2-bin rsync xz-utils file kmod bc gpg pigz xxd \
      arch-test binfmt-support qemu-user-static \
    && rm -rf /var/lib/apt/lists/*

# reachy-mini-os source (pi-gen fork) + its Git LFS files
RUN git lfs install \
 && git clone --depth 1 https://github.com/pollen-robotics/reachy-mini-os.git /pi-gen
WORKDIR /pi-gen
RUN git lfs pull

# CM5 boot tweaks + pinned daemon version. Unlike the Pi 5 build:
# - dtparam=ant2 stays (the CM5 has the U.FL connector, the Wireless uses the external antenna)
# - the imx708/i2c overlays stay (the Wireless camera is CSI)
# The motor bus keeps GPIO4/5, which on the CM5 is RP1 uart2 (ttyAMA2), not the CM4's uart3.
ARG DAEMON_VERSION=v1.8.4
RUN set -e; \
    sed -i 's/^IMG_NAME="reachyminios"$/IMG_NAME="reachyminios-cm5"/' config; \
    cfg=stage1/00-boot-files/files/config.txt; \
    sed -i 's/^dtoverlay=uart3$/dtoverlay=uart2-pi5/' "$cfg"; \
    sed -i -E "s/reachy-mini\[wireless-version\]==v[0-9.]+/reachy-mini[wireless-version]==${DAEMON_VERSION}/" \
        stage2/05-reachy-mini/01-run-chroot.sh

# CM5 runtime fixes (motors, shutdown, software H264 encoder)
COPY docker/stage-cm5-fixes.sh stage2/05-reachy-mini/02-run-chroot.sh
RUN chmod +x stage2/05-reachy-mini/02-run-chroot.sh

# the build itself runs at `docker run` (needs --privileged: loop devices + ARM emulation)
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]