Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux Mint #2

Open
Blackdragon897a opened this issue Mar 9, 2024 · 5 comments
Open

Linux Mint #2

Blackdragon897a opened this issue Mar 9, 2024 · 5 comments

Comments

@Blackdragon897a
Copy link

Blackdragon897a commented Mar 9, 2024

Hello there Mordesku !

I'm trying to port Linux Mint on PS4 but nobody want to help me lmao.
I'm asking help everywhere and it's been two or three months i'm trying to do this.
I finally found a good repo with debian drivers for ps4.
I'm happy now because there are no tutorials on internet to show us how to apply patches on linux drivers for PS4.

I was running my linux mint distro on a VM and then installed your drivers but when I tried to install the i386 drivers, it returned me an error code with dpkg...

Also, I've got a ps4pro and I know that there are some differences between ps4 patches and PS4 PRO patches so... can you help me with Linux mint drivers for ps4 pro please ?

My knowledge level with linux : near to 2/10
My configuration : PS4 Pro Belize
What I have to make linux mint on ps4 possible : Time !

@mordesku
Copy link
Owner

Hi @Blackdragon897a

Lets start from your installation problem. You gave me almost no information about the errors so I really can only guess. It looks like you haven't enabled multiarch, please read this if you want to learn, TLDR run bellow commands:

sudo dpkg --add-architecture i386
sudo apt update

and then try installation one more time.

When it comes to patching packages I don't think there is an universal guide. I am a software engineer with 10+ years of experience in many programming language so patching sources manually was really trivial to me. I can share steps I did to build patched packages.

  1. Read the Debian guide of building packages.
  2. Download sources of packages you want to patch using apt.
  3. Download build dependencies
  4. Apply patches (this is tricky, I'll explain it little bit more later)
  5. Build packages using method from the guide (debuild -b -uc -us)
  6. Install packages
  7. Profit :)

Now when it comes to applying patches. If you would like to patch sources that the original patch file was created it is usually simple. You can use patch program. But usually the files are different and simple patching will fail do to different line offsets. So you will need to apply patches manually.

Bellow you can see sample diff.

diff -ruN libdrm/radeon/r600_pci_ids.h libdrm-mod/radeon/r600_pci_ids.h
--- libdrm/radeon/r600_pci_ids.h	2020-05-25 18:24:34.398124762 +0200
+++ libdrm-mod/radeon/r600_pci_ids.h	2020-05-25 18:40:57.654848297 +0200
@@ -473,6 +473,11 @@
 CHIPSET(0x131C, KAVERI_131C, KAVERI)
 CHIPSET(0x131D, KAVERI_131D, KAVERI)
 
+CHIPSET(0x9920, LIVERPOOL_9920, LIVERPOOL)
+CHIPSET(0x9922, LIVERPOOL_9922, LIVERPOOL)
+CHIPSET(0x9923, LIVERPOOL_9923, LIVERPOOL)
+CHIPSET(0x9924, GLADIUS_9924, GLADIUS)
+
 CHIPSET(0x67A0, HAWAII_67A0, HAWAII)
 CHIPSET(0x67A1, HAWAII_67A1, HAWAII)
 CHIPSET(0x67A2, HAWAII_67A2, HAWAII)

First line is a command line diff was executed and it has also information about the file we need to patch. Which in this case is libdrm/radeon/r600_pci_ids.h later we have information about line numbers @@ -473,6 +473,11 @@ that are helpful in locating place of change but these are usually incorrect. Most important thins are following lines starting with + or with -. The one with + means we need to add a line the - means we need to delete a line.

So you need to open every patch file and go thru every diff entry and apply it to downloaded sources one by one, when you're done you build the packages and if you didn't messed up something (if you did compilation probably would fail) you got your fresh new packages ready to work on ps4.

@Blackdragon897a
Copy link
Author

Blackdragon897a commented Mar 13, 2024

Hi @mordesku !!!!!

It's true that I provide you no information on the error I was facing ! **I'm terribly sorry ! **
In my case, I'm just a 20 years old french student with just a tiny little experience in C# coding.
So yep. Trying to port that on ps4 without tutorials IS TERRIBLY HARD for someone like me. XD

Yesterday, I was thinking about Linux Mint and I wondered :
Linux Mint is an Ubuntu based system.
And Ubuntu is a Debian based system...
So, was that okay if I installed directly Debian drivers on Linux mint ??
Maybe, It's better to directly take the source code of Linux mint packages and patch them manually like you said.

But anyway, I took some screenshots !

Screenshot from 2024-03-13 17-15-12
Screenshot from 2024-03-13 17-15-53
Screenshot from 2024-03-13 17-19-23
Screenshot from 2024-03-13 17-19-38
Screenshot from 2024-03-13 17-20-54
Screenshot from 2024-03-13 17-21-05
Screenshot from 2024-03-13 17-22-16
Screenshot from 2024-03-13 17-23-40

Above, you can see all the commands I entered in the terminal.

To create a distribution for PS4, I followed this tutorial : https://ps4linux.com/make-ps4-linux-distro/
Sadly you will see on that website, there is nothing about drivers patching and package building :'( .

Yesterday, I have downloaded a .patch file for mesa 23.2.1 from the PS4-Overlay from Dr3kk4n. And I have patched and installed the mesa with these commands :

meson setup builddir
ninja -C builddir/
ninja -C builddir/ install

When I booted the distro, then, on PS4 Pro, the graphical glitches were gone. OpenGL worked but Vulkan doesn't seem to work. Well, I don't know how to verify if vulkan is working but I think, you gave the command on the first issue.

