mirror of
https://github.com/knutwurst/patchdl.git
synced 2026-10-06 07:00:26 +02:00
Make PS5 payload build reproducible
This commit is contained in:
1 parent
64bce0a3b5
commit
40b26e6c1b
4 files changed
+71
-3
No files matched your search
@@ -7,3 +7,4 @@ gen/
|
||||
*.elf
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.toolchains/
|
||||
@@ -1,6 +1,7 @@
|
||||
PS5_HOST ?= ps5
|
||||
PS5_PORT ?= 9021
|
||||
PATCHDL_HTTP_PORT ?= 12880
|
||||
ETAHEN_SOURCE_DIR ?= ../Source Code
|
||||
|
||||
ifdef PS5_PAYLOAD_SDK
|
||||
include $(PS5_PAYLOAD_SDK)/toolchain/prospero.mk
|
||||
@@ -16,9 +17,8 @@ SRCS := src/main.c src/patchdl_assets.c src/patchdl_websrv.c
|
||||
WEB_ASSETS := web/index.html web/styles.css web/app.js
|
||||
GEN_SRCS := $(patsubst web/%,gen/web/%.c,$(WEB_ASSETS))
|
||||
|
||||
CFLAGS := -g -O2 -Wall -Werror -Isrc -DPATCHDL_HTTP_PORT=$(PATCHDL_HTTP_PORT)
|
||||
LDADD := -lkernel_sys
|
||||
LDADD += `$(PS5_PAYLOAD_SDK)/bin/prospero-pkg-config libmicrohttpd --libs`
|
||||
CFLAGS := -g -O2 -Wall -Werror -Isrc -I"$(ETAHEN_SOURCE_DIR)/include" -DPATCHDL_HTTP_PORT=$(PATCHDL_HTTP_PORT)
|
||||
LDADD := -L"$(ETAHEN_SOURCE_DIR)/lib" -lmicrohttpd -lkernel_sys
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
|
||||
@@ -68,3 +68,40 @@ argv:
|
||||
```sh
|
||||
patchdl-ps5.elf 12881
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
PatchDL builds against `ps5-payload-dev/sdk` and reuses etaHEN's checked-in
|
||||
`libmicrohttpd.a` plus header files. By default, the Makefile expects etaHEN's
|
||||
source tree next to this repository:
|
||||
|
||||
```text
|
||||
../Source Code/include
|
||||
../Source Code/lib
|
||||
```
|
||||
|
||||
If the SDK is unpacked into `.toolchains/ps5-payload-sdk/ps5-payload-sdk`, the
|
||||
helper script sets the required environment automatically:
|
||||
|
||||
```sh
|
||||
scripts/build_ps5.sh clean all
|
||||
```
|
||||
|
||||
For a system-wide SDK install, set `PS5_PAYLOAD_SDK` yourself:
|
||||
|
||||
```sh
|
||||
export PS5_PAYLOAD_SDK=/opt/ps5-payload-sdk
|
||||
make clean all
|
||||
```
|
||||
|
||||
Override paths and ports as needed:
|
||||
|
||||
```sh
|
||||
make ETAHEN_SOURCE_DIR="/path/to/etaHEN/Source Code" PATCHDL_HTTP_PORT=12881
|
||||
```
|
||||
|
||||
Deploy with an ELF loader listening on the PS5:
|
||||
|
||||
```sh
|
||||
PS5_HOST=ps5 PS5_PORT=9021 scripts/build_ps5.sh test
|
||||
```
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
|
||||
if [ -z "${PS5_PAYLOAD_SDK:-}" ]; then
|
||||
LOCAL_SDK="$ROOT_DIR/.toolchains/ps5-payload-sdk/ps5-payload-sdk"
|
||||
if [ -d "$LOCAL_SDK" ]; then
|
||||
PS5_PAYLOAD_SDK="$LOCAL_SDK"
|
||||
export PS5_PAYLOAD_SDK
|
||||
else
|
||||
echo "PS5_PAYLOAD_SDK is unset and no local SDK exists at $LOCAL_SDK" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${LLVM_CONFIG:-}" ] && [ -x /opt/homebrew/opt/llvm@18/bin/llvm-config ]; then
|
||||
LLVM_CONFIG=/opt/homebrew/opt/llvm@18/bin/llvm-config
|
||||
export LLVM_CONFIG
|
||||
fi
|
||||
|
||||
if [ -n "${LLVM_CONFIG:-}" ]; then
|
||||
LLVM_BIN=$(dirname -- "$LLVM_CONFIG")
|
||||
PATH="$PS5_PAYLOAD_SDK/bin:$LLVM_BIN:$PATH"
|
||||
else
|
||||
PATH="$PS5_PAYLOAD_SDK/bin:$PATH"
|
||||
fi
|
||||
export PATH
|
||||
|
||||
exec make -C "$ROOT_DIR" "$@"
|
||||
Reference in new issue
Block a user