Skip to content

Commit e1757fb

Browse files
authored
Merge pull request #54 from fjtrujy/fix_ps2sdk
Reduce `ps2link` size and improve code.
2 parents c818628 + 32d1e6b commit e1757fb

11 files changed

Lines changed: 220 additions & 187 deletions

File tree

.github/workflows/compilation.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ jobs:
2424
run: |
2525
apk add build-base git
2626
27-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2828
- name: Compile project
2929
run: |
30-
make clean all LOADHIGH=${{ matrix.version[1] }}
30+
make -j $(getconf _NPROCESSORS_ONLN) clean
31+
make -j $(getconf _NPROCESSORS_ONLN) LOADHIGH=${{ matrix.version[1] }}
3132
3233
- name: Get short SHA
3334
id: slug
@@ -47,13 +48,13 @@ jobs:
4748
tar -zcvf ps2link-${{ steps.slug.outputs.sha8 }}-${{ matrix.version[0] }}.tar.gz ps2link
4849
4950
- name: Upload artifacts
50-
uses: actions/upload-artifact@v3
51+
uses: actions/upload-artifact@v4
5152
with:
5253
name: ps2link-${{ steps.slug.outputs.sha8 }}-${{ matrix.version[0] }}
5354
path: ps2link-${{ steps.slug.outputs.sha8 }}-${{ matrix.version[0] }}.tar.gz
5455

5556
- name: Upload uncompressd artifacts
56-
uses: actions/upload-artifact@v3
57+
uses: actions/upload-artifact@v4
5758
with:
5859
name: ps2link-uncompressed-${{ steps.slug.outputs.sha8 }}-${{ matrix.version[0] }}
5960
path: ee/ps2link.elf
@@ -64,7 +65,7 @@ jobs:
6465
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
6566
steps:
6667
- name: Download all artifacts
67-
uses: actions/download-artifact@v3
68+
uses: actions/download-artifact@v4
6869
with:
6970
path: ps2link
7071

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434
#
3535
# Generated source files
3636
#
37+
*_irx.c

Makefile

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ ZEROCOPY = 0
1313
# otherwise it will try and reset ps2link
1414
PWOFFONRESET = 1
1515

16-
# Set to the path where ps2eth is located
17-
PS2ETH = $(PS2DEV)/ps2eth
18-
19-
BIN2C=bin2c
2016
RM=rm -f
2117

2218
#
@@ -29,41 +25,13 @@ EE_BIN = ee/ps2link.elf
2925

3026
all: $(EE_BIN_PKD)
3127

32-
IRXFILES=\
33-
ps2link.irx \
34-
ioptrap.irx \
35-
ps2dev9.irx \
36-
poweroff.irx \
37-
ps2ip.irx \
38-
netman.irx \
39-
smap.irx \
40-
udptty.irx
41-
42-
EE_IRX_OBJS = $(addprefix ee/, $(addsuffix _irx.o, $(basename $(IRXFILES))))
43-
EE_IRX_OBJS += ps2ip_nm_irx.o
44-
# Where to find the IRX files
45-
vpath %.irx $(PS2SDK)/iop/irx/
46-
vpath %.irx iop/
47-
48-
# Rule to generate them
49-
ee/%_irx.o: %.irx
50-
$(BIN2C) $< $*_irx.c $*_irx
51-
$(EE_CC) -c $*_irx.c -o ee/$*_irx.o
52-
rm $*_irx.c
53-
54-
# The 'minus' sign is not handled well...
55-
ps2ip_nm_irx.o: ps2ip-nm.irx
56-
$(BIN2C) $< $*.c $*
57-
$(EE_CC) -c $*.c -o ee/$*.o
58-
rm $*.c
59-
6028
$(EE_BIN): ee
6129
$(EE_BIN_PKD): $(EE_BIN)
6230
ps2-packer $< $@ > /dev/null
6331

