Skip to content
Merged
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
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,27 @@ Control VRAM size via a plain text file containing a number in **MB** (not GB).

| vram.txt value | VRAM allocated | Payload suffix |
|:-:|:-:|:-:|
| `32` | 32 MB | `-32mb` |
| `64` | 64 MB | `-64mb` |
| `128` | 128 MB | `-128mb` |
| `256` | 256 MB | `-256mb` |
| `512` | 512 MB | `-512mb` |
| `1024` | 1 GB | `-1gb` |
| `2048` | 2 GB | `-2gb` |
| `3072` | 3 GB | `-3gb` |
| `4096` | 4 GB | `-4gb` |

Default is 1024 MB (1 GB) if vram.txt is missing or invalid. Minimum is 256 MB.
Default is 1024 MB (1 GB) if vram.txt is missing or invalid. Minimum is **32 MB**.

> **Note:** 128 MB is not supported — still under testing
> **Note:** 32 MB and 64 MB VRAM payloads work (tested on Aeolia/Belize). These are not included in the default precompiled releases, but you can compile them yourself by editing the `SIZES_MB` variable in the Makefile.

## Server Use (256MB / 512MB VRAM)
## Server Use (Low VRAM Payloads)

- **Why 256MB and 512MB?** The idea behind these low VRAM payloads is for users who are repurposing the PS4 as a server for RAM and CPU intensive tasks. If you're just running server stuff headless, you don't need 1GB+ of memory wasted on the GPU. Using these payloads frees up that shared unified memory to be used as regular system RAM instead.
- **Why 32MB, 64MB, 128MB, 256MB, 512MB?** The idea behind these low VRAM payloads is for users who are repurposing the PS4 as a server for RAM and CPU intensive tasks. If you're just running server stuff headless, you don't need 1GB+ of memory wasted on the GPU. Using these payloads frees up that shared unified memory to be used as regular system RAM instead.

- **How to use:**
- **Option 1:** Just run the 256mb or 512mb payloads.
- **Option 2:** Just add `256` or `512` into your `vram.txt` file to set it manually. Don't use these if you plan on gaming or using heavy desktop graphics!
- **Option 1:** Just run the payload with the desired VRAM size (e.g. `-32mb`, `-64mb`, etc.).
- **Option 2:** Add the value (e.g. `32`, `64`, `128`, etc.) into your `vram.txt` file to set it manually. Don't use these if you plan on gaming or using heavy desktop graphics!

