Skip to content

Commit 98ceded

Browse files
committed
Try to support multiple firmware
1 parent dbd4b31 commit 98ceded

File tree

2 files changed

+76
-43
lines changed

2 files changed

+76
-43
lines changed

.github/workflows/ci.yaml

Lines changed: 71 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
paths:
88
- '.github/workflows/ci.yaml'
99
- 'custom/**'
10+
- 'stage1/**'
11+
- 'stage2/**'
1012

1113
permissions:
1214
contents: write
@@ -18,7 +20,7 @@ jobs:
1820
runs-on: ubuntu-latest
1921
strategy:
2022
matrix:
21-
architecture: [x86_64, aarch64]
23+
firmware: [900, 903, 950, 1000, 1001, 1050, 1070, 1100]
2224

2325
steps:
2426
- name: Checkout repository
@@ -29,7 +31,7 @@ jobs:
2931
- name: Set up Alpine Linux environment
3032
uses: jirutka/[email protected]
3133
with:
32-
arch: ${{ matrix.architecture }}
34+
arch: x86_64
3335
branch: latest-stable
3436
packages: |
3537
alpine-sdk
@@ -50,72 +52,94 @@ jobs:
5052
7zip
5153
curl
5254
jq
55+
build-base
56+
gcc
57+
musl-dev
58+
make
5359
shell-name: alpine
5460

