ps2homebrew/pfsshell

Get compiler warnings/errors on Fedora 29 beta, GCC 8.2.1.

TheMuso opened this issue · 22 comments

I get the following error when attempting to compile on Fedora 29, GCC 8.2.1. Clang 7.0.0 also fails with the same error.

[themuso@balta pfsshell]$ make
CC startup.c
CC hl.c
CC util.c
CC shell.c
make -C fake_sdk
make[1]: Entering directory '/home/themuso/git/ps2/pfsshell/fake_sdk'
CC atad.c
ar rcs libfakeps2sdk.a atad.o
make[1]: Leaving directory '/home/themuso/git/ps2/pfsshell/fake_sdk'
make -C iomanX
make[1]: Entering directory '/home/themuso/git/ps2/pfsshell/iomanX'
CC iomanX.c
iomanX.c: In function ‘AddDrv’:
iomanX.c:77:9: warning: unused variable ‘oldIntr’ [-Wunused-variable]
int oldIntr;
^~~~~~~
iomanX.c: In function ‘get_new_file’:
iomanX.c:181:9: warning: unused variable ‘oldIntr’ [-Wunused-variable]
int oldIntr;
^~~~~~~
In file included from iomanX.c:20:
iomanX.c: At top level:
../fake_sdk/include/iomanX.h:113:17: error: conflicting types for ‘iomanx_lseek64’
#define lseek64 iomanx_lseek64
^~~~~~~~~~~~~~
iomanX.c:570:11: note: in expansion of macro ‘lseek64’
long long lseek64(int fd, long long offset, int whence)
^~~~~~~
../fake_sdk/include/iomanX.h:113:17: note: previous declaration of ‘iomanx_lseek64’ was here
#define lseek64 iomanx_lseek64
^~~~~~~~~~~~~~
../fake_sdk/include/iomanX.h:184:5: note: in expansion of macro ‘lseek64’
s64 lseek64(int fd, s64 offset, int whence);
^~~~~~~
make[1]: *** [../Defs.mak:16: iomanX.o] Error 1
make[1]: Leaving directory '/home/themuso/git/ps2/pfsshell/iomanX'
make: *** [Makefile:40: iomanX/libiomanX.a] Error 2

I'm getting the exact same error on Ubuntu 18.04.2 LTS. I'm not good enough with the C programming to fix the error right off the bat, but I'm looking into it.

Thanks @TheMuso the patch worked on Ubuntu 18.04.2, I was able to compile pfsshell and it executed. I was then able to copy a file to the PS2 HD I'm using.

I'm following this guide trying to get PS1 VCD file onto the __.POPS partition I created with the Free MCBoot HDDManager app.

In the browser it says the files are there, but it won't execute. One thing I noticed was that when I created the partition it added a "+" to the beginning of the new partition. So the files are actually in "+__.POPS" and the ELF files for POPStarter are in __common/POPS. Do you think that's why the games won't load?

I know this might be off topic for the compile issue, but any help is greatly appreciated.

Thanks again for again for the patch.

Probably. Try creating the partition using pfsshell again.

I will take a look at the patch once I've got other things finished.

Maybe I'm doing something wrong, but when I try to make a partition I get:

# mkpart __.POPS 8192
(!) __.POPS: Invalid argument.
(!) Exit code is -22.

Trying to make an 8G __.POPS partition. Also, when I try to mount __common I get:

# mount __common
pfs: Error: Invalid magic/version
(!) hdd0:__common: Input/output error.
(!) Exit code is -5.

Not sure if that's a bug with Ubuntu, or with the patch. I noticed that do_mkpart uses iomanx_open and maybe that was tweaked with the patch...

Also, I started clean with a initialize yes to create the base partitions which seemed to work:

# ls
0x0001   128MB __mbr
0x0100   128MB __net
0x0100   256MB __system
0x0100   512MB __sysconf
0x0100  1024MB __common

Also, @uyjulian and @TheMuso thanks for your replies and help 🥇

