Linux 2.6 on PS2

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

Yes but you said "use a disc" and by that, I assume you meant a read-only Linux system burnt to a CD or DVD. Even after you start homebrew stuff like uLaunchELF or MegaMan's RTE, the PS2's copy protection is still active and consequently you need to do the swap trick in order for a burnt disc to be recognised by the RTE or Linux.
jaymacdonald
Posts: 22
Joined: Sat Feb 24, 2007 7:20 am

Post by jaymacdonald »

Chewi wrote:Yes but you said "use a disc" and by that, I assume you meant a read-only Linux system burnt to a CD or DVD. Even after you start homebrew stuff like uLaunchELF or MegaMan's RTE, the PS2's copy protection is still active and consequently you need to do the swap trick in order for a burnt disc to be recognised by the RTE or Linux.
Oh ok. I was just wondering, if I have a WiFi adapter (USB) and a WiFi network, is their some sort of way of bootloading from the network?
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

Booting wirelessly in general is quite hard and a quick search didn't turn up anything. Since wireless generally needs stuff from userspace in order to work, you'd need to put the necessary programs and libraries on an initrd/initramfs. I wouldn't bother trying this with Linux 2.4 and 2.6 on the PS2 is still vapourware at this point. Overall, it's more hassle than it's worth.

Oh and you'd need a device AND driver that works with USB1.1. The only time I ever tried wireless with USB1.1, it didn't work because the driver appeared to assume USB2 even though the device itself did support USB1.1.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Chewi wrote:Yes but you said "use a disc" and by that, I assume you meant a read-only Linux system burnt to a CD or DVD. Even after you start homebrew stuff like uLaunchELF or MegaMan's RTE, the PS2's copy protection is still active and consequently you need to do the swap trick in order for a burnt disc to be recognised by the RTE or Linux.
Just use the DVD trick SMS uses - DVD-Rs are recognized and mounted just fine as long as they appear to be a video DVD. On the SMS site, there's a minimal set of DVD files (a few hundred KBs) that makes the DVD look like a video DVD. You can then fill up the rest of the DVD with whatever you like. With SMS, that's AVIs. With this, it would be your linux distro.

Of course the PS2 won't boot it as it's a video DVD. You still need the boot loader run by something like ule or the ID exploit. This just saves having to do the swap trick or needing a modchip to get the distro DVD mounted.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

Smart, I didn't know about that! Not that I was going to try it myself but it's good to know. Thanks.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

I think I can load the naplink modules in kernelloader, but I don't have USB->USB cable. So I can't test it and I don't know if naplink has "host:" file system support like ps2link. Does it behave the same way?
jaymacdonald
Posts: 22
Joined: Sat Feb 24, 2007 7:20 am

Post by jaymacdonald »

Mega Man wrote:I think I can load the naplink modules in kernelloader, but I don't have USB->USB cable. So I can't test it and I don't know if naplink has "host:" file system support like ps2link. Does it behave the same way?
Yes, I think it does. Resetting the IOP causes NapLink to disconnect I think, though.
I'll be happy to test.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

I decided to build a version with deactivated IOP reset. Please test if this is working with naplink. When you select a file you can also select "Host" to access the host. Please post the output of kernelloader printed through naplink.

http://mitglied.lycos.de/ps2dev/kernell ... aplink.elf
jaymacdonald
Posts: 22
Joined: Sat Feb 24, 2007 7:20 am

Post by jaymacdonald »

Mega Man wrote:I decided to build a version with deactivated IOP reset. Please test if this is working with naplink. When you select a file you can also select "Host" to access the host. Please post the output of kernelloader printed through naplink.

http://mitglied.lycos.de/ps2dev/kernell ... aplink.elf
It fails to start with NapLink.
Peer exist.
Ps2 connected.
Send execute command.
loadelf: fname host:/exec/elf secname all
loadelf version 3.30
Input ELF format filename = host:/exec/elf
0 01b00000 00199318 ..........................
Loaded, host:/exec/elf
start address 0x1b00008
gp address 00000000
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

Now I made a version with IOP reset and naplink modules loaded. I want know If there is more debug output and whether you can access the host device. USB will not work with Linux, because I activated the debug output (which uses naplink USB).

http://mitglied.lycos.de/ps2dev/kernell ... plink2.elf
jaymacdonald
Posts: 22
Joined: Sat Feb 24, 2007 7:20 am

Post by jaymacdonald »

Mega Man wrote:Now I made a version with IOP reset and naplink modules loaded. I want know If there is more debug output and whether you can access the host device. USB will not work with Linux, because I activated the debug output (which uses naplink USB).

http://mitglied.lycos.de/ps2dev/kernell ... plink2.elf
Nope, same output as the first one.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

This sounds like you can run nothing. So I have the following questions:

Can you run the normal version of kernelloader?

Can you see anything on the screen?