61+
- name: Build stage1 and stage2 for FW ${{ matrix.firmware }}
62+
shell: alpine --root {0}
63+
env:
64+
FW: ${{ matrix.firmware }}
65+
run: |
66+
set -e
67+
echo "Building stage1 and stage2 for FW ${FW}..."
68+
69+
# Build stage1
70+
echo "Building stage1 FW=${FW}"
71+
make -C stage1 FW=${FW} clean
72+
make -C stage1 FW=${FW}
73+
74+
# Build stage2
75+
echo "Building stage2 FW=${FW}"
76+
make -C stage2 FW=${FW} clean
77+
make -C stage2 FW=${FW}
78+
5579
- name: Prepare PPPwn binaries
5680
shell: alpine --root {0}
5781
env:
58-
ARCH: ${{ matrix.architecture }}
82+
FW: ${{ matrix.firmware }}
5983
run: |
6084
set -e
61-
echo "Preparing PPPwn binaries for ${ARCH}..."
85+
echo "Preparing PPPwn binaries for FW ${FW}..."
6286
mkdir -p /tmp/pppwnlive
6387
cd /tmp/pppwnlive
6488
65-
# Download and extract binaries with retries
89+
# Download and extract PPPwn binary
6690
for attempt in {1..3}; do
67-
wget https://github.com/xfangfang/PPPwn_cpp/releases/latest/download/${ARCH}-linux-musl.zip && break || sleep 5
91+
wget https://github.com/xfangfang/PPPwn_cpp/releases/latest/download/x86_64-linux-musl.zip && break || sleep 5
6892
done
69-
unzip -p ${ARCH}-linux-musl.zip | tar -xzOf - pppwn > pppwn && rm ${ARCH}-linux-musl.zip
70-
71-
wget https://github.com/B-Dem/PPPwnUI/raw/main/PPPwn/goldhen/1100/stage1.bin
72-
curl -L -o GoldHEN.7z $(curl -s https://api.github.com/repos/GoldHEN/GoldHEN/releases | jq -r '.[0].assets[0].browser_download_url')
73-
7zz e GoldHEN.7z pppnw_stage2/stage2_v*.7z -r -aoa
74-
7zz e stage2_v*.7z stage2_11.00.bin -r -aoa
75-
mv stage2_11.00.bin stage2.bin
76-
rm GoldHEN.7z stage2_v*.7z
93+
unzip -p x86_64-linux-musl.zip | tar -xzOf - pppwn > pppwn && rm x86_64-linux-musl.zip
94+
95+
# Copy compiled stage1 and stage2 binaries
96+
cp /github/workspace/stage1/stage1_${FW}.bin stage1.bin || cp /github/workspace/stage1/build/stage1_${FW}.bin stage1.bin
97+
cp /github/workspace/stage2/stage2_${FW}.bin stage2.bin || cp /github/workspace/stage2/build/stage2_${FW}.bin stage2.bin
98+
7799
cd /tmp
78100
tar -czf pppwn.tar.gz pppwnlive/*
79101
80102
- name: Install required packages and setup environment
81103
shell: alpine --root {0}
82104
env:
83-
ARCH: ${{ matrix.architecture }}
105+
FW: ${{ matrix.firmware }}
84106
run: |
85107
set -e
86-
echo "Installing required packages and setting up environment for ${ARCH}..."
108+
echo "Installing required packages and setting up environment for FW ${FW}..."
87109
find /tmp -name "pppwn.tar.gz" -exec cp {} aports/scripts/pppwn.tar.gz \;
88110
echo "permit nopass root" > /etc/doas.conf
89111
abuild-keygen -i -a -n -q
90112
91113
echo "http://dl-2.alpinelinux.org/alpine/latest-stable/main" > /etc/apk/repositories
92114
for i in {1..3}; do apk update && break || sleep 5; done
93-
mkdir -p ~/tmp ~/work/iso/${ARCH}
115+
mkdir -p ~/tmp ~/work/iso/${FW}
94116
export TMPDIR=~/tmp
95117
cp -rf custom/* aports/scripts/
96118
chmod +x aports/scripts/*
97119
98120
- name: Build ISO
99121
shell: alpine --root {0}
100122
env:
101-
ARCH: ${{ matrix.architecture }}
123+
FW: ${{ matrix.firmware }}
102124
run: |
103125
set -e
104-
echo "Building ISO for ${ARCH}..."
105-
sh aports/scripts/mkimage.sh --tag stable --outdir ~/work/iso/${ARCH} --arch ${ARCH} --repository https://dl-cdn.alpinelinux.org/alpine/latest-stable/main --profile pppwn > /var/log/mkimage.log 2>&1 \
126+
echo "Building ISO for FW ${FW}..."
127+
sh aports/scripts/mkimage.sh --tag stable --outdir ~/work/iso/${FW} --arch x86_64 --repository https://dl-cdn.alpinelinux.org/alpine/latest-stable/main --profile pppwn > /var/log/mkimage.log \
106128
|| (cat /var/log/mkimage.log || echo "No log found"; exit 1)
107-
ISO_PATH=$(find ~/work/iso/${ARCH} -name "alpine-*.iso" -print -quit)
129+
ISO_PATH=$(find ~/work/iso/${FW} -name "alpine-*.iso" -print -quit)
108130
if [ -z "$ISO_PATH" ]; then
109131
echo "ISO not found!"
110132
exit 1
111133
fi
112-
mv "$ISO_PATH" ~/work/iso/${ARCH}/pppwn-live-${ARCH}.iso
134+
# Convert firmware number to version format for filename (e.g., 1100 -> 11.00)
135+
FW_VERSION=$(echo ${FW} | sed 's/\(..\)\(..\)/\1.\2/' | sed 's/^0//')
136+
mv "$ISO_PATH" ~/work/iso/${FW}/pppwn-live-x86_64-fw${FW_VERSION}.iso
113137
114138
- name: Upload ISO artifact
115139
uses: actions/upload-artifact@v4
116140
with:
117-
name: pppwn-live-${{ matrix.architecture }}-iso
118-
path: ~/work/iso/${{ matrix.architecture }}/*.iso
141+
name: pppwn-live-x86_64-fw${{ matrix.firmware }}-iso
142+
path: ~/work/iso/${{ matrix.firmware }}/*.iso
119143

120144
create_release:
121145
if: github.ref == 'refs/heads/main'
@@ -127,30 +151,35 @@ jobs:
127151
with:
128152
path: iso_images
129153

130-
- name: Calculate SHA256 hashes
131-
id: sha256
154+
- name: Calculate SHA256 hashes and prepare release body
155+
id: prepare_release
132156
run: |
133-
echo "Calculating SHA256 checksums for each architecture..."
134-
SHA256_X86=$(sha256sum ./iso_images/pppwn-live-x86_64-iso/pppwn-live-x86_64.iso | awk '{print $1}')
135-
SHA256_AARCH64=$(sha256sum ./iso_images/pppwn-live-aarch64-iso/pppwn-live-aarch64.iso | awk '{print $1}')
136-
echo "sha256_x86=$SHA256_X86" >> $GITHUB_OUTPUT
137-
echo "sha256_aarch64=$SHA256_AARCH64" >> $GITHUB_OUTPUT
157+
echo "Calculating SHA256 checksums for each firmware..."
158+
{
159+
echo "Changelog:"
160+
echo " ${{ github.event.head_commit.message }}"
161+
echo ""
162+
echo "SHA256 Checksums:"
163+
} > release_body.txt
164+
165+
for FW in 900 903 950 1000 1001 1050 1070 1100; do
166+
# Convert firmware number to version format (e.g., 1100 -> 11.00)
167+
FW_VERSION=$(echo $FW | sed 's/\(..\)\(..\)/\1.\2/' | sed 's/^0//')
168+
ISO_DIR="./iso_images/pppwn-live-x86_64-fw${FW}-iso"
169+
ISO_FILE="${ISO_DIR}/pppwn-live-x86_64-fw${FW_VERSION}.iso"
170+
if [ -f "$ISO_FILE" ]; then
171+
SUM=$(sha256sum "$ISO_FILE" | awk '{print $1}')
172+
echo " - x86_64 FW${FW_VERSION}: \`$SUM\`" >> release_body.txt
173+
fi
174+
done
138175
139176
- name: Create Release
140177
uses: softprops/action-gh-release@v2
141178
with:
142179
tag_name: v${{ github.run_number }}
143180
name: Release v${{ github.run_number }}
144-
body: |
145-
146-
Changelog:
147-
${{ github.event.head_commit.message }}
148-
149-
SHA256 Checksums:
150-
- x86_64: `${{ steps.sha256.outputs.sha256_x86 }}`
151-
- aarch64: `${{ steps.sha256.outputs.sha256_aarch64 }}`
181+
body_path: release_body.txt
152182
files: |
153-
./iso_images/pppwn-live-x86_64-iso/pppwn-live-x86_64.iso
154-
./iso_images/pppwn-live-aarch64-iso/pppwn-live-aarch64.iso
183+
./iso_images/pppwn-live-x86_64-fw*-iso/pppwn-live-x86_64-fw*.iso
155184
env:
156-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ Temporary Items
2424

2525
# ISO image files
2626
*.iso
27-
*.img
27+
*.img
28+
29+
# TEMP: Ignore buildroot
30+
buildroot-2025.05.tar.gz
31+
buildroot-2025.05/

0 commit comments

Comments
 (0)