6432
export DEBUG LOADHIGH ZEROCOPY PWOFFONRESET
6533

66-
ee: iop builtins
34+
ee: iop
6735
$(MAKE) -C ee
6836

6937
iop:
@@ -72,11 +40,9 @@ iop:
7240
clean:
7341
$(MAKE) -C ee clean
7442
$(MAKE) -C iop clean
75-
@rm -f ee/*_irx.o bin/*.ELF bin/*.IRX
43+
@rm -f ee/*_irx.o ee/*_irx.c bin/*.ELF bin/*.IRX
7644

7745
docs:
7846
doxygen doxy.conf
7947

80-
builtins: $(EE_IRX_OBJS)
81-
8248
.PHONY: iop ee

ee/Makefile

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,60 @@ EE_INCS += -I../include
55
# This is for the sbv patch
66
EE_LIBS += -lpatches -ldebug
77

8-
# This is to builtin the IRXs into ps2link
9-
EE_OBJS += ps2link_irx.o ps2ip_nm_irx.o netman_irx.o smap_irx.o ioptrap_irx.o ps2dev9_irx.o poweroff_irx.o udptty_irx.o
8+
# IRX libs
9+
IRX_FILES += ioptrap.irx ps2dev9.irx poweroff.irx
10+
IRX_FILES += ps2ip.irx netman.irx smap.irx udptty.irx
11+
IRX_FILES += ps2link.irx
12+
EE_OBJS += $(IRX_FILES:.irx=_irx.o) ps2ip_nm_irx.o
13+
14+
# Compile with -Werror
15+
EE_CFLAGS += -Werror
1016

1117
# This is to enable the debug mode into ps2link
1218
ifeq ($(DEBUG),1)
1319
EE_CFLAGS += -DDEBUG -g
20+
else
21+
EE_CFLAGS += -Os
22+
EE_CFLAGS += -fdata-sections -ffunction-sections
1423
endif
1524

25+
ifeq ($(DEBUG),1)
26+
EE_LDFLAGS += -g
27+
else
28+
EE_LDFLAGS += -s
29+
EE_LDFLAGS += -Wl,--gc-sections
30+
endif
31+
EE_LDFLAGS += -Wl,-Map,ps2link.map
32+
1633
# This is to read the closest tag version
1734
APP_VERSION := $(shell git describe --tags --abbrev=0)
1835
EE_CFLAGS += -DAPP_VERSION=\"$(APP_VERSION)\"
1936

37+
# Use NEWLIB NANO for making smaller binaries
38+
NEWLIB_NANO = 1
39+
2040
# Use custom linkfile
2141
ifeq ($(LOADHIGH),1)
2242
EE_LINKFILE = linkfile.loadhigh
2343
else
2444
EE_LINKFILE = linkfile
2545
endif
2646

27-
ifeq ($(DEBUG),1)
28-
EE_LDFLAGS += -g
29-
else
30-
EE_LDFLAGS += -s
31-
endif
32-
3347
all: $(EE_BIN)
3448

3549
clean:
3650
-rm -f $(EE_OBJS) $(EE_BIN)
3751

52+
# IRX files
53+
# Special rule for ps2ip-nm.irx becasue - aren't valid
54+
ps2ip_nm_irx.c:
55+
$(PS2SDK)/bin/bin2c $(PS2SDK)/iop/irx/ps2ip-nm.irx $@ ps2ip_nm_irx
56+
# Special rule for local ps2link.irx
57+
ps2link_irx.c:
58+
$(PS2SDK)/bin/bin2c ../iop/ps2link.irx $@ ps2link_irx
59+
%_irx.c:
60+
$(PS2SDK)/bin/bin2c $(PS2SDK)/iop/irx/$*.irx $@ $*_irx
61+
62+
3863
include $(PS2SDK)/Defs.make
3964
include $(PS2SDK)/samples/Makefile.eeglobal_cpp

0 commit comments

Comments
 (0)