Hi, I've just started digging into PS2 Homebrew and was playing around with some stuff. Basically I wanted to build a custom / optimized software-stack for my next PS2 project. I'm already able to compile OpenPS2Loader & now wanted to do the same with FMCB. But since there seem to be a few changes in the ps2sdk/toolchain, it's not that easy. I could already fix some stuff, like for the newer libpng, but i can't figure out what's wrong with this: Code: make[1]: Entering directory '/build/modules/mcsio2' iop-gcc -O2 -G0 -c -I/usr/local/ps2dev/ps2sdk/iop/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/ps2sdk/iop/include -I/usr/local/ps2dev/ps2sdk/common/include -Wall -fno-builtin mcsio2.c -o mcsio2.o mcsio2.c:47: `sio2_mc_transfer_init' redeclared as different kind of symbol /usr/local/ps2dev/ps2sdk/iop/include/sio2man.h:69: previous declaration of `sio2_mc_transfer_init' mcsio2.c:48: `sio2_transfer' redeclared as different kind of symbol /usr/local/ps2dev/ps2sdk/iop/include/sio2man.h:70: previous declaration of `sio2_transfer' make[1]: *** [Rules.make:29: mcsio2.o] Error 1 make[1]: Leaving directory '/build/modules/mcsio2' make: *** [Makefile:129: mcsio2.s] Error 2 This are the offending lines from https://github.com/Nold360/FreeMcBoot/blob/master/modules/mcsio2/mcsio2.c Code: 46 /* xsio2man exports */ 47 /* 24 */ void (*sio2_mc_transfer_init)(void); 48 /* 25 */ int (*sio2_transfer)(sio2_transfer_data_t *sio2data); 49 /* 26 */ void (*sio2_transfer_reset)(void); 50 /* 57 */ int (*sio2_func3)(void *arg); Since I'm a noobish coder, I have no idea what they are good for... OpenPS2Loader had some similar code once, but it's been removed & is not included in the git history, sadly :/ Anyways, as the compiler told me it's a redeclaration, i commented out line 47 & 48. But than the linker complains about it... Code: make[1]: Entering directory '/build/modules/mcsio2' iop-gcc -O2 -G0 -c -I/usr/local/ps2dev/ps2sdk/iop/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/ps2sdk/iop/include -I/usr/local/ps2dev/ps2sdk/common/include -Wall -fno-builtin mcsio2.c -o mcsio2.o echo "#include \"irx_imports.h\"" > build-imports.c cat imports.lst >> build-imports.c iop-gcc -O2 -G0 -c -I/usr/local/ps2dev/ps2sdk/iop/include -I/usr/local/ps2dev/ps2sdk/common/include -I/usr/local/ps2dev/ps2sdk/iop/include -I/usr/local/ps2dev/ps2sdk/common/include -Wall -fno-builtin build-imports.c -o imports.o rm -f build-imports.c iop-gcc -nostdlib -s -o mcsio2.irx main.o mcsio2.o imports.o mcsio2.o(.text+0x174): In function `exec_sio2_transfer_thread': mcsio2.c: undefined reference to `sio2_mc_transfer_init' mcsio2.o(.text+0x178):mcsio2.c: undefined reference to `sio2_mc_transfer_init' mcsio2.o(.text+0x18c):mcsio2.c: undefined reference to `sio2_transfer' mcsio2.o(.text+0x190):mcsio2.c: undefined reference to `sio2_transfer' mcsio2.o(.text+0x2ac):mcsio2.c: undefined reference to `sio2_mc_transfer_init' mcsio2.o(.text+0x2c8):mcsio2.c: undefined reference to `sio2_transfer' collect2: ld returned 1 exit status make[1]: *** [Rules.make:50: mcsio2.irx] Error 1 make[1]: Leaving directory '/build/modules/mcsio2' make: *** [Makefile:129: mcsio2.s] Error 2 I'm using an extended Version of the Docker ps2sdk: https://github.com/Nold360/ps2dev-docker Which is based on this SDK: https://github.com/ps2dev/ps2sdk And this is my FMCB-Fork (Not all changes pushed yet): https://github.com/Nold360/FreeMcBoot I hope some of you guys might can help me out..
A long time ago, some projects like these would require missing code/modules that were not included within the PS2SDK. Rather than updating the PS2SDK, a copy of the missing files would be included as part of the project. Over the years, I have been moving the stuff into the PS2SDK, so we have less repeated code around and it brings the meaning of SDK back to the PS2SDK. Some of the definitions were either found to be incorrect or unsuitable for reasons, which was why there were changes. You may find some code that will not compile nicely, as a side effect. FMCB (even up to v1.8c, which was the code I got from Jimmikaelkael) does not use any of the homebrew SIO2 modules, so I guess you were trying to compile the installer for v1.7. You cannot remove what you removed. By right, IRX modules are statically linked - at load-time. This module attempts to dynamically locate and link the API at runtime. Since sio2man.h from the PS2SDK was updated to also have definitions of functions like sio2_mc_transfer_init, you should rename all occurrances of sio2_mc_transfer_init and sio2_transfer within mcsio2.c to something else. For example: psio2_mc_transfer_init, psio2_transfer.
On side note, you may want to note that projects like FMCB will likely not compile so well with the late PS2SDK revisions because I added kernel patchs to the PS2SDK like the thread patch. This patch replaces iWakeupThread(), which is used by the RPC-dispatcher part of the SIFRPC library, even if you do not use it. The side effect is that iWakeupThread will be replaced with additional functions, which results in bloat. If you do not use the crt0 module from the late PS2SDK (a common practice for these projects), then iWakeupThread() will not even work. But chances are, you will not use the RPC server part of SIFRPC (it was dysfunctional until 2017 anyway), so needless code bloat is the only problem you will encounter. The solution for all these issues, is to not link to libkernel, but the new libkernel-nopatch. Edit the Makefile(s) for FMCB itself and replace -lkernel with -lkernel-nopatch. This is only an issue for applications that require savings in space, like FMCB. Does not matter for everything else like the FMCB installer.
I did this already & it compiled/linked. thx. I patched the Makefiles, thanks. I came pretty far now, even if i just removed some CDVD-related functions - since i don't care about disks anyways.. Here is the next error that doesn't tell me anything: Code: ee-gcc -mno-crt0 -Tlinkfile -L/usr/local/ps2dev/ps2sdk/ee/lib -nostartfiles -Tlinkfile -L/usr/local/ps2dev/gsKit/lib -L/usr/local/ps2dev/ps2sdk/ports/lib -L/usr/local/ps2dev/ps2sdk/sbv/lib -L/usr/local/ps2dev/libcdvd/lib -L. -s \ -o FREE_MCBOOT.ELF crt0.o main.o gui.o timer.o pad.o osdname.o mcid.o build_osd.o embed.o mcsp_rpc.o sjpcm_rpc.o iomanx.o filexio.o usbd.o usbhdfsd.o cdvd.o mcsio2.o mcsp.o freesd.o sjpcm.o launcher1.o launcher2.o icon_sys.o icon_icn.o boot_icon_sys.o boot_icon_icn.o cnf_icon_sys.o cnf_icon_icn.o apps_icon_sys.o apps_icon_icn.o FREEMCB_CNF.o font_verdana.o background.o logo.o bar_up.o bar_down.o bar_delimiter.o credits_coded.o credits_gui.o highlight.o highlight_bw.o option_install_normal.o option_install_multi.o option_launch_fmcb.o option_fmcb_cfg.o option_format_mc.o option_uninstall.o icon_ok.o icon_warning.o icon_error.o clic_snd.o option_snd.o elf_loader.o -Xlinker --start-group -lpatches -lpadx -lcdvd -lcdvdfs -lmc -lgskit -ldmakit -lm -lz -lpng -ldebug -Xlinker --end-group -lc -lkernel-nopatch /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.3/../../../../ee/lib/libm.a(w_pow.o)(.text+0x28): In function `pow': ../../../../../newlib/libm/math/w_pow.c:86: relocation truncated to fit: R_MIPS_GPREL16 __fdlib_version /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.3/../../../../ee/lib/libm.a(w_pow.o)(.text+0x1f8):../../../../../newlib/libm/math/w_pow.c:161: relocation truncated to fit: R_MIPS_GPREL16 __fdlib_version /usr/local/ps2dev/ee/lib/gcc-lib/ee/3.2.3/../../../../ee/lib/libm.a(w_pow.o)(.text+0x298):../../../../../newlib/libm/math/w_pow.c:204: relocation truncated to fit: R_MIPS_GPREL16 __fdlib_version collect2: ld returned 1 exit status make: *** [Makefile.eeglobal:53: FREE_MCBOOT.ELF] Error 1 Could I just complie just the installer & combine it with a precompiled FMCB? Basically all i need is a FMCB-Installer that installs a customized config. (+ some interface changes in the installer)
There are a few things happening, but I don't really know why it is happening. The error occurs when linking libm (the math library). However, this libm is from Newlib, which we're using for C++ support. It probably shouldn't be using that, unless it compiles C++ code. It's still not supposed to have any problems with internal symbols being in the wrong section either (sdata vs data). I don't think this should even happen for library variables... When did you build your toolchain? At some point, I removed the "-G0" parameter from the script that sets up Newlib. Did not see why it would matter. It was reverted at some point. You could. It is a separate program after all. Would you mind telling us what you plan to do? If you want to ship a custom FREEMCB.CNF file, that modification can be done to any FMCB package. But do you really need to change the installer?