Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42d6506f38 | ||
|
|
3b34c2bbac | ||
|
|
18ba8fb35f | ||
|
|
00a223a5bc | ||
|
|
f4dc9127c7 | ||
|
|
dfa033f366 | ||
|
|
8a47c8ce8a | ||
|
|
af06958989 | ||
|
|
9a04802afb | ||
|
|
d8f473e204 | ||
|
|
bdbf37c55b | ||
|
|
9326867936 | ||
|
|
493cf0ca42 | ||
|
|
bd0ed7a600 | ||
|
|
4cec4b0d4a | ||
|
|
1cd33432d9 | ||
|
|
2bd56599e7 | ||
|
|
6b9789ca3a | ||
|
|
042d3c4f8b | ||
|
|
cc0e8d5af7 | ||
|
|
ba4b75362e | ||
|
|
9126bc5f7e | ||
|
|
b335aadce8 | ||
|
|
4a9a2f68f1 | ||
|
|
c98dd080dd | ||
|
|
ec64322177 | ||
|
|
8d2fa31bc9 | ||
|
|
27eb58e188 | ||
|
|
bba50ee092 | ||
|
|
89bcddcb4b | ||
|
|
8f517976ba | ||
|
|
9c3a591db8 | ||
|
|
02fe95fbfc | ||
|
|
b760cc1d83 | ||
|
|
a7af7a4041 | ||
|
|
36dc0137bd | ||
|
|
7fe32b54c9 | ||
|
|
c70c2506ad | ||
|
|
7c6c52904e | ||
|
|
ef88661453 | ||
|
|
68358829d6 | ||
|
|
892e17741f | ||
|
|
83489e54ea | ||
|
|
da8c45465a | ||
|
|
3d0e269244 | ||
|
|
b40e137a37 | ||
|
|
7ed291dd46 | ||
|
|
2d7882051e | ||
|
|
cab5a9f9f8 | ||
|
|
0b2ba0e76e | ||
|
|
795cb3d126 | ||
|
|
0801d52c97 | ||
|
|
1481ecc512 | ||
|
|
96486d6267 | ||
|
|
2720826c22 | ||
|
|
81b47ab254 | ||
|
|
9c65425f7c | ||
|
|
e9e44e6cc9 | ||
|
|
3ba32c40db | ||
|
|
ad72f91ee8 | ||
|
|
97138e24de | ||
|
|
15d13529a8 | ||
|
|
337604c25d | ||
|
|
eddcedcca1 |
No files matched your search
@@ -0,0 +1 @@
|
||||
* text=auto eol=lf
|
||||
@@ -171,7 +171,7 @@ make palera1n_mingw
|
||||
- [staturnz](https://github.com/staturnz) - Liteusb, Loader contributions
|
||||
- [libusb](https://github.com/libimobiledevice/libimobiledevice) - Library for access to usb-devices, used by libopenra1n
|
||||
- [idevice](https://github.com/jkcoxson/idevice) - Library for access to usbmuxd devices
|
||||
- [plooshi](https://github.com/plooshi) - Plooshfinder, plooshinit, various legacy patches
|
||||
- [sarah](https://github.com/plooshi) - Plooshfinder, plooshinit, various legacy patches
|
||||
- [Procursus](https://github.com/ProcursusTeam/Procursus) - Bootstrap & binpack
|
||||
- [tealbathingsuit](https://github.com/tealbathingsuit) - Tweak injection ([ElleKit](https://github.com/tealbathingsuit/ellekit))
|
||||
- [sbingner](https://github.com/sbingner) - Substitute
|
||||
@@ -13,14 +13,17 @@ on:
|
||||
- CMakeLists.txt
|
||||
- Makefile
|
||||
|
||||
env:
|
||||
TAG: ${{ github.ref_name }}
|
||||
|
||||
jobs:
|
||||
build-loader:
|
||||
runs-on: macos-15
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: a766a91bf4b691317df24d3be41e44e754a3e0d8
|
||||
ref: 9faf50968854aa47de65231e2985d60f6944d627
|
||||
repository: palera1n/loader
|
||||
|
||||
- name: Install dependencies (brew)
|
||||
@@ -28,7 +31,7 @@ jobs:
|
||||
brew install gnu-sed
|
||||
|
||||
- name: Select correct Xcode
|
||||
uses: mobiledevops/xcode-select-version-action@7b50160de7c8bd6a8c4ee2c2e6b5ee0983886c0b
|
||||
uses: mobiledevops/xcode-select-version-action@7b50160de7c8bd6a8c4ee2c2e6b5ee0983886c0b # v1.1.0
|
||||
with:
|
||||
xcode-select-version: 16.4
|
||||
|
||||
@@ -39,9 +42,9 @@ jobs:
|
||||
make package PLATFORM=appletvos PACKAGE_NAME=palera1nLoaderTV
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: loader
|
||||
name: _loader
|
||||
path: |
|
||||
packages/*
|
||||
|
||||
@@ -50,19 +53,19 @@ jobs:
|
||||
needs: [build-loader]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: 9cadaa63569ba318677b4ef0869ad984b3663a6c
|
||||
ref: 7e1f6e122c3a45fc45e939293c7e2eaa1889731f
|
||||
repository: palera1n/jbinit
|
||||
submodules: true
|
||||
|
||||
- name: Download loader artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: loader
|
||||
name: _loader
|
||||
|
||||
- name: Select correct Xcode
|
||||
uses: mobiledevops/xcode-select-version-action@7b50160de7c8bd6a8c4ee2c2e6b5ee0983886c0b
|
||||
uses: mobiledevops/xcode-select-version-action@7b50160de7c8bd6a8c4ee2c2e6b5ee0983886c0b # v1.1.0
|
||||
with:
|
||||
xcode-select-version: 16.4
|
||||
|
||||
@@ -87,9 +90,9 @@ jobs:
|
||||
mv src/binpack.dmg upload/
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: embedded
|
||||
name: _embedded
|
||||
path: |
|
||||
upload/*
|
||||
|
||||
@@ -97,14 +100,18 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: e98323f8a09abd80fc4cbcd74dee023b91a1ec22
|
||||
repository: palera1n/PongoOS
|
||||
|
||||
- name: Install dependencies (brew)
|
||||
run: |
|
||||
brew install make
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
make
|
||||
gmake -j$(sysctl -n hw.ncpu)
|
||||
|
||||
- name: Prepare upload directory
|
||||
run: |
|
||||
@@ -113,9 +120,9 @@ jobs:
|
||||
mv build/checkra1n-kpf-pongo upload/
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: pongo
|
||||
name: _pongo
|
||||
path: |
|
||||
upload/*
|
||||
|
||||
@@ -132,21 +139,21 @@ jobs:
|
||||
- aarch64-linux-musl
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
token: ${{ secrets.BUILD_GITHUB_TOKEN }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Download Pongo
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: pongo
|
||||
name: _pongo
|
||||
path: embedded/
|
||||
|
||||
- name: Download embedded artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: embedded
|
||||
name: _embedded
|
||||
path: embedded/
|
||||
|
||||
- name: Download musl toolchain
|
||||
@@ -176,7 +183,7 @@ jobs:
|
||||
- name: Install dependencies (apt)
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential cmake autoconf automake libtool pkg-config zstd
|
||||
sudo apt install -y build-essential cmake autoconf automake libtool pkg-config zstd jq
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
@@ -216,12 +223,59 @@ jobs:
|
||||
esac
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: palera1n-${{ matrix.triple }}
|
||||
path: |
|
||||
build/*.tar.gz
|
||||
|
||||
build-linux-appimage:
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [build-pongo, build-ramdisk]
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04
|
||||
arch: x86_64
|
||||
- os: ubuntu-24.04-arm
|
||||
arch: aarch64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
token: ${{ secrets.BUILD_GITHUB_TOKEN }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Download Pongo
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: _pongo
|
||||
path: embedded/
|
||||
|
||||
- name: Download embedded artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: _embedded
|
||||
path: embedded/
|
||||
|
||||
- name: Install dependencies (apt)
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential cmake autoconf automake libtool pkg-config zstd jq libwxgtk3.2-dev
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
make package WITH_GUI=1 WITH_TUI=1 WITH_CIDERRAIN=1 BUILD_TYPE=Release JOBS=$(nproc)
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: palera1n-${{ matrix.arch }}-linux-gui
|
||||
path: |
|
||||
build/*.AppImage
|
||||
|
||||
build-macos:
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [build-pongo, build-ramdisk]
|
||||
@@ -235,31 +289,31 @@ jobs:
|
||||
arch: x86_64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
token: ${{ secrets.BUILD_GITHUB_TOKEN }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Download Pongo
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: pongo
|
||||
name: _pongo
|
||||
path: embedded/
|
||||
|
||||
- name : Download embedded artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: embedded
|
||||
name: _embedded
|
||||
path: embedded/
|
||||
|
||||
- name: Install dependencies (brew)
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake autoconf automake libtool pkg-config
|
||||
brew install make cmake autoconf automake libtool pkg-config
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
make palera1n WITH_STATIC=1 WITH_GUI=1 WITH_TUI=1 WITH_CIDERRAIN=1 BUILD_TYPE=Release JOBS=$(sysctl -n hw.ncpu)
|
||||
gmake palera1n WITH_STATIC=1 WITH_GUI=1 WITH_TUI=1 WITH_CIDERRAIN=1 BUILD_TYPE=Release JOBS=$(sysctl -n hw.ncpu)
|
||||
strip -x build/palera1n.app/Contents/MacOS/palera1n
|
||||
|
||||
- name: Package
|
||||
@@ -267,7 +321,7 @@ jobs:
|
||||
cd build && zip -r palera1n-macos-${{ matrix.arch }}.zip palera1n.app
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: palera1n-macos-${{ matrix.arch }}
|
||||
path: |
|
||||
@@ -278,42 +332,41 @@ jobs:
|
||||
needs: [build-pongo, build-ramdisk]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
token: ${{ secrets.BUILD_GITHUB_TOKEN }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Procursus
|
||||
uses: beerpiss/[email protected]
|
||||
uses: beerpiss/procursus-action@fbd8e4db6742ffc2c300b4995587a57bcb66654b # v2.0.2
|
||||
with:
|
||||
cache: true
|
||||
mirror: 'https://apt.procurs.us/'
|
||||
|
||||
- name: Download Pongo
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: pongo
|
||||
name: _pongo
|
||||
path: embedded/
|
||||
|
||||
- name : Download embedded artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: embedded
|
||||
name: _embedded
|
||||
path: embedded/
|
||||
|
||||
- name: Install dependencies (brew)
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake libtool gnu-sed
|
||||
brew install make cmake libtool gnu-sed
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
make palera1n_xcode PLATFORM=iphoneos WITH_STATIC=1 BUILD_TYPE=Release JOBS=$(sysctl -n hw.ncpu)
|
||||
cmake --build build
|
||||
gmake palera1n PLATFORM=iphoneos WITH_STATIC=1 WITH_CIDERRAIN=1 BUILD_TYPE=Release JOBS=$(sysctl -n hw.ncpu)
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
cd build
|
||||
cd build
|
||||
cpack -DCPACK_PACKAGE_FILE_NAME="palera1n-iphoneos-arm" \
|
||||
-DCPACK_PACKAGING_INSTALL_PREFIX="/usr/"
|
||||
cpack -DCPACK_PACKAGE_FILE_NAME="palera1n-iphoneos-arm64" \
|
||||
@@ -323,8 +376,8 @@ jobs:
|
||||
mkdir -p palera1n-iphoneos-arm/DEBIAN
|
||||
tar -xf palera1n-iphoneos-arm64.tar.gz -C palera1n-iphoneos-arm64
|
||||
tar -xf palera1n-iphoneos-arm.tar.gz -C palera1n-iphoneos-arm
|
||||
cp ../packaging/control palera1n-iphoneos-arm64/DEBIAN/control
|
||||
cp ../packaging/control palera1n-iphoneos-arm/DEBIAN/control
|
||||
cp ../resources/control palera1n-iphoneos-arm64/DEBIAN/control
|
||||
cp ../resources/control palera1n-iphoneos-arm/DEBIAN/control
|
||||
|
||||
VERSION=$(grep '^#define PALERAIN_VERSION' ../src/globals.h | cut -d'"' -f2 | tr -cd '0-9.')
|
||||
|
||||
@@ -337,7 +390,7 @@ jobs:
|
||||
dpkg-deb --build palera1n-iphoneos-arm
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: palera1n-iphoneos-arm64
|
||||
path: |
|
||||
@@ -348,15 +401,15 @@ jobs:
|
||||
needs: [build-macos]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Download arm64 artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-macos-arm64
|
||||
|
||||
- name: Download x86_64 artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-macos-x86_64
|
||||
|
||||
@@ -382,8 +435,8 @@ jobs:
|
||||
run: |
|
||||
create-dmg \
|
||||
--volname "palera1n-macos-universal" \
|
||||
--volicon "packaging/drive.icns" \
|
||||
--background "packaging/background.png" \
|
||||
--volicon "resources/drive.icns" \
|
||||
--background "resources/background.png" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 510 350 \
|
||||
--icon-size 100 \
|
||||
@@ -393,130 +446,150 @@ jobs:
|
||||
dist/palera1n-macos-universal.dmg dist/palera1n-macos-universal
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: palera1n-macos-universal
|
||||
path: |
|
||||
dist/palera1n-macos-universal.dmg
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
needs: [build-pongo, build-ramdisk]
|
||||
# build-windows:
|
||||
# runs-on: windows-latest
|
||||
# needs: [build-pongo, build-ramdisk]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# steps:
|
||||
# - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Download Pongo
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: pongo
|
||||
path: embedded/
|
||||
# - name: Download Pongo
|
||||
# uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
# with:
|
||||
# name: _pongo
|
||||
# path: embedded/
|
||||
|
||||
- name: Download embedded artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: embedded
|
||||
path: embedded/
|
||||
# - name: Download embedded artifacts
|
||||
# uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
# with:
|
||||
# name: _embedded
|
||||
# path: embedded/
|
||||
|
||||
- name: Install dependencies (choco)
|
||||
run: choco install nsis.portable
|
||||
# - name: Install dependencies (choco)
|
||||
# run: choco install nsis.portable
|
||||
|
||||
- name: Install dependencies (msys2)
|
||||
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884
|
||||
with:
|
||||
msystem: MINGW64
|
||||
install: >
|
||||
git
|
||||
mingw-w64-x86_64-toolchain
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-libusb
|
||||
mingw-w64-x86_64-rust
|
||||
mingw-w64-x86_64-nsis
|
||||
libtool
|
||||
openssl
|
||||
openssl-devel
|
||||
python-devel
|
||||
autoconf
|
||||
automake
|
||||
zip
|
||||
vim
|
||||
make
|
||||
patch
|
||||
update: true
|
||||
# - name: Install dependencies (msys2)
|
||||
# uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0
|
||||
# with:
|
||||
# msystem: MINGW64
|
||||
# install: >
|
||||
# git
|
||||
# mingw-w64-x86_64-toolchain
|
||||
# mingw-w64-x86_64-cmake
|
||||
# mingw-w64-x86_64-libusb
|
||||
# mingw-w64-x86_64-rust
|
||||
# mingw-w64-x86_64-nsis
|
||||
# mingw-w64-x86_64-jq
|
||||
# libtool
|
||||
# openssl
|
||||
# openssl-devel
|
||||
# python-devel
|
||||
# autoconf
|
||||
# automake
|
||||
# zip
|
||||
# vim
|
||||
# make
|
||||
# patch
|
||||
# update: true
|
||||
|
||||
- name: Build
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
make palera1n_mingw WITH_STATIC=1 WITH_GUI=1 BUILD_TYPE=Release JOBS=$(nproc)
|
||||
strip -s build/palera1n.exe
|
||||
# - name: Build
|
||||
# shell: msys2 {0}
|
||||
# run: |
|
||||
# make palera1n_mingw WITH_STATIC=1 WITH_GUI=1 BUILD_TYPE=Release JOBS=$(nproc)
|
||||
# strip -s build/palera1n.exe
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
cd build && cpack -DCPACK_PACKAGE_FILE_NAME="palera1n-windows-x86_64-setup"
|
||||
# - name: Package
|
||||
# run: |
|
||||
# cd build && cpack -DCPACK_PACKAGE_FILE_NAME="palera1n-windows-x86_64-setup"
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: palera1n-windows-x86_64
|
||||
path: |
|
||||
build/palera1n-windows-x86_64-setup.exe
|
||||
# - name: Upload
|
||||
# uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
# with:
|
||||
# name: palera1n-windows-x86_64
|
||||
# path: |
|
||||
# build/palera1n-windows-x86_64-setup.exe
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
needs: [build-ramdisk, build-pongo, build-linux, build-macos-universal, build-windows, build-ios]
|
||||
needs: [
|
||||
build-ramdisk,
|
||||
build-pongo,
|
||||
build-linux,
|
||||
build-macos-universal,
|
||||
# build-windows,
|
||||
build-ios
|
||||
]
|
||||
|
||||
steps:
|
||||
- name: Download embedded artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: embedded
|
||||
name: _embedded
|
||||
path: embedded/
|
||||
|
||||
- name: Download Pongo
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: pongo
|
||||
name: _pongo
|
||||
path: embedded/
|
||||
|
||||
- name: Download Linux i486 Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-i486-linux-musl
|
||||
path: dist/
|
||||
|
||||
- name: Download Linux x86_64 Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-x86_64-linux-musl
|
||||
path: dist/
|
||||
|
||||
- name: Download Linux armel Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-armel-linux-musleabi
|
||||
path: dist/
|
||||
|
||||
- name: Download Linux x86_64 AppImage Artifact
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-x86_64-linux-gui
|
||||
path: dist/
|
||||
|
||||
- name: Download Linux aarch64 AppImage Artifact
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-aarch64-linux-gui
|
||||
path: dist/
|
||||
|
||||
- name: Download Linux aarch64 Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-aarch64-linux-musl
|
||||
path: dist/
|
||||
|
||||
- name: Download macOS Universal Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-macos-universal
|
||||
path: dist/
|
||||
|
||||
# - name: Download Windows Artifact
|
||||
# uses: actions/download-artifact@v4
|
||||
# uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
# with:
|
||||
# name: palera1n-windows-x86_64
|
||||
# path: dist/
|
||||
|
||||
- name: Download iOS Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
|
||||
with:
|
||||
name: palera1n-iphoneos-arm64
|
||||
path: dist/
|
||||
@@ -526,20 +599,26 @@ jobs:
|
||||
find . -maxdepth 1 -type f -print0 | tar --null -czf ../dist/resource.tar.gz --files-from=-
|
||||
working-directory: embedded
|
||||
|
||||
- name: Extract Version
|
||||
id: get_version
|
||||
run: |
|
||||
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
|
||||
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v3.0.2
|
||||
with:
|
||||
name: v${{ steps.get_version.outputs.version }}
|
||||
tag_name: v${{ steps.get_version.outputs.version }}
|
||||
name: ${{ env.TAG }}
|
||||
tag_name: ${{ env.TAG }}
|
||||
files: |
|
||||
dist/*
|
||||
body: |
|
||||
## What's Changed
|
||||
|
||||
<!-- auto generated -->
|
||||
|
||||
## Files
|
||||
|
||||
- `palera1n-iphoneos-${arch}.deb`: Palera1n for iOS jailbroken environments.
|
||||
- `palera1n-linux-${arch}.tar.gz`: Palera1n for Linux on CPU architecture `${arch}`.
|
||||
- `palera1n-macos-universal.dmg`: Palera1n for macOS 10.11+.
|
||||
- `resources.tar.gz`: Precompiled embedded artifacts used for compiling this tool.
|
||||
generate_release_notes: true
|
||||
fail_on_unmatched_files: true
|
||||
draft: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,25 +1,33 @@
|
||||
name: "Upload debs"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "palera1n tag"
|
||||
required: true
|
||||
type: string
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
TAG: ${{ github.event.inputs.version || github.event.release.tag_name }}
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download debs from release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh release download "${{ github.event.release.tag_name }}" \
|
||||
--pattern "palera1n-iphoneos-arm64.deb" \
|
||||
--pattern "palera1n-iphoneos-arm.deb"
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
if [ ! -f "palera1n-iphoneos-arm64.deb" ] || [ ! -f "palera1n-iphoneos-arm.deb" ]; then
|
||||
echo "Debs not found :/"
|
||||
exit 1
|
||||
fi
|
||||
- name: Download debs from tag
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release download "${{ env.TAG }}"
|
||||
mkdir -p cdn-upload
|
||||
cp *.tar.gz cdn-upload/
|
||||
cp *.deb cdn-upload/
|
||||
cp *.dmg cdn-upload/
|
||||
|
||||
- name: Upload debs to repo
|
||||
if: github.repository == 'palera1n/palera1n'
|
||||
@@ -28,18 +36,50 @@ jobs:
|
||||
API_TOKEN: ${{ secrets.BUILD_GITHUB_TOKEN }}
|
||||
GH_REPO: palera1n/repo.palera.in
|
||||
run: |
|
||||
git clone https://$USERNAME:[email protected]/$GH_REPO.git upload
|
||||
git clone https://$USERNAME:[email protected]/$GH_REPO.git repo-upload
|
||||
|
||||
ARM64_HASH=$(sha256sum palera1n-iphoneos-arm64.deb | cut -c1-8)
|
||||
ARM_HASH=$(sha256sum palera1n-iphoneos-arm.deb | cut -c1-8)
|
||||
cp palera1n-iphoneos-arm64.deb upload/pool/iphoneos-arm64/palera1n_${{ github.event.release.tag_name }}_${ARM64_HASH}_iphoneos-arm64.deb
|
||||
cp palera1n-iphoneos-arm.deb upload/pool/iphoneos-arm/palera1n_${{ github.event.release.tag_name }}_${ARM_HASH}_iphoneos-arm.deb
|
||||
rm -rf repo-upload/dists/stable/main/binary-iphoneos-arm{,64}/palera1n*.deb
|
||||
cp palera1n-iphoneos-arm64.deb repo-upload/pool/iphoneos-arm64/palera1n-iphoneos-arm64.deb
|
||||
cp palera1n-iphoneos-arm.deb repo-upload/pool/iphoneos-arm/palera1n-iphoneos-arm.deb
|
||||
|
||||
cd upload
|
||||
cd repo-upload
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.name "$USERNAME"
|
||||
git config user.email "[email protected]"
|
||||
|
||||
git add .
|
||||
git commit -m "Update palera1n for ${{ github.event.release.tag_name }}" || exit 0
|
||||
git commit -m "Update palera1n for ${{ env.TAG }}" || exit 0
|
||||
git push https://$USERNAME:[email protected]/$GH_REPO.git
|
||||
|
||||
- name: Upload artifacts to cdn
|
||||
if: github.repository == 'palera1n/palera1n'
|
||||
uses: wangyucode/sftp-upload-action@v3
|
||||
with:
|
||||
host: ${{ secrets.NICKCHAN_FTP_HOST }}
|
||||
port: ${{ secrets.NICKCHAN_FTP_PORT }}
|
||||
username: palera1n
|
||||
password: ${{ secrets.NICKCHAN_FTP_PASS }}
|
||||
forceUpload: true
|
||||
dryRun: false
|
||||
localDir: 'cdn-upload'
|
||||
remoteDir: "/palera1n/c-rewrite/releases/${{ env.TAG }}"
|
||||
|
||||
- name: Bump palen1x
|
||||
if: github.repository == 'palera1n/palera1n'
|
||||
env:
|
||||
USERNAME: GitHub-Actions
|
||||
API_TOKEN: ${{ secrets.BUILD_GITHUB_TOKEN }}
|
||||
GH_REPO: palera1n/palen1x
|
||||
BRANCH: Alpine
|
||||
run: |
|
||||
git clone https://$USERNAME:[email protected]/$GH_REPO.git tag
|
||||
cd tag
|
||||
|
||||
git config --global user.name "$USERNAME"
|
||||
git config --global user.email "[email protected]"
|
||||
|
||||
git commit --allow-empty -m "bump to ${{ env.TAG }}"
|
||||
git push https://$USERNAME:[email protected]/$GH_REPO.git "$BRANCH"
|
||||
|
||||
git tag "${{ env.TAG }}"
|
||||
git push https://$USERNAME:[email protected]/$GH_REPO.git "${{ env.TAG }}"
|
||||
@@ -8,8 +8,10 @@ embedded/Pongo.bin
|
||||
embedded/checkra1n-kpf-pongo
|
||||
embedded/ramdisk.dmg
|
||||
embedded/binpack.dmg
|
||||
embedded/DFUHelperDeviceInfo-minified.json
|
||||
|
||||
apple-include-*
|
||||
*-unknown-*
|
||||
libusbK/
|
||||
libusbK-tmp/
|
||||
|
||||
|
||||
@@ -25,34 +25,10 @@ option(WITH_CIDERRAIN "Build with Ciderra1n instead of Openra1n" OFF)
|
||||
# MARK: BUILD REQUIREMENTS
|
||||
# =========================
|
||||
|
||||
if(LINUX AND WITH_STATIC)
|
||||
if(NOT CROSS_HOST_TRIPLE MATCHES "musl" AND NOT CMAKE_C_COMPILER_TARGET MATCHES "musl" AND NOT CMAKE_C_COMPILER MATCHES "musl")
|
||||
message(FATAL_ERROR "Static builds on Linux require a musl toolchain. Please specify a musl cross-compiler or set -DCROSS_HOST_TRIPLE=...-linux-musl")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW AND NOT WITH_STATIC)
|
||||
message(FATAL_ERROR "MinGW builds must be static. Please configure with -DWITH_STATIC=1")
|
||||
endif()
|
||||
|
||||
if(MINGW AND WITH_TUI)
|
||||
message(FATAL_ERROR "-DWITH_TUI=1 is not supported on MinGW builds.")
|
||||
endif()
|
||||
|
||||
if(MINGW AND WITH_CIDERRAIN)
|
||||
message(FATAL_ERROR "-DWITH_CIDERRAIN=1 is not supported on MinGW builds.")
|
||||
endif()
|
||||
|
||||
if(IOS AND (WITH_TUI OR WITH_GUI))
|
||||
message(FATAL_ERROR "-DWITH_TUI=1 or -DWITH_GUI=1 is not supported on iOS builds.")
|
||||
endif()
|
||||
|
||||
if(IOS AND WITH_CIDERRAIN)
|
||||
message(FATAL_ERROR "-DWITH_CIDERRAIN=1 is not supported on iOS builds.")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/BuildRequirements.cmake")
|
||||
|
||||
# =========================
|
||||
# SETUP
|
||||
# MARK: SETUP
|
||||
# =========================
|
||||
|
||||
if(MINGW)
|
||||
@@ -109,6 +85,14 @@ FetchContent_MakeAvailable(nlohmann_json)
|
||||
# MARK: TARGET
|
||||
# =========================
|
||||
|
||||
message(STATUS "========================")
|
||||
message(STATUS "Using XXD on this shit!!!")
|
||||
message(STATUS "========================")
|
||||
include(cmake/Xxd.cmake)
|
||||
if(IOS)
|
||||
include(cmake/AppleHeaders.cmake)
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
|
||||
"src/*.cpp"
|
||||
"src/*.c"
|
||||
@@ -117,13 +101,14 @@ file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
|
||||
)
|
||||
|
||||
if((APPLE AND NOT IOS) AND WITH_GUI)
|
||||
set(APP_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/palera1n.icns")
|
||||
set(APP_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/AppIcon.icns")
|
||||
set(APP_ICON_CAR "${CMAKE_CURRENT_SOURCE_DIR}/resources/Assets.car")
|
||||
add_executable(palera1n MACOSX_BUNDLE ${SOURCES})
|
||||
target_sources(palera1n PRIVATE ${APP_ICON})
|
||||
target_sources(palera1n PRIVATE ${APP_ICON} ${APP_ICON_CAR})
|
||||
set_source_files_properties(${APP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set_source_files_properties(${APP_ICON_CAR} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set_target_properties(palera1n PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist"
|
||||
MACOSX_BUNDLE_ICON_FILE palera1n.icns
|
||||
)
|
||||
elseif(IOS)
|
||||
add_executable(palera1n MACOSX_BUNDLE ${SOURCES})
|
||||
@@ -164,33 +149,7 @@ if(WITH_CIDERRAIN)
|
||||
target_compile_definitions(palera1n PRIVATE WITH_CIDERRAIN)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref --symbolic-full-name "@{u}"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git remote get-url origin
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_URL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
target_compile_definitions(palera1n PRIVATE
|
||||
GIT_HASH="${GIT_HASH}"
|
||||
GIT_BRANCH="${GIT_BRANCH}"
|
||||
GIT_URL="${GIT_URL}"
|
||||
)
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Git.cmake")
|
||||
|
||||
# =========================
|
||||
# MARK: LINKS
|
||||
@@ -208,225 +167,24 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# =========================
|
||||
# MARK: NON-CMAKE DEPENDENCIES
|
||||
# MARK: NON-CMAKE DEPENDENCIES (LOCAL)
|
||||
# =========================
|
||||
|
||||
# ra1ns
|
||||
if(WITH_CIDERRAIN)
|
||||
message(STATUS "Building with Ciderra1n support")
|
||||
|
||||
# TODO: get rid
|
||||
execute_process(
|
||||
COMMAND patch --batch --forward -p1 -i ${CMAKE_SOURCE_DIR}/patches/liteusb/0001-cpp-compatible.patch
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/external/liteusb
|
||||
RESULT_VARIABLE LITEUSB_PATCH_RESULT
|
||||
)
|
||||
|
||||
if(IOS)
|
||||
execute_process(
|
||||
COMMAND xcrun --sdk iphoneos --show-sdk-path
|
||||
OUTPUT_VARIABLE IOS_SDK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"CFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"CXXFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"LDFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n
|
||||
RESULT_VARIABLE CIDERRA1N_BUILD_RESULT
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n
|
||||
RESULT_VARIABLE CIDERRA1N_BUILD_RESULT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CIDERRA1N_BUILD_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to build Ciderra1n.")
|
||||
endif()
|
||||
|
||||
set(CIDERRAIN_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/build/include")
|
||||
set(CIDERRAIN_LIB "${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/build/lib/ciderra1n/libciderra1n.a")
|
||||
target_include_directories(palera1n PRIVATE ${CIDERRAIN_INCLUDE_DIR})
|
||||
target_link_libraries(palera1n PRIVATE "${CIDERRAIN_LIB}")
|
||||
|
||||
if(IOS)
|
||||
target_include_directories(palera1n PRIVATE "${CMAKE_SOURCE_DIR}/apple-include-iphoneos")
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
set(LITEUSB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/external/liteusb/include")
|
||||
target_compile_definitions(palera1n PRIVATE LITEUSB_PLATFORM_LINUX)
|
||||
target_include_directories(palera1n PRIVATE ${LITEUSB_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Ciderra1n.cmake")
|
||||
else()
|
||||
message(STATUS "Building with Openra1n support")
|
||||
|
||||
if(IOS)
|
||||
execute_process(
|
||||
COMMAND xcrun --sdk iphoneos --show-sdk-path
|
||||
OUTPUT_VARIABLE IOS_SDK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"CFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"CXXFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"LDFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libopenra1n
|
||||
RESULT_VARIABLE OPENRA1N_BUILD_RESULT
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libopenra1n
|
||||
RESULT_VARIABLE OPENRA1N_BUILD_RESULT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT OPENRA1N_BUILD_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to build Openra1n.")
|
||||
endif()
|
||||
|
||||
set(OPENRA1N_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/1stparty/libopenra1n/build/include")
|
||||
set(OPENRA1N_LIB "${CMAKE_SOURCE_DIR}/1stparty/libopenra1n/build/lib/openra1n/libopenra1n.a")
|
||||
|
||||
target_include_directories(palera1n PRIVATE ${OPENRA1N_INCLUDE_DIR})
|
||||
target_link_libraries(palera1n PRIVATE "${OPENRA1N_LIB}")
|
||||
|
||||
if(IOS)
|
||||
target_include_directories(palera1n PRIVATE "${CMAKE_SOURCE_DIR}/apple-include-iphoneos")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Openra1n.cmake")
|
||||
endif()
|
||||
|
||||
# idevice
|
||||
if(WITH_GUI OR WITH_TUI)
|
||||
set(IDevice_CARGO_ARGS
|
||||
--release
|
||||
--no-default-features
|
||||
--features "usbmuxd ring tcp"
|
||||
)
|
||||
|
||||
set(IDevice_ENV)
|
||||
|
||||
if(CROSS_HOST_TRIPLE)
|
||||
if(CROSS_HOST_TRIPLE STREQUAL "i486-linux-musl")
|
||||
set(RUST_TARGET "i686-unknown-linux-musl")
|
||||
elseif(CROSS_HOST_TRIPLE STREQUAL "x86_64-linux-musl")
|
||||
set(RUST_TARGET "x86_64-unknown-linux-musl")
|
||||
elseif(CROSS_HOST_TRIPLE STREQUAL "armel-linux-musleabi")
|
||||
set(RUST_TARGET "arm-unknown-linux-musleabi")
|
||||
elseif(CROSS_HOST_TRIPLE STREQUAL "aarch64-linux-musl")
|
||||
set(RUST_TARGET "aarch64-unknown-linux-musl")
|
||||
endif()
|
||||
|
||||
if(RUST_TARGET)
|
||||
string(TOUPPER "${RUST_TARGET}" RUST_TARGET_ENV)
|
||||
string(REPLACE "-" "_" RUST_TARGET_ENV "${RUST_TARGET_ENV}")
|
||||
|
||||
list(APPEND IDevice_CARGO_ARGS --target ${RUST_TARGET})
|
||||
list(APPEND IDevice_ENV
|
||||
"CC=${CMAKE_C_COMPILER}"
|
||||
"AR=${CMAKE_AR}"
|
||||
"CARGO_TARGET_${RUST_TARGET_ENV}_LINKER=${CMAKE_C_COMPILER}"
|
||||
)
|
||||
endif()
|
||||
|
||||
elseif(MINGW)
|
||||
set(RUST_TARGET "x86_64-pc-windows-gnu")
|
||||
|
||||
list(APPEND IDevice_CARGO_ARGS --target ${RUST_TARGET})
|
||||
|
||||
list(APPEND IDevice_ENV
|
||||
"CC=${CMAKE_C_COMPILER}"
|
||||
"AR=${CMAKE_AR}"
|
||||
"CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=${CMAKE_C_COMPILER}"
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(idevice_ep
|
||||
GIT_REPOSITORY https://github.com/jkcoxson/idevice.git
|
||||
GIT_TAG v0.1.65
|
||||
|
||||
PATCH_COMMAND
|
||||
patch --forward --ignore-whitespace -p1 < "${CMAKE_SOURCE_DIR}/patches/idevice/0001-compile-usbmuxd-and-windows-fixes.patch" || true
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND} -E env
|
||||
${IDevice_ENV}
|
||||
cargo build
|
||||
${IDevice_CARGO_ARGS}
|
||||
--manifest-path <SOURCE_DIR>/ffi/Cargo.toml
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR>/cpp
|
||||
${CMAKE_COMMAND}
|
||||
-B build
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DIDEVICE_FFI_PATH=<SOURCE_DIR>/target/${RUST_TARGET}/release/${FFI_LIB_NAME}
|
||||
"-DCMAKE_CXX_FLAGS=-Du_int64_t=uint64_t -Du_int32_t=uint32_t -Du_int16_t=uint16_t -Du_int8_t=uint8_t"
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} --build <SOURCE_DIR>/cpp/build --config Release
|
||||
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/lib/idevice
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/include
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/target/${RUST_TARGET}/release/libidevice_ffi.a
|
||||
<INSTALL_DIR>/lib/idevice/libidevice_ffi.a
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/cpp/build/libidevice++.a
|
||||
<INSTALL_DIR>/lib/idevice/libidevice++.a
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
<SOURCE_DIR>/cpp/include
|
||||
<INSTALL_DIR>/include
|
||||
|
||||
BUILD_IN_SOURCE 1
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property(idevice_ep install_dir)
|
||||
set(IDEVICE_INCLUDE_DIR "${install_dir}/include")
|
||||
set(IDEVICE_LIBRARY "${install_dir}/lib/idevice/libidevice++.a")
|
||||
set(IDEVICE_FFI_LIBRARY "${install_dir}/lib/idevice/libidevice_ffi.a")
|
||||
add_dependencies(palera1n idevice_ep)
|
||||
target_include_directories(palera1n PRIVATE ${IDEVICE_INCLUDE_DIR})
|
||||
target_link_libraries(palera1n PRIVATE "${IDEVICE_LIBRARY}" "${IDEVICE_FFI_LIBRARY}")
|
||||
if(MINGW)
|
||||
target_link_libraries(palera1n PRIVATE bcrypt userenv ntdll)
|
||||
endif()
|
||||
target_compile_definitions(palera1n PRIVATE LIBPLIST_STATIC)
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Idevice.cmake")
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
if(APPLE)
|
||||
target_link_options(palera1n PRIVATE
|
||||
-Wl,-dead_strip
|
||||
-Wl,-x
|
||||
)
|
||||
elseif(MINGW)
|
||||
target_link_options(palera1n PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
)
|
||||
elseif(LINUX)
|
||||
target_link_options(palera1n PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# =========================
|
||||
# MARK: NON-CMAKE DEPENDENCIES
|
||||
# =========================
|
||||
|
||||
if(WITH_STATIC)
|
||||
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config)
|
||||
@@ -587,7 +345,7 @@ else()
|
||||
target_link_libraries(palera1n PRIVATE ${CURSES_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND NOT CIDERRAIN)
|
||||
if(NOT APPLE AND NOT WITH_CIDERRAIN)
|
||||
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
|
||||
target_include_directories(palera1n PRIVATE ${LIBUSB_INCLUDE_DIRS})
|
||||
target_link_libraries(palera1n PRIVATE ${LIBUSB_LIBRARIES})
|
||||
@@ -596,77 +354,31 @@ else()
|
||||
endif()
|
||||
|
||||
# =========================
|
||||
# MARK: INSTALL
|
||||
# MARK: STRIP FLAGS
|
||||
# =========================
|
||||
|
||||
if(LINUX AND NOT MINGW)
|
||||
install(TARGETS palera1n RUNTIME DESTINATION bin)
|
||||
elseif(IOS)
|
||||
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/Debug-iphoneos/palera1n.app/palera1n" DESTINATION bin)
|
||||
elseif(APPLE AND WITH_GUI)
|
||||
install(TARGETS palera1n BUNDLE DESTINATION .)
|
||||
elseif(APPLE)
|
||||
install(TARGETS palera1n RUNTIME DESTINATION bin)
|
||||
elseif(MINGW)
|
||||
install(TARGETS palera1n
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libstdc++-6.dll"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libgcc_s_seh-1.dll"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libwinpthread-1.dll"
|
||||
DESTINATION .
|
||||
)
|
||||
|
||||
if(NOT WITH_CIDERRAIN)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libusb-1.0.dll"
|
||||
DESTINATION .
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
if(APPLE)
|
||||
target_link_options(palera1n PRIVATE
|
||||
-Wl,-dead_strip
|
||||
-Wl,-x
|
||||
)
|
||||
elseif(MINGW)
|
||||
target_link_options(palera1n PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
)
|
||||
elseif(LINUX)
|
||||
target_link_options(palera1n PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((LINUX AND NOT MINGW) OR IOS OR (APPLE AND NOT IOS AND NOT WITH_GUI))
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/docs/palera1n.1" DESTINATION share/man/man1)
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/docs/p1ctl.8" DESTINATION share/man/man8)
|
||||
endif()
|
||||
# =========================
|
||||
# MARK: INSTALL
|
||||
# =========================
|
||||
|
||||
set(CPACK_PACKAGE_NAME "palera1n")
|
||||
set(CPACK_PACKAGE_VERSION "0")
|
||||
set(CPACK_PACKAGE_FILE_NAME "palera1n")
|
||||
|
||||
if(MINGW)
|
||||
set(CPACK_GENERATOR "NSIS64")
|
||||
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "palera1n")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "palera1n")
|
||||
set(CPACK_NSIS_PACKAGE_NAME "palera1n")
|
||||
set(CPACK_NSIS_BRANDING_TEXT "palera1n Setup")
|
||||
|
||||
set(CPACK_NSIS_MODIFY_PATH OFF)
|
||||
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
||||
|
||||
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/palera1n.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/resources/palera1n.ico")
|
||||
|
||||
set(CPACK_PACKAGE_EXECUTABLES "palera1n" "palera1n")
|
||||
|
||||
set(CPACK_NSIS_CREATE_ICONS_EXTRA
|
||||
"CreateShortCut \\\"\\$DESKTOP\\\\palera1n.lnk\\\" \\\"\\$INSTDIR\\\\bin\\\\palera1n.exe\\\""
|
||||
)
|
||||
|
||||
set(CPACK_NSIS_DELETE_ICONS_EXTRA
|
||||
"Delete \\\"\\$DESKTOP\\\\palera1n.lnk\\\""
|
||||
)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
|
||||
elseif(APPLE AND WITH_GUI)
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
else()
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/BuildInstall.cmake")
|
||||
|
||||
@@ -1,153 +1,72 @@
|
||||
.PHONY: apple-include payloads palera1n palera1n_xcode palera1n_mingw clean
|
||||
.PHONY: all clean
|
||||
|
||||
# TODO: get rid of this makefile, this is too complicated
|
||||
WITH_GUI ?= 0
|
||||
WITH_TUI ?= 0
|
||||
WITH_RAMDISK ?= 1
|
||||
WITH_BINPACK ?= 1
|
||||
WITH_STATIC ?= 0
|
||||
WITH_CIDERRAIN ?= 0
|
||||
BUILD_TYPE ?= Debug
|
||||
|
||||
WITH_GUI ?= 0
|
||||
WITH_TUI ?= 0
|
||||
WITH_RAMDISK ?= 1
|
||||
WITH_BINPACK ?= 1
|
||||
WITH_STATIC ?= 0
|
||||
WITH_CIDERRAIN ?= 0
|
||||
BUILD_TYPE ?= Debug
|
||||
|
||||
CMAKE_SYSROOT ?=
|
||||
CMAKE_SYSROOT ?=
|
||||
CROSS_HOST_TRIPLE ?=
|
||||
JOBS ?=
|
||||
JOBS ?= 1
|
||||
|
||||
PLATFORM ?= host
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
BUILD_ARGS :=
|
||||
ifneq ($(strip $(JOBS)),)
|
||||
BUILD_ARGS += --parallel $(JOBS)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),ios)
|
||||
PLATFORM := iphoneos
|
||||
endif
|
||||
TARGET_SYSROOT :=
|
||||
MACOSX_SYSROOT := $(shell xcrun --sdk macosx --show-sdk-path)
|
||||
CUSTOM_INCLUDE_PATH := apple-include-$(PLATFORM)
|
||||
|
||||
ifeq ($(PLATFORM),iphoneos)
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
$(error iOS builds require macOS/Xcode)
|
||||
endif
|
||||
TARGET_SYSROOT := $(shell xcrun --sdk iphoneos --show-sdk-path)
|
||||
else ifeq ($(PLATFORM),macos)
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
$(error macOS SDK builds require macOS/Xcode)
|
||||
endif
|
||||
TARGET_SYSROOT := $(shell xcrun --sdk macosx --show-sdk-path)
|
||||
ifneq ($(UNAME_S),Darwin)
|
||||
$(error iOS targets are only supported on macOS)
|
||||
endif
|
||||
|
||||
CMAKE_GENERATOR := -G Xcode
|
||||
APPLE_SYSROOT := $(shell xcrun --sdk iphoneos --show-sdk-path)
|
||||
|
||||
CMAKE_PLATFORM_ARGS := \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_SYSROOT="$(APPLE_SYSROOT)" \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64
|
||||
|
||||
else ifeq ($(UNAME_S),Windows_NT)
|
||||
CMAKE_GENERATOR := -G "MinGW Makefiles"
|
||||
else
|
||||
CMAKE_GENERATOR :=
|
||||
endif
|
||||
|
||||
CMAKE_COMMON_ARGS := \
|
||||
CMAKE_ARGS := \
|
||||
$(CMAKE_GENERATOR) \
|
||||
-DCMAKE_SYSROOT="$(CMAKE_SYSROOT)" \
|
||||
-DCROSS_HOST_TRIPLE="$(CROSS_HOST_TRIPLE)" \
|
||||
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
|
||||
-DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" \
|
||||
-DWITH_GUI=$(WITH_GUI) \
|
||||
-DWITH_TUI=$(WITH_TUI) \
|
||||
-DWITH_RAMDISK=$(WITH_RAMDISK) \
|
||||
-DWITH_BINPACK=$(WITH_BINPACK) \
|
||||
-DWITH_STATIC=$(WITH_STATIC) \
|
||||
-DWITH_CIDERRAIN=$(WITH_CIDERRAIN) \
|
||||
-DWITH_STATIC=$(WITH_STATIC)
|
||||
$(CMAKE_PLATFORM_ARGS)
|
||||
|
||||
CMAKE_APPLE_ARGS :=
|
||||
ifneq ($(strip $(JOBS)),)
|
||||
BUILD_ARGS := --parallel $(JOBS)
|
||||
endif
|
||||
|
||||
all: palera1n
|
||||
|
||||
palera1n:
|
||||
@cmake -S . -B build $(CMAKE_ARGS)
|
||||
@cmake --build build $(BUILD_ARGS)
|
||||
ifeq ($(PLATFORM),iphoneos)
|
||||
|
||||
CMAKE_APPLE_ARGS := \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_SYSROOT="$(TARGET_SYSROOT)" \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=15.0
|
||||
|
||||
@codesign --force --sign - --entitlements resources/entitlements.xml build/Debug-iphoneos/palera1n.app/palera1n
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),macos)
|
||||
|
||||
CMAKE_APPLE_ARGS := \
|
||||
-DCMAKE_SYSTEM_NAME=Darwin \
|
||||
-DCMAKE_OSX_SYSROOT="$(TARGET_SYSROOT)"
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),iphoneos)
|
||||
APPLE_INCLUDE_DEP := apple-include
|
||||
else
|
||||
APPLE_INCLUDE_DEP :=
|
||||
endif
|
||||
|
||||
apple-include:
|
||||
mkdir -p $(CUSTOM_INCLUDE_PATH)/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOSurface,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch}
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/{arpa,bsm,hfs,net,xpc,netinet,servers,timeconv.h,launch.h} $(CUSTOM_INCLUDE_PATH)
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/objc/objc-runtime.h $(CUSTOM_INCLUDE_PATH)/objc
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/libkern/{OSDebug.h,OSKextLib.h,OSReturn.h,OSThermalNotification.h,OSTypes.h,machine} $(CUSTOM_INCLUDE_PATH)/libkern
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/kern $(CUSTOM_INCLUDE_PATH)
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/sys/{tty*,ptrace,kern*,random,reboot,user,vnode,disk,vmmeter,conf}.h $(CUSTOM_INCLUDE_PATH)/sys
|
||||
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/disklabel.h $(CUSTOM_INCLUDE_PATH)/sys
|
||||
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOKit.framework/Headers/{AppleConvergedIPCKeys.h,IOBSD.h,IOCFBundle.h,IOCFPlugIn.h,IOCFURLAccess.h,IOKitServer.h,IORPC.h,IOSharedLock.h,IOUserServer.h,audio,avc,firewire,graphics,hid,hidsystem,i2c,iokitmig.h,kext,ndrvsupport,network,ps,pwr_mgt,sbp2,scsi,serial,storage,stream,usb,video} $(CUSTOM_INCLUDE_PATH)/IOKit
|
||||
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/Security.framework/Headers/{mds_schema,oidsalg,SecKeychainSearch,certextensions,Authorization,eisl,SecDigestTransform,SecKeychainItem,oidscrl,cssmcspi,CSCommon,cssmaci,SecCode,CMSDecoder,oidscert,SecRequirement,AuthSession,SecReadTransform,oids,cssmconfig,cssmkrapi,SecPolicySearch,SecAccess,cssmtpi,SecACL,SecEncryptTransform,cssmapi,cssmcli,mds,x509defs,oidsbase,SecSignVerifyTransform,cssmspi,cssmkrspi,SecTask,cssmdli,SecAsn1Coder,cssm,SecTrustedApplication,SecCodeHost,SecCustomTransform,oidsattr,SecIdentitySearch,cssmtype,SecAsn1Types,emmtype,SecTransform,SecTrustSettings,SecStaticCode,emmspi,SecTransformReadTransform,SecKeychain,SecDecodeTransform,CodeSigning,AuthorizationPlugin,cssmerr,AuthorizationTags,CMSEncoder,SecEncodeTransform,SecureDownload,SecAsn1Templates,AuthorizationDB,SecCertificateOIDs,cssmapple}.h $(CUSTOM_INCLUDE_PATH)/Security
|
||||
# cp -af $(MACOSX_SYSROOT)/usr/include/{ar,bootstrap,launch,libc,libcharset,localcharset,nlist,NSSystemDirectories,tzfile,vproc}.h $(CUSTOM_INCLUDE_PATH)
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/mach/{*.defs,{mach_vm,shared_region}.h} $(CUSTOM_INCLUDE_PATH)/mach
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/mach/machine/*.defs $(CUSTOM_INCLUDE_PATH)/mach/machine
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/rpc/pmap_clnt.h $(CUSTOM_INCLUDE_PATH)/rpc
|
||||
cp -af $(MACOSX_SYSROOT)/usr/include/rpcsvc/yp{_prot,clnt}.h $(CUSTOM_INCLUDE_PATH)/rpcsvc
|
||||
cp -af $(TARGET_SYSROOT)/usr/include/mach/machine/thread_state.h $(CUSTOM_INCLUDE_PATH)/mach/machine
|
||||
cp -af $(TARGET_SYSROOT)/usr/include/mach/arm $(CUSTOM_INCLUDE_PATH)/mach
|
||||
cp -af $(MACOSX_SYSROOT)/System/Library/Frameworks/IOKit.framework/Headers/* $(CUSTOM_INCLUDE_PATH)/IOKit
|
||||
# gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/stdlib.h > $(CUSTOM_INCLUDE_PATH)/stdlib.h
|
||||
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/time.h > $(CUSTOM_INCLUDE_PATH)/time.h
|
||||
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/unistd.h > $(CUSTOM_INCLUDE_PATH)/unistd.h
|
||||
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/mach/task.h > $(CUSTOM_INCLUDE_PATH)/mach/task.h
|
||||
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/mach/mach_host.h > $(CUSTOM_INCLUDE_PATH)/mach/mach_host.h
|
||||
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/ucontext.h > $(CUSTOM_INCLUDE_PATH)/ucontext.h
|
||||
# gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/signal.h > $(CUSTOM_INCLUDE_PATH)/signal.h
|
||||
gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $(TARGET_SYSROOT)/usr/include/spawn.h > $(CUSTOM_INCLUDE_PATH)/spawn.h
|
||||
gsed -E /'__API_UNAVAILABLE'/d < $(TARGET_SYSROOT)/usr/include/pthread.h > $(CUSTOM_INCLUDE_PATH)/pthread.h
|
||||
gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// $(CUSTOM_INCLUDE_PATH)/IOKit/IOKitLib.h
|
||||
gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// $(CUSTOM_INCLUDE_PATH)/spawn.h
|
||||
gsed -i -E s/'API_UNAVAILABLE\(.*\)'// $(CUSTOM_INCLUDE_PATH)/xpc/*.h
|
||||
gsed -i 's|// __XPC_INDIRECT__|\n#include "$(TARGET_SYSROOT)/usr/include/bsm/audit.h"\n|' $(CUSTOM_INCLUDE_PATH)/xpc/connection.h
|
||||
|
||||
payloads:
|
||||
mkdir -p src/gen/embedded
|
||||
|
||||
xz --format=lzma -vfc6ekT 0 embedded/ramdisk.dmg > embedded/ramdisk-compressed.dmg.lzma
|
||||
xz --format=lzma -vfc6ekT 0 embedded/checkra1n-kpf-pongo > embedded/checkra1n-kpf-pongo-compressed.lzma
|
||||
|
||||
@for file in embedded/*; do \
|
||||
name=$$(basename "$$file"); \
|
||||
name=$${name%.*}; \
|
||||
echo " XXD $$file"; \
|
||||
echo "#pragma once" > "src/gen/embedded/$$name.h"; \
|
||||
xxd -i "$$file" \
|
||||
| sed 's/unsigned char/static const unsigned char/g' \
|
||||
| sed 's/unsigned int/static const size_t/g' \
|
||||
>> "src/gen/embedded/$$name.h"; \
|
||||
done
|
||||
|
||||
palera1n: payloads
|
||||
@cmake -S . -B build \
|
||||
$(CMAKE_COMMON_ARGS) \
|
||||
$(CMAKE_APPLE_ARGS) && \
|
||||
cmake --build build $(BUILD_ARGS)
|
||||
|
||||
palera1n_xcode: $(APPLE_INCLUDE_DEP) payloads
|
||||
@cmake -S . -B build \
|
||||
-G Xcode \
|
||||
$(CMAKE_COMMON_ARGS) \
|
||||
$(CMAKE_APPLE_ARGS)
|
||||
|
||||
palera1n_mingw: payloads
|
||||
@cmake -S . -B build \
|
||||
-G "MinGW Makefiles" \
|
||||
$(CMAKE_COMMON_ARGS) && \
|
||||
cmake --build build $(BUILD_ARGS)
|
||||
package: palera1n
|
||||
cpack --config build/CPackConfig.cmake -C $(BUILD_TYPE)
|
||||
|
||||
clean:
|
||||
@rm -rf build src/gen
|
||||
@rm -rf apple-include-*
|
||||
@if [ -d 1stparty/libciderra1n ]; then $(MAKE) -C 1stparty/libciderra1n clean; fi
|
||||
@rm -rf build src/gen apple-include-*
|
||||
@if [ -d 1stparty/libciderra1n ]; then \
|
||||
$(MAKE) -C 1stparty/libciderra1n clean; \
|
||||
fi
|
||||
@$(MAKE) -C 1stparty/libopenra1n clean
|
||||
@@ -0,0 +1,9 @@
|
||||
find_program(BASH_EXECUTABLE bash REQUIRED)
|
||||
find_program(_GSED gsed REQUIRED)
|
||||
|
||||
execute_process(
|
||||
COMMAND "${BASH_EXECUTABLE}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/apple-headers.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
@@ -0,0 +1,111 @@
|
||||
# =========================
|
||||
# MARK: INSTALL
|
||||
# =========================
|
||||
|
||||
if(LINUX AND NOT MINGW)
|
||||
if(WITH_GUI)
|
||||
install(TARGETS palera1n RUNTIME DESTINATION usr/bin)
|
||||
else()
|
||||
install(TARGETS palera1n RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
elseif(IOS)
|
||||
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/Debug-iphoneos/palera1n.app/palera1n" DESTINATION bin)
|
||||
elseif(APPLE AND WITH_GUI)
|
||||
install(TARGETS palera1n BUNDLE DESTINATION .)
|
||||
elseif(APPLE)
|
||||
install(TARGETS palera1n RUNTIME DESTINATION bin)
|
||||
elseif(MINGW)
|
||||
install(TARGETS palera1n
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libstdc++-6.dll"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libgcc_s_seh-1.dll"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libwinpthread-1.dll"
|
||||
DESTINATION .
|
||||
)
|
||||
|
||||
if(NOT WITH_CIDERRAIN)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libusb-1.0.dll"
|
||||
DESTINATION .
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((LINUX AND NOT MINGW) OR IOS OR (APPLE AND NOT IOS AND NOT WITH_GUI))
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/docs/palera1n.1" DESTINATION usr/share/man/man1)
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/docs/p1ctl.8" DESTINATION usr/share/man/man8)
|
||||
endif()
|
||||
|
||||
if((LINUX AND NOT MINGW) OR IOS OR (APPLE AND NOT IOS AND WITH_GUI))
|
||||
include(InstallRequiredSystemLibraries)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/in.palera.palera1n.desktop"
|
||||
DESTINATION share/applications
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/hicolor/64x64/apps/in.palera.palera1n.png"
|
||||
DESTINATION usr/share/icons/hicolor/64x64/apps
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/hicolor/128x128/apps/in.palera.palera1n.png"
|
||||
DESTINATION usr/share/icons/hicolor/128x128/apps
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/hicolor/256x256/apps/in.palera.palera1n.png"
|
||||
DESTINATION usr/share/icons/hicolor/256x256/apps
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/hicolor/512x512/apps/in.palera.palera1n.png"
|
||||
DESTINATION usr/share/icons/hicolor/512x512/apps
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_NAME "palera1n")
|
||||
set(CPACK_PACKAGE_VERSION "0")
|
||||
set(CPACK_PACKAGE_FILE_NAME "palera1n")
|
||||
|
||||
if(MINGW)
|
||||
set(CPACK_GENERATOR "NSIS64")
|
||||
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "palera1n")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "palera1n")
|
||||
set(CPACK_NSIS_PACKAGE_NAME "palera1n")
|
||||
set(CPACK_NSIS_BRANDING_TEXT "palera1n Setup")
|
||||
|
||||
set(CPACK_NSIS_MODIFY_PATH OFF)
|
||||
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
||||
|
||||
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/palera1n.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/resources/palera1n.ico")
|
||||
|
||||
set(CPACK_PACKAGE_EXECUTABLES "palera1n" "palera1n")
|
||||
|
||||
set(CPACK_NSIS_CREATE_ICONS_EXTRA
|
||||
"CreateShortCut \\\"\\$DESKTOP\\\\palera1n.lnk\\\" \\\"\\$INSTDIR\\\\bin\\\\palera1n.exe\\\""
|
||||
)
|
||||
|
||||
set(CPACK_NSIS_DELETE_ICONS_EXTRA
|
||||
"Delete \\\"\\$DESKTOP\\\\palera1n.lnk\\\""
|
||||
)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
|
||||
elseif(APPLE AND WITH_GUI)
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
else()
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
||||
if(WITH_GUI)
|
||||
include("${CMAKE_SOURCE_DIR}/cmake/LinuxDeploy.cmake")
|
||||
else()
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
endif()
|
||||
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
include(CPack)
|
||||
@@ -0,0 +1,41 @@
|
||||
# =========================
|
||||
# BUILD REQUIREMENTS
|
||||
# =========================
|
||||
|
||||
if(LINUX AND WITH_STATIC)
|
||||
if(
|
||||
NOT CROSS_HOST_TRIPLE MATCHES "musl"
|
||||
AND NOT CMAKE_C_COMPILER_TARGET MATCHES "musl"
|
||||
AND NOT CMAKE_C_COMPILER MATCHES "musl"
|
||||
)
|
||||
message(FATAL_ERROR
|
||||
"Static builds on Linux require a musl toolchain. "
|
||||
"Please specify a musl cross-compiler or set "
|
||||
"-DCROSS_HOST_TRIPLE=...-linux-musl"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW AND NOT WITH_STATIC)
|
||||
message(FATAL_ERROR
|
||||
"MinGW builds must be static. Please configure with -DWITH_STATIC=1"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MINGW AND WITH_TUI)
|
||||
message(FATAL_ERROR
|
||||
"-DWITH_TUI=1 is not supported on MinGW builds."
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MINGW AND WITH_CIDERRAIN)
|
||||
message(FATAL_ERROR
|
||||
"-DWITH_CIDERRAIN=1 is not supported on MinGW builds."
|
||||
)
|
||||
endif()
|
||||
|
||||
if(IOS AND (WITH_TUI OR WITH_GUI))
|
||||
message(FATAL_ERROR
|
||||
"-DWITH_TUI=1 or -DWITH_GUI=1 is not supported on iOS builds."
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,61 @@
|
||||
# =========================
|
||||
# MARK: NON-CMAKE DEPENDENCIES: CIDERRAIN
|
||||
# =========================
|
||||
|
||||
message(STATUS "Building with Ciderra1n support")
|
||||
|
||||
# TODO: get rid
|
||||
execute_process(
|
||||
COMMAND patch --batch --forward -p1 -i ${CMAKE_SOURCE_DIR}/patches/liteusb/0001-cpp-compatible.patch
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/external/liteusb
|
||||
RESULT_VARIABLE LITEUSB_PATCH_RESULT
|
||||
)
|
||||
|
||||
if(IOS)
|
||||
execute_process(
|
||||
COMMAND xcrun --sdk iphoneos --show-sdk-path
|
||||
OUTPUT_VARIABLE IOS_SDK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"EXTRA_CFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"CXXFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"LDFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n
|
||||
RESULT_VARIABLE CIDERRA1N_BUILD_RESULT
|
||||
)
|
||||
elseif(APPLE)
|
||||
execute_process(
|
||||
COMMAND make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} EXTRA_CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n
|
||||
RESULT_VARIABLE CIDERRA1N_BUILD_RESULT
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libciderra1n
|
||||
RESULT_VARIABLE CIDERRA1N_BUILD_RESULT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CIDERRA1N_BUILD_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to build Ciderra1n.")
|
||||
endif()
|
||||
|
||||
set(CIDERRAIN_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/build/include")
|
||||
set(CIDERRAIN_LIB "${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/build/lib/ciderra1n/libciderra1n.a")
|
||||
target_include_directories(palera1n PRIVATE ${CIDERRAIN_INCLUDE_DIR})
|
||||
target_link_libraries(palera1n PRIVATE "${CIDERRAIN_LIB}")
|
||||
|
||||
if(IOS)
|
||||
target_include_directories(palera1n PRIVATE "${CMAKE_SOURCE_DIR}/apple-include-iphoneos")
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
set(LITEUSB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/1stparty/libciderra1n/external/liteusb/include")
|
||||
target_compile_definitions(palera1n PRIVATE LITEUSB_PLATFORM_LINUX)
|
||||
target_include_directories(palera1n PRIVATE ${LITEUSB_INCLUDE_DIR})
|
||||
endif()
|
||||
@@ -0,0 +1,31 @@
|
||||
# =========================
|
||||
# MARK: GIT INFO
|
||||
# =========================
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref --symbolic-full-name "@{u}"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git remote get-url origin
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_URL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
target_compile_definitions(palera1n PRIVATE
|
||||
GIT_HASH="${GIT_HASH}"
|
||||
GIT_BRANCH="${GIT_BRANCH}"
|
||||
GIT_URL="${GIT_URL}"
|
||||
)
|
||||
@@ -0,0 +1,121 @@
|
||||
# =========================
|
||||
# MARK: NON-CMAKE DEPENDENCIES: IDEVICE
|
||||
# =========================
|
||||
|
||||
|
||||
set(IDevice_CARGO_ARGS
|
||||
--release
|
||||
--no-default-features
|
||||
--features "usbmuxd ring tcp"
|
||||
)
|
||||
|
||||
set(IDevice_ENV)
|
||||
|
||||
if(APPLE)
|
||||
if(IOS)
|
||||
list(APPEND IDevice_ENV "IPHONEOS_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
else()
|
||||
list(APPEND IDevice_ENV "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CROSS_HOST_TRIPLE)
|
||||
if(CROSS_HOST_TRIPLE STREQUAL "i486-linux-musl")
|
||||
set(RUST_TARGET "i686-unknown-linux-musl")
|
||||
elseif(CROSS_HOST_TRIPLE STREQUAL "x86_64-linux-musl")
|
||||
set(RUST_TARGET "x86_64-unknown-linux-musl")
|
||||
elseif(CROSS_HOST_TRIPLE STREQUAL "armel-linux-musleabi")
|
||||
set(RUST_TARGET "arm-unknown-linux-musleabi")
|
||||
elseif(CROSS_HOST_TRIPLE STREQUAL "aarch64-linux-musl")
|
||||
set(RUST_TARGET "aarch64-unknown-linux-musl")
|
||||
endif()
|
||||
|
||||
if(RUST_TARGET)
|
||||
string(TOUPPER "${RUST_TARGET}" RUST_TARGET_ENV)
|
||||
string(REPLACE "-" "_" RUST_TARGET_ENV "${RUST_TARGET_ENV}")
|
||||
|
||||
list(APPEND IDevice_CARGO_ARGS --target ${RUST_TARGET})
|
||||
list(APPEND IDevice_ENV
|
||||
"CC=${CMAKE_C_COMPILER}"
|
||||
"AR=${CMAKE_AR}"
|
||||
"CARGO_TARGET_${RUST_TARGET_ENV}_LINKER=${CMAKE_C_COMPILER}"
|
||||
)
|
||||
endif()
|
||||
|
||||
elseif(MINGW)
|
||||
set(RUST_TARGET "x86_64-pc-windows-gnu")
|
||||
|
||||
list(APPEND IDevice_CARGO_ARGS --target ${RUST_TARGET})
|
||||
|
||||
list(APPEND IDevice_ENV
|
||||
"CC=${CMAKE_C_COMPILER}"
|
||||
"AR=${CMAKE_AR}"
|
||||
"CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=${CMAKE_C_COMPILER}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Only build idevice if libraries are missing
|
||||
set(IDEVICE_INSTALL_DIR "${CMAKE_BINARY_DIR}/idevice_ep-prefix")
|
||||
if(NOT (EXISTS "${IDEVICE_INSTALL_DIR}/lib/idevice/libidevice++.a"
|
||||
AND EXISTS "${IDEVICE_INSTALL_DIR}/lib/idevice/libidevice_ffi.a"))
|
||||
|
||||
ExternalProject_Add(idevice_ep
|
||||
GIT_REPOSITORY https://github.com/jkcoxson/idevice.git
|
||||
GIT_TAG v0.1.65
|
||||
|
||||
PATCH_COMMAND
|
||||
patch --forward --ignore-whitespace -p1 < "${CMAKE_SOURCE_DIR}/patches/idevice/0001-compile-usbmuxd-and-windows-fixes.patch" || true
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND} -E env
|
||||
${IDevice_ENV}
|
||||
cargo build
|
||||
${IDevice_CARGO_ARGS}
|
||||
--manifest-path <SOURCE_DIR>/ffi/Cargo.toml
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR>/cpp
|
||||
${CMAKE_COMMAND}
|
||||
-B build
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DIDEVICE_FFI_PATH=<SOURCE_DIR>/target/${RUST_TARGET}/release/${FFI_LIB_NAME}
|
||||
"-DCMAKE_CXX_FLAGS=-Du_int64_t=uint64_t -Du_int32_t=uint32_t -Du_int16_t=uint16_t -Du_int8_t=uint8_t"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} --build <SOURCE_DIR>/cpp/build --config Release
|
||||
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/lib/idevice
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/include
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/target/${RUST_TARGET}/release/libidevice_ffi.a
|
||||
<INSTALL_DIR>/lib/idevice/libidevice_ffi.a
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/cpp/build/libidevice++.a
|
||||
<INSTALL_DIR>/lib/idevice/libidevice++.a
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
<SOURCE_DIR>/cpp/include
|
||||
<INSTALL_DIR>/include
|
||||
|
||||
BUILD_IN_SOURCE 1
|
||||
)
|
||||
|
||||
add_dependencies(palera1n idevice_ep)
|
||||
endif()
|
||||
|
||||
set(IDEVICE_INCLUDE_DIR "${IDEVICE_INSTALL_DIR}/include")
|
||||
set(IDEVICE_LIBRARY "${IDEVICE_INSTALL_DIR}/lib/idevice/libidevice++.a")
|
||||
set(IDEVICE_FFI_LIBRARY "${IDEVICE_INSTALL_DIR}/lib/idevice/libidevice_ffi.a")
|
||||
|
||||
target_include_directories(palera1n PRIVATE ${IDEVICE_INCLUDE_DIR})
|
||||
target_link_libraries(palera1n PRIVATE "${IDEVICE_LIBRARY}" "${IDEVICE_FFI_LIBRARY}")
|
||||
|
||||
if(MINGW)
|
||||
target_link_libraries(palera1n PRIVATE bcrypt userenv ntdll)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(palera1n PRIVATE LIBPLIST_STATIC)
|
||||
@@ -0,0 +1,117 @@
|
||||
# cmake/LinuxDeploy.cmake
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
|
||||
set(LINUXDEPLOY_URL
|
||||
"https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-aarch64.AppImage"
|
||||
)
|
||||
else()
|
||||
set(LINUXDEPLOY_URL
|
||||
"https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(LINUXDEPLOY
|
||||
"${CMAKE_BINARY_DIR}/linuxdeploy"
|
||||
)
|
||||
|
||||
if(NOT EXISTS "${LINUXDEPLOY}")
|
||||
message(STATUS "Downloading linuxdeploy...")
|
||||
|
||||
file(DOWNLOAD
|
||||
"${LINUXDEPLOY_URL}"
|
||||
"${LINUXDEPLOY}"
|
||||
SHOW_PROGRESS
|
||||
STATUS LINUXDEPLOY_DOWNLOAD_STATUS
|
||||
)
|
||||
|
||||
list(GET LINUXDEPLOY_DOWNLOAD_STATUS 0 LINUXDEPLOY_DOWNLOAD_RESULT)
|
||||
|
||||
if(NOT LINUXDEPLOY_DOWNLOAD_RESULT EQUAL 0)
|
||||
list(GET LINUXDEPLOY_DOWNLOAD_STATUS 1 LINUXDEPLOY_DOWNLOAD_ERROR)
|
||||
|
||||
message(FATAL_ERROR
|
||||
"Failed to download linuxdeploy: ${LINUXDEPLOY_DOWNLOAD_ERROR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(
|
||||
CHMOD "${LINUXDEPLOY}"
|
||||
FILE_PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
|
||||
set(CPACK_GENERATOR "External")
|
||||
set(CPACK_EXTERNAL_ENABLE_STAGING YES)
|
||||
|
||||
set(CPACK_EXTERNAL_PACKAGE_SCRIPT
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/LinuxDeploy-package.cmake"
|
||||
)
|
||||
|
||||
set(LINUXDEPLOY_SCRIPT [=[
|
||||
set(APPDIR "${CPACK_TEMPORARY_DIRECTORY}")
|
||||
set(OUTPUT_DIR "@CMAKE_BINARY_DIR@")
|
||||
|
||||
set(DESKTOP_FILE
|
||||
"${APPDIR}/share/applications/in.palera.palera1n.desktop"
|
||||
)
|
||||
|
||||
message(STATUS "Running linuxdeploy")
|
||||
message(STATUS "AppDir: ${APPDIR}")
|
||||
message(STATUS "Output: ${OUTPUT_DIR}")
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"@LINUXDEPLOY@"
|
||||
"--appdir=${APPDIR}"
|
||||
"--desktop-file=${DESKTOP_FILE}"
|
||||
"--output=appimage"
|
||||
WORKING_DIRECTORY "${OUTPUT_DIR}"
|
||||
RESULT_VARIABLE RESULT
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
ERROR_VARIABLE ERROR
|
||||
)
|
||||
|
||||
if(OUTPUT)
|
||||
message(STATUS "${OUTPUT}")
|
||||
endif()
|
||||
|
||||
if(ERROR)
|
||||
message(STATUS "${ERROR}")
|
||||
endif()
|
||||
|
||||
if(NOT RESULT EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"linuxdeploy failed with exit code ${RESULT}"
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS
|
||||
"AppImage generated in ${OUTPUT_DIR}"
|
||||
)
|
||||
]=])
|
||||
|
||||
string(
|
||||
REPLACE
|
||||
"@LINUXDEPLOY@"
|
||||
"${LINUXDEPLOY}"
|
||||
LINUXDEPLOY_SCRIPT
|
||||
"${LINUXDEPLOY_SCRIPT}"
|
||||
)
|
||||
|
||||
string(
|
||||
REPLACE
|
||||
"@CMAKE_BINARY_DIR@"
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
LINUXDEPLOY_SCRIPT
|
||||
"${LINUXDEPLOY_SCRIPT}"
|
||||
)
|
||||
|
||||
file(GENERATE
|
||||
OUTPUT "${CPACK_EXTERNAL_PACKAGE_SCRIPT}"
|
||||
CONTENT "${LINUXDEPLOY_SCRIPT}"
|
||||
)
|
||||
@@ -0,0 +1,51 @@
|
||||
# =========================
|
||||
# MARK: NON-CMAKE DEPENDENCIES: OPENRAIN
|
||||
# =========================
|
||||
|
||||
message(STATUS "Building with Openra1n support")
|
||||
|
||||
if(IOS)
|
||||
execute_process(
|
||||
COMMAND xcrun --sdk iphoneos --show-sdk-path
|
||||
OUTPUT_VARIABLE IOS_SDK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"CFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"CXXFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -I${CMAKE_SOURCE_DIR}/apple-include-iphoneos"
|
||||
"LDFLAGS=-isysroot ${IOS_SDK} -arch arm64 -miphoneos-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libopenra1n
|
||||
RESULT_VARIABLE OPENRA1N_BUILD_RESULT
|
||||
)
|
||||
elseif(APPLE)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"CFLAGS=-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libopenra1n
|
||||
RESULT_VARIABLE OPENRA1N_BUILD_RESULT
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND make CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/1stparty/libopenra1n
|
||||
RESULT_VARIABLE OPENRA1N_BUILD_RESULT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT OPENRA1N_BUILD_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to build Openra1n.")
|
||||
endif()
|
||||
|
||||
set(OPENRA1N_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/1stparty/libopenra1n/build/include")
|
||||
set(OPENRA1N_LIB "${CMAKE_SOURCE_DIR}/1stparty/libopenra1n/build/lib/openra1n/libopenra1n.a")
|
||||
|
||||
target_include_directories(palera1n PRIVATE ${OPENRA1N_INCLUDE_DIR})
|
||||
target_link_libraries(palera1n PRIVATE "${OPENRA1N_LIB}")
|
||||
|
||||
if(IOS)
|
||||
target_include_directories(palera1n PRIVATE "${CMAKE_SOURCE_DIR}/apple-include-iphoneos")
|
||||
endif()
|
||||
@@ -0,0 +1,10 @@
|
||||
find_program(BASH_EXECUTABLE bash REQUIRED)
|
||||
find_program(_XXD xxd REQUIRED)
|
||||
find_program(_JQ jq REQUIRED)
|
||||
find_program(_XZ xz REQUIRED)
|
||||
|
||||
execute_process(
|
||||
COMMAND "${BASH_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Xxd.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
mkdir -p "$ROOT_DIR/src/gen/embedded"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
mkdir -p src/gen/embedded
|
||||
|
||||
xz --format=lzma -vfc6ekT 0 $ROOT_DIR/embedded/ramdisk.dmg > $ROOT_DIR/embedded/ramdisk-compressed.lzma
|
||||
xz --format=lzma -vfc6ekT 0 $ROOT_DIR/embedded/checkra1n-kpf-pongo > $ROOT_DIR/embedded/checkra1n-kpf-pongo-compressed.lzma
|
||||
jq -c . $ROOT_DIR/embedded/DFUHelperDeviceInfo.json > $ROOT_DIR/embedded/DFUHelperDeviceInfo-minified.json
|
||||
|
||||
for file in embedded/*; do
|
||||
name=$(basename "$file")
|
||||
symbol="embedded_${name//[^a-zA-Z0-9_]/_}"
|
||||
|
||||
echo " XXD $file"
|
||||
|
||||
xxd -i "$file" \
|
||||
| sed -E \
|
||||
-e "s/^unsigned char .*\[\] =/static const unsigned char ${symbol}[] =/" \
|
||||
-e "s/^unsigned int .*_len =/static const size_t ${symbol}_len =/" \
|
||||
> "src/gen/embedded/${name%.*}.h"
|
||||
done
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
PLATFORM="${1:-iphoneos}"
|
||||
|
||||
case "$PLATFORM" in
|
||||
iphoneos)
|
||||
TARGET_SDK="iphoneos"
|
||||
;;
|
||||
*)
|
||||
echo "error: unsupported platform: $PLATFORM" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$(uname -s)" != "Darwin" ]]; then
|
||||
echo "error: Apple SDK builds require macOS/Xcode" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MACOSX_SYSROOT="$(xcrun --sdk macosx --show-sdk-path)"
|
||||
TARGET_SYSROOT="$(xcrun --sdk "$TARGET_SDK" --show-sdk-path)"
|
||||
CUSTOM_INCLUDE_PATH="$ROOT_DIR/apple-include-$PLATFORM"
|
||||
|
||||
mkdir -p "$CUSTOM_INCLUDE_PATH"/IOKit/kext
|
||||
cp -af "$MACOSX_SYSROOT"/System/Library/Frameworks/IOKit.framework/Headers/{AppleConvergedIPCKeys.h,IOBSD.h,IOCFBundle.h,IOCFPlugIn.h,IOCFURLAccess.h,IOKitServer.h,IORPC.h,IOSharedLock.h,IOUserServer.h,audio,avc,firewire,graphics,hid,hidsystem,i2c,iokitmig.h,kext,ndrvsupport,network,ps,pwr_mgt,sbp2,scsi,serial,storage,stream,usb,video} "$CUSTOM_INCLUDE_PATH/IOKit"
|
||||
cp -af "$MACOSX_SYSROOT"/System/Library/Frameworks/IOKit.framework/Headers/* "$CUSTOM_INCLUDE_PATH/IOKit"
|
||||
gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// "$CUSTOM_INCLUDE_PATH/IOKit/IOKitLib.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
.Nd arm64 iOS/iPadOS/tvOS 15-26, bridgeOS 5-10 jailbreaking tool
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl hvlfcBsTVpednq
|
||||
.Op Fl hvlfcBsTVpPednq
|
||||
.Op Fl e Ar Boot arguments
|
||||
.Op Fl k Ar Pongo image
|
||||
.Op Fl o Ar overlay file
|
||||
@@ -159,6 +159,12 @@ Remove the jailbreak while keeping user data. Some jailbreak files may remain
|
||||
after running this command. Additionally, jailbreak apps may remain on the
|
||||
home screen on for a while even when the files are deleted as the icon cache
|
||||
still has their icons. When used with
|
||||
.Fl f , -rootful ,
|
||||
this will actually boot the device in rootless mode then delete the jailbreak
|
||||
files. As a result, using the loader app to install the jailbreak environment
|
||||
is not supported when this option is used together with
|
||||
.Fl f , -rootful
|
||||
\[char46]
|
||||
|
||||
.It Fl -force-enable-ssv
|
||||
Force the jailbreak to detect Signed System Volume (SSV) as being required on
|
||||
@@ -174,13 +180,6 @@ option is specified as well.
|
||||
(It is technically possible to setup fakefs using this option as well, but this
|
||||
is not a supported scenario)
|
||||
|
||||
.Fl f , -rootful ,
|
||||
this will actually boot the device in rootless mode then delete the jailbreak
|
||||
files. As a result, using the loader app to install the jailbreak environment
|
||||
is not supported when this option is used together with
|
||||
.Fl f , -rootful
|
||||
\[char46]
|
||||
|
||||
.It Fl l , -rootless
|
||||
Proceed in rootless mode. This option is only supported on iOS/iPadOS.
|
||||
|
||||
@@ -219,6 +218,9 @@ Boots the device in verbose mode, allowing boot logs to be seen.
|
||||
.It Fl p , -early-exit
|
||||
Exit after booting into a clean PongoOS shell.
|
||||
|
||||
.It Fl P , -late-exit
|
||||
Exit after uploading existing images into the PongoOS shell.
|
||||
|
||||
.It Fl e , -extra-bootargs Ar boot arguments
|
||||
Specify custom XNU kernel command line. Additionally, the
|
||||
.Em wdt=-1
|
||||
@@ -372,6 +374,11 @@ Equivalent to using the
|
||||
.Fl p , -early-exit
|
||||
option.
|
||||
|
||||
.It Ev RA1N_LATE_EXIT
|
||||
Equivalent to using the
|
||||
.Fl P , -late-exit
|
||||
option.
|
||||
|
||||
.It Ev RA1N_EXTRA_BOOTARGS
|
||||
Equivalent to using the
|
||||
.Fl e , -extra-bootargs
|
||||
@@ -600,6 +607,13 @@ has been removed, since it leaks memory in launchd.
|
||||
has been renamed to
|
||||
.Fl f, -rootful
|
||||
due to its ambiguity. As it supports both fakefs and realfs on certain platforms.
|
||||
|
||||
.Fl P, -pongo-full
|
||||
has been renamed to
|
||||
.Fl P, -late-exit
|
||||
due to its ambiguity.
|
||||
|
||||
|
||||
.Sh SEE ALSO
|
||||
.Xr launchd 8
|
||||
.Xr launchd.plist 5
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
"devicemap":{
|
||||
"iPhone6,1":"iphonese",
|
||||
"iPhone6,2":"iphonese",
|
||||
|
||||
"iPhone7,1":"iphone6s",
|
||||
"iPhone7,2":"iphone6s",
|
||||
"iPhone8,1":"iphone6s",
|
||||
"iPhone8,2":"iphone6s",
|
||||
|
||||
"iPhone8,4":"iphonese",
|
||||
|
||||
"iPhone9,1":"iphone7",
|
||||
"iPhone9,2":"iphone7",
|
||||
"iPhone9,3":"iphone7",
|
||||
"iPhone9,4":"iphone7",
|
||||
|
||||
"iPhone10,1":"iphone8",
|
||||
"iPhone10,2":"iphone8",
|
||||
"iPhone10,4":"iphone8",
|
||||
@@ -46,7 +50,6 @@
|
||||
"iPad7,6":"ipad",
|
||||
"iPad7,11":"ipad",
|
||||
"iPad7,12":"ipad",
|
||||
|
||||
"iPad8,1":"ipad",
|
||||
"iPad8,2":"ipad",
|
||||
"iPad8,3":"ipad",
|
||||
@@ -72,10 +75,33 @@
|
||||
"iPad4,9":"ipadmini",
|
||||
"iPad5,1":"ipadmini",
|
||||
"iPad5,2":"ipadmini",
|
||||
|
||||
"iPod7,1":"ipodtouch",
|
||||
"iPod9,1":"ipodtouch7",
|
||||
|
||||
"AppleTV5,3":"appletv4",
|
||||
"AppleTV6,2":"appletv4k"
|
||||
"AppleTV6,2":"appletv4k",
|
||||
|
||||
"iMac20,1":"dfuonly",
|
||||
"iMac20,2":"dfuonly",
|
||||
"MacBookAir8,1":"dfuonly",
|
||||
"MacBookAir8,2":"dfuonly",
|
||||
"MacBookPro9,1":"dfuonly",
|
||||
"MacBookPro15,1":"dfuonly",
|
||||
"MacBookPro15,2":"dfuonly",
|
||||
"MacBookPro15,3":"dfuonly",
|
||||
"MacBookPro15,4":"dfuonly",
|
||||
"MacBookPro16,1":"dfuonly",
|
||||
"MacBookPro16,2":"dfuonly",
|
||||
"MacBookPro16,3":"dfuonly",
|
||||
"MacBookPro16,4":"dfuonly",
|
||||
"iMacPro1,1":"dfuonly",
|
||||
"Macmini8,1":"dfuonly",
|
||||
"MacPro7,1":"dfuonly",
|
||||
"iBridge2,11":"dfuonly",
|
||||
"iBridge2,13":"dfuonly",
|
||||
"AudioAccessory1,1":"dfuonly",
|
||||
"AudioAccessory1,2":"dfuonly"
|
||||
},
|
||||
"devicelayout":{
|
||||
"ipodtouch7":{
|
||||
@@ -271,6 +297,9 @@
|
||||
}
|
||||
},
|
||||
"sequence":"atv_standard_breakout"
|
||||
},
|
||||
"dfuonly": {
|
||||
"is_supported": false
|
||||
}
|
||||
},
|
||||
"sequences":{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cat > /etc/udev/rules.d/turdusra1n.rules <<'EOF'
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="1227", GROUP="plugdev", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="1338", GROUP="plugdev", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="4141", GROUP="plugdev", MODE="0666"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="1281", GROUP="plugdev", MODE="0666"
|
||||
EOF
|
||||
|
||||
getent group plugdev >/dev/null 2>&1 || groupadd plugdev
|
||||
usermod -aG plugdev "$USER"
|
||||
|
||||
udevadm control --reload-rules
|
||||
udevadm trigger
|
||||
@@ -48,6 +48,8 @@ prefix_path="${XDG_BIN_HOME:-$HOME/.local}"
|
||||
bin_path="$prefix_path/bin"
|
||||
install_path="$bin_path/palera1n"
|
||||
old_install_path="/usr/local/bin/palera1n"
|
||||
# DMG shit
|
||||
downloaded_dmg="0"
|
||||
|
||||
download() {
|
||||
local url="$1"
|
||||
@@ -230,15 +232,44 @@ esac
|
||||
# Run
|
||||
# =========
|
||||
|
||||
download_version=$(curl -s https://api.github.com/repos/palera1n/palera1n/releases/latest | grep -o '"tag_name": "[^"]*' | sed 's/"tag_name": "//' || true)
|
||||
latest_tag=$(curl -fsSL https://api.github.com/repos/palera1n/palera1n/tags \
|
||||
| grep -m1 -o '"name": "[^"]*' \
|
||||
| sed 's/"name": "//' || true)
|
||||
|
||||
if [ -z "$download_version" ]; then
|
||||
error "Could not retrieve the latest release version from GitHub API."
|
||||
latest_release=$(curl -fsSL https://api.github.com/repos/palera1n/palera1n/releases/latest \
|
||||
| grep -o '"tag_name": "[^"]*' \
|
||||
| sed 's/"tag_name": "//' || true)
|
||||
|
||||
if [ -z "$latest_release" ]; then
|
||||
error "Could not retrieve the latest release version from GitHub."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$latest_tag" ] && [ "$latest_tag" != "$latest_release" ]; then
|
||||
printf "Select a version to download:\n"
|
||||
printf " 1) Latest Beta (%s)\n" "$latest_tag"
|
||||
printf " 2) Latest Release (%s)\n" "$latest_release"
|
||||
printf "Choice [1/2, default: 2]: "
|
||||
read -r choice
|
||||
|
||||
case "$choice" in
|
||||
1)
|
||||
download_version="$latest_tag"
|
||||
;;
|
||||
""|2)
|
||||
download_version="$latest_release"
|
||||
;;
|
||||
*)
|
||||
error "Invalid selection."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
download_version="$latest_release"
|
||||
fi
|
||||
|
||||
info "Detected environment: $os_name ($arch)"
|
||||
info "Targeting release tag: ${download_version}"
|
||||
info "Targeting version: ${download_version}"
|
||||
|
||||
download_prefix="https://github.com/palera1n/palera1n/releases/download"
|
||||
mkdir -p "$bin_path"
|
||||
@@ -267,12 +298,17 @@ case "$os" in
|
||||
tgz_url="${download_prefix}/${download_version}/palera1n-macos-${arch}.tar.gz"
|
||||
bin_url="${download_prefix}/${download_version}/palera1n-macos-${arch}"
|
||||
|
||||
if curl -fsLI "$dmg_url" >/dev/null 2>&1; then
|
||||
error "DMG releases are not supported by this CLI installer. Please download the DMG manually."
|
||||
exit 1
|
||||
fi
|
||||
hdiutil detach "/Volumes/palera1n-macos-universal" >/dev/null 2>&1 || true
|
||||
|
||||
if curl -fsLI "$tgz_url" >/dev/null 2>&1; then
|
||||
if curl -fsLI "$dmg_url" >/dev/null 2>&1; then
|
||||
info "Downloading macOS DMG..."
|
||||
dmg_file="$TMPDIR/palera1n-macos-universal-$(date +%s).dmg"
|
||||
download "$dmg_url" "$dmg_file"
|
||||
hdiutil attach "$dmg_file" >/dev/null 2>&1
|
||||
open "/Volumes/palera1n-macos-universal"
|
||||
rm -f -- "$dmg_file"
|
||||
downloaded_dmg="1"
|
||||
elif curl -fsLI "$tgz_url" >/dev/null 2>&1; then
|
||||
info "Installing from macOS tarball..."
|
||||
curl -fsSL "$tgz_url" | tar -xz -C "$prefix_path"
|
||||
else
|
||||
@@ -283,6 +319,11 @@ case "$os" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$downloaded_dmg" = "1" ]; then
|
||||
info "palera1n DMG downloaded. Please drag the palera1n app to your Applications folder."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
add_to_path "$bin_path"
|
||||
|
||||
if [ -f "$install_path" ]; then
|
||||
@@ -294,7 +335,7 @@ if [ -f "$install_path" ]; then
|
||||
info "palera1n installed successfully at ${install_path}."
|
||||
info "Type \`palera1n\` in your terminal to get started!"
|
||||
exec "${SHELL:-/bin/sh}" -l
|
||||
else
|
||||
else
|
||||
error "palera1n failed to install. Please check your internet connection and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 647 KiB |
|
After Width: | Height: | Size: 203 KiB |
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"fill" : {
|
||||
"linear-gradient" : [
|
||||
"srgb:0.68630,0.73449,0.81004,1.00000",
|
||||
"srgb:0.73248,0.53902,0.51652,1.00000"
|
||||
],
|
||||
"orientation" : {
|
||||
"start" : {
|
||||
"x" : 0.5,
|
||||
"y" : 0
|
||||
},
|
||||
"stop" : {
|
||||
"x" : 0.5,
|
||||
"y" : 0.7
|
||||
}
|
||||
}
|
||||
},
|
||||
"groups" : [
|
||||
{
|
||||
"layers" : [
|
||||
{
|
||||
"blend-mode" : "screen",
|
||||
"fill" : {
|
||||
"solid" : "srgb:0.95467,1.00000,0.96255,1.00000"
|
||||
},
|
||||
"hidden" : false,
|
||||
"image-name" : "palera1n_glyph 2.png",
|
||||
"name" : "palera1n_glyph 2"
|
||||
},
|
||||
{
|
||||
"glass" : false,
|
||||
"hidden" : true,
|
||||
"image-name" : "asdsadsadasasd.png",
|
||||
"name" : "asdsadsadasasd",
|
||||
"opacity" : 0.7
|
||||
},
|
||||
{
|
||||
"fill" : {
|
||||
"solid" : "srgb:0.91539,1.00000,0.91492,1.00000"
|
||||
},
|
||||
"glass" : false,
|
||||
"hidden" : false,
|
||||
"image-name" : "asdasdasdas.png",
|
||||
"name" : "asdasdasdas",
|
||||
"opacity" : 0.3
|
||||
},
|
||||
{
|
||||
"blend-mode" : "normal",
|
||||
"glass" : false,
|
||||
"hidden" : true,
|
||||
"image-name" : "palera1n_bg.png",
|
||||
"name" : "palera1n_bg",
|
||||
"opacity" : 1
|
||||
}
|
||||
],
|
||||
"shadow" : {
|
||||
"kind" : "neutral",
|
||||
"opacity" : 0.5
|
||||
},
|
||||
"translucency" : {
|
||||
"enabled" : true,
|
||||
"value" : 0.5
|
||||
}
|
||||
}
|
||||
],
|
||||
"supported-platforms" : {
|
||||
"circles" : [
|
||||
"watchOS"
|
||||
],
|
||||
"squares" : "shared"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>palera1n</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>palera1n.icns</string>
|
||||
<string>AppIcon</string>
|
||||
<key>CFBundleIconName</key>
|
||||
<string>AppIcon</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>palera1n</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
@@ -20,5 +22,9 @@
|
||||
<string>(c) 2026 palera1n</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
@@ -0,0 +1,10 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=palera1n
|
||||
Comment=Semi-tethered jailbreak for iOS 15+
|
||||
Categories=Utility;
|
||||
Icon=in.palera.palera1n
|
||||
Exec=palera1n
|
||||
Terminal=false
|
||||
StartupWMClass=in.palera.palera1n
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#if defined(WITH_GUI) || defined(WITH_TUI)
|
||||
|
||||
#ifndef MAIN__DEVICE_INFO_H
|
||||
#define MAIN__DEVICE_INFO_H
|
||||
#ifndef P1__DEVICE_INFO_HPP
|
||||
#define P1__DEVICE_INFO_HPP
|
||||
|
||||
// stolen from irecovery, I dont think an array
|
||||
// of devices can be copyrighted?
|
||||
@@ -369,6 +369,9 @@ static struct irecv_device irecv_devices[] = {
|
||||
/* Apple Vision Pro */
|
||||
{ "RealityDevice14,1", "n301ap", 0x42, 0x8112, "Apple Vision Pro" },
|
||||
{ "RealityDevice17,1", "n301aap", 0x42, 0x8142, "Apple Vision Pro (M5)" },
|
||||
/* Lightning Video Adapters */
|
||||
{ "iAccy1,1", "b137ap", 0x00, 0x8747, "Lightning Digital AV Adapter" },
|
||||
{ "iAccy1,2", "b165ap", 0x02, 0x8747, "Lightning to VGA Adapter" },
|
||||
/* Private Cloud Compute Research Environment */
|
||||
{ "iPhone99,11", "vresearch101ap", 0x90, 0xFE01, "iPhone 99,11" },
|
||||
{ nullptr, nullptr, -1, -1, nullptr }
|
||||
@@ -379,6 +382,6 @@ static struct irecv_device irecv_devices[] = {
|
||||
void get_recovery_info(char *sn, const char **ecid, const char **product_model, const char **product_name);
|
||||
void get_name_from_product_type(const char *product_type, const char **name);
|
||||
|
||||
#endif // MAIN__DEVICE_INFO_H
|
||||
#endif // P1__DEVICE_INFO_HPP
|
||||
|
||||
#endif // WITH_GUI || WITH_TUI
|
||||
@@ -73,6 +73,7 @@ struct ManagedDevice {
|
||||
bool normalPresent = false;
|
||||
bool recoveryPresent = false;
|
||||
bool dfuPresent = false;
|
||||
bool pongoPresent = false;
|
||||
hotplug_handle_t handle{};
|
||||
uint32_t device_id = 0;
|
||||
|
||||
@@ -279,6 +280,7 @@ static void handle_other_add(hotplug_handle_t handle, DeviceMode mode) {
|
||||
|
||||
m.recoveryPresent = (mode == DeviceMode::Recovery);
|
||||
m.dfuPresent = (mode == DeviceMode::DFU);
|
||||
m.pongoPresent = (mode == DeviceMode::Pongo);
|
||||
}
|
||||
publish_state();
|
||||
}
|
||||
@@ -304,6 +306,7 @@ static void remove_device(platform_service_t service, DeviceMode mode, uint32_t
|
||||
switch (mode) {
|
||||
case DeviceMode::Recovery: return pair.second.recoveryPresent;
|
||||
case DeviceMode::DFU: return pair.second.dfuPresent;
|
||||
case DeviceMode::Pongo: return pair.second.pongoPresent;
|
||||
default: return false;
|
||||
}
|
||||
});
|
||||
@@ -319,9 +322,11 @@ static void remove_device(platform_service_t service, DeviceMode mode, uint32_t
|
||||
m.recoveryPresent = false;
|
||||
} else if (mode == DeviceMode::DFU) {
|
||||
m.dfuPresent = false;
|
||||
} else if (mode == DeviceMode::Pongo) {
|
||||
m.pongoPresent = false;
|
||||
}
|
||||
|
||||
if (!m.normalPresent && !m.recoveryPresent && !m.dfuPresent) {
|
||||
if (!m.normalPresent && !m.recoveryPresent && !m.dfuPresent && !m.pongoPresent) {
|
||||
release_handle(m.handle);
|
||||
g_devices.erase(it);
|
||||
}
|
||||
@@ -419,6 +424,9 @@ static void hotplug_callback(hotplug_event_t event, hotplug_handle_t handle) {
|
||||
case HOTPLUG_EVENT_DFU_REMOVE: remove_device(srv, DeviceMode::DFU); break;
|
||||
case HOTPLUG_EVENT_RECOVERY_ADD: handle_other_add(handle, DeviceMode::Recovery); break;
|
||||
case HOTPLUG_EVENT_RECOVERY_REMOVE: remove_device(srv, DeviceMode::Recovery); break;
|
||||
case HOTPLUG_EVENT_PONGO_ADD: handle_other_add(handle, DeviceMode::Pongo); break;
|
||||
case HOTPLUG_EVENT_PONGO_REMOVE: remove_device(srv, DeviceMode::Pongo); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#if defined(WITH_GUI) || defined(WITH_TUI)
|
||||
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
#ifndef P1__EVENT_HPP
|
||||
#define P1__EVENT_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
@@ -43,7 +43,8 @@ enum class DeviceMode
|
||||
None,
|
||||
Normal,
|
||||
Recovery,
|
||||
DFU
|
||||
DFU,
|
||||
Pongo,
|
||||
};
|
||||
|
||||
struct DeviceState
|
||||
@@ -68,6 +69,6 @@ void ensure_device_event_system_started();
|
||||
bool enter_recovery();
|
||||
void exit_recovery();
|
||||
|
||||
#endif // EVENT_H
|
||||
#endif // P1__EVENT_HPP
|
||||
|
||||
#endif // WITH_GUI || WITH_TUI
|
||||
@@ -35,15 +35,16 @@
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
||||
constexpr int32_t APPLE_VID = 0x05AC;
|
||||
constexpr int32_t PID_DFU = 0x1227;
|
||||
constexpr int32_t PID_RECOVERY_1 = 0x1280;
|
||||
constexpr int32_t PID_RECOVERY_2 = 0x1281;
|
||||
constexpr int32_t PID_RECOVERY_3 = 0x1282;
|
||||
constexpr int32_t PID_RECOVERY_4 = 0x1283;
|
||||
constexpr int32_t APPLE_VID = 0x05AC;
|
||||
constexpr int32_t PID_DFU = 0x1227;
|
||||
constexpr int32_t PID_RECOVERY_1 = 0x1280;
|
||||
constexpr int32_t PID_RECOVERY_2 = 0x1281;
|
||||
constexpr int32_t PID_RECOVERY_3 = 0x1282;
|
||||
constexpr int32_t PID_RECOVERY_4 = 0x1283;
|
||||
constexpr int32_t PID_PONGO = 0x4141;
|
||||
|
||||
static const std::vector<int32_t> TARGET_PIDS = {
|
||||
PID_DFU, PID_RECOVERY_1, PID_RECOVERY_2, PID_RECOVERY_3, PID_RECOVERY_4
|
||||
PID_DFU, PID_RECOVERY_1, PID_RECOVERY_2, PID_RECOVERY_3, PID_RECOVERY_4, PID_PONGO
|
||||
};
|
||||
|
||||
static hotplug_callback_t gUserCallback = nullptr;
|
||||
@@ -56,6 +57,9 @@ static hotplug_event_t get_hotplug_event(int32_t pid, bool arrived) {
|
||||
if (pid == PID_DFU) {
|
||||
return arrived ? HOTPLUG_EVENT_DFU_ADD : HOTPLUG_EVENT_DFU_REMOVE;
|
||||
}
|
||||
if (pid == PID_PONGO) {
|
||||
return arrived ? HOTPLUG_EVENT_PONGO_ADD : HOTPLUG_EVENT_PONGO_REMOVE;
|
||||
}
|
||||
return arrived ? HOTPLUG_EVENT_RECOVERY_ADD : HOTPLUG_EVENT_RECOVERY_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#if defined(WITH_GUI) || defined(WITH_TUI)
|
||||
|
||||
#ifndef MAIN__HOTPLUG_HPP
|
||||
#define MAIN__HOTPLUG_HPP
|
||||
#ifndef P1__HOTPLUG_HPP
|
||||
#define P1__HOTPLUG_HPP
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -51,7 +51,9 @@ typedef enum {
|
||||
HOTPLUG_EVENT_DFU_ADD,
|
||||
HOTPLUG_EVENT_DFU_REMOVE,
|
||||
HOTPLUG_EVENT_RECOVERY_ADD,
|
||||
HOTPLUG_EVENT_RECOVERY_REMOVE
|
||||
HOTPLUG_EVENT_RECOVERY_REMOVE,
|
||||
HOTPLUG_EVENT_PONGO_ADD,
|
||||
HOTPLUG_EVENT_PONGO_REMOVE,
|
||||
} hotplug_event_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -77,6 +79,6 @@ void exit_recovery(hotplug_handle_t handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MAIN__HOTPLUG_HPP
|
||||
#endif // P1__HOTPLUG_HPP
|
||||
|
||||
#endif // WITH_GUI || WITH_TUI
|
||||
@@ -67,6 +67,7 @@ const char* stage_to_string(int stage)
|
||||
case STAGE_YOLODFU: return "Booting PongoOS...";
|
||||
case STAGE_PONGO: return "Booting...";
|
||||
case STAGE_DONE: return "Done!";
|
||||
case STAGE_ERROR: return "Error!";
|
||||
default: return "Waiting...";
|
||||
}
|
||||
}
|
||||
@@ -80,6 +81,7 @@ int stage_to_progress(int stage)
|
||||
case STAGE_YOLODFU: return 60;
|
||||
case STAGE_PONGO: return 70;
|
||||
case STAGE_DONE: return 100;
|
||||
case STAGE_ERROR: return 99;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +132,7 @@ const char* err_to_string(int err) {
|
||||
|
||||
int exploit(int *stage)
|
||||
{
|
||||
LOG("Waiting for devices...");
|
||||
LOG("Waiting for DFU mode devices...");
|
||||
|
||||
*stage = STAGE_RESET;
|
||||
|
||||
@@ -156,7 +158,21 @@ int exploit(int *stage)
|
||||
if (!usb_get_client_flag(client, &flag))
|
||||
goto reloop;
|
||||
|
||||
if (flag & kDeviceDFUModeFlag) {
|
||||
// no reason to use this for tui/gui
|
||||
if ((flag & kDeviceRecoveryModeFlag) && (palerain_flags & palerain_option_cli)) {
|
||||
LOG("Found recovery mode device");
|
||||
|
||||
cr = ra1n_enter_dfu(client);
|
||||
if (cr == RA1N_CLIENT_ERR_NONE) {
|
||||
usb_close(client);
|
||||
*stage = STAGE_RESET;
|
||||
continue;
|
||||
}
|
||||
LOG_ERROR("Failed to enter DFU mode (rv=%d, reason=%s)", cr, err_to_string(cr));
|
||||
usb_close(client);
|
||||
*stage = STAGE_ERROR;
|
||||
break; // err
|
||||
} else if (flag & kDeviceDFUModeFlag) {
|
||||
if (flag & kDeviceStandardPwnedDFUModeFlag) {
|
||||
// we cant do shit sorry
|
||||
LOG_ERROR("Found an unknown pwned DFU mode device");
|
||||
@@ -271,10 +287,9 @@ int exploit(int *stage)
|
||||
usb_close(client);
|
||||
continue;
|
||||
} else {
|
||||
LOG_ERROR("Found unknown device");
|
||||
usb_close(client);
|
||||
*stage = STAGE_ERROR;
|
||||
break; // err
|
||||
*stage = STAGE_RESET;
|
||||
continue; // unknown mode, just reloop
|
||||
}
|
||||
|
||||
reloop:
|
||||
@@ -311,7 +326,7 @@ int exploit(int *stage)
|
||||
|
||||
int exploit(int *stage)
|
||||
{
|
||||
LOG("Waiting for devices...");
|
||||
LOG("Waiting for DFU mode devices...");
|
||||
|
||||
struct DeviceConfiguration deviceConfig;
|
||||
struct PayloadConfiguration payloadConfig;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RUN_H
|
||||
#define RUN_H
|
||||
#ifndef P1__EXPLOIT_H
|
||||
#define P1__EXPLOIT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -60,4 +60,4 @@ int exploit(int *stage);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RUN_H
|
||||
#endif // P1__EXPLOIT_H
|
||||
@@ -39,7 +39,7 @@
|
||||
#endif
|
||||
#if WITH_RAMDISK
|
||||
# include "gen/embedded/ramdisk.h"
|
||||
# include "gen/embedded/ramdisk-compressed.dmg.h"
|
||||
# include "gen/embedded/ramdisk-compressed.h"
|
||||
#endif
|
||||
#include "gen/embedded/Pongo.h"
|
||||
#include "gen/embedded/checkra1n-kpf-pongo.h"
|
||||
@@ -64,8 +64,8 @@ payload_t g_payload_overlay = {
|
||||
|
||||
#if WITH_RAMDISK
|
||||
payload_t g_payload_ramdisk = {
|
||||
.data = embedded_ramdisk_compressed_dmg_lzma,
|
||||
.data_len = embedded_ramdisk_compressed_dmg_lzma_len,
|
||||
.data = embedded_ramdisk_compressed_lzma,
|
||||
.data_len = embedded_ramdisk_compressed_lzma_len,
|
||||
.uncompressed_data_len = embedded_ramdisk_dmg_len,
|
||||
};
|
||||
#else
|
||||
@@ -88,6 +88,29 @@ payload_t g_payload_kpf = {
|
||||
.uncompressed_data_len = embedded_checkra1n_kpf_pongo_len,
|
||||
};
|
||||
|
||||
#define PONGO_MAX_SZ (0x7fe00)
|
||||
#define MACHO_MAGIC_32 (0xFEEDFACE)
|
||||
#define MACHO_MAGIC_64 (0xFEEDFACF)
|
||||
|
||||
bool check_payload_validity(const payload_t *payload, bool isPongo)
|
||||
{
|
||||
if (!payload || !payload->data || payload->data_len < 4)
|
||||
return false;
|
||||
|
||||
const uint32_t magic = *(const uint32_t *)payload->data;
|
||||
const bool isMachO = (magic == MACHO_MAGIC_32 || magic == MACHO_MAGIC_64);
|
||||
|
||||
if (isPongo) {
|
||||
if (isMachO || payload->data_len > PONGO_MAX_SZ)
|
||||
return false;
|
||||
} else {
|
||||
if (!isMachO)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool override_payload_from_file(const char *path, payload_t *out)
|
||||
{
|
||||
FILE *f = fopen(path, "rb");
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
#ifndef P1__GLOBALS_H
|
||||
#define P1__GLOBALS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -52,10 +52,11 @@ extern payload_t g_payload_kpf;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool check_payload_validity(const payload_t *payload, bool isPongo);
|
||||
bool override_payload_from_file(const char *path, payload_t *out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GLOBALS_H
|
||||
#endif // P1__GLOBALS_H
|
||||
@@ -65,10 +65,10 @@ void print_credits() {
|
||||
"::\n"
|
||||
":: ======== Made by =======>\n"
|
||||
":: Made by: asdfugil, kok3shidoll, claration, mineek\n"
|
||||
":: plooshi, staturnz\n"
|
||||
":: sarah, staturnz\n"
|
||||
":: ======== Thanks to =======>\n"
|
||||
":: Thanks to: itsnebulalol, llsc12, lrdsnow, dedbeddedbed\n"
|
||||
":: kirb, ehilwyma, opa334, 0x7ff, alfiecg25, sneko, sbingner\n"
|
||||
":: kirb, ehilwyma, opa334, 0x7ff, alfiecg24, sneko, sbingner\n"
|
||||
":: nikias, tihmstar\n"
|
||||
":: Checkra1n (Siguza, axi0mx, littlelailo et al.)\n"
|
||||
":: Procursus (Hayden Seay, Cameron Katri, Keto et al.)\n"
|
||||
@@ -103,6 +103,7 @@ void print_usage(char* argv) {
|
||||
" -T, --telnetd Enable TELNET daemon on port 46 (insecure)\n"
|
||||
" -V, --verbose-boot Enable verbose booting\n"
|
||||
" -p, --early-exit Exit after uploading Pongo\n"
|
||||
" -P, --late-exit Exit after uploading existing images to Pongo\n"
|
||||
" -e, --extra-bootargs <BOOTARGS> Set extra bootargs\n"
|
||||
" -k, --override-pongo <FILE PATH> Override Pongo image\n"
|
||||
" -K, --override-kpf <FILE PATH> Override kernel patchfinder\n"
|
||||
@@ -136,6 +137,7 @@ void print_usage(char* argv) {
|
||||
" RA1N_TELNETD=1 Enable TELNET daemon on port 46 (insecure)\n"
|
||||
" RA1N_VERBOSE_BOOT=1 Enable verbose booting\n"
|
||||
" RA1N_EARLY_EXIT=1 Exit after uploading Pongo\n"
|
||||
" RA1N_LATE_EXIT=1 Exit after uploading existing images to Pongo\n"
|
||||
" RA1N_EXTRA_BOOTARGS=<FILE PATH> Set extra bootargs\n"
|
||||
" RA1N_OVERRIDE_PONGO=<FILE PATH> Override Pongo image\n"
|
||||
" RA1N_OVERRIDE_KPF=<FILE PATH> Override kernel patchfinder\n"
|
||||
@@ -171,15 +173,6 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
int options;
|
||||
int option_index = 0;
|
||||
|
||||
bool set_cli = false, set_gui = false, set_tui = false;
|
||||
bool set_flower = false, set_force_revert = false, set_ssv = false;
|
||||
bool set_rootless = false, set_rootful = false;
|
||||
bool set_fakefs = false, set_partial_fakefs = false;
|
||||
bool set_safemode = false, set_telnetd = false, set_verbose = false;
|
||||
bool set_pongo_exit = false, set_no_colors = false, set_quick = false;
|
||||
bool set_extra_bootargs = false, set_pongo = false, set_kpf = false;
|
||||
bool set_overlay = false, set_ramdisk = false;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
@@ -202,6 +195,7 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
{"telnetd", no_argument, NULL, 'T'},
|
||||
{"verbose-boot", no_argument, NULL, 'V'},
|
||||
{"early-exit", no_argument, NULL, 'p'},
|
||||
{"late-exit", no_argument, NULL, 'P'},
|
||||
{"extra-bootargs", required_argument, NULL, 'e'},
|
||||
{"override-pongo", required_argument, NULL, 'k'},
|
||||
{"override-kpf", required_argument, NULL, 'K'},
|
||||
@@ -241,7 +235,7 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
|
||||
// MARK: Standard
|
||||
|
||||
while ((options = getopt_long(argc, argv, "hvlfcBsTVpe:k:K:o:r:dnq", long_options, &option_index)) != -1) {
|
||||
while ((options = getopt_long(argc, argv, "hvlfcBsTVpPe:k:K:o:r:dnq", long_options, &option_index)) != -1) {
|
||||
switch (options) {
|
||||
case 'h': // --help
|
||||
print_usage(argv[0]);
|
||||
@@ -294,11 +288,9 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
palerain_flags |= palerain_option_ssv;
|
||||
break;
|
||||
case 'l': // --rootless
|
||||
palerain_flags &= ~palerain_option_rootful;
|
||||
palerain_flags |= palerain_option_rootless;
|
||||
break;
|
||||
case 'f': // --rootful
|
||||
palerain_flags &= ~palerain_option_rootless;
|
||||
palerain_flags |= palerain_option_rootful;
|
||||
break;
|
||||
case 'c': // --setup-fakefs
|
||||
@@ -319,6 +311,9 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
case 'p': // --early-exit
|
||||
palerain_flags |= palerain_option_pongo_exit;
|
||||
break;
|
||||
case 'P': // --late-exit
|
||||
palerain_flags |= palerain_option_pongo_full;
|
||||
break;
|
||||
case 'e': // --extra-bootargs
|
||||
if (strlen(optarg) > (sizeof(boot_args) - 0x20)) {
|
||||
LOG_ERROR("Boot arguments too long!");
|
||||
@@ -338,11 +333,10 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
LOG_ERROR("Failed to load pongo payload, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
if (g_payload_pongo.data_len > PONGO_MAX_SZ) {
|
||||
LOG_ERROR("Pongo payload is too large! %zu bytes (max %zu)", g_payload_pongo.data_len, PONGO_MAX_SZ);
|
||||
if (!check_payload_validity(&g_payload_pongo, true)) {
|
||||
LOG_ERROR("Pongo payload is invalid or too large! %zu bytes", g_payload_pongo.data_len);
|
||||
exit(1);
|
||||
}
|
||||
// TODO: check if macho, otherwise exit
|
||||
LOG("Overriding pongo payload with %s", optarg);
|
||||
break;
|
||||
case 'K': // --override-kpf
|
||||
@@ -350,11 +344,8 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
LOG_ERROR("Failed to load kpf payload, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
if (g_payload_kpf.data_len < 4
|
||||
|| (memcmp(g_payload_kpf.data, MACHO_MAGIC_64, 4) != 0
|
||||
&& memcmp(g_payload_kpf.data, MACHO_MAGIC_32, 4) != 0))
|
||||
{
|
||||
LOG_ERROR("Invalid kpf payload, is it macho?");
|
||||
if (!check_payload_validity(&g_payload_kpf, false)) {
|
||||
LOG_ERROR("KPF payload is invalid! Is it a valid Mach-O binary?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding kpf payload with %s", optarg);
|
||||
@@ -394,65 +385,66 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
|
||||
// MARK: Environment vars
|
||||
|
||||
if (!set_cli && get_env_binary("RA1N_CLI") == 1) {
|
||||
if (get_env_binary("RA1N_CLI") == 1) {
|
||||
palerain_flags &= ~palerain_option_tui;
|
||||
palerain_flags &= ~palerain_option_gui;
|
||||
palerain_flags |= palerain_option_cli;
|
||||
}
|
||||
#ifdef WITH_GUI
|
||||
if (!set_gui && get_env_binary("RA1N_GUI") == 1) {
|
||||
if (get_env_binary("RA1N_GUI") == 1) {
|
||||
palerain_flags &= ~palerain_option_cli;
|
||||
palerain_flags &= ~palerain_option_tui;
|
||||
palerain_flags |= palerain_option_gui;
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_TUI
|
||||
if (!set_tui && get_env_binary("RA1N_TUI") == 1) {
|
||||
if (get_env_binary("RA1N_TUI") == 1) {
|
||||
palerain_flags &= ~palerain_option_cli;
|
||||
palerain_flags &= ~palerain_option_gui;
|
||||
palerain_flags |= palerain_option_tui;
|
||||
}
|
||||
#endif
|
||||
if (!set_flower && get_env_binary("RA1N_DARK_BLOCKCHAIN") == 1) {
|
||||
if (get_env_binary("RA1N_DARK_BLOCKCHAIN") == 1) {
|
||||
palerain_flags |= palerain_option_flower_chain;
|
||||
}
|
||||
if (!set_force_revert && get_env_binary("RA1N_FORCE_REVERT") == 1) {
|
||||
if (get_env_binary("RA1N_FORCE_REVERT") == 1) {
|
||||
palerain_flags |= palerain_option_force_revert;
|
||||
}
|
||||
if (!set_ssv && get_env_binary("RA1N_FORCE_ENABLE_SSV") == 1) {
|
||||
if (get_env_binary("RA1N_FORCE_ENABLE_SSV") == 1) {
|
||||
palerain_flags |= palerain_option_ssv;
|
||||
}
|
||||
if (!set_rootless && get_env_binary("RA1N_ROOTLESS") == 1) {
|
||||
palerain_flags &= ~palerain_option_rootful;
|
||||
if (get_env_binary("RA1N_ROOTLESS") == 1) {
|
||||
palerain_flags |= palerain_option_rootless;
|
||||
}
|
||||
if (!set_rootful && get_env_binary("RA1N_ROOTFUL") == 1) {
|
||||
palerain_flags &= ~palerain_option_rootless;
|
||||
if (get_env_binary("RA1N_ROOTFUL") == 1) {
|
||||
palerain_flags |= palerain_option_rootful;
|
||||
}
|
||||
if (!set_fakefs && get_env_binary("RA1N_SETUP_FAKEFS") == 1) {
|
||||
if (get_env_binary("RA1N_SETUP_FAKEFS") == 1) {
|
||||
palerain_flags |= palerain_option_setup_rootful;
|
||||
}
|
||||
if (!set_partial_fakefs && get_env_binary("RA1N_SETUP_PARTIAL_FAKEFS") == 1) {
|
||||
if (get_env_binary("RA1N_SETUP_PARTIAL_FAKEFS") == 1) {
|
||||
palerain_flags |= palerain_option_setup_partial_root;
|
||||
}
|
||||
if (!set_safemode && get_env_binary("RA1N_SAFE_MODE") == 1) {
|
||||
if (get_env_binary("RA1N_SAFE_MODE") == 1) {
|
||||
palerain_flags |= palerain_option_safemode;
|
||||
}
|
||||
if (!set_telnetd && get_env_binary("RA1N_TELNETD") == 1) {
|
||||
if (get_env_binary("RA1N_TELNETD") == 1) {
|
||||
palerain_flags |= palerain_option_telnetd;
|
||||
}
|
||||
if (!set_verbose && get_env_binary("RA1N_VERBOSE_BOOT") == 1) {
|
||||
if (get_env_binary("RA1N_VERBOSE_BOOT") == 1) {
|
||||
palerain_flags |= palerain_option_verbose_boot;
|
||||
}
|
||||
if (!set_pongo_exit && get_env_binary("RA1N_EARLY_EXIT") == 1) {
|
||||
if (get_env_binary("RA1N_EARLY_EXIT") == 1) {
|
||||
palerain_flags |= palerain_option_pongo_exit;
|
||||
}
|
||||
if (!set_no_colors && get_env_binary("RA1N_NO_COLORS") == 1) {
|
||||
if (get_env_binary("RA1N_LATE_EXIT") == 1) {
|
||||
palerain_flags |= palerain_option_pongo_full;
|
||||
}
|
||||
if (get_env_binary("RA1N_NO_COLORS") == 1) {
|
||||
palerain_flags |= palerain_option_no_colors;
|
||||
}
|
||||
#if defined(WITH_GUI) || defined(WITH_TUI)
|
||||
if (!set_quick && get_env_binary("RA1N_QUICK") == 1) {
|
||||
if (get_env_binary("RA1N_QUICK") == 1) {
|
||||
palerain_flags |= palerain_option_quick;
|
||||
}
|
||||
#endif
|
||||
@@ -465,116 +457,115 @@ void parse_arguments(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!set_extra_bootargs) {
|
||||
const char *env_bootargs = getenv("RA1N_EXTRA_BOOTARGS");
|
||||
if (env_bootargs) {
|
||||
if (strlen(env_bootargs) > (sizeof(boot_args) - 0x20)) {
|
||||
LOG_ERROR("Boot arguments too long!");
|
||||
exit(1);
|
||||
}
|
||||
snprintf(boot_args, sizeof(boot_args), "%s", env_bootargs);
|
||||
const char *env_bootargs = getenv("RA1N_EXTRA_BOOTARGS");
|
||||
if (env_bootargs) {
|
||||
if (strlen(env_bootargs) > (sizeof(boot_args) - 0x20)) {
|
||||
LOG_ERROR("Boot arguments too long!");
|
||||
exit(1);
|
||||
}
|
||||
snprintf(boot_args, sizeof(boot_args), "%s", env_bootargs);
|
||||
}
|
||||
|
||||
if (!set_pongo) {
|
||||
const char *env_pongo = getenv("RA1N_OVERRIDE_PONGO");
|
||||
if (env_pongo) {
|
||||
if (!override_payload_from_file(env_pongo, &g_payload_pongo)) {
|
||||
LOG_ERROR("Failed to load pongo payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
if (g_payload_pongo.data_len > PONGO_MAX_SZ) {
|
||||
LOG_ERROR("Pongo payload is too large! %zu bytes (max %zu)", g_payload_pongo.data_len, PONGO_MAX_SZ);
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding pongo payload with %s (from env)", env_pongo);
|
||||
const char *env_pongo = getenv("RA1N_OVERRIDE_PONGO");
|
||||
if (env_pongo) {
|
||||
if (!override_payload_from_file(env_pongo, &g_payload_pongo)) {
|
||||
LOG_ERROR("Failed to load pongo payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
if (!check_payload_validity(&g_payload_pongo, true)) {
|
||||
LOG_ERROR("Pongo payload is invalid or too large! %zu bytes", g_payload_pongo.data_len);
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding pongo payload with %s (from env)", env_pongo);
|
||||
}
|
||||
|
||||
if (!set_kpf) {
|
||||
const char *env_kpf = getenv("RA1N_OVERRIDE_KPF");
|
||||
if (env_kpf) {
|
||||
if (!override_payload_from_file(env_kpf, &g_payload_kpf)) {
|
||||
LOG_ERROR("Failed to load kpf payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
if (g_payload_kpf.data_len < 4
|
||||
|| (memcmp(g_payload_kpf.data, MACHO_MAGIC_64, 4) != 0
|
||||
&& memcmp(g_payload_kpf.data, MACHO_MAGIC_32, 4) != 0))
|
||||
{
|
||||
LOG_ERROR("Invalid kpf payload from env, is it macho?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding kpf payload with %s (from env)", env_kpf);
|
||||
const char *env_kpf = getenv("RA1N_OVERRIDE_KPF");
|
||||
if (env_kpf) {
|
||||
if (!override_payload_from_file(env_kpf, &g_payload_kpf)) {
|
||||
LOG_ERROR("Failed to load kpf payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
if (!check_payload_validity(&g_payload_kpf, false)) {
|
||||
LOG_ERROR("Invalid kpf payload from env, is it macho?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding kpf payload with %s (from env)", env_kpf);
|
||||
}
|
||||
|
||||
if (!set_overlay) {
|
||||
const char *env_overlay = getenv("RA1N_OVERRIDE_OVERLAY");
|
||||
if (env_overlay) {
|
||||
if (!override_payload_from_file(env_overlay, &g_payload_overlay)) {
|
||||
LOG_ERROR("Failed to load overlay payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding overlay payload with %s (from env)", env_overlay);
|
||||
const char *env_overlay = getenv("RA1N_OVERRIDE_OVERLAY");
|
||||
if (env_overlay) {
|
||||
if (!override_payload_from_file(env_overlay, &g_payload_overlay)) {
|
||||
LOG_ERROR("Failed to load overlay payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding overlay payload with %s (from env)", env_overlay);
|
||||
}
|
||||
|
||||
if (!set_ramdisk) {
|
||||
const char *env_ramdisk = getenv("RA1N_OVERRIDE_RAMDISK");
|
||||
if (env_ramdisk) {
|
||||
if (!override_payload_from_file(env_ramdisk, &g_payload_ramdisk)) {
|
||||
LOG_ERROR("Failed to load ramdisk payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding ramdisk payload with %s (from env)", env_ramdisk);
|
||||
const char *env_ramdisk = getenv("RA1N_OVERRIDE_RAMDISK");
|
||||
if (env_ramdisk) {
|
||||
if (!override_payload_from_file(env_ramdisk, &g_payload_ramdisk)) {
|
||||
LOG_ERROR("Failed to load ramdisk payload from env, is the path correct?");
|
||||
exit(1);
|
||||
}
|
||||
LOG("Overriding ramdisk payload with %s (from env)", env_ramdisk);
|
||||
}
|
||||
|
||||
// MARK: Flag checks
|
||||
|
||||
if (!(palerain_flags & palerain_option_gui) &&
|
||||
!(palerain_flags & palerain_option_tui))
|
||||
if ((palerain_flags & palerain_option_pongo_exit) &&
|
||||
(palerain_flags & palerain_option_pongo_full))
|
||||
{
|
||||
if ((palerain_flags & palerain_option_pongo_exit) &&
|
||||
((palerain_flags & palerain_option_rootful) ||
|
||||
(palerain_flags & palerain_option_rootless) ||
|
||||
(palerain_flags & palerain_option_setup_rootful) ||
|
||||
(palerain_flags & palerain_option_setup_partial_root)))
|
||||
LOG_ERROR("You cannot specify both early-exit and late-exit modes.\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Pongo exit modes are standalone and cannot be combined with root modes
|
||||
if (palerain_flags & (palerain_option_pongo_exit | palerain_option_pongo_full))
|
||||
{
|
||||
if (palerain_flags & (palerain_option_rootful | palerain_option_rootless))
|
||||
{
|
||||
LOG_ERROR("[-p, --early-exit] cannot be used with [-f, --rootful], [-l, --rootless], [-c, --setup-fakefs], or [-B, --setup-partial-fakefs].\n");
|
||||
LOG_ERROR("Pongo exit modes cannot be used with [-l, --rootless] or [-f, --rootful].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(palerain_flags & palerain_option_pongo_exit) &&
|
||||
!(palerain_flags & palerain_option_rootful) &&
|
||||
!(palerain_flags & palerain_option_rootless))
|
||||
{
|
||||
LOG_ERROR("You must specify either [-l, --rootless] or [-f, --rootful].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
goto skip_root_types;
|
||||
}
|
||||
|
||||
if ((palerain_flags & palerain_option_rootful) &&
|
||||
(palerain_flags & palerain_option_rootless))
|
||||
{
|
||||
LOG_ERROR("You cannot specify both [-l, --rootless] and [-f, --rootful].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
// Normal root checks
|
||||
if (!(palerain_flags & palerain_option_gui) &&
|
||||
!(palerain_flags & palerain_option_tui) &&
|
||||
!(palerain_flags & palerain_option_rootful) &&
|
||||
!(palerain_flags & palerain_option_rootless))
|
||||
{
|
||||
LOG_ERROR("You must specify either [-l, --rootless] or [-f, --rootful].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((palerain_flags & palerain_option_setup_rootful) &&
|
||||
(palerain_flags & palerain_option_setup_partial_root))
|
||||
{
|
||||
LOG_ERROR("You cannot specify both [-c, --setup-fakefs] and [-B, --setup-partial-fakefs].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if ((palerain_flags & palerain_option_rootful) &&
|
||||
(palerain_flags & palerain_option_rootless))
|
||||
{
|
||||
LOG_ERROR("You cannot specify both [-l, --rootless] and [-f, --rootful].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (((palerain_flags & palerain_option_setup_rootful) ||
|
||||
(palerain_flags & palerain_option_setup_partial_root)) &&
|
||||
!(palerain_flags & palerain_option_rootful))
|
||||
skip_root_types:
|
||||
|
||||
if ((palerain_flags & palerain_option_setup_rootful) &&
|
||||
(palerain_flags & palerain_option_setup_partial_root))
|
||||
{
|
||||
LOG_ERROR("You cannot specify both [-c, --setup-fakefs] and [-B, --setup-partial-fakefs].\n");
|
||||
print_usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((palerain_flags & palerain_option_setup_rootful) ||
|
||||
(palerain_flags & palerain_option_setup_partial_root))
|
||||
{
|
||||
if (!(palerain_flags & palerain_option_rootful))
|
||||
{
|
||||
LOG_ERROR("[-c, --setup-fakefs] or [-B, --setup-partial-fakefs] require [-f, --rootful].\n");
|
||||
print_usage(argv[0]);
|
||||
|
||||
@@ -62,9 +62,7 @@ p1_transfer_ret_t issue_pongo_command(const p1_usb_handle_t *handle, const char
|
||||
if (command != NULL) {
|
||||
size_t len = strlen(command);
|
||||
|
||||
// unlikely to happen, unless we add support for pongoterm
|
||||
// TODO: discuss on adding a pongoterm
|
||||
if (len > CMD_LENGTH_MAX) {
|
||||
if (len >= CMD_LENGTH_MAX) {
|
||||
LOG_ERROR("Pongo command too long: %s", command);
|
||||
result.ret = 1;
|
||||
return result;
|
||||
@@ -86,12 +84,8 @@ p1_transfer_ret_t issue_pongo_command(const p1_usb_handle_t *handle, const char
|
||||
result = send_interface_control_request(handle, 0x21, 3, 0, 0, command_buf, len);
|
||||
if (result.ret != USB_TRANSFER_OK) goto result;
|
||||
#endif
|
||||
|
||||
// return early if the command is boot, we dont care about results
|
||||
if (strncmp(command,"boot",4) == 0) goto result;
|
||||
}
|
||||
|
||||
// TODO: does this work correctly?
|
||||
while (in_progress) {
|
||||
#if WITH_CIDERRAIN
|
||||
result = usb_ctrl_transfer(handle, 0xA1, 2, 0, 0, &in_progress, sizeof(in_progress));
|
||||
@@ -101,26 +95,35 @@ p1_transfer_ret_t issue_pongo_command(const p1_usb_handle_t *handle, const char
|
||||
if (result.ret != USB_TRANSFER_OK) goto result;
|
||||
#endif
|
||||
|
||||
if (in_progress == 0) break;
|
||||
|
||||
if (outpos + 0x1000 >= sizeof(stdout_buf)) {
|
||||
memmove(stdout_buf, stdout_buf + 0x1000, sizeof(stdout_buf) - 0x1000);
|
||||
outpos -= 0x1000;
|
||||
if (!in_progress) break;
|
||||
if (outpos > 0x1000) {
|
||||
memmove(stdout_buf, stdout_buf + outpos - 0x1000, 0x1000);
|
||||
outpos = 0x1000;
|
||||
}
|
||||
|
||||
outlen = 0;
|
||||
#if WITH_CIDERRAIN
|
||||
result = usb_ctrl_transfer(handle, 0xA1, 1, 0, 0, stdout_buf + outpos, 0x1000);
|
||||
result = usb_ctrl_transfer(handle, 0xA1, 1, 0, 0, (uint8_t *)(stdout_buf + outpos), 0x1000);
|
||||
if (result.ret != kUSBResponseSuccess) goto result;
|
||||
outlen = result.wLenDone;
|
||||
#else
|
||||
result = send_interface_control_request(handle, 0xA1, 1, 0, 0, stdout_buf + outpos, 0x1000);
|
||||
if (result.ret != USB_TRANSFER_OK) goto result;
|
||||
outlen = result.sz;
|
||||
#endif
|
||||
|
||||
outlen = 0x1000;
|
||||
outpos += outlen;
|
||||
}
|
||||
|
||||
result:
|
||||
result:
|
||||
if (result.ret != 0) {
|
||||
// boot command, we don't care about results, lets assume success :-)
|
||||
if (command != NULL && (!strncmp("boot", command, 4))) {
|
||||
result.ret = 0;
|
||||
return result;
|
||||
}
|
||||
LOG_ERROR("PongoOS command output: %.*s", (int)outpos, stdout_buf);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -199,8 +202,6 @@ p1_checkm8_err_t send_compressed_pongo(p1_usb_handle_t *handle, const uint8_t *p
|
||||
return cr;
|
||||
}
|
||||
|
||||
// TODO: support early-exit but with all embedded artifacts already loaded
|
||||
|
||||
p1_checkm8_err_t send_full_pongo_jailbreak(p1_usb_handle_t *handle)
|
||||
{
|
||||
p1_transfer_ret_t result;
|
||||
@@ -280,10 +281,14 @@ p1_checkm8_err_t send_full_pongo_jailbreak(p1_usb_handle_t *handle)
|
||||
if (result.ret != 0) goto bad;
|
||||
}
|
||||
|
||||
if (palerain_flags & palerain_option_pongo_full)
|
||||
goto good;
|
||||
|
||||
// TODO: why do we check results
|
||||
result = issue_pongo_command(handle, "bootx");
|
||||
if (result.ret != 0) goto bad;
|
||||
|
||||
good:
|
||||
return 0;
|
||||
bad:
|
||||
return 255;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef USB_PONGO_H
|
||||
#define USB_PONGO_H
|
||||
#ifndef P1__PONGO_HELPER_H
|
||||
#define P1__PONGO_HELPER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -46,12 +46,7 @@ typedef transfer_ret_t p1_transfer_ret_t;
|
||||
typedef checkm8_err_t p1_checkm8_err_t;
|
||||
#endif
|
||||
|
||||
#define PONGO_MAX_SZ (0x7fe00)
|
||||
// used for checking overridden files (KPF mainly)
|
||||
#define MACHO_MAGIC_32 (const unsigned char[]){ 0xCE, 0xFA, 0xED, 0xFE }
|
||||
#define MACHO_MAGIC_64 (const unsigned char[]){ 0xCF, 0xFA, 0xED, 0xFE }
|
||||
|
||||
p1_checkm8_err_t send_compressed_pongo(p1_usb_handle_t *handle, const uint8_t *pongo_bin, const size_t pongo_bin_length);
|
||||
p1_checkm8_err_t send_full_pongo_jailbreak(p1_usb_handle_t *handle);
|
||||
|
||||
#endif // USB_PONGO_H
|
||||
#endif // P1__PONGO_HELPER_H
|
||||
@@ -28,7 +28,7 @@
|
||||
#if defined(WITH_GUI) || defined(WITH_TUI)
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "gen/embedded/DFUHelperDeviceInfo.h"
|
||||
#include "gen/embedded/DFUHelperDeviceInfo-minified.h"
|
||||
#include "sequence.hpp"
|
||||
|
||||
DfuSequence ParseSequence(const std::string& deviceKey)
|
||||
@@ -36,9 +36,9 @@ DfuSequence ParseSequence(const std::string& deviceKey)
|
||||
DfuSequence seq;
|
||||
|
||||
static nlohmann::json j = nlohmann::json::parse(
|
||||
embedded_DFUHelperDeviceInfo_json,
|
||||
embedded_DFUHelperDeviceInfo_json +
|
||||
embedded_DFUHelperDeviceInfo_json_len
|
||||
embedded_DFUHelperDeviceInfo_minified_json,
|
||||
embedded_DFUHelperDeviceInfo_minified_json +
|
||||
embedded_DFUHelperDeviceInfo_minified_json_len
|
||||
);
|
||||
|
||||
auto itMap = j["devicemap"].find(deviceKey);
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#if defined(WITH_GUI) || defined(WITH_TUI)
|
||||
|
||||
#ifndef SEQUENCE_H
|
||||
#define SEQUENCE_H
|
||||
#ifndef P1__SEQUENCE_HPP
|
||||
#define P1__SEQUENCE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -64,6 +64,6 @@ DfuSequence ParseSequence(const std::string& deviceKey);
|
||||
bool SequenceIsSupported(const DfuSequence* seq);
|
||||
bool SequenceRequiresCLI(const DfuSequence* seq);
|
||||
|
||||
#endif // SEQUENCE_H
|
||||
#endif // P1__SEQUENCE_HPP
|
||||
|
||||
#endif // WITH_GUI || WITH_TUI
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_HPP
|
||||
#define TUI_HPP
|
||||
#ifndef P1__TUI_HPP
|
||||
#define P1__TUI_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@@ -93,6 +93,6 @@ private:
|
||||
void ui_run(void);
|
||||
void update_tui_device_state(const DeviceState* new_state);
|
||||
|
||||
#endif // TUI_HPP
|
||||
#endif // P1__TUI_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -27,11 +27,11 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_BRANDING_HPP
|
||||
#define TUI_BRANDING_HPP
|
||||
#ifndef P1__TUI_BRANDING_HPP
|
||||
#define P1__TUI_BRANDING_HPP
|
||||
|
||||
void draw_tui_sidebar_branding(int y, int x, int width);
|
||||
|
||||
#endif // TUI_BRANDING_HPP
|
||||
#endif // P1__TUI_BRANDING_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_DFU_ART_HPP
|
||||
#define TUI_DFU_ART_HPP
|
||||
#ifndef P1__TUI_DFU_ART_HPP
|
||||
#define P1__TUI_DFU_ART_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -43,6 +43,6 @@ struct DfuAsciiPreview {
|
||||
const DfuAsciiPreview* find_dfu_ascii_preview(const std::string& imageName);
|
||||
void draw_dfu_ascii_preview(const DfuAsciiPreview& preview, int sx, int sy);
|
||||
|
||||
#endif // TUI_DFU_ART_HPP
|
||||
#endif // P1__TUI_DFU_ART_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_DFU_PANEL_HPP
|
||||
#define TUI_DFU_PANEL_HPP
|
||||
#ifndef P1__TUI_DFU_PANEL_HPP
|
||||
#define P1__TUI_DFU_PANEL_HPP
|
||||
|
||||
#include "TuiPanel.hpp"
|
||||
#include "../sequence.hpp"
|
||||
@@ -73,6 +73,6 @@ private:
|
||||
std::chrono::steady_clock::time_point m_last_tick;
|
||||
};
|
||||
|
||||
#endif // TUI_DFU_PANEL_HPP
|
||||
#endif // P1__TUI_DFU_PANEL_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -118,12 +118,6 @@ void TuiExploitPanel::exploit()
|
||||
|
||||
std::thread([this]()
|
||||
{
|
||||
const DeviceState deviceState = GetFrame()->GetDeviceState();
|
||||
if (!deviceState.connected || deviceState.mode != DeviceMode::DFU) {
|
||||
m_is_exploiting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
auto stage = std::make_shared<std::atomic<int>>(STAGE_RESET);
|
||||
auto result = std::make_shared<std::atomic<int>>(0);
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_EXPLOIT_PANEL_HPP
|
||||
#define TUI_EXPLOIT_PANEL_HPP
|
||||
#ifndef P1__TUI_EXPLOIT_PANEL_HPP
|
||||
#define P1__TUI_EXPLOIT_PANEL_HPP
|
||||
|
||||
#include "TuiPanel.hpp"
|
||||
|
||||
@@ -60,6 +60,6 @@ private:
|
||||
std::atomic<bool> m_is_exploiting{false};
|
||||
};
|
||||
|
||||
#endif // TUI_EXPLOIT_PANEL_HPP
|
||||
#endif // P1__TUI_EXPLOIT_PANEL_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -53,9 +53,6 @@ static std::string get_device_title(const DeviceState& state) {
|
||||
}
|
||||
|
||||
const std::string product = state.displayName.empty() ? (state.productType.empty() ? "Unknown" : state.productType) : state.displayName;
|
||||
if (state.mode == DeviceMode::DFU) {
|
||||
return "DFU Mode device";
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
@@ -74,7 +71,7 @@ static std::string get_device_subtitle(const DeviceState& state) {
|
||||
switch (state.mode) {
|
||||
case DeviceMode::Normal:
|
||||
if (state.requiresCLI) {
|
||||
return "Sorry, jailbreaking is only available via CLI mode * iOS " + version + "\n" + ecid;
|
||||
return "Sorry, jailbreaking is only available via DFU mode * iOS " + version + "\n" + ecid;
|
||||
} else if (state.isSupported) {
|
||||
return "Connected in normal mode * iOS " + version + "\n" + ecid;
|
||||
} else {
|
||||
@@ -82,14 +79,24 @@ static std::string get_device_subtitle(const DeviceState& state) {
|
||||
}
|
||||
case DeviceMode::Recovery:
|
||||
if (state.requiresCLI) {
|
||||
return "Sorry, jailbreaking is only available via CLI mode.\n" + ecid;
|
||||
return "Sorry, jailbreaking is only available via DFU mode.\n" + ecid;
|
||||
} else if (state.isSupported) {
|
||||
return "Connected in recovery mode.\n" + ecid;
|
||||
} else {
|
||||
return "Sorry, this recovery device is not supported.\n" + ecid;
|
||||
}
|
||||
case DeviceMode::DFU:
|
||||
return "Sorry, jailbreaking in DFU is not supported.\n";
|
||||
if (state.isSupported) {
|
||||
return "Connected in DFU mode.\n" + ecid;
|
||||
} else {
|
||||
return "Sorry, this DFU device is not supported.\n" + ecid;
|
||||
}
|
||||
case DeviceMode::Pongo:
|
||||
if (state.isSupported) {
|
||||
return "Connected in PongoOS mode.\n" + ecid;
|
||||
} else {
|
||||
return "This PongoOS device is not supported, worth a shot though...\n" + ecid;
|
||||
}
|
||||
case DeviceMode::None:
|
||||
return "Please connect a device to get started. Ensure version range is 15.0+";
|
||||
}
|
||||
@@ -136,7 +143,7 @@ void TuiMainPanel::draw(int sy, int sx, int selected) {
|
||||
}
|
||||
|
||||
const std::string made_by =
|
||||
"Made by: asdfugil, claration, kok3shidoll, mineek, plooshi, staturnz";
|
||||
"Made by: asdfugil, claration, kok3shidoll, mineek, sarah, staturnz";
|
||||
const std::string thanks_to =
|
||||
"Thanks to: itsnebulalol, llsc12, lrdsnow, dedbeddedbed, kirb, ehilwyma, "
|
||||
"opa334, 0x7ff, alfiecg24, sneko, sbingner, nikias, "
|
||||
@@ -223,14 +230,23 @@ void TuiMainPanel::handle_enter(int selected, int sy, int sx) {
|
||||
case 1:
|
||||
GetFrame()->ShowSettings(5);
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
if (block_start) break;
|
||||
|
||||
bool can_start = (state.connected && state.isSupported && !state.requiresCLI && state.mode != DeviceMode::DFU);
|
||||
bool isDfuLike =
|
||||
state.mode == DeviceMode::DFU ||
|
||||
state.mode == DeviceMode::Pongo;
|
||||
|
||||
bool can_start =
|
||||
state.connected &&
|
||||
state.isSupported &&
|
||||
(isDfuLike || !state.requiresCLI);
|
||||
|
||||
if (can_start) {
|
||||
if (state.mode == DeviceMode::Recovery) {
|
||||
GetFrame()->ShowDfu(1);
|
||||
} else if (isDfuLike) {
|
||||
GetFrame()->ShowExploit(0);
|
||||
} else {
|
||||
GetFrame()->ShowRecovery(1);
|
||||
}
|
||||
@@ -261,7 +277,13 @@ bool TuiMainPanel::is_button_enabled(int btn_idx) const {
|
||||
switch(btn_idx) {
|
||||
case 0: return true;
|
||||
case 1: return true;
|
||||
case 2: return (state.connected && state.isSupported && !state.requiresCLI && state.mode != DeviceMode::DFU);
|
||||
case 2: {
|
||||
bool isDfuLike =
|
||||
state.mode == DeviceMode::DFU ||
|
||||
state.mode == DeviceMode::Pongo;
|
||||
|
||||
return state.connected && state.isSupported && (isDfuLike || !state.requiresCLI);
|
||||
}
|
||||
case 3: return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_MAIN_PANEL_HPP
|
||||
#define TUI_MAIN_PANEL_HPP
|
||||
#ifndef P1__TUI_MAIN_PANEL_HPP
|
||||
#define P1__TUI_MAIN_PANEL_HPP
|
||||
|
||||
#include "TuiPanel.hpp"
|
||||
|
||||
@@ -47,6 +47,6 @@ public:
|
||||
const char** get_buttons() const override;
|
||||
};
|
||||
|
||||
#endif // TUI_MAIN_PANEL_HPP
|
||||
#endif // P1__TUI_MAIN_PANEL_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_PANEL_HPP
|
||||
#define TUI_PANEL_HPP
|
||||
#ifndef P1__TUI_PANEL_HPP
|
||||
#define P1__TUI_PANEL_HPP
|
||||
|
||||
#include <ncurses.h>
|
||||
|
||||
@@ -71,6 +71,6 @@ private:
|
||||
TuiFrame* m_frame = nullptr;
|
||||
};
|
||||
|
||||
#endif // TUI_PANEL_HPP
|
||||
#endif // P1__TUI_PANEL_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_RECOVERY_PANEL_HPP
|
||||
#define TUI_RECOVERY_PANEL_HPP
|
||||
#ifndef P1__TUI_RECOVERY_PANEL_HPP
|
||||
#define P1__TUI_RECOVERY_PANEL_HPP
|
||||
|
||||
#include "TuiPanel.hpp"
|
||||
|
||||
@@ -61,6 +61,6 @@ private:
|
||||
bool m_buttons_disabled;
|
||||
};
|
||||
|
||||
#endif // TUI_RECOVERY_PANEL_HPP
|
||||
#endif // P1__TUI_RECOVERY_PANEL_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -69,14 +69,16 @@ void TuiSettingsPanel::draw(int sy, int sx, int selected) {
|
||||
!!(palerain_flags & palerain_option_safemode),
|
||||
!!(palerain_flags & palerain_option_verbose_boot),
|
||||
!!(palerain_flags & palerain_option_force_revert),
|
||||
!!(palerain_flags & palerain_option_flower_chain)
|
||||
!!(palerain_flags & palerain_option_flower_chain),
|
||||
!!(palerain_flags & palerain_option_ssv)
|
||||
};
|
||||
|
||||
const char *labels[] = {
|
||||
"Safe Mode",
|
||||
"Verbose Boot",
|
||||
"Restore System",
|
||||
"Dark Blockchain"
|
||||
"Dark Blockchain",
|
||||
"Force Enable SSV Flag"
|
||||
};
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
@@ -98,20 +100,25 @@ void TuiSettingsPanel::draw(int sy, int sx, int selected) {
|
||||
if (selected == i + 1) attroff(A_REVERSE);
|
||||
}
|
||||
|
||||
mvprintw(sy + 13, content_x, "Jailbreak Type:");
|
||||
mvprintw(sy + 13, content_x, "[%c] ", states[4] ? 'x' : ' ');
|
||||
if (selected == 5) attron(A_REVERSE);
|
||||
mvprintw(sy + 14, content_x + 2, "(%c) Rootless", is_rootful ? ' ' : 'x');
|
||||
printw("%s", labels[4]);
|
||||
if (selected == 5) attroff(A_REVERSE);
|
||||
|
||||
mvprintw(sy + 15, content_x, "Jailbreak Type:");
|
||||
if (selected == 6) attron(A_REVERSE);
|
||||
mvprintw(sy + 15, content_x + 2, "(%c) Rootful", is_rootful ? 'x' : ' ');
|
||||
mvprintw(sy + 16, content_x + 2, "(%c) Rootless", is_rootful ? ' ' : 'x');
|
||||
if (selected == 6) attroff(A_REVERSE);
|
||||
|
||||
mvprintw(sy + 17, content_x, "Rootful Options:");
|
||||
if (selected == 7) attron(A_REVERSE);
|
||||
mvprintw(sy + 17, content_x + 2, "(%c) Rootful", is_rootful ? 'x' : ' ');
|
||||
if (selected == 7) attroff(A_REVERSE);
|
||||
|
||||
mvprintw(sy + 19, content_x, "Rootful Options:");
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const int item_idx = 7 + i;
|
||||
const int row = sy + 18 + i;
|
||||
const int item_idx = 8 + i;
|
||||
const int row = sy + 20 + i;
|
||||
const bool active = is_rootful;
|
||||
const bool is_selected = selected == item_idx;
|
||||
const bool checked = setup_selection == i;
|
||||
@@ -171,34 +178,35 @@ void TuiSettingsPanel::handle_enter(int selected, int sy, int sx) {
|
||||
case 2: edit_boot_args(sy, sx); break;
|
||||
case 3: palerain_flags ^= palerain_option_force_revert; break;
|
||||
case 4: palerain_flags ^= palerain_option_flower_chain; break;
|
||||
case 5:
|
||||
case 5: palerain_flags ^= palerain_option_ssv; break;
|
||||
case 6:
|
||||
palerain_flags &= ~(palerain_option_rootless | palerain_option_rootful);
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
palerain_flags |= palerain_option_rootless;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
palerain_flags &= ~(palerain_option_rootless | palerain_option_rootful);
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
palerain_flags |= palerain_option_rootful;
|
||||
break;
|
||||
case 7:
|
||||
if (palerain_flags & palerain_option_rootful) {
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if (palerain_flags & palerain_option_rootful) {
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
palerain_flags |= palerain_option_setup_rootful;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (palerain_flags & palerain_option_rootful) {
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
palerain_flags |= palerain_option_setup_rootful;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (palerain_flags & palerain_option_rootful) {
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
palerain_flags |= palerain_option_setup_partial_root;
|
||||
}
|
||||
break;
|
||||
case 10: GetFrame()->ShowMain(0); break;
|
||||
case 11: GetFrame()->ShowMain(0); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +215,7 @@ void TuiSettingsPanel::handle_device_update(const DeviceState& state) {
|
||||
}
|
||||
|
||||
bool TuiSettingsPanel::is_button_enabled(int btn_idx) const {
|
||||
if (btn_idx >= 7 && btn_idx <= 9) {
|
||||
if (btn_idx >= 8 && btn_idx <= 10) {
|
||||
return (palerain_flags & palerain_option_rootful) != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_SETTINGS_PANEL_HPP
|
||||
#define TUI_SETTINGS_PANEL_HPP
|
||||
#ifndef P1__TUI_SETTINGS_PANEL_HPP
|
||||
#define P1__TUI_SETTINGS_PANEL_HPP
|
||||
|
||||
#include "TuiPanel.hpp"
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
void handle_device_update(const DeviceState& state) override;
|
||||
bool is_button_enabled(int btn_idx) const override;
|
||||
|
||||
int get_total_items() const override { return 11; }
|
||||
int get_total_items() const override { return 12; }
|
||||
int get_button_count() const override { return 1; }
|
||||
const char** get_buttons() const override;
|
||||
|
||||
@@ -50,6 +50,6 @@ private:
|
||||
void edit_boot_args(int start_y, int start_x);
|
||||
};
|
||||
|
||||
#endif // TUI_SETTINGS_PANEL_HPP
|
||||
#endif // P1__TUI_SETTINGS_PANEL_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
#ifdef WITH_TUI
|
||||
|
||||
#ifndef TUI_TEXT_HPP
|
||||
#define TUI_TEXT_HPP
|
||||
#ifndef P1__TUI_TEXT_HPP
|
||||
#define P1__TUI_TEXT_HPP
|
||||
|
||||
#include <ncurses.h>
|
||||
|
||||
@@ -105,6 +105,6 @@ inline int draw_wrapped_text(int y, int x, int width, const std::string& text, i
|
||||
|
||||
} // namespace tui_text
|
||||
|
||||
#endif // TUI_TEXT_HPP
|
||||
#endif // P1__TUI_TEXT_HPP
|
||||
|
||||
#endif // WITH_TUI
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* palera1n - https://palera.in
|
||||
*
|
||||
* Copyright (C) 2026 palera1n team
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
#include "udev_helper.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h> // waitpid
|
||||
#include <sys/stat.h> // chmod
|
||||
|
||||
#include "gen/embedded/add_udev_rules.h"
|
||||
|
||||
int udev_rules_exist(void)
|
||||
{
|
||||
return access("/etc/udev/rules.d/turdusra1n.rules", F_OK) == 0;
|
||||
}
|
||||
|
||||
int add_udev_rules(void)
|
||||
{
|
||||
FILE *f = fopen("/tmp/udevhelper.sh", "wb");
|
||||
if (!f)
|
||||
return 1;
|
||||
|
||||
fwrite(
|
||||
embedded_add_udev_rules_sh,
|
||||
1,
|
||||
embedded_add_udev_rules_sh_len,
|
||||
f
|
||||
);
|
||||
fclose(f);
|
||||
|
||||
chmod("/tmp/udevhelper.sh", 0700);
|
||||
|
||||
pid_t pid = fork();
|
||||
|
||||
if (pid < 0) {
|
||||
unlink("/tmp/udevhelper.sh");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
execlp("pkexec", "pkexec", "/tmp/udevhelper.sh", (char *)NULL);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int status;
|
||||
waitpid(pid, &status, 0);
|
||||
|
||||
unlink("/tmp/udevhelper.sh");
|
||||
|
||||
return WIFEXITED(status) ? WEXITSTATUS(status) : 1;
|
||||
}
|
||||
|
||||
#endif // defined(__linux__)
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* palera1n - https://palera.in
|
||||
*
|
||||
* Copyright (C) 2026 palera1n team
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef P1__UDEV_HELPER_H
|
||||
#define P1__UDEV_HELPER_H
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int udev_rules_exist(void);
|
||||
int add_udev_rules(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // defined(__linux__)
|
||||
|
||||
#endif // P1__UDEV_HELPER_H
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "../globals.h"
|
||||
#if defined(WITH_GUI) && defined(__linux__)
|
||||
# include "../udev_helper.h"
|
||||
#endif
|
||||
#include "../events/event.hpp"
|
||||
|
||||
wxDEFINE_EVENT(EVT_DEVICE_STATE_UPDATE, wxCommandEvent);
|
||||
@@ -71,6 +74,13 @@ MainFrame::MainFrame()
|
||||
|
||||
SetSizer(root);
|
||||
|
||||
// menu bar
|
||||
#if __APPLE__
|
||||
auto* menuBar = new wxMenuBar;
|
||||
SetMenuBar(menuBar);
|
||||
#endif
|
||||
|
||||
// listeners
|
||||
Bind(EVT_DEVICE_STATE_UPDATE, [this](wxCommandEvent& e)
|
||||
{
|
||||
auto* state = static_cast<DeviceState*>(e.GetClientData());
|
||||
@@ -99,6 +109,36 @@ void MainFrame::ShowMain()
|
||||
m_dfu->Hide();
|
||||
m_exploit->Hide();
|
||||
Layout();
|
||||
|
||||
// check udev rules
|
||||
#if defined(WITH_GUI) && defined(__linux__)
|
||||
|
||||
if (!udev_rules_exist()) {
|
||||
int result = wxMessageBox(
|
||||
"USB permissions need to be configured before exploiting.\n\n"
|
||||
"This will install the required udev rules so palera1n "
|
||||
"can communicate with your device over USB in DFU.\n\n"
|
||||
"Otherwise, we may not be able to jailbreak your device.",
|
||||
"Set Up USB Permissions",
|
||||
wxYES_NO | wxICON_INFORMATION,
|
||||
this
|
||||
);
|
||||
|
||||
if (result != wxYES)
|
||||
return;
|
||||
|
||||
if (add_udev_rules() != 0) {
|
||||
wxMessageBox(
|
||||
"Failed to configure USB permissions.",
|
||||
"Error",
|
||||
wxOK | wxICON_ERROR,
|
||||
this
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainFrame::ShowSettings()
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APPFRAME_H
|
||||
#define APPFRAME_H
|
||||
#ifndef P1__APP_FRAME_HPP
|
||||
#define P1__APP_FRAME_HPP
|
||||
|
||||
#ifdef WITH_GUI
|
||||
|
||||
@@ -77,4 +77,4 @@ public:
|
||||
|
||||
#endif // WITH_GUI
|
||||
|
||||
#endif // APPFRAME_H
|
||||
#endif // P1__APP_FRAME_HPP
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DEVICEPANEL_H
|
||||
#define DEVICEPANEL_H
|
||||
#ifndef P1__DEVICE_PANEL_HPP
|
||||
#define P1__DEVICE_PANEL_HPP
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "../events/event.hpp"
|
||||
@@ -65,4 +65,4 @@ private:
|
||||
DeviceState m_deviceState;
|
||||
};
|
||||
|
||||
#endif // DEVICEPANEL_H
|
||||
#endif // P1__DEVICE_PANEL_HPP
|
||||
@@ -75,7 +75,11 @@ DfuPanel::DfuPanel(MainFrame* frame, wxWindow* parent)
|
||||
"Time to put the device into DFU mode.",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxST_WRAP
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
);
|
||||
left->Add(m_headerText, 0, wxTOP | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
@@ -160,6 +164,7 @@ void DfuPanel::SetDeviceState(const DeviceState& state)
|
||||
m_index = m_sequence.steps.size();
|
||||
m_stepRemaining = -1;
|
||||
m_actionExecutedIndex = -1;
|
||||
m_waitingForDfuTransition = true;
|
||||
|
||||
const wxColour inactive =
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
|
||||
@@ -191,8 +196,11 @@ void DfuPanel::SetDeviceState(const DeviceState& state)
|
||||
GetMainFrame()->ShowMain();
|
||||
}
|
||||
|
||||
if (!m_isEnteringDfu && !state.connected)
|
||||
if (!state.connected)
|
||||
{
|
||||
if (m_isEnteringDfu || m_waitingForDfuTransition)
|
||||
return;
|
||||
|
||||
m_isEnteringDfu = false;
|
||||
m_backButton->Enable();
|
||||
m_startButton->Enable();
|
||||
@@ -202,6 +210,8 @@ void DfuPanel::SetDeviceState(const DeviceState& state)
|
||||
|
||||
void DfuPanel::OnShow(wxShowEvent& event)
|
||||
{
|
||||
DevicePanel::OnShow(event);
|
||||
|
||||
if (event.IsShown())
|
||||
{
|
||||
if (palerain_flags & palerain_option_quick) {
|
||||
@@ -212,8 +222,6 @@ void DfuPanel::OnShow(wxShowEvent& event)
|
||||
StartSequence(m_sequence);
|
||||
}
|
||||
}
|
||||
|
||||
DevicePanel::OnShow(event);
|
||||
}
|
||||
|
||||
void DfuPanel::LoadDevice(const std::string& productType)
|
||||
@@ -362,6 +370,7 @@ void DfuPanel::StartSequence(const DfuSequence& seq)
|
||||
m_index = 0;
|
||||
m_stepRemaining = -1;
|
||||
m_actionExecutedIndex = -1;
|
||||
m_waitingForDfuTransition = false;
|
||||
|
||||
RunStep();
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DFUPANEL_H
|
||||
#define DFUPANEL_H
|
||||
#ifndef P1__DFU_PANEL_HPP
|
||||
#define P1__DFU_PANEL_HPP
|
||||
|
||||
#ifdef WITH_GUI
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
wxTimer m_timer;
|
||||
wxTimer m_stagnentTimer;
|
||||
bool m_isEnteringDfu = false;
|
||||
bool m_waitingForDfuTransition = false;
|
||||
|
||||
wxPanel* m_devicePanel = nullptr;
|
||||
wxStaticBitmap* m_deviceImage = nullptr;
|
||||
@@ -72,4 +73,4 @@ private:
|
||||
|
||||
#endif // WITH_GUI
|
||||
|
||||
#endif // DFUPANEL_H
|
||||
#endif // P1__DFU_PANEL_HPP
|
||||
@@ -78,7 +78,11 @@ ExploitPanel::ExploitPanel(MainFrame* frame, wxWindow* parent)
|
||||
left->Add(new wxStaticText(this, wxID_ANY, "Installing jailbreak, this will take a moment. Do not disconnect the device until finished.",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxST_WRAP
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
), 0, wxALL, 10);
|
||||
left->Add(m_statusText, 0, wxALL, 10);
|
||||
left->Add(m_progressBar, 0, wxALL | wxEXPAND, 20);
|
||||
@@ -109,12 +113,6 @@ void ExploitPanel::StartExploit()
|
||||
|
||||
std::thread([this]()
|
||||
{
|
||||
const auto deviceState = GetDeviceState();
|
||||
if (!deviceState.connected || deviceState.mode != DeviceMode::DFU) {
|
||||
wxTheApp->CallAfter([this]() { m_backButton->Enable(); });
|
||||
return;
|
||||
}
|
||||
|
||||
auto stage = std::make_shared<std::atomic<int>>(STAGE_RESET);
|
||||
auto result = std::make_shared<std::atomic<int>>(0);
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EXPLOITPANEL_HPP
|
||||
#define EXPLOITPANEL_HPP
|
||||
#ifndef P1__EXPLOIT_PANEL_HPP
|
||||
#define P1__EXPLOIT_PANEL_HPP
|
||||
|
||||
#ifdef WITH_GUI
|
||||
|
||||
@@ -49,4 +49,4 @@ private:
|
||||
|
||||
#endif // WITH_GUI
|
||||
|
||||
#endif // EXPLOITPANEL_HPP
|
||||
#endif // P1__EXPLOIT_PANEL_HPP
|
||||
@@ -74,14 +74,18 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
auto* credtext = new wxStaticText(
|
||||
this,
|
||||
wxID_ANY,
|
||||
"Made by: asdfugil, claration, kok3shidoll, mineek, plooshi, staturnz\n\n"
|
||||
"Made by: asdfugil, claration, kok3shidoll, mineek, sarah, staturnz\n\n"
|
||||
"Thanks to: itsnebulalol, llsc12, lrdsnow, dedbeddedbed, kirb, ehilwyma, "
|
||||
"opa334, 0x7ff, alfiecg24, sneko, sbingner, nikias, tihmstar, "
|
||||
"Checkra1n (Siguza, axi0mx, littlelailo et al.), Procursus (Hayden Seay, "
|
||||
"Cameron Katri, Keto et al.)",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxST_WRAP
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
);
|
||||
|
||||
auto* twitterLabel = new wxStaticText(this, wxID_ANY, "Twitter:");
|
||||
@@ -133,6 +137,11 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
palerain_flags &= ~palerain_option_quick;
|
||||
});
|
||||
|
||||
donateButton->Bind(wxEVT_BUTTON, [](wxCommandEvent&)
|
||||
{
|
||||
wxLaunchDefaultBrowser("https://patreon.com/palera1n");
|
||||
});
|
||||
|
||||
optionsButton->Bind(wxEVT_BUTTON, [frame](wxCommandEvent&)
|
||||
{
|
||||
frame->ShowSettings();
|
||||
@@ -144,6 +153,9 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
frame->ShowRecovery();
|
||||
else if (frame->GetDeviceState().mode == DeviceMode::Recovery)
|
||||
frame->ShowDfu();
|
||||
else if (frame->GetDeviceState().mode == DeviceMode::DFU ||
|
||||
frame->GetDeviceState().mode == DeviceMode::Pongo)
|
||||
frame->ShowExploit();
|
||||
});
|
||||
|
||||
left->Add(m_deviceTitle, 0, wxLEFT | wxRIGHT | wxTOP, 10);
|
||||
@@ -159,7 +171,11 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
"NOTE: Please ensure you've made a backup of your device before proceeding.\n",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxST_WRAP
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
);
|
||||
|
||||
wxFont noteFont = warningNote->GetFont();
|
||||
@@ -216,7 +232,7 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
m_deviceTitle->SetLabel("Multiple devices detected");
|
||||
m_deviceSubtitle->SetLabel(
|
||||
wxString::Format(
|
||||
"%u USB devices connected. Disconnect extras and keep only one device attached.\n",
|
||||
"%u USB devices connected. Disconnect extras and keep\nonly one device attached.",
|
||||
state.connectedDeviceCount
|
||||
)
|
||||
);
|
||||
@@ -241,7 +257,7 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
case DeviceMode::Normal:
|
||||
if (state.requiresCLI) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via CLI mode - OS " + versionString + "\n" + ecidString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via DFU mode - OS " + versionString + "\n" + ecidString);
|
||||
m_startButton->Enable(false);
|
||||
} else if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
@@ -256,7 +272,7 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
case DeviceMode::Recovery:
|
||||
if (state.requiresCLI) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via CLI mode.\n" + ecidString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking is only available via DFU mode.\n" + ecidString);
|
||||
m_startButton->Enable(false);
|
||||
} else if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
@@ -269,9 +285,26 @@ void MainPanel::SetDeviceState(const DeviceState& state)
|
||||
}
|
||||
break;
|
||||
case DeviceMode::DFU:
|
||||
m_deviceTitle->SetLabel("DFU Mode device");
|
||||
m_deviceSubtitle->SetLabel("Sorry, jailbreaking in DFU is not supported.\n");
|
||||
m_startButton->Enable(false);
|
||||
if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Connected in DFU mode.\n" + ecidString);
|
||||
m_startButton->Enable();
|
||||
} else {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Sorry, this DFU device is not supported.\n" + ecidString);
|
||||
m_startButton->Enable(false);
|
||||
}
|
||||
break;
|
||||
case DeviceMode::Pongo:
|
||||
if (state.isSupported) {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("Connected in PongoOS mode.\n" + ecidString);
|
||||
m_startButton->Enable();
|
||||
} else {
|
||||
m_deviceTitle->SetLabel(productString);
|
||||
m_deviceSubtitle->SetLabel("This PongoOS device is not supported, worth a shot though...\n" + ecidString);
|
||||
m_startButton->Enable();
|
||||
}
|
||||
break;
|
||||
case DeviceMode::None:
|
||||
m_deviceTitle->SetLabel(deviceTextString);
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MAINPANEL_H
|
||||
#define MAINPANEL_H
|
||||
#ifndef P1__MAIN_PANEL_HPP
|
||||
#define P1__MAIN_PANEL_HPP
|
||||
|
||||
#ifdef WITH_GUI
|
||||
|
||||
@@ -48,4 +48,4 @@ private:
|
||||
|
||||
#endif // WITH_GUI
|
||||
|
||||
#endif // MAINPANEL_H
|
||||
#endif // P1__MAIN_PANEL_HPP
|
||||
@@ -88,7 +88,11 @@ RecoveryPanel::RecoveryPanel(MainFrame* frame, wxWindow* parent)
|
||||
"The device needs to be put into DFU mode to apply the jailbreak. This is a manual process and we will guide you through it.",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxST_WRAP
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
), 0, wxALL, 10);
|
||||
left->Add(m_statusText, 0, wxALL, 10);
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RECOVERYPANEL_H
|
||||
#define RECOVERYPANEL_H
|
||||
#ifndef P1__RECOVERY_PANEL_HPP
|
||||
#define P1__RECOVERY_PANEL_HPP
|
||||
|
||||
#ifdef WITH_GUI
|
||||
|
||||
@@ -53,4 +53,4 @@ private:
|
||||
|
||||
#endif // WITH_GUI
|
||||
|
||||
#endif // RECOVERYPANEL_H
|
||||
#endif // P1__RECOVERY_PANEL_HPP
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "SettingsPanel.hpp"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/bitmap.h>
|
||||
@@ -41,78 +42,111 @@
|
||||
#include "../paleinfo.h"
|
||||
#include "../gen/embedded/logo.h"
|
||||
|
||||
auto createTitle = [](wxWindow* parent, const wxString& text)
|
||||
{
|
||||
auto* title = new wxStaticText(parent, wxID_ANY, text);
|
||||
|
||||
wxFont font = title->GetFont();
|
||||
font.SetPointSize(font.GetPointSize() - 1);
|
||||
font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||
|
||||
title->SetFont(font);
|
||||
|
||||
|
||||
return title;
|
||||
};
|
||||
|
||||
auto createDescription = [](wxWindow* parent, const wxString& text)
|
||||
{
|
||||
auto* description = new wxStaticText(
|
||||
parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize,
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
);
|
||||
|
||||
wxFont font = description->GetFont();
|
||||
font.SetPointSize(font.GetPointSize() - 2);
|
||||
description->SetFont(font);
|
||||
|
||||
return description;
|
||||
};
|
||||
|
||||
SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
: DevicePanel(frame, parent)
|
||||
{
|
||||
auto* root = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto* left = new wxBoxSizer(wxVERTICAL);
|
||||
auto* right = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxMemoryInputStream stream(embedded_logo_png, embedded_logo_png_len);
|
||||
wxImage img(stream, wxBITMAP_TYPE_PNG);
|
||||
wxBitmap bmp(img);
|
||||
|
||||
auto* logo = new wxStaticBitmap(this, wxID_ANY, bmp);
|
||||
auto* logoText = new wxStaticText(this, wxID_ANY, "Options");
|
||||
auto* right = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
left->Add(new wxStaticText(this, wxID_ANY,
|
||||
"You may set the following options. If you don't know what they mean you'll probably have no reason to set them.",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxST_WRAP
|
||||
), 0, wxALL, 10);
|
||||
#ifdef __linux__
|
||||
wxSP_WRAP
|
||||
#else
|
||||
wxST_WRAP
|
||||
#endif
|
||||
), 0, wxTOP | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
auto* optionSafemode = new wxCheckBox(this, wxID_ANY, "Safe Mode");
|
||||
auto* optionVerbose = new wxCheckBox(this, wxID_ANY, "Verbose Boot");
|
||||
auto* optionRevert = new wxCheckBox(this, wxID_ANY, "Restore System");
|
||||
auto* optionDarkBlockchain = new wxCheckBox(this, wxID_ANY, "Dark Blockchain");
|
||||
auto* bootArgs = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
|
||||
auto* rootType = new wxRadioBox(
|
||||
this,
|
||||
wxID_ANY,
|
||||
"Jailbreak Type",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
2,
|
||||
(const wxString[]){
|
||||
"Rootless",
|
||||
"Rootful"
|
||||
},
|
||||
1,
|
||||
wxRA_SPECIFY_COLS
|
||||
);
|
||||
auto* notebook = new wxNotebook(this, wxID_ANY);
|
||||
auto* generalPage = new wxPanel(notebook);
|
||||
auto* advancedPage = new wxPanel(notebook);
|
||||
|
||||
auto* setupMode = new wxRadioBox(
|
||||
this,
|
||||
wxID_ANY,
|
||||
"Rootful Options",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
3,
|
||||
(const wxString[]){
|
||||
"Boot",
|
||||
"Create FakeFS",
|
||||
"Create BindFS"
|
||||
},
|
||||
1,
|
||||
wxRA_SPECIFY_COLS
|
||||
);
|
||||
//
|
||||
// Controls
|
||||
//
|
||||
auto* optionSafemode = new wxCheckBox(generalPage, wxID_ANY, "Safe Mode");
|
||||
auto* optionVerbose = new wxCheckBox(generalPage, wxID_ANY, "Verbose Boot");
|
||||
auto* optionRevert = new wxCheckBox(generalPage, wxID_ANY, "Restore System");
|
||||
auto* optionDarkBlockchain = new wxCheckBox(generalPage, wxID_ANY, "Dark Blockchain");
|
||||
|
||||
auto* rootless = new wxRadioButton(generalPage, wxID_ANY, "Rootless", wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
|
||||
auto* rootful = new wxRadioButton(generalPage, wxID_ANY, "Rootful");
|
||||
|
||||
auto* setupBoot = new wxRadioButton(generalPage, wxID_ANY, "Boot", wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
|
||||
auto* setupFakeFS = new wxRadioButton(generalPage, wxID_ANY, "Create fakeFS");
|
||||
auto* setupBindFS = new wxRadioButton(generalPage, wxID_ANY, "Create Partial fakeFS");
|
||||
|
||||
auto* bootArgs = new wxTextCtrl(advancedPage, wxID_ANY);
|
||||
auto* optionForceEnableSSV = new wxCheckBox(advancedPage, wxID_ANY, "Force Enable SSV Flag");
|
||||
|
||||
//
|
||||
// Load
|
||||
//
|
||||
optionSafemode->SetValue(palerain_flags & palerain_option_safemode);
|
||||
optionVerbose->SetValue(palerain_flags & palerain_option_verbose_boot);
|
||||
optionRevert->SetValue(palerain_flags & palerain_option_force_revert);
|
||||
optionDarkBlockchain->SetValue(palerain_flags & palerain_option_flower_chain);
|
||||
|
||||
bootArgs->SetValue(wxString(boot_args, wxConvUTF8));
|
||||
if (palerain_flags & palerain_option_rootful)
|
||||
rootType->SetSelection(1);
|
||||
else
|
||||
rootType->SetSelection(0);
|
||||
optionForceEnableSSV->SetValue(palerain_flags & palerain_option_ssv);
|
||||
|
||||
rootless->SetValue(!(palerain_flags & palerain_option_rootful));
|
||||
rootful->SetValue(palerain_flags & palerain_option_rootful);
|
||||
|
||||
if (palerain_flags & palerain_option_setup_rootful)
|
||||
setupMode->SetSelection(1);
|
||||
setupFakeFS->SetValue(true);
|
||||
else if (palerain_flags & palerain_option_setup_partial_root)
|
||||
setupMode->SetSelection(2);
|
||||
setupBindFS->SetValue(true);
|
||||
else
|
||||
setupMode->SetSelection(0);
|
||||
setupMode->Enable(rootType->GetSelection() == 1);
|
||||
setupBoot->SetValue(true);
|
||||
|
||||
bool isRootful = rootful->GetValue();
|
||||
|
||||
setupBoot->Enable(true);
|
||||
setupFakeFS->Enable(isRootful);
|
||||
setupBindFS->Enable(isRootful);
|
||||
|
||||
optionSafemode->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& e)
|
||||
{
|
||||
@@ -121,6 +155,7 @@ SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
else
|
||||
palerain_flags &= ~palerain_option_safemode;
|
||||
});
|
||||
|
||||
optionVerbose->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& e)
|
||||
{
|
||||
if (e.IsChecked())
|
||||
@@ -128,6 +163,7 @@ SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
else
|
||||
palerain_flags &= ~palerain_option_verbose_boot;
|
||||
});
|
||||
|
||||
optionRevert->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& e)
|
||||
{
|
||||
if (e.IsChecked())
|
||||
@@ -135,6 +171,7 @@ SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
else
|
||||
palerain_flags &= ~palerain_option_force_revert;
|
||||
});
|
||||
|
||||
optionDarkBlockchain->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& e)
|
||||
{
|
||||
if (e.IsChecked())
|
||||
@@ -142,60 +179,136 @@ SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
else
|
||||
palerain_flags &= ~palerain_option_flower_chain;
|
||||
});
|
||||
|
||||
bootArgs->Bind(wxEVT_TEXT, [&](wxCommandEvent& e)
|
||||
{
|
||||
wxString value = e.GetString();
|
||||
if (value.length() > (sizeof(boot_args) - 0x20)) {
|
||||
|
||||
if (value.length() > (sizeof(boot_args) - 0x20))
|
||||
return;
|
||||
}
|
||||
snprintf(boot_args, sizeof(boot_args), "%s", value.ToStdString().c_str());
|
||||
|
||||
snprintf(boot_args, sizeof(boot_args),
|
||||
"%s",
|
||||
value.ToStdString().c_str());
|
||||
});
|
||||
rootType->Bind(wxEVT_RADIOBOX, [setupMode](wxCommandEvent& e)
|
||||
|
||||
optionForceEnableSSV->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& e)
|
||||
{
|
||||
palerain_flags &= ~(palerain_option_rootless | palerain_option_rootful);
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
|
||||
setupMode->Enable(e.GetSelection() == 1);
|
||||
setupMode->SetSelection(0);
|
||||
|
||||
if (e.GetSelection() == 0)
|
||||
palerain_flags |= palerain_option_rootless;
|
||||
if (e.IsChecked())
|
||||
palerain_flags |= palerain_option_ssv;
|
||||
else
|
||||
palerain_flags |= palerain_option_rootful;
|
||||
palerain_flags &= ~palerain_option_ssv;
|
||||
});
|
||||
|
||||
setupMode->Bind(wxEVT_RADIOBOX, [&](wxCommandEvent& e)
|
||||
rootless->Bind(wxEVT_RADIOBUTTON,
|
||||
[setupBoot, setupFakeFS, setupBindFS](wxCommandEvent&)
|
||||
{
|
||||
palerain_flags &= ~(palerain_option_setup_rootful | palerain_option_setup_partial_root);
|
||||
palerain_flags &= ~(palerain_option_rootless |
|
||||
palerain_option_rootful |
|
||||
palerain_option_setup_rootful |
|
||||
palerain_option_setup_partial_root);
|
||||
|
||||
if (e.GetSelection() == 1)
|
||||
palerain_flags |= palerain_option_setup_rootful;
|
||||
else if (e.GetSelection() == 2)
|
||||
palerain_flags |= palerain_option_setup_partial_root;
|
||||
palerain_flags |= palerain_option_rootless;
|
||||
|
||||
setupBoot->SetValue(true);
|
||||
setupFakeFS->Enable(false);
|
||||
setupBindFS->Enable(false);
|
||||
});
|
||||
|
||||
auto* contentRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto* leftColumn = new wxBoxSizer(wxVERTICAL);
|
||||
auto* rightColumn = new wxBoxSizer(wxVERTICAL);
|
||||
rootful->Bind(wxEVT_RADIOBUTTON,
|
||||
[setupFakeFS, setupBindFS](wxCommandEvent&)
|
||||
{
|
||||
palerain_flags &= ~(palerain_option_rootless |
|
||||
palerain_option_rootful);
|
||||
|
||||
leftColumn->Add(rootType, 0, wxALL | wxEXPAND, 5);
|
||||
leftColumn->Add(setupMode, 0, wxALL | wxEXPAND, 5);
|
||||
palerain_flags |= palerain_option_rootful;
|
||||
|
||||
rightColumn->Add(optionSafemode, 0, wxALL, 5);
|
||||
rightColumn->Add(optionVerbose, 0, wxALL, 5);
|
||||
rightColumn->Add(optionRevert, 0, wxALL, 5);
|
||||
rightColumn->Add(optionDarkBlockchain, 0, wxALL, 5);
|
||||
rightColumn->AddStretchSpacer();
|
||||
setupFakeFS->Enable(true);
|
||||
setupBindFS->Enable(true);
|
||||
});
|
||||
|
||||
contentRow->Add(leftColumn, 1, wxEXPAND | wxRIGHT, 10);
|
||||
contentRow->Add(rightColumn, 1, wxEXPAND | wxLEFT, 10);
|
||||
setupBoot->Bind(wxEVT_RADIOBUTTON, [](wxCommandEvent&)
|
||||
{
|
||||
palerain_flags &= ~(palerain_option_setup_rootful |
|
||||
palerain_option_setup_partial_root);
|
||||
});
|
||||
|
||||
left->Add(contentRow, 1, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
left->Add(new wxStaticText(this, wxID_ANY, "Boot Arguments:"), 0, wxALL, 15);
|
||||
left->Add(bootArgs, 0, wxLEFT | wxRIGHT | wxEXPAND, 30);
|
||||
left->AddStretchSpacer();
|
||||
setupFakeFS->Bind(wxEVT_RADIOBUTTON, [&](wxCommandEvent&)
|
||||
{
|
||||
palerain_flags &= ~palerain_option_setup_partial_root;
|
||||
palerain_flags |= palerain_option_setup_rootful;
|
||||
});
|
||||
|
||||
setupBindFS->Bind(wxEVT_RADIOBUTTON, [&](wxCommandEvent&)
|
||||
{
|
||||
palerain_flags &= ~palerain_option_setup_rootful;
|
||||
palerain_flags |= palerain_option_setup_partial_root;
|
||||
});
|
||||
|
||||
//
|
||||
// General
|
||||
//
|
||||
auto* generalSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto* generalLeft = new wxBoxSizer(wxVERTICAL);
|
||||
auto* generalRight = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
generalLeft->Add(createTitle(generalPage, "Startup"), 0, wxBOTTOM, 3);
|
||||
|
||||
generalLeft->Add(optionSafemode, 0, wxTOP, 7);
|
||||
generalLeft->Add(optionVerbose, 0, wxTOP , 7);
|
||||
generalLeft->Add(optionRevert, 0, wxTOP, 7);
|
||||
generalLeft->Add(optionDarkBlockchain, 0, wxTOP, 7);
|
||||
|
||||
generalLeft->AddStretchSpacer();
|
||||
|
||||
generalRight->Add(createTitle(generalPage, "Jailbreak Type"), 0, wxBOTTOM, 3);
|
||||
|
||||
generalRight->Add(rootless, 0, wxTOP, 7);
|
||||
generalRight->Add(rootful, 0, wxTOP | wxBOTTOM, 5);
|
||||
|
||||
generalRight->Add(createTitle(generalPage, "Startup (Rootful)"), 0, wxTOP | wxBOTTOM, 3);
|
||||
|
||||
generalRight->Add(setupBoot, 0, wxTOP, 7);
|
||||
generalRight->Add(setupFakeFS, 0, wxTOP, 5);
|
||||
generalRight->Add(setupBindFS, 0, wxTOP, 5);
|
||||
|
||||
generalRight->AddStretchSpacer();
|
||||
|
||||
generalSizer->Add(generalLeft, 1, wxEXPAND | wxRIGHT | wxLEFT, 10);
|
||||
generalSizer->Add(generalRight, 1, wxEXPAND | wxLEFT, 10);
|
||||
|
||||
generalPage->SetSizer(generalSizer);
|
||||
|
||||
//
|
||||
// Advanced
|
||||
//
|
||||
auto* advancedOuterSizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto* advancedSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
advancedSizer->Add(createTitle(advancedPage, "Boot Arguments"), 0, wxBOTTOM, 3);
|
||||
|
||||
advancedSizer->Add(bootArgs, 0, wxTOP | wxBOTTOM | wxEXPAND, 7);
|
||||
|
||||
advancedSizer->Add(createTitle(advancedPage, "Advanced"), 0, wxTOP | wxBOTTOM, 3);
|
||||
|
||||
advancedSizer->Add(optionForceEnableSSV, 0, wxTOP | wxBOTTOM, 7);
|
||||
advancedSizer->Add(createDescription(advancedPage, "Forces the jailbreak to detect SSV as being required."), 0, wxLEFT | wxRIGHT, 20);
|
||||
|
||||
advancedOuterSizer->Add(advancedSizer, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 10);
|
||||
|
||||
advancedPage->SetSizer(advancedOuterSizer);
|
||||
|
||||
notebook->AddPage(generalPage, "General", true);
|
||||
notebook->AddPage(advancedPage, "Advanced");
|
||||
|
||||
left->Add(notebook, 1, wxEXPAND | wxALL, 10);
|
||||
|
||||
//
|
||||
// Right side
|
||||
//
|
||||
auto* back = new wxButton(this, wxID_ANY, "Back");
|
||||
|
||||
right->Add(logo, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxLEFT | wxRIGHT, 10);
|
||||
right->Add(logoText, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 5);
|
||||
right->AddStretchSpacer();
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SETTINGSPANEL_H
|
||||
#define SETTINGSPANEL_H
|
||||
#ifndef P1__SETTINGS_PANEL_HPP
|
||||
#define P1__SETTINGS_PANEL_HPP
|
||||
|
||||
#ifdef WITH_GUI
|
||||
|
||||
@@ -42,4 +42,4 @@ public:
|
||||
|
||||
#endif // WITH_GUI
|
||||
|
||||
#endif // SETTINGSPANEL_H
|
||||
#endif // P1__SETTINGS_PANEL_HPP
|
||||