diff --git a/.gitignore b/.gitignore index 2665037..ae8f410 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,14 @@ # Build output gen/ +build/ *.o *.a *.so *.elf __pycache__/ -diagnostics/*.json +diagnostics/ +output/ +screenshot.png # Local environment / editor noise .env diff --git a/Makefile b/Makefile index 9d2575f..fc51bb9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SHELL := bash ifeq ($(strip $(PS5_PAYLOAD_SDK)),) -ifneq ($(filter ps5-diag,$(MAKECMDGOALS)),ps5-diag) +ifeq ($(filter ps5-diag ps5-smoke,$(MAKECMDGOALS)),) $(error PS5_PAYLOAD_SDK is required, e.g. export PS5_PAYLOAD_SDK=/path/to/ps5-payload-sdk) endif else @@ -20,9 +20,8 @@ PS5_HOST ?= ps5 PS5_PORT ?= 9021 PYTHON ?= python3 WEB_PORT ?= 5905 -HELLO_HTTP_PORT ?= 5906 -VERSION_TAG := bfpilot-v0.2.1 +VERSION_TAG := bfpilot-v0.3 BUILD_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) LLVM_BINDIR ?= $(shell dirname "$$(command -v clang 2>/dev/null || command -v clang.exe 2>/dev/null || command -v llvm-strip 2>/dev/null || command -v llvm-strip.exe 2>/dev/null || echo clang)" 2>/dev/null || echo .) @@ -31,18 +30,7 @@ export LLVM_BINDIR export LLVM_CONFIG BFPILOT_BIN := bfpilot.elf -DEBUG_BIN := bfpilot-debug.elf -FULL_BIN := bfpilot-full.elf LAUNCHER_INSTALLER_BIN := bfpilot-launcher-installer.elf -SAFE_LAUNCHER_INSTALLER_BIN := bfpilot-launcher-installer-safe.elf -HELLO_BOOT_BIN := tests/hello_boot.elf -HELLO_HTTP_BIN := tests/hello_http.elf -HELLO_NOTIFY_BIN := tests/hello_notify.elf -INSTALLER_ENTER_PROBE_BIN := tests/installer_enter_probe.elf -INSTALLER_LINKONLY_APPINST_BIN := tests/installer_linkonly_appinst.elf -INSTALLER_RUNTIME_RESOLVE_APPINST_BIN := tests/installer_runtime_resolve_appinst.elf -INSTALLER_SYSMODULE_APPINST_BIN := tests/installer_sysmodule_appinst.elf -INSTALLER_WEBSRV_PATTERN_BIN := tests/installer_websrv_pattern.elf WEB_SRCS := src/lite_main.c WEB_SRCS += src/boot_marker.c @@ -54,55 +42,16 @@ WEB_SRCS += src/mime.c WEB_SRCS += src/notify.c WEB_SRCS += src/transfer.c -LEGACY_FULL_SRCS := $(WEB_SRCS) -LEGACY_FULL_SRCS += src/app_installer.c -LEGACY_FULL_SRCS += src/sce_resolve.c - LAUNCHER_INSTALLER_SRCS := src/launcher_installer_force_main.c LAUNCHER_INSTALLER_SRCS += src/boot_marker.c LAUNCHER_INSTALLER_SRCS += src/notify.c -SAFE_LAUNCHER_INSTALLER_SRCS := src/launcher_installer_main.c -SAFE_LAUNCHER_INSTALLER_SRCS += src/boot_marker.c -SAFE_LAUNCHER_INSTALLER_SRCS += src/notify.c -SAFE_LAUNCHER_INSTALLER_SRCS += src/sce_resolve.c - -HELLO_BOOT_SRCS := tests/hello_boot.c src/boot_marker.c src/notify.c -HELLO_HTTP_SRCS := tests/hello_http.c src/boot_marker.c src/notify.c -HELLO_NOTIFY_SRCS := tests/hello_notify.c src/boot_marker.c src/notify.c -INSTALLER_ENTER_PROBE_SRCS := tests/installer_enter_probe.c -INSTALLER_ENTER_PROBE_SRCS += src/boot_marker.c -INSTALLER_ENTER_PROBE_SRCS += src/notify.c -INSTALLER_LINKONLY_APPINST_SRCS := tests/installer_linkonly_appinst.c -INSTALLER_LINKONLY_APPINST_SRCS += src/boot_marker.c -INSTALLER_LINKONLY_APPINST_SRCS += src/notify.c -INSTALLER_RUNTIME_RESOLVE_APPINST_SRCS := tests/installer_runtime_resolve_appinst.c -INSTALLER_RUNTIME_RESOLVE_APPINST_SRCS += src/boot_marker.c -INSTALLER_RUNTIME_RESOLVE_APPINST_SRCS += src/notify.c -INSTALLER_SYSMODULE_APPINST_SRCS := tests/installer_sysmodule_appinst.c -INSTALLER_SYSMODULE_APPINST_SRCS += src/boot_marker.c -INSTALLER_SYSMODULE_APPINST_SRCS += src/notify.c -INSTALLER_WEBSRV_PATTERN_SRCS := tests/installer_websrv_pattern.c -INSTALLER_WEBSRV_PATTERN_SRCS += src/boot_marker.c -INSTALLER_WEBSRV_PATTERN_SRCS += src/notify.c - ASSETS := $(wildcard assets/*) GEN_SRCS := $(patsubst assets/%,gen/assets/%,$(ASSETS:=.c)) APP_ASSETS := assets-app/param.json assets-app/icon0.png BFPILOT_OBJS := $(patsubst %.c,build/bfpilot/%.o,$(WEB_SRCS) $(GEN_SRCS)) -DEBUG_OBJS := $(patsubst %.c,build/debug/%.o,$(WEB_SRCS) $(GEN_SRCS)) -LEGACY_FULL_OBJS := $(patsubst %.c,build/legacy-full/%.o,$(LEGACY_FULL_SRCS) $(GEN_SRCS)) LAUNCHER_INSTALLER_OBJS := $(patsubst %.c,build/launcher-installer/%.o,$(LAUNCHER_INSTALLER_SRCS)) -SAFE_LAUNCHER_INSTALLER_OBJS := $(patsubst %.c,build/launcher-installer-safe/%.o,$(SAFE_LAUNCHER_INSTALLER_SRCS)) -HELLO_BOOT_OBJS := $(patsubst %.c,build/hello-boot/%.o,$(HELLO_BOOT_SRCS)) -HELLO_HTTP_OBJS := $(patsubst %.c,build/hello-http/%.o,$(HELLO_HTTP_SRCS)) -HELLO_NOTIFY_OBJS := $(patsubst %.c,build/hello-notify/%.o,$(HELLO_NOTIFY_SRCS)) -INSTALLER_ENTER_PROBE_OBJS := $(patsubst %.c,build/installer-enter-probe/%.o,$(INSTALLER_ENTER_PROBE_SRCS)) -INSTALLER_LINKONLY_APPINST_OBJS := $(patsubst %.c,build/installer-linkonly-appinst/%.o,$(INSTALLER_LINKONLY_APPINST_SRCS)) -INSTALLER_RUNTIME_RESOLVE_APPINST_OBJS := $(patsubst %.c,build/installer-runtime-resolve-appinst/%.o,$(INSTALLER_RUNTIME_RESOLVE_APPINST_SRCS)) -INSTALLER_SYSMODULE_APPINST_OBJS := $(patsubst %.c,build/installer-sysmodule-appinst/%.o,$(INSTALLER_SYSMODULE_APPINST_SRCS)) -INSTALLER_WEBSRV_PATTERN_OBJS := $(patsubst %.c,build/installer-websrv-pattern/%.o,$(INSTALLER_WEBSRV_PATTERN_SRCS)) COMMON_CFLAGS := -Os -Wall -Werror -Isrc COMMON_CFLAGS += -ffunction-sections -fdata-sections -flto @@ -118,51 +67,11 @@ BFPILOT_CFLAGS += -DBFPILOT_DEBUG_NOTIFICATIONS=0 BFPILOT_CFLAGS += -DBFPILOT_ENABLE_LAUNCHER=0 BFPILOT_CFLAGS += -DBFPILOT_DISABLE_LAUNCHER=1 -DEBUG_CFLAGS := $(COMMON_CFLAGS) -DEBUG_CFLAGS += -DBFPILOT_PAYLOAD_NAME=\"bfpilot-debug\" -DEBUG_CFLAGS += -DBFPILOT_BUILD_MODE=\"debug\" -DEBUG_CFLAGS += -DBFPILOT_WEB_PORT=$(WEB_PORT) -DEBUG_CFLAGS += -DBFPILOT_DEBUG_NOTIFICATIONS=1 -DEBUG_CFLAGS += -DBFPILOT_ENABLE_LAUNCHER=0 -DEBUG_CFLAGS += -DBFPILOT_DISABLE_LAUNCHER=1 - -FULL_CFLAGS := $(COMMON_CFLAGS) -FULL_CFLAGS += -DBFPILOT_PAYLOAD_NAME=\"bfpilot-full\" -FULL_CFLAGS += -DBFPILOT_BUILD_MODE=\"full\" -FULL_CFLAGS += -DBFPILOT_WEB_PORT=$(WEB_PORT) -FULL_CFLAGS += -DBFPILOT_DEBUG_NOTIFICATIONS=1 -FULL_CFLAGS += -DBFPILOT_ENABLE_LAUNCHER=1 -FULL_CFLAGS += -DBFPILOT_DISABLE_LAUNCHER=0 - LAUNCHER_INSTALLER_CFLAGS := $(COMMON_CFLAGS) LAUNCHER_INSTALLER_CFLAGS += -DBFPILOT_PAYLOAD_NAME=\"bfpilot-launcher-installer\" LAUNCHER_INSTALLER_CFLAGS += -DBFPILOT_BUILD_MODE=\"launcher-installer-force\" -SAFE_LAUNCHER_INSTALLER_CFLAGS := $(COMMON_CFLAGS) -SAFE_LAUNCHER_INSTALLER_CFLAGS += -DBFPILOT_PAYLOAD_NAME=\"bfpilot-launcher-installer-safe\" -SAFE_LAUNCHER_INSTALLER_CFLAGS += -DBFPILOT_BUILD_MODE=\"launcher-installer-safe\" - -HELLO_BOOT_CFLAGS := $(COMMON_CFLAGS) -HELLO_BOOT_CFLAGS += -DBFPILOT_BUILD_MODE=\"hello-boot\" - -HELLO_HTTP_CFLAGS := $(COMMON_CFLAGS) -HELLO_HTTP_CFLAGS += -DBFPILOT_BUILD_MODE=\"hello-http\" -HELLO_HTTP_CFLAGS += -DBFPILOT_HELLO_HTTP_PORT=$(HELLO_HTTP_PORT) - -HELLO_NOTIFY_CFLAGS := $(COMMON_CFLAGS) -HELLO_NOTIFY_CFLAGS += -DBFPILOT_BUILD_MODE=\"hello-notify\" - -INSTALLER_ENTER_PROBE_CFLAGS := $(COMMON_CFLAGS) -INSTALLER_ENTER_PROBE_CFLAGS += -DBFPILOT_BUILD_MODE=\"installer-enter-probe\" - -INSTALLER_LINKONLY_APPINST_CFLAGS := $(COMMON_CFLAGS) -INSTALLER_LINKONLY_APPINST_CFLAGS += -DBFPILOT_BUILD_MODE=\"installer-linkonly-appinst\" - -INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS := $(COMMON_CFLAGS) -INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS += -DBFPILOT_BUILD_MODE=\"installer-runtime-resolve-appinst\" - COMMON_LDFLAGS := -Wl,--gc-sections -flto -APPINST_LDLIBS := -lSceAppInstUtil PRIVILEGED_APPINST_LDLIBS := -lkernel_sys -lSceSystemService PRIVILEGED_APPINST_LDLIBS += -lSceUserService -lSceAppInstUtil @@ -182,9 +91,6 @@ WINDOWS_LINK_PREFIX := --gc-sections --sysroot="$(PS5_PAYLOAD_SDK_POSIX)" WINDOWS_LINK_PREFIX += -L"$(PS5_PAYLOAD_SDK_POSIX)/target/lib" WINDOWS_LINK_PREFIX += -L"$(PS5_PAYLOAD_SDK_POSIX)/target/user/homebrew/lib" WINDOWS_LINK_PREFIX += -l:crt1.o -l:crti.o -l:crtbegin.o -lc -WINDOWS_BASE_SUFFIX := -lkernel_web -lSceLibcInternal -WINDOWS_BASE_SUFFIX += -lc_stub_weak -lkernel_stub_weak -WINDOWS_BASE_SUFFIX += -l:crtend.o -l:crtn.o WINDOWS_WEB_SUFFIX := -lkernel_web -lSceLibcInternal -lSceNet WINDOWS_WEB_SUFFIX += -lc_stub_weak -lkernel_stub_weak WINDOWS_WEB_SUFFIX += -l:crtend.o -l:crtn.o @@ -201,36 +107,12 @@ $(1) endef endif -all: bfpilot debug full launcher-installer launcher-installer-safe hello-boot hello-http hello-notify installer-enter-probe installer-linkonly-appinst installer-runtime-resolve-appinst installer-websrv-pattern +all: bfpilot launcher-installer bfpilot: $(BFPILOT_BIN) -debug: $(DEBUG_BIN) - -full: $(FULL_BIN) - -legacy-full: full - launcher-installer: $(LAUNCHER_INSTALLER_BIN) -launcher-installer-safe: $(SAFE_LAUNCHER_INSTALLER_BIN) - -hello-boot: $(HELLO_BOOT_BIN) - -hello-http: $(HELLO_HTTP_BIN) - -hello-notify: $(HELLO_NOTIFY_BIN) - -installer-enter-probe: $(INSTALLER_ENTER_PROBE_BIN) - -installer-linkonly-appinst: $(INSTALLER_LINKONLY_APPINST_BIN) - -installer-runtime-resolve-appinst: $(INSTALLER_RUNTIME_RESOLVE_APPINST_BIN) - -installer-sysmodule-appinst: $(INSTALLER_SYSMODULE_APPINST_BIN) - -installer-websrv-pattern: $(INSTALLER_WEBSRV_PATTERN_BIN) - gen/assets: $(call run,mkdir -p $@) @@ -241,180 +123,47 @@ build/bfpilot/%.o: %.c Makefile $(call run,mkdir -p $(dir $@)) $(call run,$(CC_CMD) $(BFPILOT_CFLAGS) -c $< -o $@) -build/debug/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(DEBUG_CFLAGS) -c $< -o $@) - -build/legacy-full/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(FULL_CFLAGS) -c $< -o $@) - build/launcher-installer/%.o: %.c Makefile $(call run,mkdir -p $(dir $@)) $(call run,$(CC_CMD) $(LAUNCHER_INSTALLER_CFLAGS) -c $< -o $@) -build/launcher-installer-safe/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(SAFE_LAUNCHER_INSTALLER_CFLAGS) -c $< -o $@) - -build/hello-boot/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(HELLO_BOOT_CFLAGS) -c $< -o $@) - -build/hello-http/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(HELLO_HTTP_CFLAGS) -c $< -o $@) - -build/hello-notify/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(HELLO_NOTIFY_CFLAGS) -c $< -o $@) - -build/installer-enter-probe/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(INSTALLER_ENTER_PROBE_CFLAGS) -c $< -o $@) - -build/installer-linkonly-appinst/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(INSTALLER_LINKONLY_APPINST_CFLAGS) -c $< -o $@) - -build/installer-runtime-resolve-appinst/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS) -c $< -o $@) - -build/installer-sysmodule-appinst/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS) -c $< -o $@) - -build/installer-websrv-pattern/%.o: %.c Makefile - $(call run,mkdir -p $(dir $@)) - $(call run,$(CC_CMD) $(INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS) -c $< -o $@) - ifeq ($(HOST_IS_WINDOWS),1) $(BFPILOT_BIN): $(BFPILOT_OBJS) $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(BFPILOT_OBJS) $(WINDOWS_WEB_SUFFIX)) $(call run,$(STRIP_CMD) --strip-all $@) $(call run,$(PYTHON) scripts/scrub_main_payload.py $@) -$(DEBUG_BIN): $(DEBUG_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(DEBUG_OBJS) $(WINDOWS_WEB_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - $(call run,$(PYTHON) scripts/scrub_main_payload.py $@) - -$(FULL_BIN): $(LEGACY_FULL_OBJS) $(APP_ASSETS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(LEGACY_FULL_OBJS) $(WINDOWS_WEB_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - $(LAUNCHER_INSTALLER_BIN): $(LAUNCHER_INSTALLER_OBJS) $(APP_ASSETS) $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(LAUNCHER_INSTALLER_OBJS) $(WINDOWS_APPINST_SUFFIX)) $(call run,$(STRIP_CMD) --strip-all $@) - -$(SAFE_LAUNCHER_INSTALLER_BIN): $(SAFE_LAUNCHER_INSTALLER_OBJS) $(APP_ASSETS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(SAFE_LAUNCHER_INSTALLER_OBJS) $(WINDOWS_BASE_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(HELLO_BOOT_BIN): $(HELLO_BOOT_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(HELLO_BOOT_OBJS) $(WINDOWS_BASE_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(HELLO_HTTP_BIN): $(HELLO_HTTP_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(HELLO_HTTP_OBJS) $(WINDOWS_WEB_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(HELLO_NOTIFY_BIN): $(HELLO_NOTIFY_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(HELLO_NOTIFY_OBJS) $(WINDOWS_BASE_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_ENTER_PROBE_BIN): $(INSTALLER_ENTER_PROBE_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(INSTALLER_ENTER_PROBE_OBJS) $(WINDOWS_BASE_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_LINKONLY_APPINST_BIN): $(INSTALLER_LINKONLY_APPINST_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(INSTALLER_LINKONLY_APPINST_OBJS) $(WINDOWS_APPINST_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_RUNTIME_RESOLVE_APPINST_BIN): $(INSTALLER_RUNTIME_RESOLVE_APPINST_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(INSTALLER_RUNTIME_RESOLVE_APPINST_OBJS) $(WINDOWS_BASE_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_WEBSRV_PATTERN_BIN): $(INSTALLER_WEBSRV_PATTERN_OBJS) - $(call run,$(LD_CMD) -o $@ $(WINDOWS_LINK_PREFIX) $(INSTALLER_WEBSRV_PATTERN_OBJS) $(WINDOWS_APPINST_SUFFIX)) - $(call run,$(STRIP_CMD) --strip-all $@) else $(BFPILOT_BIN): $(BFPILOT_OBJS) $(call run,$(CC_CMD) $(BFPILOT_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(BFPILOT_OBJS)) $(call run,$(STRIP_CMD) --strip-all $@) $(call run,$(PYTHON) scripts/scrub_main_payload.py $@) -$(DEBUG_BIN): $(DEBUG_OBJS) - $(call run,$(CC_CMD) $(DEBUG_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(DEBUG_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - $(call run,$(PYTHON) scripts/scrub_main_payload.py $@) - -$(FULL_BIN): $(LEGACY_FULL_OBJS) $(APP_ASSETS) - $(call run,$(CC_CMD) $(FULL_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(LEGACY_FULL_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - $(LAUNCHER_INSTALLER_BIN): $(LAUNCHER_INSTALLER_OBJS) $(APP_ASSETS) $(call run,$(CC_CMD) $(LAUNCHER_INSTALLER_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(LAUNCHER_INSTALLER_OBJS) $(PRIVILEGED_APPINST_LDLIBS)) $(call run,$(STRIP_CMD) --strip-all $@) - -$(SAFE_LAUNCHER_INSTALLER_BIN): $(SAFE_LAUNCHER_INSTALLER_OBJS) $(APP_ASSETS) - $(call run,$(CC_CMD) $(SAFE_LAUNCHER_INSTALLER_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(SAFE_LAUNCHER_INSTALLER_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(HELLO_BOOT_BIN): $(HELLO_BOOT_OBJS) - $(call run,$(CC_CMD) $(HELLO_BOOT_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(HELLO_BOOT_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(HELLO_HTTP_BIN): $(HELLO_HTTP_OBJS) - $(call run,$(CC_CMD) $(HELLO_HTTP_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(HELLO_HTTP_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(HELLO_NOTIFY_BIN): $(HELLO_NOTIFY_OBJS) - $(call run,$(CC_CMD) $(HELLO_NOTIFY_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(HELLO_NOTIFY_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_ENTER_PROBE_BIN): $(INSTALLER_ENTER_PROBE_OBJS) - $(call run,$(CC_CMD) $(INSTALLER_ENTER_PROBE_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(INSTALLER_ENTER_PROBE_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_LINKONLY_APPINST_BIN): $(INSTALLER_LINKONLY_APPINST_OBJS) - $(call run,$(CC_CMD) $(INSTALLER_LINKONLY_APPINST_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(INSTALLER_LINKONLY_APPINST_OBJS) $(APPINST_LDLIBS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_RUNTIME_RESOLVE_APPINST_BIN): $(INSTALLER_RUNTIME_RESOLVE_APPINST_OBJS) - $(call run,$(CC_CMD) $(INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(INSTALLER_RUNTIME_RESOLVE_APPINST_OBJS)) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_SYSMODULE_APPINST_BIN): $(INSTALLER_SYSMODULE_APPINST_OBJS) - $(call run,$(CC_CMD) $(INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(INSTALLER_SYSMODULE_APPINST_OBJS) -lSceSysmodule) - $(call run,$(STRIP_CMD) --strip-all $@) - -$(INSTALLER_WEBSRV_PATTERN_BIN): $(INSTALLER_WEBSRV_PATTERN_OBJS) - $(call run,$(CC_CMD) $(INSTALLER_RUNTIME_RESOLVE_APPINST_CFLAGS) $(COMMON_LDFLAGS) -o $@ $(INSTALLER_WEBSRV_PATTERN_OBJS) -lkernel_sys -lSceSystemService -lSceUserService -lSceAppInstUtil) - $(call run,$(STRIP_CMD) --strip-all $@) endif inspect-imports: all - $(call run,bash scripts/inspect_imports.sh $(BFPILOT_BIN) $(DEBUG_BIN) $(FULL_BIN) $(LAUNCHER_INSTALLER_BIN) $(SAFE_LAUNCHER_INSTALLER_BIN) $(HELLO_BOOT_BIN) $(HELLO_HTTP_BIN) $(HELLO_NOTIFY_BIN) $(INSTALLER_ENTER_PROBE_BIN) $(INSTALLER_LINKONLY_APPINST_BIN) $(INSTALLER_RUNTIME_RESOLVE_APPINST_BIN) $(INSTALLER_WEBSRV_PATTERN_BIN)) + $(call run,bash scripts/inspect_imports.sh $(BFPILOT_BIN) $(LAUNCHER_INSTALLER_BIN)) deploy-bfpilot: bfpilot $(call run,$(DEPLOY_CMD) -h $(PS5_HOST) -p $(PS5_PORT) $(BFPILOT_BIN)) -deploy-debug: debug - $(call run,$(DEPLOY_CMD) -h $(PS5_HOST) -p $(PS5_PORT) $(DEBUG_BIN)) - -deploy-full: full - $(call run,$(DEPLOY_CMD) -h $(PS5_HOST) -p $(PS5_PORT) $(FULL_BIN)) - deploy-launcher-installer: launcher-installer $(call run,$(DEPLOY_CMD) -h $(PS5_HOST) -p $(PS5_PORT) $(LAUNCHER_INSTALLER_BIN)) ps5-diag: $(call run,$(PYTHON) scripts/ps5_diag.py) +ps5-smoke: + $(call run,$(PYTHON) scripts/ps5_smoke.py) + clean: - $(call run,rm -rf $(BFPILOT_BIN) $(DEBUG_BIN) $(FULL_BIN) bfpilot-full-legacy.elf $(LAUNCHER_INSTALLER_BIN) $(SAFE_LAUNCHER_INSTALLER_BIN) bfpilot-core.elf build gen $(HELLO_BOOT_BIN) $(HELLO_HTTP_BIN) $(HELLO_NOTIFY_BIN) $(INSTALLER_ENTER_PROBE_BIN) $(INSTALLER_LINKONLY_APPINST_BIN) $(INSTALLER_RUNTIME_RESOLVE_APPINST_BIN) $(INSTALLER_SYSMODULE_APPINST_BIN) $(INSTALLER_WEBSRV_PATTERN_BIN) tests/hello_appinst.elf) + $(call run,rm -rf $(BFPILOT_BIN) $(LAUNCHER_INSTALLER_BIN) build gen) .SECONDARY: $(GEN_SRCS) -.PHONY: all bfpilot debug full legacy-full launcher-installer launcher-installer-safe hello-boot hello-http hello-notify installer-enter-probe installer-linkonly-appinst installer-runtime-resolve-appinst installer-sysmodule-appinst installer-websrv-pattern inspect-imports clean deploy-bfpilot deploy-debug deploy-full deploy-launcher-installer ps5-diag +.PHONY: all bfpilot launcher-installer inspect-imports clean deploy-bfpilot deploy-launcher-installer ps5-diag ps5-smoke diff --git a/README.md b/README.md index 57f9d1d..1879c15 100644 --- a/README.md +++ b/README.md @@ -1,136 +1,122 @@ # BFpilot -this is still in BETA phase but its working and does a good enough job. -BFpilot is a small PS5 userland payload that starts a browser-based file -manager on port `5905`. -It is intentionally narrow: no daemons,or anythink that doesnt serve the purpose of a file manager +BFpilot is a lightweight PS5 payload that serves a browser-based file manager at +`http://:5905/`. -Current prepared release: `v0.2.1` +The project is split into two payloads: -## Recommended Payload +- `bfpilot.elf` - the main file manager payload. +- `bfpilot-launcher-installer.elf` - an optional home-screen tile installer. -Use `bfpilot.elf` as the main release payload. +The main payload stays deliberately small and compatibility-focused. It does +not import launcher installer libraries, does not install the tile, and can be +used without touching PS5 app installation services. -`bfpilot.elf` is the maximum-compatibility file manager: +## Features -- Starts the HTTP file manager at `http://:5905/`. -- Does not install or refresh a PS5 home-screen tile. -- Does not compile or link `src/app_installer.c`. -- Does not link `libSceAppInstUtil`. -- Does not depend on AppInstUtil, SystemService, UserService, or optional - launcher-only Sony libraries. -- Writes boot and runtime diagnostics under `/data/BFpilot`. +- Browse local PS5 paths from a web browser. +- Upload and download files. +- Copy, move, rename, create folders, and delete from the web UI. +- PS5-side copy and move operations with progress and cancellation. +- Transfer timing, throughput, and device diagnostics. +- Clean places sidebar for Root, Homebrew, Mounts, User, Data, mounted drives, + and custom shortcuts. +- Mounted USB/ext drives are shown only when they are actually present. +- Top storage summary for Data and mounted drives. +- Persistent custom shortcuts with add, rename, and remove controls. +- Optional launcher tile that opens `http://127.0.0.1:5905/`. -Use `bfpilot-debug.elf` when you need extra proof that the payload reached -`main()` and progressed through startup. It is still file-manager-only and does -not link AppInstUtil. +## Download -Use `bfpilot-full.elf` when you want the 0.2.0-style integrated launcher -install path. This is the best first installer-capable build for your 11.6 case: -it starts BFpilot and attempts the home-screen tile install inside the same -process, after optional PS5 service initialization. It does not direct-link -AppInstUtil; it dynamically resolves the same AppInst functions used by the -previous full build. +Use the release assets: -Use `bfpilot-launcher-installer.elf` only after `bfpilot.elf` works. It is a -separate optional payload whose only job is installing or refreshing the -home-screen tile. It uses the complete pattern proven by ps5 websrv: direct -`kernel_sys`, SystemService, UserService, and AppInstUtil imports, UserService -initialization, and temporary system authid during registration. It restores -the original authid before exit. The file manager is still unaffected. +- `bfpilot.elf` for the file manager. +- `bfpilot-launcher-installer.elf` only if you want the PS5 home-screen tile. -Use `bfpilot-launcher-installer-safe.elf` only for diagnostics. It does not -direct-link AppInstUtil and reports whether AppInstUtil is already reachable -through the safe runtime path. +Run `bfpilot.elf` first. After the web UI is working, run the launcher installer +payload if you want the tile. -## What It Does +## Usage -- Runs a file-manager web UI at `http://:5905/`. -- Supports browse, upload, download, copy, move, rename, mkdir, and delete. -- Shows progress for copy, move, delete, and browser uploads. -- Creates missing copy/move target folders automatically. -- Keeps default shortcuts at `/data/homebrew` and `/mnt/usb0`. -- Writes boot markers to `/data/BFpilot/boot.log`. -- Writes runtime logs to `/data/BFpilot/log.txt`. -- Writes fatal-signal diagnostics to `/data/BFpilot/crash.log`. +Inject the file manager payload to your loader, usually on port `9021`: -The optional launcher tile, if installed by the separate installer payload, -opens: +```sh +python3 payload_sender.py 192.168.1.204 9021 bfpilot.elf +``` + +Open: + +```text +http://192.168.1.204:5905/ +``` + +Health checks: + +```text +http://192.168.1.204:5905/api/status +http://192.168.1.204:5905/api/diag +http://192.168.1.204:5905/api/fs/places +``` + +Install or refresh the launcher tile: + +```sh +python3 payload_sender.py 192.168.1.204 9021 bfpilot-launcher-installer.elf +``` + +The tile opens: ```text http://127.0.0.1:5905/ ``` -## Runtime Notes +## Build -Inject the ELF to your payload loader on port `9021`. +Set `PS5_PAYLOAD_SDK` to your PS5 payload SDK path: -First test: - -```text -send bfpilot.elf to :9021 -open http://:5905/ -open http://:5905/api/status -open http://:5905/api/diag +```sh +export PS5_PAYLOAD_SDK=/path/to/ps5-payload-sdk +make clean all +make inspect-imports ``` -Debug test: +Expected outputs: ```text -send bfpilot-debug.elf to :9021 -open http://:5905/api/diag -check /data/BFpilot/boot.log -check /data/BFpilot/log.txt +bfpilot.elf +bfpilot-launcher-installer.elf ``` -Full install test: - -```text -send bfpilot-full.elf to :9021 -open http://:5905/ -check /data/BFpilot/log.txt -``` - -Alternate port test while an old instance is still running: - -```text -send bfpilot-debug.elf --port 5906 to :9021 -open http://:5906/api/status -``` - -Launcher installer test: - -```text -send bfpilot-launcher-installer.elf to :9021 -check /data/BFpilot/launcher-installer.log -``` - -If `bfpilot-launcher-installer.elf` gives no notification and no log, run the -probes below to distinguish ordinary entry, incomplete AppInst imports, and the -complete websrv dependency pattern. - -If the launcher installer appears to do nothing, run the probes in this order: - -```text -tests/installer_enter_probe.elf -tests/installer_linkonly_appinst.elf -tests/installer_runtime_resolve_appinst.elf -tests/installer_websrv_pattern.elf -``` - -If `installer_linkonly_appinst.elf` does not create -`/data/BFpilot/linkonly_appinst_entered.txt`, direct AppInstUtil imports are -failing before `main()` on that loader/firmware. - -If `installer_runtime_resolve_appinst.elf` logs -`kernel_dynlib_handle libSceAppInstUtil.sprx rc=0xffffffff`, AppInstUtil is not -reachable through BFpilot's safe runtime path on that firmware/loader. That does -not invalidate the `bfpilot-full.elf` path on firmware where the same runtime -resolution is available, such as the 11.6 case you reported. +`make inspect-imports` verifies that the file manager payload does not contain +launcher/AppInstUtil imports and that the isolated installer contains the +required installer imports. ## Diagnostics -Save these files when reporting failures: +Local read-only diagnostics: + +```sh +PS5_IP=192.168.1.204 BF_WEB_PORT=5905 make ps5-diag +``` + +Smoke test the file APIs using only BFpilot-created files under `/data/test`: + +```sh +PS5_IP=192.168.1.204 BF_WEB_PORT=5905 \ +BF_ALLOW_PS5_WRITE=1 \ +make ps5-smoke +``` + +Optional benchmark mode writes under `/data/test/bfpilot-bench` by default: + +```sh +PS5_IP=192.168.1.204 BF_WEB_PORT=5905 \ +BF_ALLOW_PS5_WRITE=1 \ +BF_ALLOWED_REMOTE_ROOTS=/data/test/bfpilot-bench \ +python3 scripts/ps5_diag.py --bench +``` + +Runtime logs are stored on the PS5 at: ```text /data/BFpilot/boot.log @@ -139,74 +125,15 @@ Save these files when reporting failures: /data/BFpilot/launcher-installer.log ``` -If there is no notification and no `/data/BFpilot/boot.log` entry, the payload -probably failed before `main()` or the loader rejected it. If the boot marker -appears but the server does not start, the failure happened after `main()`. +## Compatibility Notes -## Build +`bfpilot.elf` is file-manager-only by design. It avoids AppInstUtil, +SystemService, UserService, and privileged launcher imports because those can +fail before `main()` on some firmware/loader combinations. -```sh -export PS5_PAYLOAD_SDK=/path/to/ps5-payload-sdk -make clean all -``` +`bfpilot-launcher-installer.elf` is separate and uses the complete launcher +installer dependency set. If launcher installation fails on a firmware, the file +manager payload remains usable. -Individual targets: - -```sh -make bfpilot -make debug -make full -make launcher-installer -make hello-boot -make hello-http -make hello-notify -make installer-enter-probe -make installer-linkonly-appinst -make installer-runtime-resolve-appinst -make inspect-imports -``` - -Outputs: - -```text -bfpilot.elf -bfpilot-debug.elf -bfpilot-full.elf -bfpilot-launcher-installer.elf -bfpilot-launcher-installer-safe.elf -tests/hello_boot.elf -tests/hello_http.elf -tests/hello_notify.elf -tests/installer_enter_probe.elf -tests/installer_linkonly_appinst.elf -tests/installer_runtime_resolve_appinst.elf -``` - -The compatibility check must pass for release builds: - -```sh -make inspect-imports -``` - -It fails if `bfpilot.elf` or `bfpilot-debug.elf` contain AppInstUtil, -`sceAppInst`, `app_installer`, or `BFPL00001` installer fingerprints. Direct -`libSceAppInstUtil.sprx` import is allowed only for installer/probe targets. -The release installer must also import `kernel_sys`, SystemService, and -UserService; `make inspect-imports` enforces this composition. - -## Project Layout - -- `src/lite_main.c` starts the file-manager payload, handles clean reload, and - starts the web server. -- `src/boot_marker.c` writes the earliest cross-payload boot marker. -- `src/websrv_lite.c` serves `/`, `/api/status`, `/api/diag`, `/fs`, and - `/api/fs/*`. -- `src/transfer.c` contains upload, copy, move, delete, and long-running job - handling. -- `src/launcher_installer_main.c` is the isolated optional launcher installer. -- `tests/` contains small probe payloads for loader, HTTP, notification, and - AppInstUtil testing. - -See [docs/COMPATIBILITY_STRATEGY.md](docs/COMPATIBILITY_STRATEGY.md) for the -firmware compatibility strategy and [docs/FIRMWARE_TESTING.md](docs/FIRMWARE_TESTING.md) -for the test protocol. +More detail is in [docs/COMPATIBILITY_STRATEGY.md](docs/COMPATIBILITY_STRATEGY.md) +and [docs/FIRMWARE_TESTING.md](docs/FIRMWARE_TESTING.md). diff --git a/assets/files.html b/assets/files.html index 6cf6ed7..d1c8785 100644 --- a/assets/files.html +++ b/assets/files.html @@ -119,16 +119,49 @@ min-width: 0; } - .title strong { + .title > strong { display: block; font-size: 18px; } - .title span { + .title > span { color: var(--muted); font-size: 12px; } + .storage-summary { + margin-top: 3px; + display: flex; + flex-wrap: wrap; + gap: 8px; + color: var(--muted); + font-size: 11px; + line-height: 1.3; + } + + .storage-summary span { + min-width: 0; + max-width: 100%; + border: 0; + background: transparent; + padding: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .storage-summary span + span::before { + content: "ยท "; + color: #667789; + } + + .storage-summary strong { + display: inline; + color: var(--ink); + font-size: inherit; + font-weight: 600; + } + .status { min-height: 30px; display: inline-flex; @@ -158,7 +191,7 @@ margin: 0 auto; padding: 14px; display: grid; - grid-template-columns: 150px minmax(0, 1fr) 300px; + grid-template-columns: 190px minmax(0, 1fr) 300px; gap: 12px; min-height: 0; } @@ -179,13 +212,32 @@ align-self: start; display: grid; gap: 8px; + overflow: hidden; + } + + .rail-list, + .rail-tools { + display: grid; + gap: 6px; + } + + .rail-title { + color: var(--muted); + font-size: 11px; + font-weight: 700; + letter-spacing: 0.04em; + text-transform: uppercase; } .rail button { width: 100%; + min-width: 0; justify-content: flex-start; text-align: left; background: var(--soft); + white-space: normal; + padding: 6px 10px; + min-height: 34px; } .rail button.active { @@ -195,6 +247,24 @@ font-weight: 700; } + .place-label { + display: block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .place-meta { + display: block; + margin-top: 1px; + color: var(--muted); + font-size: 10.5px; + font-weight: 400; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .browser { min-height: 650px; display: grid; @@ -341,14 +411,48 @@ } .target-buttons, - .target-grid { + .target-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } + .target-grid { + display: grid; + grid-template-columns: 1fr; + gap: 8px; + } + .target-grid button { background: var(--soft); + min-width: 0; + padding: 7px 9px; + overflow-wrap: anywhere; + white-space: normal; + font-family: Consolas, Menlo, monospace; + font-size: 12px; + line-height: 1.25; + } + + .target-label { + display: block; + color: var(--ink); + font-family: Arial, Helvetica, sans-serif; + font-size: 13px; + font-weight: 700; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .target-meta { + display: block; + margin-top: 2px; + color: var(--muted); + font-family: Consolas, Menlo, monospace; + font-size: 10.5px; + font-weight: 400; + overflow-wrap: anywhere; } .detail { @@ -502,19 +606,21 @@ grid-column: 1 / -1; } + .storage-summary span { + max-width: calc(100vw - 96px); + } + .shell { grid-template-columns: 1fr; padding: 10px; } .rail { - display: flex; - overflow-x: auto; + display: grid; } .rail button { - width: auto; - flex: 0 0 auto; + width: 100%; } .pathbar { @@ -565,13 +671,24 @@
BFpilot File Manager +
+ Storage: loading +
Connecting
- +
@@ -603,15 +720,13 @@