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
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1
FROM devkitpro/devkitarm:latest AS root
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base image devkitpro/devkitarm is for 32-bit ARM and doesn’t match this project’s Switch/libnx toolchain (AArch64). CI builds in devkitpro/devkita64 (see .github/workflows/build-jobs.yaml:11), and both sysmod/Makefile and overlay/Makefile include $(DEVKITPRO)/libnx/switch_rules and target armv8-a. Update the Dockerfile to use the devkita64 image so switch-dev and the AArch64 compiler are available and the Docker build succeeds.

Suggested change
FROM devkitpro/devkitarm:latest AS root
FROM devkitpro/devkita64:latest AS root

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the :latest tag makes Docker builds non-reproducible and can break unexpectedly when the upstream image changes. Consider pinning to a specific devkitPro image tag (or digest) that matches what CI uses so local Docker builds remain stable.

Suggested change
FROM devkitpro/devkitarm:latest AS root
FROM devkitpro/devkitarm:<pinned-tag> AS root

Copilot uses AI. Check for mistakes.

# Use Bash (explicitly) as the default shell.
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]

# Obviously, please keep these package names alphabetized.
RUN apt-get -y update && apt-get -y upgrade && \
apt-get -y install \
build-essential \
git \
zip \
;
Comment on lines +8 to +13
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apt-get upgrade in the image build increases build time and reduces reproducibility (and can occasionally introduce breaking changes in the toolchain image). Prefer installing only the needed packages with --no-install-recommends and cleaning apt lists, without upgrading the full base image.

Suggested change
RUN apt-get -y update && apt-get -y upgrade && \
apt-get -y install \
build-essential \
git \
zip \
;
RUN apt-get -y update && \
apt-get -y install --no-install-recommends \
build-essential \
git \
zip \
&& rm -rf /var/lib/apt/lists/*

Copilot uses AI. Check for mistakes.

# Install Switch dev dependencies.
RUN dkp-pacman -Sy && dkp-pacman -S --noconfirm switch-dev

# Compile source code.
WORKDIR /workspace

ENTRYPOINT ["make"]
51 changes: 39 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,44 @@ The overlay can be used to change the config options and to see what patches are

## Building

### prerequisites
- Install [devkitpro](https://devkitpro.org/wiki/Getting_Started)
- Run the following:
```sh
git clone --recurse-submodules https://github.com/ITotalJustice/sys-patch.git
cd ./sys-patch
make
```

The output of `out/` can be copied to your SD card.
To activate the sys-module, reboot your switch, or, use [sysmodules overlay](https://github.com/WerWolv/ovl-sysmodules/releases/latest) with the accompanying overlay to activate it.
### Clone with submodules

Clone this repository (with submodules), and move into the project directory.

```sh
git clone --recurse-submodules https://github.com/ITotalJustice/sys-patch.git
cd ./sys-patch
```

If you cloned, but forgot the submodules, you can install them after-the-fact.

```sh
# git clone --recurse-submodules https://github.com/ITotalJustice/sys-patch.git
# cd ./sys-patch

git submodule init
git submodule update
```

### With Docker

1. Install [Docker Desktop](https://docker.com/desktop) (for Mac/Windows).
1. Run:

```sh
docker compose up --build
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a one-shot build container, docker compose up is a bit awkward because it creates/stops a named service container and may require manual cleanup/re-runs. Consider documenting docker compose run --rm syspatch (or up --abort-on-container-exit) to better match the intended “run build then exit” workflow.

Suggested change
docker compose up --build
docker compose run --rm syspatch

Copilot uses AI. Check for mistakes.
```

### Without Docker

1. Install [devkitARM](https://devkitpro.org/wiki/Getting_Started).
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This instruction likely points to the wrong toolchain for Nintendo Switch builds. The project uses libnx/switch_rules and -march=armv8-a... (AArch64), so users typically need devkitPro with devkitA64 (not devkitARM). Updating the wording here will prevent failed local builds.

Suggested change
1. Install [devkitARM](https://devkitpro.org/wiki/Getting_Started).
1. Install [devkitPro with devkitA64](https://devkitpro.org/wiki/Getting_Started).

Copilot uses AI. Check for mistakes.
2. Run:

```sh
make
```

The output of `out/` can be copied to the root of your SD card (DO NOT overwrite — merge the changes into the existing directory structure). To activate the sys-module, reboot your switch, or, use [sysmodules overlay](https://github.com/WerWolv/ovl-sysmodules/releases/latest) with the accompanying overlay to activate it.

---

Expand All @@ -60,7 +87,7 @@ Here's a quick run down of what's being patched:
- **fs** and **es** need new patches after every new firmware version.
- **ldr** needs new patches after every new [Atmosphere](https://github.com/Atmosphere-NX/Atmosphere/) release.
- **nifm** ctest patch allows the device to connect to a network without needing to make a connection to a server
- **nim** patches to the ssl function call within nim that queries "https://api.hac.%.ctest.srv.nintendo.net/v1/time", and crashes the console if console ssl certificate is not intact. This patch instead makes the console not crash.
- **nim** patches to the ssl function call within nim that queries `https://api.hac.%.ctest.srv.nintendo.net/v1/time`, and crashes the console if console ssl certificate is not intact. This patch instead makes the console not crash.

The patches are applied on boot. Once done, the sys-module stops running.
The memory footprint *(16kib)* and the binary size *(~50kib)* are both very small.
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
syspatch:
build:
context: .
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the bind mount, the container runs as root by default, so build artifacts written into the repo (e.g., out/, build/) will be owned by root on Linux hosts. Consider setting a user: (UID:GID) in the compose service or documenting this caveat so users don’t end up with permission issues when running Docker builds locally.

Suggested change
context: .
context: .
user: "${UID:-1000}:${GID:-1000}"

Copilot uses AI. Check for mistakes.
volumes:
- .:/workspace
Loading