## Note
* Use .elf`s files instead of .bin whenever possible as they provide a better success rate.
Expand All @@ -74,6 +77,7 @@ Baikal: ``console=uart8250,mmio32,0xC890E000``
## How to Compile
git clone https://github.com/ArabPixel/ps4-linux-payloads
cd ps4-linux-payloads/linux
# Edit the Makefile SIZES_MB variable to add 32 or 64 if you want those payloads
make


Expand All @@ -88,7 +92,8 @@ Baikal: ``console=uart8250,mmio32,0xC890E000``

## Change log

- Sub-1GB VRAM payloads – Added 256mb and 512mb payload sizes for PS4 used as a headless server where GPU memory is largely unused. Set `vram.txt` to `256` or `512` (MB) to use them. [v22](https://github.com/ArabPixel/ps4-linux-payloads/releases/tag/v22)
- Sub-1GB VRAM payloads – Added 128mb, 256mb and 512mb payload sizes for PS4 used as a headless server where GPU memory is largely unused. Set `vram.txt` to `128`, `256` or `512` (MB) to use them. [v22](https://github.com/ArabPixel/ps4-linux-payloads/releases/tag/v22)
- **128MB VRAM payloads are now supported (compile yourself by editing Makefile).**

- PS4 12.5x, 13.0x Support. [v21.5](https://github.com/ArabPixel/ps4-linux-payloads/releases/tag/v21.5)

Expand Down
24 changes: 15 additions & 9 deletions linux/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FIRMWARES = 505 672 700 750 800 850 900 903 960 1000 1050 1100 1102 1150 1200 1250 1300 1302
SIZES = 256mb 512mb 1gb 2gb 3gb 4gb
SIZES_MB = 128 256 512 1024 2048 3072 4096

# Generate payload targets automatically
PAYLOADS = $(foreach fw,$(FIRMWARES), \
$(foreach sz,$(SIZES), \
fw$(fw)/payload-$(fw)-$(sz).bin \
fw$(fw)/payload-$(fw)-$(sz)-baikal.bin))
$(foreach sz,$(SIZES_MB), \
fw$(fw)/payload-$(fw)-$(sz)mb.bin \
fw$(fw)/payload-$(fw)-$(sz)mb-baikal.bin))

# Common compiler flags
CC = gcc
Expand All @@ -14,7 +14,7 @@ LDFLAGS = -Wl,-gc-sections

# VRAM size flags - value passed as MB to allow sub-1GB sizes (256/512 MB)
define VRAM_FLAGS
$(if $(filter 256mb,$(1)),-DVRAM_MB_DEFAULT=256,$(if $(filter 512mb,$(1)),-DVRAM_MB_DEFAULT=512,$(if $(filter 1gb,$(1)),-DVRAM_MB_DEFAULT=1024,$(if $(filter 2gb,$(1)),-DVRAM_MB_DEFAULT=2048,$(if $(filter 3gb,$(1)),-DVRAM_MB_DEFAULT=3072,$(if $(filter 4gb,$(1)),-DVRAM_MB_DEFAULT=4096))))))
# No longer needed, but kept for reference if legacy support is required
endef

# Firmware version formatting helper (handles both 3-digit and 4-digit versions)
Expand Down Expand Up @@ -52,15 +52,21 @@ ps4-kexec-%/kexec.bin:
file $@ | fgrep -q '$@: DOS executable (COM)'

# Template function to generate rules
# Usage: $(call make-payload-rule,firmware,size,main-source,variant-suffix)
# Usage: $(call make-payload-rule,firmware,size_in_mb,main-source,variant-suffix)
define make-payload-rule
fw$(1)/payload-$(1)-$(2)$(4).elf: ../lib/lib.a $(3) ps4-kexec-$(1)$(4)/kexec.bin
$(CC) $(CFLAGS) ../lib/lib.a -D__$(call FW_VERSION,$(1))__ -DPS4_$(call FW_VERSION,$(1)) $(call VRAM_FLAGS,$(2)) $(3) $(LDFLAGS) -o $$@
fw$(1)/payload-$(1)-$(2)mb$(4).elf: ../lib/lib.a $(3) ps4-kexec-$(1)$(4)/kexec.bin
@mkdir -p fw$(1)
$(CC) $(CFLAGS) ../lib/lib.a \
-D__$(call FW_VERSION,$(1))__ -DPS4_$(call FW_VERSION,$(1)) \
-DVRAM_MB_DEFAULT=$(2) \
-DVRAM_MB_MIN=32 \
-DVRAM_MB_MAX=4096 \
$(3) $(LDFLAGS) -o $$@
endef

# Generate all rules for each firmware
$(foreach fw,$(FIRMWARES), \
$(foreach sz,$(SIZES), \
$(foreach sz,$(SIZES_MB), \
$(eval $(call make-payload-rule,$(fw),$(sz),main.c,)) \
$(eval $(call make-payload-rule,$(fw),$(sz),main-baikal.c,-baikal)) \
) \
Expand Down
6 changes: 4 additions & 2 deletions linux/main-baikal.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ int my_atoi(const char *s)
#endif

#ifndef VRAM_MB_MIN
#define VRAM_MB_MIN 256
#define VRAM_MB_MIN 128
#endif

// VRAM_MB_MAX is injected by the Makefile
// Provide a safe fallback only if somehow not set (should not happen in normal builds).
#ifndef VRAM_MB_MAX
#define VRAM_MB_MAX 5120
#define VRAM_MB_MAX 4096
#endif

#ifndef HDD_BOOT_PATH
Expand Down
6 changes: 4 additions & 2 deletions linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ int my_atoi(const char *s)
#endif

#ifndef VRAM_MB_MIN
#define VRAM_MB_MIN 256
#define VRAM_MB_MIN 128
#endif

// VRAM_MB_MAX is injected by the Makefile
// Provide a safe fallback only if somehow not set (should not happen in normal builds).
#ifndef VRAM_MB_MAX
#define VRAM_MB_MAX 5120
#define VRAM_MB_MAX 4096
#endif

#ifndef HDD_BOOT_PATH
Expand Down