mirror of
https://github.com/ps5-linux/ps5-linux-loader.git
synced 2026-05-09 00:24:16 +00:00
Compare commits
10 Commits
v1.0
...
9d0bfe00b9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d0bfe00b9 | ||
|
|
b9e4b36688 | ||
|
|
5ae9c4de79 | ||
|
|
aedd5e3b38 | ||
|
|
b45045217f | ||
|
|
c602ff8063 | ||
|
|
65961996d7 | ||
|
|
354e996485 | ||
|
|
6ac9bab944 | ||
|
|
2497034be9 |
83
README.md
83
README.md
@@ -45,6 +45,17 @@ To run *ps5-linux*, you need some required and optional hardwares:
|
||||
|
||||
#### Linux/macOS:
|
||||
|
||||
Install docker:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install docker.io -y
|
||||
sudo service docker start
|
||||
sudo usermod -aG docker $USER
|
||||
```
|
||||
|
||||
Restart the terminal.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ps5-linux/ps5-linux-image
|
||||
cd ps5-linux-image
|
||||
@@ -99,36 +110,7 @@ sudo dd if=output/ps5-ubuntu2604.img of=/dev/sdX bs=4M status=progress conv=fsyn
|
||||
|
||||
#### Windows (Balena Etcher):
|
||||
|
||||
Download Balena Etcher, select the .img file, select your USB drive, click Flash.
|
||||
|
||||
#### Windows (WSL2 + usbipd):
|
||||
|
||||
Install usbipd in PowerShell as administrator:
|
||||
|
||||
```bash
|
||||
winget install usbipd
|
||||
```
|
||||
|
||||
Plug in your USB drive, list devices and find the busid of your drive:
|
||||
|
||||
```bash
|
||||
usbipd list
|
||||
```
|
||||
|
||||
Bind and attach it to WSL (replace 5-3 with your busid):
|
||||
|
||||
```bash
|
||||
usbipd bind --busid 5-3
|
||||
usbipd attach --busid 5-3 --wsl
|
||||
```
|
||||
|
||||
Then flash from WSL:
|
||||
|
||||
```bash
|
||||
lsblk # confirm the drive appeared, e.g. /dev/sdb
|
||||
sudo wipefs -a /dev/sdX
|
||||
sudo dd if=output/ps5-ubuntu2604.img of=/dev/sdX bs=4M status=progress
|
||||
```
|
||||
Download [Balena Etcher](https://etcher.balena.io/), select the .img file, select your USB drive, click Flash.
|
||||
|
||||
### 3. Plug the USB drive into your PS5
|
||||
|
||||
@@ -156,6 +138,13 @@ git clone https://github.com/ps5-linux/ps5-linux-loader
|
||||
cd ps5-linux-loader
|
||||
make
|
||||
```
|
||||
## Compiling on ARM64 Linux
|
||||
|
||||
Install the x86-64 cross-compilation tools before:
|
||||
|
||||
```bash
|
||||
sudo apt install gcc-x86-64-linux-gnu binutils-x86-64-linux-gnu
|
||||
```
|
||||
|
||||
Find your PS5 IP at `Settings → Network → View Connection Status`.
|
||||
|
||||
@@ -167,11 +156,13 @@ If all is successful, the payload will automatically go into rest mode. Wait unt
|
||||
|
||||
If the LED is white, but you still have a blackscreen then:
|
||||
|
||||
- Try removing `video=DP-1:1920x1080@60` line in cmdline.txt.
|
||||
- Try different monitors or capture cards, ideally with different resolutions. Currently, some monitors have issues.
|
||||
- Try setting `amdgpu.force_1080p=1` in `cmdline.txt` in the FAT32 partition of the USB drive.
|
||||
|
||||
If none of this helps, please report the issue in our [Discord server](https://discord.gg/PeMGVB7BAm) and provide your EDID information.
|
||||
|
||||
|
||||
## First Boot
|
||||
|
||||
Configure your system and memorize your login password.
|
||||
@@ -180,31 +171,38 @@ Then, there are certain settings and commands we recommend doing:
|
||||
|
||||
1. Disable screen saver, as it is currently buggy.
|
||||
|
||||
2. Install Firefox:
|
||||
2. Possibly, you have to disable and reenable your Wired/WLAN connection to get internet connection.
|
||||
|
||||
3. Install Firefox:
|
||||
|
||||
```bash
|
||||
sudo snap install firefox
|
||||
```
|
||||
|
||||
4. Update mesa:
|
||||
|
||||
```bash
|
||||
snap install firefox
|
||||
sudo snap refresh mesa-2404 --channel=latest/edge
|
||||
```
|
||||
|
||||
3. Clone our [ps5-linux-tools](https://github.com/ps5-linux/ps5-linux-tools):
|
||||
5. Clone our [ps5-linux-tools](https://github.com/ps5-linux/ps5-linux-tools):
|
||||
|
||||
```bash
|
||||
sudo apt install zlib1g-dev
|
||||
git clone https://github.com/ps5-linux/ps5-linux-tools
|
||||
cd ps5-linux-tools
|
||||
make
|
||||
```
|
||||
|
||||
## M.2 installation
|
||||
|
||||
You can use a M.2 SSD exclusively for Linux (which means you cannot use it for PS5 game storage).
|
||||
|
||||
1. Attach the M.SSD and boot Linux on your PS5.
|
||||
|
||||
2. Run these commands to initialize your M.2:
|
||||
1. Attach the M.SSD and format it on your PS5.
|
||||
2. Boot Linux on your PS5 and run these commands to initialize your M.2:
|
||||
|
||||
```bash
|
||||
sudo apt install zlib1g-dev
|
||||
cd ps5-linux-tools
|
||||
gcc -o m2_init m2_init.c -lz
|
||||
sudo ./m2_init
|
||||
```
|
||||
|
||||
@@ -226,6 +224,8 @@ chmod +x ./m2_exec.sh
|
||||
sudo ./m2_exec.sh
|
||||
```
|
||||
|
||||
Then follow the same instructions again as the previous section.
|
||||
|
||||
In order to always boot Linux from your M.2, you can edit the label at `/boot/efi/cmdline.txt` from `root=LABEL=ubuntu2604` to `root=LABEL=ubuntu2604-m2`.
|
||||
|
||||
## Fan & boost control
|
||||
@@ -234,7 +234,6 @@ We provide a simple tool that allows you to boost your CPU to 3500Mhz and GPU to
|
||||
|
||||
```bash
|
||||
cd ps5-linux-tools
|
||||
gcc -o ps5_control ps5_control.c
|
||||
sudo ./ps5_control --fan on
|
||||
sudo ./ps5_control --boost on
|
||||
```
|
||||
@@ -247,7 +246,6 @@ Always turn on fan when your turn on boost, as this is what the official PS5 OS
|
||||
- A: No, this is a soft-mod. You need to re-run the exploit in order to boot into Linux.
|
||||
- Q: Can I put Linux into standby and resume?
|
||||
- A: No, this is not supported. We may however add a shutdown feature that puts your PS5 into rest-mode allowing you to relaunch Linux when powering up again.
|
||||
|
||||
- Q: Can I continue using my PS5 if I install Linux?
|
||||
- A: Yes, the internal SSD is not modified
|
||||
- Q: Can I use the PS5's NIC/WLAN module in Linux?
|
||||
@@ -257,7 +255,7 @@ Always turn on fan when your turn on boost, as this is what the official PS5 OS
|
||||
- Q: Does the DualSense controller work?
|
||||
- A: Via a Bluetooth dongle. Built-in Bluetooth is not yet supported.
|
||||
- Q: What resolutions and refresh rates are supported?
|
||||
- A: So far only 1080p, 1440p and 2160p at 60Hz. 120Hz or 30Hz may be added in the future.
|
||||
- A: 1080p, 1440p and 2160p at 60Hz are broadly supported. 1440p@120Hz has been the only confirmed working on the DELL S3225QC yet. 120Hz or 30Hz may be added in the future.
|
||||
|
||||
|
||||
## Tips and tricks
|
||||
@@ -265,6 +263,9 @@ Always turn on fan when your turn on boost, as this is what the official PS5 OS
|
||||
- You can adjust the kernel cmdline in `cmdline.txt` in the FAT32 partition.
|
||||
- You can adjust the VRAM size in `vram.txt` in the FAT32 partition. By default, it uses 512MB (0x20000000) which enables [Dynamic VRAM allocation](https://elektricm.github.io/amd-bc250-docs/bios/flashing/#why-flash-the-bios).
|
||||
- Monitor hotswap may work, but it will not change resolution automatically.
|
||||
- Some monitors have a black screen if a video=DP-1: parameter is set in `cmdline.txt`. Confirmed working without `video=DP-1:1920x1080@60` on:
|
||||
- MSI MAG274Q QD E2, DELL S2721DGF, DELL U2515H (1440p@60Hz)
|
||||
- Possibly also: LG 27GL850, Lenovo Legion Y27q, ViewSonic Elite XG270QG
|
||||
|
||||
Many configurations, tips and tricks from the [AMD BC250 Documentation](https://elektricm.github.io/amd-bc250-docs/) also apply to PS5.
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "utils.h"
|
||||
#include <stdint.h>
|
||||
|
||||
static uint64_t alloc_page(void);
|
||||
static void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
||||
uint64_t alloc_page(void);
|
||||
void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
||||
int bits);
|
||||
void pte_store(uintptr_t ptep, uint64_t pte);
|
||||
static int read_file(const char *path, void *buf, size_t bufsize);
|
||||
static void trim_newline(char *s);
|
||||
int read_file(const char *path, void *buf, size_t bufsize);
|
||||
void trim_newline(char *s);
|
||||
int fetch_linux(struct linux_info *info);
|
||||
|
||||
@@ -3,9 +3,16 @@ ifndef PS5_PAYLOAD_SDK
|
||||
endif
|
||||
|
||||
# 1. Variables
|
||||
ifeq ($(shell uname -m),aarch64)
|
||||
CC = x86_64-linux-gnu-gcc
|
||||
LD = x86_64-linux-gnu-ld
|
||||
OBJCOPY = x86_64-linux-gnu-objcopy
|
||||
else
|
||||
CC = gcc
|
||||
LD = ld
|
||||
CFLAGS = -O2 -fno-stack-protector -ffreestanding -nostdlib -fcf-protection=none -I$(PS5_PAYLOAD_SDK)/target/include
|
||||
OBJCOPY = objcopy
|
||||
endif
|
||||
CFLAGS = -O2 -fno-stack-protector -ffreestanding -nostdlib -fcf-protection=none -m64 -I$(PS5_PAYLOAD_SDK)/target/include
|
||||
LDFLAGS = -T linker.ld
|
||||
TARGET = shellcode_hypervisor.elf
|
||||
TEXT_BIN = shellcode_hypervisor.bin
|
||||
@@ -23,7 +30,7 @@ $(TARGET): $(OBJ)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(TEXT_BIN): $(TARGET)
|
||||
objcopy -O binary -j .shell_code $(TARGET) $(TEXT_BIN)
|
||||
$(OBJCOPY) -O binary -j .shell_code $(TARGET) $(TEXT_BIN)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET) $(TEXT_BIN) $(dump)
|
||||
|
||||
@@ -3,9 +3,16 @@ ifndef PS5_PAYLOAD_SDK
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(shell uname -m),aarch64)
|
||||
CC = x86_64-linux-gnu-gcc
|
||||
LD = x86_64-linux-gnu-ld
|
||||
OBJCOPY = x86_64-linux-gnu-objcopy
|
||||
else
|
||||
CC = gcc
|
||||
LD = ld
|
||||
CFLAGS = -O2 -fno-stack-protector -ffreestanding -nostdlib -I$(PS5_PAYLOAD_SDK)/target/include
|
||||
OBJCOPY = objcopy
|
||||
endif
|
||||
CFLAGS = -O2 -fno-stack-protector -ffreestanding -nostdlib -m64 -I$(PS5_PAYLOAD_SDK)/target/include
|
||||
LDFLAGS = -T linker.ld
|
||||
TARGET = shellcode_kernel.elf
|
||||
TEXT_BIN = shellcode_text.bin
|
||||
@@ -24,7 +31,7 @@ $(TARGET): $(OBJ)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(TEXT_BIN): $(TARGET)
|
||||
objcopy -O binary -j .text $(TARGET) $(TEXT_BIN)
|
||||
$(OBJCOPY) -O binary -j .text $(TARGET) $(TEXT_BIN)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET) $(TEXT_BIN) $(dump)
|
||||
|
||||
@@ -217,10 +217,9 @@ int stage4_force_vmcb_reload(void) {
|
||||
int stage5_remove_xotext(void) {
|
||||
DEBUG_PRINT("\nHV-Defeat [stage5] xotext removal\n");
|
||||
|
||||
uint64_t start =
|
||||
ktext - 0xF0000; // Include first pages where fun stuff is located
|
||||
uint64_t start = ktext;
|
||||
uint64_t end = kdata;
|
||||
int n = 0;
|
||||
int n __attribute__((unused)) = 0;
|
||||
|
||||
for (uint64_t a = start; a < end; a += 0x1000) {
|
||||
page_chain_set_rw(a);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#define MINI_SYSCORE_PID 1
|
||||
|
||||
static uint64_t alloc_page(void) {
|
||||
uint64_t alloc_page(void) {
|
||||
|
||||
void *page = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
@@ -30,7 +30,7 @@ static uint64_t alloc_page(void) {
|
||||
return va_to_pa_user((uintptr_t)page);
|
||||
}
|
||||
|
||||
static void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
||||
void install_page(uintptr_t pml4, vm_offset_t va, vm_paddr_t pa,
|
||||
int bits) {
|
||||
uint64_t entry;
|
||||
|
||||
@@ -100,7 +100,7 @@ long find_and_get_size_of_file(const char *filename, char *found_path) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int find_and_read_file(const char *filename, void *buf, size_t bufsize) {
|
||||
int find_and_read_file(const char *filename, void *buf, size_t bufsize) {
|
||||
char full_path[256];
|
||||
struct stat st;
|
||||
|
||||
@@ -119,7 +119,7 @@ static int find_and_read_file(const char *filename, void *buf, size_t bufsize) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int read_file(const char *path, void *buf, size_t bufsize) {
|
||||
int read_file(const char *path, void *buf, size_t bufsize) {
|
||||
int fd = open(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
@@ -128,7 +128,7 @@ static int read_file(const char *path, void *buf, size_t bufsize) {
|
||||
return r;
|
||||
}
|
||||
|
||||
static void trim_newline(char *s) {
|
||||
void trim_newline(char *s) {
|
||||
while (*s != '\0') {
|
||||
if (*s == '\r' || *s == '\n') {
|
||||
*s = '\0';
|
||||
|
||||
@@ -197,7 +197,7 @@ offset_list off_0403 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.IOMMU_SOFTC = 0x33C7680,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
|
||||
@@ -225,8 +225,8 @@ void notify(const char *fmt, ...) {
|
||||
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
notify_internal(buffer);
|
||||
printf(buffer);
|
||||
notify_internal((uint8_t *)buffer);
|
||||
printf("%s", buffer);
|
||||
}
|
||||
|
||||
void notify_internal(uint8_t *msg) {
|
||||
@@ -236,7 +236,7 @@ void notify_internal(uint8_t *msg) {
|
||||
} req;
|
||||
bzero(&req, sizeof(req));
|
||||
uint64_t len =
|
||||
strlen(msg) < (sizeof(req.msg) - 1) ? strlen(msg) : (sizeof(req.msg) - 1);
|
||||
strlen((const char *)msg) < (sizeof(req.msg) - 1) ? strlen((const char *)msg) : (sizeof(req.msg) - 1);
|
||||
memcpy(req.msg, msg, len);
|
||||
sceKernelSendNotificationRequest(0, &req, sizeof(req), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user