mirror of
https://github.com/ps5-linux/ps5-linux-loader.git
synced 2026-05-09 16:32:00 +00:00
Compare commits
4 Commits
9d0bfe00b9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a58386b98 | ||
|
|
dcb60beef2 | ||
|
|
9f1d4f683d | ||
|
|
235ad43eb5 |
23
README.md
23
README.md
@@ -173,19 +173,24 @@ Then, there are certain settings and commands we recommend doing:
|
||||
|
||||
2. Possibly, you have to disable and reenable your Wired/WLAN connection to get internet connection.
|
||||
|
||||
3. Install Firefox:
|
||||
3. Hold packages to prevent updating the kernel when doing `apt upgrade`:
|
||||
```bash
|
||||
sudo apt-mark hold linux-generic linux-generic-hwe-24.04 linux-generic-hwe-26.04 linux-image-generic linux-image-generic-hwe-24.04 linux-image-generic-hwe-26.04 linux-headers-generic linux-headers-generic-hwe-24.04 linux-headers-generic-hwe-26.04
|
||||
```
|
||||
|
||||
4. Install Firefox:
|
||||
|
||||
```bash
|
||||
sudo snap install firefox
|
||||
```
|
||||
|
||||
4. Update mesa:
|
||||
5. Update mesa:
|
||||
|
||||
```bash
|
||||
sudo snap refresh mesa-2404 --channel=latest/edge
|
||||
```
|
||||
|
||||
5. Clone our [ps5-linux-tools](https://github.com/ps5-linux/ps5-linux-tools):
|
||||
6. Clone our [ps5-linux-tools](https://github.com/ps5-linux/ps5-linux-tools):
|
||||
|
||||
```bash
|
||||
sudo apt install zlib1g-dev
|
||||
@@ -198,17 +203,18 @@ Then, there are certain settings and commands we recommend doing:
|
||||
|
||||
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 format it on your PS5.
|
||||
2. Boot Linux on your PS5 and run these commands to initialize your M.2:
|
||||
1. Attach the M.2 SSD by following the [official guide](https://www.playstation.com/en-us/support/hardware/ps5-install-m2-ssd).
|
||||
2. **VERY IMPORTANT**: If you used the M2. SSD for games before, reformat it on the PS5 under `Settings` → `Storage` → `M.2 SSD Storage`.
|
||||
3. Boot Linux on your PS5 and run these commands to initialize your M.2:
|
||||
|
||||
```bash
|
||||
cd ps5-linux-tools
|
||||
sudo ./m2_init
|
||||
```
|
||||
|
||||
3. Reboot via `sudo reboot`. If your PS5 asks you to format your M.2 again, please report this issue to us in our [Discord server](https://discord.gg/PeMGVB7BAm) and provide your M.2 model and storage size.
|
||||
4. Relaunch Linux on your PS5.
|
||||
5. Copy the `ps5-ubuntu2604.img` image that you built during installation or rebuild it on your PS5. Then, install it onto your M.2:
|
||||
4. Reboot via `sudo reboot`. If your PS5 asks you to format your M.2 again, please report this issue to us in our [Discord server](https://discord.gg/PeMGVB7BAm) and provide your M.2 model and storage size.
|
||||
5. Relaunch Linux on your PS5.
|
||||
6. Copy the `ps5-ubuntu2604.img` image that you built during installation or rebuild it on your PS5. Then, install it onto your M.2:
|
||||
|
||||
```bash
|
||||
cd ps5-linux-tools
|
||||
@@ -260,6 +266,7 @@ Always turn on fan when your turn on boost, as this is what the official PS5 OS
|
||||
|
||||
## Tips and tricks
|
||||
|
||||
- If you see graphical issues in your games, add the environment variable `RADV_DEBUG=nohiz` as [recommended for BC250](https://elektricm.github.io/amd-bc250-docs/drivers/environment/#critical-environment-variables) as well.
|
||||
- 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.
|
||||
|
||||
@@ -42,6 +42,7 @@ struct linux_info {
|
||||
size_t initrd_size;
|
||||
size_t vram_size;
|
||||
char cmdline[2048];
|
||||
int kit_type;
|
||||
uintptr_t linux_info; // PA of linux_info
|
||||
};
|
||||
|
||||
@@ -156,4 +157,17 @@ void enter_rest_mode(void);
|
||||
#define DEBUG_PRINT(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
bool if_exists(const char* path);
|
||||
bool sceKernelIsTestKit(void);
|
||||
bool sceKernelIsDevKit(void);
|
||||
|
||||
enum kit_type {
|
||||
KIT_RETAIL,
|
||||
KIT_TESTKIT,
|
||||
KIT_DEVKIT
|
||||
};
|
||||
|
||||
enum kit_type get_kit_type(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@ struct linux_info {
|
||||
size_t initrd_size;
|
||||
size_t vram_size;
|
||||
char cmdline[2048];
|
||||
int kit_type;
|
||||
};
|
||||
|
||||
static struct linux_info info;
|
||||
@@ -88,8 +89,16 @@ static void e820_memory_setup(struct boot_params *bp) {
|
||||
append_e820_table(bp, 0x0f0000000, 0x0f8000000, E820_TYPE_RESERVED);
|
||||
append_e820_table(bp, 0x100000000, VRAM_BASE, E820_TYPE_RAM);
|
||||
append_e820_table(bp, VRAM_BASE, 0x470000000, E820_TYPE_RESERVED); // VRAM
|
||||
append_e820_table(bp, 0x470000000, 0x47f300000, E820_TYPE_RAM);
|
||||
append_e820_table(bp, 0x47f300000, 0x480000000, E820_TYPE_RESERVED);
|
||||
|
||||
// DevKits have 32GB
|
||||
if (info.kit_type != KIT_DEVKIT) {
|
||||
append_e820_table(bp, 0x470000000, 0x47f300000, E820_TYPE_RAM);
|
||||
append_e820_table(bp, 0x47f300000, 0x480000000, E820_TYPE_RESERVED);
|
||||
}
|
||||
else {
|
||||
append_e820_table(bp, 0x470000000, 0x87f300000, E820_TYPE_RAM);
|
||||
append_e820_table(bp, 0x87f300000, 0x880000000, E820_TYPE_RESERVED);
|
||||
}
|
||||
}
|
||||
|
||||
void boot_linux(void) {
|
||||
@@ -124,7 +133,7 @@ void boot_linux(void) {
|
||||
|
||||
memcpy((void *)kernel_pa, (void *)(info.bzimage + setup_size), kernel_size);
|
||||
|
||||
// printf("This is kernel_pa: "); print_val64(kernel_pa); printf("\n");
|
||||
|
||||
void (*startup_64)(uint64_t physaddr, struct boot_params *bp) =
|
||||
(void *)(kernel_pa + 0x200);
|
||||
startup_64(kernel_pa, bp);
|
||||
@@ -159,7 +168,7 @@ void entry(void) {
|
||||
}
|
||||
|
||||
// Disable IOMMU.
|
||||
*(volatile uint64_t *)0xfdd80018 &= ~1;
|
||||
*(volatile uint64_t *)(AMDIOMMU_MMIO_BASE + AMDIOMMU_CTRL) &= ~1;
|
||||
|
||||
memcpy(&info, (void *)(cave_linux_info), sizeof(struct linux_info));
|
||||
|
||||
|
||||
@@ -37,7 +37,16 @@
|
||||
#define DCHUBBUB_WHITELIST_BASE_ADDR_0 0x24878
|
||||
#define DCHUBBUB_WHITELIST_TOP_ADDR_0 0x2487c
|
||||
|
||||
#define AMDIOMMU_MMIO_BASE 0xfdd80000
|
||||
#define AMDIOMMU_CTRL 0x18
|
||||
|
||||
#define MAXCPU 16
|
||||
|
||||
void entry(void);
|
||||
void boot_linux(void);
|
||||
void boot_linux(void);
|
||||
|
||||
enum kit_type {
|
||||
KIT_RETAIL,
|
||||
KIT_TESTKIT,
|
||||
KIT_DEVKIT
|
||||
};
|
||||
@@ -46,6 +46,7 @@ struct linux_info {
|
||||
size_t initrd_size;
|
||||
size_t vram_size;
|
||||
char cmdline[2048];
|
||||
int kit_type;
|
||||
};
|
||||
|
||||
static struct linux_info info;
|
||||
|
||||
@@ -220,6 +220,7 @@ int fetch_linux(struct linux_info *info) {
|
||||
info->initrd_size = initrd_size;
|
||||
info->vram_size = vram_size;
|
||||
strcpy(info->cmdline, cmdline);
|
||||
info->kit_type = (int) get_kit_type();
|
||||
|
||||
uint64_t page = alloc_page();
|
||||
kwrite(pa_to_dmap(page), info, sizeof(struct linux_info));
|
||||
|
||||
@@ -5,8 +5,8 @@ offset_list off_0300 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33175E0,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -37,8 +37,8 @@ offset_list off_0310 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33175E0,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -69,8 +69,8 @@ offset_list off_0320 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33175E0,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -101,8 +101,8 @@ offset_list off_0321 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33175E0,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -133,8 +133,8 @@ offset_list off_0400 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33C7680,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -165,8 +165,8 @@ offset_list off_0402 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33C7680,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -198,7 +198,7 @@ offset_list off_0403 = {
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33C7680,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -229,8 +229,8 @@ offset_list off_0450 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33C7680,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
@@ -261,8 +261,8 @@ offset_list off_0451 = {
|
||||
.HV_VCPU_ARRAY_OFF = 0x5D0,
|
||||
.HV_VCPU_STRIDE = 0x320,
|
||||
.HV_VCPU_VMCB_PTR = 0x08,
|
||||
.KERNEL_CODE_CAVE = 0x0043000,
|
||||
.KERNEL_DATA_CAVE = 0x0043000 + 0xBBE300,
|
||||
.KERNEL_CODE_CAVE = 0x500,
|
||||
.KERNEL_DATA_CAVE = 0xC01300,
|
||||
.IOMMU_SOFTC = 0x33C7680,
|
||||
.VMSPACE_VM_VMID = 0x1E4,
|
||||
.VMSPACE_VM_PMAP = 0x1D0,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* Global Variables */
|
||||
offset_list env_offset;
|
||||
@@ -247,4 +248,32 @@ void enter_rest_mode(void) {
|
||||
sceKernelNotifySystemSuspendStart();
|
||||
sceKernelSetEventFlag(event, 0x400);
|
||||
sceKernelCloseEventFlag(&event);
|
||||
}
|
||||
|
||||
|
||||
// Kit type by EchoStretch
|
||||
bool if_exists(const char* path) {
|
||||
struct stat st;
|
||||
return stat(path, &st) == 0;
|
||||
}
|
||||
|
||||
bool sceKernelIsTestKit(void) {
|
||||
return if_exists("/system/priv/lib/libSceDeci5Ttyp.sprx");
|
||||
}
|
||||
|
||||
bool sceKernelIsDevKit(void) {
|
||||
return if_exists("/system/priv/lib/libSceDeci5Dtracep.sprx");
|
||||
}
|
||||
|
||||
enum kit_type get_kit_type(void) {
|
||||
if (sceKernelIsDevKit()) {
|
||||
notify("DevKit detected\n");
|
||||
return KIT_DEVKIT;
|
||||
}
|
||||
if (sceKernelIsTestKit()) {
|
||||
notify("TestKit detected\n");
|
||||
return KIT_TESTKIT;
|
||||
}
|
||||
notify("Retail console detected\n");
|
||||
return KIT_RETAIL;
|
||||
}
|
||||
Reference in New Issue
Block a user