frno7 / linux

Linux 2.2, 2.6, 3.x, 4.x and 5.x kernels for the PlayStation 2.
Other
86 stars 5 forks source link

Boot the kernel directly off the optical disk drive #37

Open frno7 opened 3 years ago

frno7 commented 3 years ago

Explain on the wiki how to install Linux on a DVD, similar to https://github.com/frno7/linux/issues/4#issuecomment-752571259 but with a 5.x kernel. A guide has now been written for creating a bootable DVD for PlayStation 2 Linux. Plan:

faissaloo commented 3 years ago

I've created a basic tutorial that should work: https://github.com/frno7/linux/wiki/Creating-a-bootable-PS2-Slim-DVD

frno7 commented 3 years ago

@faissaloo, perhaps we should make a note about what version of the Linux kernel the basic tutorial currently covers?

faissaloo commented 3 years ago

The tutorial should be version agnostic

frno7 commented 3 years ago

Sure, but BOOT/VMLINUZ.GZ from the ISO must have some version? Something like this:

  1. Replace ./BOOT/VMLINUZ.GZ (Linux kernel version 2.x.y) with your version of vmlinuz.gz

Also, the Black Rhino distribution won’t run properly with 4.x and 5.x kernels, because it uses R5900 128-bit multimedia instructions (LQ, SQ, PEXTLB, PEXTLW and so on in for instance /lib/ld.so). MMIs aren’t currently supported, see issue #5. Linux 2.x kernels are not IEEE 754 compatible, unlike 5.x kernels, as explained in issue #3. So versions are quite important until we have sorted out the issues, at the very least.

The initial patch submission, as discussed with kernel maintainers regarding issue #1, will be limited to the o32 psABI. In this regard, the Black Rhino build is nonstandard.

faissaloo commented 3 years ago

Oh sure, this tutorial isn't supposed to produce a Black Rhino iso, I've written it such that you replace/delete all the BlackRhino specific files. I've added some more detail now, let me know what you think. As long as this kernel can be booted with KernelLoader there should be no issues.

frno7 commented 3 years ago

Thanks! I added a section Notes about R5900 Linux distributions and kernel versions to the guide. Last time I tried the Kernel Loader program it crashed when attempting to boot Linux 4.x and 5.x, so I assume that this will be a problem as well? In that case the kernel ought to be launched from wLaunchELF directly (as is usually done when launching 5.x kernels from a USB drive).

Eventually the kernel ought to be able to bypass even wLaunchELF and boot directly regardless of hardware state, but as noted in #4 we have a couple of initialisation issues to sort out first, starting with #9.

faissaloo commented 3 years ago

When it comes to launching directly, how do you handle passing kernel parameters? That's the main thing KernelLoader is for. I've added some information about what to do if you the disk to start a different ELF.

frno7 commented 3 years ago

One more thing, I strongly suggest that the step 2 ought to be something like this:

  1. Verify that the downloaded 7z archive file has SHA256 xxx.

The URL itself doesn’t look particularly trustworthy, and one should always verify downloads anyway!

frno7 commented 3 years ago

When it comes to launching directly, how do you handle passing kernel parameters? That's the main thing KernelLoader is for.

Oh, that’s rather easy. Simply enable CMDLINE_BOOL and set CMDLINE to whatever parameters you need in your kernel config:

https://github.com/frno7/linux/blob/59a11ab94a4020408c7dfbf92bd55778e17b43f1/arch/mips/Kconfig.debug#L33-L67

frno7 commented 3 years ago

Additionally, as per https://github.com/frno7/linux/issues/33#issuecomment-529501922, one can pass parameters to kernel modules in the initialisation scripts, like this:

modprobe ps2fb mode_option=1920x1080p@50 mode_margin=+13+0

The line above would load the Graphics Synthesizer frame buffer device driver and set the default video resolution to progressive 1920×1080 at 50 Hz, and then do some minor pixel adjustments as explained in:

https://github.com/frno7/linux/blob/00a55c7e3a39f56e0e703a02dda5f52075b8f46a/drivers/video/fbdev/ps2fb.c#L2352-L2358

Video modelines are very flexible with 5.x kernels, unlike 2.x kernels that don’t handle 1920×1080.

frno7 commented 3 years ago

Some more: I think the guide should be renamed by omitting the word slim so that we have a general DVD guide (incidentally, slim has unfortunate connotations that would best to avoid).

Then a step 0 ought to be to review the PlayStation 2 Linux hardware model compatibility, and make sure that one has SCPH-7xxxx or possibly SCPH-900xx. I know that 2.x kernels are fiddly getting to work with various models. 5.x kernels should be much better at this, in the sense that they shouldn’t be possible to misconfigure for any particular model (that is, if it boots on one, it should boot on all).

I put the USB alternative in the header. Eventually we should to link to a USB guide there (and vice versa, have the USB guide link to the DVD dito).

frno7 commented 3 years ago

Ah, regarding spelling: all other wiki pages spell out PlayStation 2 in the titles, with no abbreviation like PS2. The DVD guide ought to follow suit.

faissaloo commented 3 years ago

I didn't even realise you could hardcode the kernel config. Thanks to your suggestion regarding verifying downloads I realised the download link I was using previous had truncated the file lol, so I've switched it to another site and added the SHA. I've also linked to the hardware compatibility for this kernel and fixed the abbreviations.

frno7 commented 3 years ago

Thanks, @faissaloo! I did a few minor adjustments to the guide:

A couple of questions:

  1. Can the filename 9Zbm8Tdz4DvLXUGB.7Z be improved to something more intelligible? Also having a version number, for instance?
  2. How does 9Zbm8Tdz4DvLXUGB.7Z relate to the variants at PS2 Live Linux DVD v3? Does it come from there? Is it somehow repackaged?
faissaloo commented 3 years ago

The filename was set by the site I uploaded to, the ISO in it is based on ps2linux_live_v3_pal_small_no_modchip.7z. I don't know that PAL vs NTSC refers to anything that we aren't replacing. The changes made are as follows:
I replaced its VIDEO_TS/ with the the FreeDVDBoot payload whose ELF in turn has been replaced with wLaunchELF+autostart and LNCHELF.CNF is added to configure it.

frno7 commented 3 years ago

Great! Would you like to update the guide with a (small) note on these particular changes compared with ps2linux_live_v3_pal_small_no_modchip.7z, and add a link to the original site?

faissaloo commented 3 years ago

Done, how's that?

frno7 commented 3 years ago

@faissaloo, nice, thank you very much!

deba5er commented 3 years ago

9Zbm8Tdz4DvLXUGB.7Z link no longer works. Would you be able to renew or update?

frno7 commented 3 years ago

@deba5er, see also https://github.com/frno7/linux/issues/4#issuecomment-898962340. I think download issues with these Linux 2.x images ought to be a separate issue, as they’re tangential to the the topic of this one. @deba5er, could you create a new issue and ping @faissaloo about it, please?