And by the way, I wonder if you have a discord account ?
If that's the case, I can send you screenshots faster and you'll be able to help me to port Linux Mint on PS4 easier too !
Just tell me when you have time so, I will not bother you everyday with stupid noob questions XD.

And thank you so much for taking the time to teach me how to patch and build packages for ps4 !
I'll get to work now to see what I can do ! Alright ! LET'S GO !!!!

@mordesku
Copy link
Owner

mordesku commented Mar 13, 2024

There are couple thing I need to address here.

  1. Do not paste screenshots. It is really hard to find something. Next time redirect command output to the file using > and paste that file.
  2. My packages are build for Debian, Mint has special flavor Linux Mint Debian Edition that is build on top of Debian. I assumed you are using this one as you tried Debian packages.
  3. Although Debian and Ubuntu shares some parts and Ubuntu originates from Debian these distributions are not binary compatible and it is not guaranteed that package from one will work on another. Your problem seems to be related to missing dependen(cy/cies) which may be the result of using debian packages on ubuntu base
  4. Vulkan on PS4 require at least 5.X kernel or maybe 5.5+ I'm not sure but it doesn't work on 4.X kernel. You can test this by typing vulkaninfo in terminal. If you see something like below it doesn't work:
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /usr/src/debug/vulkan-tools/Vulkan-Tools-1.3.269/vulkaninfo/./vulkaninfo.h:688:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER

@Blackdragon897a
Copy link
Author

Blackdragon897a commented Mar 21, 2024

Hello @mordesku !

1 - I'm sorry !!!! As you can see, I begin with github 😥 I though It was easier to post screenshots ! Sorry again !
2/3 - Yes. Each time I wanted to install Debian drivers on Linux Mint, It results with a messy distro.
3 - I'm using a 5.15.25 FULL LTO linux kernel. I have installed vulkan-tools and wrote vkcube to test vulkan but... It crashed.

So, where am I ?

  • I did a little research to see which packages I should patch for ps4 pro. If I'm correct, I have to patch mesa, libdrm and xorg-video-amdgpu.
  • I have installed and updated Linux Mint on VM on my windows PC.
  • I made a backup of the VM. Important.
  • After that, in synaptic, I can see that I have mesa 23.2.1-1ubuntu installed on my system, libdrm2.4.113-2ubuntu, and xserver-xorg-video-amdgpu 22.0.0-1ubuntu0.2.
  • So, I have downloaded those 3 tar.gz source code on Launchpad.net.
  • Then, I went on the PS4-Overlay from DR3kk4n dev to download his ps4 mesa and xorg patches for ps4.
  • I also downloaded the libdrm patch from VvSx87.
  • all of these files are on github and the PS4 discord server i joined.
  • Now, I have the source code of these drivers and the .patch files.

Let's begin with mesa 23.2.1 :

  • I have installed meson, ninja, python3, mesa build-dep, bison etc...
  • I patched the mesa source code with Dr3kk4n .patch file using patch -p1 command.
  • I compiled it with : meson setup build/ and ninja -C build/
  • And then, I installed it with ninja -C build/ install
  • Results : before, I've got some graphical glitches on ps4 but now, the problem is gone. OpenGL works fine but Vulkan doesn't work.
  • I've got some errors when I typed meson setup build/ : libtizonia, and two other dependencies were mising and I didn't know how to install them using apt....
  • I also got some red "NO" before I compile the mesa source code...
  • My firefox crash when I go on github or youtube too. I don't understand why...

About libdrm2.4.113-2ubuntu :

  • I have succesfully patched it I think. I've got only one red "NO" while typing meson setup build/
  • and then lile for mesa : ninja -C build/ and ninja -C build/ install worked fine

About xserver-xorg-video-amdgpu 22.0.0-1ubuntu0.2 :

  • I have patched it manually because the lines in the .patch file I downloaded were not correct.
  • And I compiled it and installed it succesfully, well I think.

As you can see, trying to compile mesa correctly is a big pain for a newbie like me and make Vulkan work is hopeless. Tell me if you want the output when I'm trying to compile mesa !

@mordesku
Copy link
Owner

Hello @Blackdragon897a

So according to what you wrote you haven't compiled any packaged and definitely you haven't installed any packages on your system. You took sources and patch them and then "installed" them on your system. I wrote installed in quotes because i don't think it was installed in the right location. You need to distinguish two things.

  1. building packages from source which produces installable packages (*.deb) that can be installed using dpkg.
  2. building some tools and libraries from source and installing it as it is. (this is what you did)

In the first scenario package sources and install script is prepared by the system developer (we just patch some sources) and when installed all files are placed in the right location.

In your case you compiled some programs and libraries. Installed it in i assume default prefix which usually is /usr/local. Which is fine for some additional libraries you want o use and you don't want to mess the system. But if you want to replace system libraries you should not install in /usr/local but in /usr.

There is additional advantage of using deb packages rather than manual builds. When Ubuntu package maintainer will release an update of a modified packages. If it was installed the way you did it will get simply overridden because the system have no knowledge about your modification (apt/dpkg keeps records of every installed packages). If you install manually created package (.deb), the system will recognize it was not Ubuntu package and will not overwrite it if not explicitly asked. (Well I'm not sure about Ubuntu but Debian wouldn't overwrite it).

So please learn how to build DEB packages from source (there is a link in my first reply, it is more about debian but it should work with ubuntu). Take a look at this thread especially on "New Approach"

https://askubuntu.com/questions/81870/how-to-download-modify-build-and-install-a-debian-source-package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants