View previous topic :: View next topic |
Author |
Message |
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Tue May 02, 2006 10:03 am Post subject: PlayStation 2 - Major progress, help me finish! |
|
|
Now before you say I'm flogging a dead horse, hear me out. I've made some serious progress! After a lot of blood, sweat and determination, I more or less have Gentoo running on my PlayStation 2. Here's what I have at the base.
- linux 2.4.17
- binutils 2.14
- gcc 3.0.4 (C and C++)
- uclibc 0.9.27 (quite recent!)
- xorg 7.0
I hope you'll agree that list is not quite so ancient as what we've come to expect from this platform. If the thought of compiling on such a slow machine puts you off, don't worry, I have cross-compiling working too. Both "ROOT=/gentoo-ps2 emerge blah" and distcc work just fine. The former case doesn't always work but that's just because not all packages are cross-compile friendly.
In terms of how much "fiddling" with Gentoo is necessary, I have written ebuilds for all the extra packages. There's a few patches involved and they will need some further adjustments before they can be officially accepted but most of the work has been done there. I've written my own Portage profile, which lives in /usr/portage/profiles/uclibc/mips/ps2. It's basically a combination of mips/ps2/uclibc/2.4 stuff.
As I said above, I more or less have it working. I have a few outstanding problems but none of them are showstoppers and with a bit of help, I think we can have a fully working system. Yeah! So here's the list.
********************
emerge system
"emerge system" is almost complete. I think psmisc, busybox and kbd are failing due to uclibc-specific issues. No biggy. busybox can be made to work if you leave out hdparm and I have actually seen it working. The problems might even be 0.9.27 specific because I tried 0.9.28 before (broken on MIPS) and busybox compiled with that no problem.
epatch always fails
This is a pretty weird problem. Portage works fine except that epatch, the function used for patching, always fails, even though the debug output shows that the patch applied cleanly. I only run Portage on the PS2 for the stubborn packages and I can easily unpack/patch the files using ebuild on my PC. Setting FEATURES="keepwork" stops the PS2 from screwing it up again.
gcc 3.2.2
A more recent version of gcc would be nice. gcc 3.2.2 was ported to the PS2 by MrHTFord but that version wasn't for Linux. I monkeyed around with it for ages, trying to get it to work but the best I managed was a statically compiled "Hello World". Anything more resulted in bus errors or segmentation faults. The main problem was that the compiler was geared for 64-bit and I had to hack the crap out of the specs file to get it back to 32-bit. As far as I understand it, we can't use 64-bit until we have a 64-bit kernel for the PS2. Pigs will fly before that happens. Still, I think I wasn't far off from getting gcc 3.2.2 to work, maybe someone with better knowledge can figure it out.
Graphical support (Xorg / XDirectFB / framebuffer) UPDATED 23rd May 2006
We are now in a MUCH better position in this area than we were a month ago. At that time, I firmly believed that we were going to need someone very experienced to write a new driver for us. I decided to have a shot at updating the framebuffer driver from 2.2.1 myself. Despite never having done any real kernel hacking before, I somehow managed to pull it off. You should have seen my face the first time it worked. So where are we at now? We have a fully functioning, albeit somewhat inefficient, framebuffer driver. Despite the inefficiency, it runs lsdldoom at full speed without problems. We also have modular xorg 7.0 running on the fbdev driver. Early indications show that it is working well. While all this is sufficient for simple desktop apps, it is perhaps less than sufficient for anything more intensive like games. The basic requirement here is to get some 2D acceleration working. This would involve porting XDirectFB to xorg 7.0 and writing a DirectFB driver specifically for the PS2. I anticipate that I may be able to do both of these things myself. More advanced requirements in the form of 3D acceleration would probably require writing DRI/DRM drivers. I anticipate that this may be beyond my capabilities. Having said that, I seem to recall there being some existing 3D acceleration on the original distribution. I don't know at this point whether any of that code is still useful.
********************
Okay so that's pretty much all the problems I've encountered. Anyone care to help? Let me know and I'll send you a tarball of my system as it stands. I'm netbooting my system over NFS but you can use a hard drive if you prefer. If you want to help out but don't have the PS2 Linux DVD, which is needed to boot then send me a PM.
Last edited by Chewi on Sun May 28, 2006 10:37 pm; edited 6 times in total |
|
Back to top |
|
|
22bsti n00b
Joined: 01 May 2006 Posts: 14 Location: the armpit of the west
|
Posted: Tue May 02, 2006 12:10 pm Post subject: |
|
|
how did you manage this with the linux kit or some other way??
forgive me if this has been beaten to death i only asked this because it is getting harder to find the linux kit and if possible i would like to avoid getting it if possible
Last edited by 22bsti on Tue May 02, 2006 12:45 pm; edited 1 time in total |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Tue May 02, 2006 12:35 pm Post subject: |
|
|
Weeell... I didn't want to say this because I don't want to be hauled up as some pirate - I don't condone piracy. It's true, I don't have the kit. The only part of the kit you actually need that you can't buy separately is the first DVD. It has the PS2Linux RTE on it. The problem is that you can't buy the kit at all anymore, let alone buy the DVD separately. Yeah sometimes you can get in on eBay but it's like gold dust there. Because of all that, I had to download the first DVD via torrent and use certain risque methods to make it work. Some people might say "Well I bought the kit, why didn't you?" but I didn't get into this until recently. They stopped selling it years ago. If Sony were to start selling the DVDs again, separately from the kit and at a reasonable price than I would certainly buy it. I don't want to make further excuses for myself but I think it may be fair to say that the kit's price was largely to cover the cost of the hardware rather than the software anyway. |
|
Back to top |
|
|
22bsti n00b
Joined: 01 May 2006 Posts: 14 Location: the armpit of the west
|
Posted: Tue May 02, 2006 12:48 pm Post subject: |
|
|
i suspect this isnt the foum to discuss such things can i hit you up on msn for more info because i have been dying to try this but have decided to wait until i found out that it will *probably* work |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Tue May 02, 2006 1:02 pm Post subject: |
|
|
Sure thing. |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sat May 06, 2006 10:10 pm Post subject: |
|
|
Where's my band of helpers? I guess if you want something done, you've got to do it yourself. Consequently I've started working on bringing the framebuffer driver to 2.4. I've only ever made small adjustments to the kernel before but it seems to be working out. Despite the fact that the PS2-specific code was moved all over the place between 2.2 and 2.4, I have managed to fix several compiler errors so far. This is what's left!
Code: | mipsEEel-scei-linux-uclibc-gcc -I /home/chewi/tmp/ps2/linux-2.4.17-ps2/include/asm/gcc -D__KERNEL__ -I/home/chewi/tmp/ps2/linux-2.4.17-ps2/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -G 0 -mno-abicalls -fno-pic -march=r5900 -pipe -c -o ps2gsfb.o ps2gsfb.c
In file included from ps2gsfb.c:17:
/home/chewi/tmp/ps2/linux-2.4.17-ps2/include/linux/malloc.h:4:2: warning: #warning linux/malloc.h is deprecated, use linux/slab.h instead.
ps2gsfb.c:169: warning: initialization from incompatible pointer type
ps2gsfb.c:169: warning: initialization from incompatible pointer type
ps2gsfb.c:169: warning: initialization from incompatible pointer type
ps2gsfb.c:169: warning: initialization from incompatible pointer type
ps2gsfb.c:170: warning: initialization from incompatible pointer type
ps2gsfb.c:170: warning: initialization from incompatible pointer type
ps2gsfb.c:170: warning: initialization from incompatible pointer type
ps2gsfb.c:176: warning: initialization from incompatible pointer type
ps2gsfb.c: In function `ps2gs_loadframe':
ps2gsfb.c:281: warning: implicit declaration of function `PACK64'
ps2gsfb.c:281: warning: implicit declaration of function `PACK32'
ps2gsfb.c:309: warning: passing arg 1 of `ps2dma_check_and_add_queue' from incompatible pointer type
ps2gsfb.c:309: warning: passing arg 2 of `ps2dma_check_and_add_queue' makes integer from pointer without a cast
ps2gsfb.c:309: too many arguments to function `ps2dma_check_and_add_queue'
ps2gsfb.c: In function `ps2gsfb_encode_fix':
ps2gsfb.c:410: warning: assignment makes integer from pointer without a cast
ps2gsfb.c:420: warning: assignment makes integer from pointer without a cast
ps2gsfb.c: In function `set_color_bitfields':
ps2gsfb.c:459: warning: deprecated use of label at end of compound statement
ps2gsfb.c: In function `ps2gsfb_set_var':
ps2gsfb.c:609: warning: assignment makes pointer from integer without a cast
ps2gsfb.c:669: warning: implicit declaration of function `ps2gs_setscreeninfo'
ps2gsfb.c: In function `virt_to_kseg':
ps2gsfb.c:856: warning: implicit declaration of function `MAP_NR'
ps2gsfb.c: In function `ps2gsfb_nopage':
ps2gsfb.c:916: structure has no member named `vm_offset'
ps2gsfb.c:912: warning: `offset' might be used uninitialized in this function
ps2gsfb.c: In function `ps2gsfb_mmap':
ps2gsfb.c:959: structure has no member named `vm_offset'
ps2gsfb.c:963: structure has no member named `vm_offset'
ps2gsfb.c:965: structure has no member named `vm_offset'
ps2gsfb.c:978: wrong type argument to increment
ps2gsfb.c: In function `alloc_frame':
ps2gsfb.c:1093: invalid type argument of `->'
make[3]: *** [ps2gsfb.o] Error 1
make[3]: Leaving directory `/home/chewi/tmp/ps2/linux-2.4.17-ps2/drivers/video'
make[2]: *** [first_rule] Error 2
make[2]: Leaving directory `/home/chewi/tmp/ps2/linux-2.4.17-ps2/drivers/video'
make[1]: *** [_subdir_video] Error 2
make[1]: Leaving directory `/home/chewi/tmp/ps2/linux-2.4.17-ps2/drivers'
make: *** [_dir_drivers] Error 2 |
|
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun May 07, 2006 12:44 am Post subject: |
|
|
Well I got it to compile with no errors or warnings. I gave it a try and...
Code: | Playstation2 Graphics Synthesizer revision: 00005519
Console: switching to colour frame buffer device 80x30
fb0: PS2 GS frame buffer device, using 1800K of video memory
DMA error sending frame to GS |
All I got was a blank screen! I was able to see that dmesg output by SSHing in. To be honest, that's a better result than I was expecting. I didn't really expect the kernel to boot at all, especially not first time! The /dev/fb0 device node is there and fbset seems happy so I'm definitely on the right track. |
|
Back to top |
|
|
RoundsToZero Guru
Joined: 17 Nov 2003 Posts: 478 Location: New York, NY
|
Posted: Thu May 11, 2006 1:40 pm Post subject: |
|
|
If you have a way of working around the sync-on-green requirement for the monitor, let me know. You say you don't have the kit so maybe you don't know what I'm talking about. The only monitor I have that worked with the kit is a 24" beast of a CRT. There's no way I'm taking that thing all the way to school with me and then up four flights of stairs to my room . |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Thu May 11, 2006 10:10 pm Post subject: |
|
|
Sync-on-green is only a requirement if you're using a monitor. You can just use a TV as I have been doing - I don't have the monitor adapter myself. TV resolutions are a bit odd and not great - something like 640x200 or 640x240 (I think it's different for PAL and NTSC). However 640x400 and 640x480 are possible if you use interlacing. This usually results in a really bad flicker but I found an optional "trick" being used in the framebuffer driver, which majorly reduces the flickering. I haven't got the framebuffer driver to work yet (been away for a few days) but I've seen exactly the same technique used on the Amiga and it does work really well. If you really want to use a monitor, check out this list. You've probably seen this already though. http://playstation2-linux.com/sog.php |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun May 14, 2006 11:44 pm Post subject: |
|
|
Great news! I've almost got the framebuffer driver completely working! It works right now but only with text, any graphical stuff doesn't appear. A simple framebuffer test program says its working but nothing appears. fbv (framebuffer image viewer) shows nothing. links2 complains about the mouse, not sure why, gpm is working fine. lsdldoom bombed the first time I tried it and then crashed the machine the second time I tried it. I'll get there soon enough. |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sat May 20, 2006 5:30 pm Post subject: |
|
|
Oh wow, oh wow, oh wow!! It works!! It bloody well works!! I ran Doom and it's actually really fast. I'm so pleased! Stay tuned. |
|
Back to top |
|
|
Requisition Tux's lil' helper
Joined: 29 Apr 2006 Posts: 117
|
Posted: Sun May 21, 2006 7:34 pm Post subject: |
|
|
Be sure to keep us posted and upload a finished version of the software! You also might want to consider doing something like the GentooX people did. |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun May 21, 2006 8:31 pm Post subject: |
|
|
I think the Gentoo MIPS guys will be reluctant to support this even after I get much of it working but I certainly don't blame them. It's a lot to ask. Consequently, I will probably launch an independent site for this, with its own bug tracker where people can look up solutions to common problems.
Coincidentally, the GentooX developer, the only official Gentoo developer in Scotland, lives in Edinburgh, which is just an hour and a half from here. He has a much easier a much easier job than I do though, the Xbox is basically just a stripped down PC in a fancy case!
My girlfriend was playing Doom this afternoon so as I said in the last post, it really does work. I'm trying to get X working now, either through XDirectFB or Xfbdev. I'm not sure which route to take. As far as I can tell, the only advantage XDirectFB has is hardware acceleration - but we won't get that unless I write an accelerated driver. I don't think that's as hard as it sounds. The advantage that Xfbdev has is that it is officially part of Xorg and consequently, it is more up-to-date. It is also more likely to work with Gentoo's modular X setup. I've tried asking around on the subject but haven't had any useful answers yet. I'm trying XDirectFB now anyway. |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sun May 21, 2006 8:37 pm Post subject: |
|
|
Mabe you need to integrate this in portage under another thing
Mips= Linux/GNU/lgibc/mips (if my memory is good)
so why not:
usr/portage/profiles/consoles/playstation2/mips
or:
/usr/portage/profiles/playstation2//mips
instead of having something like the xbox:
/usr/portage/profiles/default-linux/x86/xbox
so this thing won't be suported by the mips guy but by another team
mabe you need to find people to support that
i think that the first thing would be the integration in portage
then mabe a stage3 and an install cd and the install docs
mabe you will need to learn how gentoo project works that could help you a lot
Mabe the xbox also need to be integrated into the main portage tree
Last edited by GNUtoo on Sun May 21, 2006 9:25 pm; edited 1 time in total |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun May 21, 2006 9:04 pm Post subject: |
|
|
Using µclibc over glibc is important for two reasons. Firstly, the PS2 only has 32MB RAM - glibc would eat that for breakfast. Secondly, glibc hasn't been updated for the PS2 in a very long time. There were a LOT of patches applied. It's possible that a recent glibc version would work without patches but I doubt it. µclibc, on the other hand, works pretty much out of the box.
I don't think I really need a dedicated team, I've been working entirely on my own so far. Obviously I can only do so much since my knowledge is fairly limited but any help, even if it's just a one-off patch for something, would be appreciated.
stage3 was my original intention. stage2 might be a possibility. stage1 is pointless because a PS2 is a PS2, no questions asked. A bootable install CD is out of the question, simply because you cannot boot from any disc using the RTE other than the official PS2 Linux DVDs. Some kind of netbooting tarball would be feasible though.
I am extremely familiar with Gentoo, I've been using it solidly for three years. Seems longer. |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sun May 21, 2006 9:58 pm Post subject: |
|
|
mabe you need to find a developer that explain you all the thing for having your work in "experimental" just like the xbox
but that's a GREAT work!!!
WOW!!! |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Mon May 22, 2006 7:04 pm Post subject: |
|
|
Okay here's the deal with XDirectFB. It currently only builds against the old-style monolithic X build trees - so either xorg 6.8 or 6.9. It currently won't build against xorg 7.0. This means that when you build it with Portage, it tries to build practically the whole of xorg just to build one pesky server. I wasn't sure if the resulting server would work alongside xorg 7.0 components but I decided to try anyway. I didn't get to find out though because the build failed due to a missing C++ compiler. Since it would be a lot more sensible to get XDirectFB working with xorg 7.0 and since it offers no immediate benefit to us, I've decided to put it aside for now.
I then looked at Xfbdev. It's another simplistic X server that is part of the TinyX collection of servers, also known as kdrive. This builds in much the same way as XDirectFB but as far as I know, it only builds against XFree86. That's a big no no.
It was then that I realised there was still one more option left. I had been confusing Xfbdev with the fbdev driver for the xorg server. The xorg server is not exactly minimalistic but it'll do for now. XDirectFB and Xfbdev are designed to be minimalistic and will run with very little else installed but the fact is that unless you're running very simple apps, you still tend to need a whole plethora of X libraries. I know this from trying to use Xvesa (one of the other TinyX servers) on a Pentium 133 once. It's not as big a problem as it used to be thanks to modular X though since Portage will generally only install the libraries you actually need.
Sooo... I'm 52 packages away from having xorg server emerged. Most of the packages are stubbornly refusing to cross-compile due to path issues (trying to link against /usr/lib/libX11.so instead of /mnt/gentoo-ps2/usr/lib/libX11.so for example) so I'm having to build it on the PS2 itself. I'm using distcc but it's still slow. Anyway, next time I post here, it might be from some browser on the PS2. Haven't decided which one yet! |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Tue May 23, 2006 2:21 pm Post subject: |
|
|
It works! I've only just tried it so all I have is crappy old twm so far but the point is it works! |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Tue May 23, 2006 3:15 pm Post subject: |
|
|
So at first, I had it using 640x240, which was just unbearable. After some tweaking of the config file, I got it to use 640x480 with interlacing. It's impossible to read anything, especially on my 14" TV but I'll try some bigger fonts later and I'll also try enabling the anti-flicker option in the framebuffer driver. Those resolutions are for PAL, the respective resolutions on NTSC would be 640x224 and 640x448. |
|
Back to top |
|
|
Redhatter Retired Dev
Joined: 20 Sep 2003 Posts: 548 Location: Brisbane, QLD, Australia
|
Posted: Wed May 24, 2006 1:16 am Post subject: |
|
|
Have you tried a Sync-on-green monitor hooked up to the "VGA" output? (true VGA has separate sync, not SoG... hence I call it "VGA")
I've been watching this from a distance, but you seem to have made great progress on this so far. Whether a PS2 running modern Linux will be all that useful or not remains to be seen... 32MB RDRAM isn't a lot to be playing with, even with loads of HDD space for swap.
What CHOST are you using? And how are you working around the PS2's bastardised CPU? _________________ Stuart Longland (a.k.a Redhatter, VK4MSL)
I haven't lost my mind - it's backed up on a tape somewhere...
Gentoo/MIPS Cobalt developer, Mozilla herd member. |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Wed May 24, 2006 7:31 am Post subject: |
|
|
I don't have the monitor adapter and I doubt it would work with my monitor anyway.
I was wondering when you or Kumba would say something! At the moment, I'm netbooting and using swap over NFS so it's even slower than it might be but it's not been too bad. I've installed Gentoo on an Amiga 1200 before so I've put up with worse. Then again, my Amiga has 128MB RAM! As you say, it remains to be seen whether it holds up well under any real usage. The thing is though, I never intended this to be for anything serious. I have two motivations. Firstly, I want a machine my girlfriend can chat on MSN with and play simple games on. Secondly, I just enjoy the challenge.
The CHOST I'm using is mipsEEel-scei-linux-uclibc. I don't know MIPS assembly or anything like that. Apart from updating the framebuffer driver, all I've really done is brought the best of what's already available for the PS2 into the context of a modern Gentoo system. That's linux 2.4.17, binutils 2.14 and gcc 3.0.4 (maybe 3.2.2 with some help). The rest works more or less out of the box. Cross-compiling using Portage has failed more often than not but that's not a PS2 problem. |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Wed May 24, 2006 8:44 am Post subject: |
|
|
Not very useful, I'm afraid. Black Rhino is the ancient Debian-based distribution most of the PS2 Linux community are already using. That version of Gentoo PS2 is also ancient and was never updated beyond the original release. |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Wed May 24, 2006 12:23 pm Post subject: |
|
|
I saw that
kernel 2.2...lol |
|
Back to top |
|
|
nibiru n00b
Joined: 09 Jun 2005 Posts: 38
|
Posted: Sun May 28, 2006 9:23 pm Post subject: |
|
|
Hi again Chewi,
I finally have my PS2 working with an internal HD AND the network interface.
I managed to activate the hd loader from a memory card (they call it "exploitation" I think ), and now I can even transfer files directly from the PC to the PS2 via network.
How could I install Gentoo on it? Could you produce a bootable .iso image? I would test it instantly!
regards.
PS I've just added the last 16 megs to my Amiga so I have 128 megabytes too... should I try to compile Gentoo for it too? |
|
Back to top |
|
|
|