Can you run simple ps2sdk example programs like "Hello World"?

Did you need to replace printf by nprintf in example programs?

Can you start my last version with something else than naplink, but start naplink on your PC in listen mode?
jaymacdonald
Posts: 22
Joined: Sat Feb 24, 2007 7:20 am

Post by jaymacdonald »

Mega Man wrote:Can you run the normal version of kernelloader?
yes, perfectly
Mega Man wrote:Can you see anything on the screen?
Whilst running the naplink version it shows the naplink main screen, then simply a blank screen
Mega Man wrote:Can you run simple ps2sdk example programs like "Hello World"?
yes
Mega Man wrote:Did you need to replace printf by nprintf in example programs?
no, they printed the messages with normal printf
Mega Man wrote:Can you start my last version with something else than naplink, but start naplink on your PC in listen mode?
no, the naplink2 version will not boot normally, it will just freeze at the loading, please wait screen
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

My assumption is that nprintf leads to a deadlock, although nprintf is intented for naplink. I disabled nprintf and use normal printf. To be sure I removed printf before IOP reset.

http://mitglied.lycos.de/ps2dev/kernell ... plink3.elf
jaymacdonald
Posts: 22
Joined: Sat Feb 24, 2007 7:20 am

Post by jaymacdonald »

Mega Man wrote:My assumption is that nprintf leads to a deadlock, although nprintf is intented for naplink. I disabled nprintf and use normal printf. To be sure I removed printf before IOP reset.

http://mitglied.lycos.de/ps2dev/kernell ... plink3.elf
Sorry, still no success loading it.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

There should be no difference between the normal version and this version at startup. I don't know what is wrong. I think it's better when you try to compile kernelloader and check in which line a printf is still working. A complete description is included in the README file.

http://mitglied.lycos.de/ps2dev/kernell ... link.patch
http://mitglied.lycos.de/ps2dev/kernelloader1.5.tgz

Apply patch with:

Code: Select all

patch -p0 <../../naplink.patch
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

Good news. I've got GCC to build for the first time in months. I had trouble with it ever since I started adding 128-bit support. The bad news is that madplay doesn't behave any differently. I'm not sure if it's using the 128-bit stuff at all. There are 128-bit instructions in the resulting binaries but I think these are just from the assembly used in ps2sdk. That's okay though, the 128-bit instructions aren't actually needed so I can always fix that later if there really is a problem.

I tried to take some of the alignment stuff from 3.2.2 and found that it made madplay fail earlier. Alignment is the only issue I can think of that I haven't tackled properly so I'm fairly sure this is where the problem lies. I wish I understood it better.

I'll probably put out a commit soon.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

RESULT!! I got madplay to make some sound!! :D We're not there yet but this is very encouraging. I decided to track down exactly where madplay was failing using some humble printfs. I didn't realise that madplay carried its own copy of the isjpcm IRX and it was the loading of this module that was failing. For some reason, the SifWriteBackDCache function would just hang. I took this code out of madplay and ran it independently. It worked. Hmm. I then inserted it into the beginning of madplay's main function. It still worked. Hmm. I then tried it at various points, all the way up until the original location. For some bizarre reason, it works everywhere but there. With that part working, I was actually able to play some sound, much to my amazement. It only plays one file at the moment though, all the others fail with various exceptions. It simply must have something to do with the alignment! I'll keep digging.

I've submitted new ebuilds for PCSX2 so that I could use it to help me debug this stuff. Check out http://bugs.gentoo.org/show_bug.cgi?id=141626 if you're interested.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

If anyone's interested, I've just made a commit. This is the first one I've made in a long time. You'll need a recent version of Portage because I've removed the separate digest files.
justinc
Posts: 1
Joined: Sun Mar 09, 2008 8:18 am

Post by justinc »

Hey mega man I was able to use your loader to boot my existing linux install. Thanks now i don't have to keep using cogswap. Im not sure the exact ps2 model number but I know it's a version 7.
User avatar
Chewi
Posts: 104
Joined: Sun Nov 26, 2006 12:49 pm
Location: Perth, Scotland
Contact:

Post by Chewi »

News!

Firstly, I've ditched the 128-bit stuff for now. It wasn't working out and it's just not needed. Maybe I'll revisit it sometime or someone else can have a go.

Secondly, I have a confession to make. Everything is suddenly working a lot better. I've thrown three MP3s at madplay and it plays all of them. I tried to run Mega Man's Ballion game. It crashes but it gets quite far through the startup before it dies. I haven't seen what happens on screen and I haven't tested much else because my girlfriend is using the GameCube and we only have a universal cable! This is obviously great news but I'm feeling silly because all I did was change all the CFLAGS from -O2 to -O0, which is something I should have done from the start. I've tried to pin down exactly which optimisation is causing problems but it doesn't appear to be one that's controlled with a command line option and that makes finding it extremely awkward.
Post Reply