You might have invalid partitions, so initialized yes will wipe and format everything

@uyjulian still getting the errors after doing the initialize yes:

# initialize yes
# mount __common
pfs: Error: Invalid magic/version
(!) hdd0:__common: Input/output error.
(!) Exit code is -5.

Also, I can't create a new partition, or folder, if I put the drive into the PS2 and use the HDDManager app.

@uyjulian still getting the errors after doing the initialize yes:

# initialize yes
# mount __common
pfs: Error: Invalid magic/version
(!) hdd0:__common: Input/output error.
(!) Exit code is -5.

Also, I can't create a new partition, or folder, if I put the drive into the PS2 and use the HDDManager app.

Low-level test the drive with the appropriate manufacturer's tool (example: Seagate and some others that are rebranded Seagate drives: use Seatools (Windows, DOS, Bootable (direct download).) You can easily find the right tester for your drive with a quick Google search, but if there isn't one, Seatools will still work for it.

Check if S.M.A.R.T. is tripped, then perform a Short DST (if applicable), then a Short Generic, then a Long Generic. (If the first passes, it's always good to do another Long Generic, but it's not necessary.) If any of them fail, raw copy the entire drive to some file with something like dd or dd4win, then replace it.

@ParzivalWolfram thanks, I'll definitely do those checks on the drive. I did try the pfsshell initialize yes on a 2nd drive and am getting the same errors when trying to create a partition, mount a partition, etc.

If I create the partitions using the HDDManager app in uLaunchELF psshell can mount the drive just fine.

I'll do some more testing and open another ticket if necessary since the original compile bug seems to be working fixed.

Ok, I feel like a dummy.

After digging into the code, I realized that you need to do mkfs after the initialize yes command to create the partitions. Once I did mkfs __common I could successfully mount __common and copy files.

After some more digging I realized that mkpart __.POPS 8192 won't work because the max partition size is 4096. So doing mkpart __.POPS 4096 works absolutely fine. Also, sizes of 2048 and 1024 work fine too.

What I'm experiencing now is that when using pfsshell to create a partition it doesn't show up in the uLaunchELF file browser and I'm not sure why? I can see the partition in the uLaunchELF HDDManager app, but it doesn't show up in the partition list and I can't copy files into it on the PS2 (copying files using pfsshell works fine).

Is there another command I'm missing?

Thanks again everyone for you help, I really appreciate it!

I experimented some more and creating a test partition works and I am able to view it in uLaunchELF. I also tried a __POPS partition instead of the documented "__.POPS" partition thinking maybe the period character is causing a problem, but neither appears in uLauchELF.

So pfsshell seems to be working fine and the problem is that uLauchELF doesn't recognize partitions starting with '__' (or maybe '_').

Anyone have any ideas why that may be? Just curious I know this issue has gotten pretty off topic from the original compile problem.

I really appreciate the help though, thanks again!

Not sure. This is the code for listing the partitions in uLaunchELF: https://github.com/AKuHAK/uLaunchELF/blob/8b4d00e47279a9eecb8d66888ba3bc247b41c6f0/filer.c#L653

Are you sure you have latest version of uLaunchELF from http://akuhak.github.io/test_build ?

@uyjulian thanks so much for the links. My uLaunchELF is 4.43a which looks newer than the one in the test_build...

Either way I copied the BOOT.ELF to the PS2 and after booting I can now see the __.POPS directory in uLaunchELF!!! Woo!

Not exactly sure why changing the boot.elf fixed viewing the __.POPS directory, but things seem to be coming along. Still not able to run PS1 games from HD, but that's another issue.

Thanks again!

Last question (I think). Does the latest pfsshell run, or compile, on Windows? If so is there steps for doing that?

Super thanks again everyone for all your help and patience. I'm a PS2 modding noob as you can probably tell 👍

It cross compiles for Windows using mingw, but currently it can not access real disks, only disk images.

Solution from #11 merged. Closing.