diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..deda242
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[Makefile]
+indent_style = tab
+indent_size = 4
+
+[*]
+
diff --git a/.github/ISSUE_TEMPLATE/basic.yml b/.github/ISSUE_TEMPLATE/basic.yml
deleted file mode 100644
index c643bba..0000000
--- a/.github/ISSUE_TEMPLATE/basic.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: No Template
-description: Create a standard issue, no template involved.
-labels: [palera1n help]
-body:
- - type: textarea
- id: description
- attributes:
- label: Description
- description:
- placeholder: Anyone else has issues with ...? If so, I found a solution.
- validations:
- required: true
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index 58ff25e..0000000
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-blank_issues_enabled: false
-contact_links:
- - name: Mention us on X (formerly known as Twitter)
- url: https://twitter.com/palera1n
- about: Mention us about your issue if you're not comfortable with using Github issues.
diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml
deleted file mode 100644
index eb5ecd0..0000000
--- a/.github/ISSUE_TEMPLATE/feature.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Feature Request
-description: Request a feature in palera1n!
-labels: [enhancement]
-body:
- - type: textarea
- id: feature-request
- attributes:
- label: Feature Description
- description:
- placeholder: I want ... to be added to palera1n, because ...
- validations:
- required: true
- - type: textarea
- id: detailed-description
- attributes:
- label: Start going into detail..
- description:
- placeholder: I think it should also include ..., because of convenience.
- validations:
- required: false
-
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/problem.yml b/.github/ISSUE_TEMPLATE/problem.yml
deleted file mode 100644
index d88762b..0000000
--- a/.github/ISSUE_TEMPLATE/problem.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: Create Issue
-description: Ask help for palera1n regarding support or generally how it works!
-labels: [palera1n help]
-body:
- - type: input
- id: device
- attributes:
- label: Device
- description: What is the device that you're using with palera1n? (iPhone, iPad, iPod Touch, appleTV, iBridge (T2))
- placeholder: iPhone X
- validations:
- required: true
- - type: input
- id: version
- attributes:
- label: Version
- description: What is version you're running? (i.e. iOS, iPadOS, tvOS, bridgeOS)
- placeholder: iOS 15.6
- validations:
- required: true
- - type: checkboxes
- id: passcode-enabled
- attributes:
- label: Passcode?
- description: Is your passcode enabled?
- options:
- - label: Passcode is enabled.
- required: false
- - type: textarea
- id: detailed-description
- attributes:
- label: Start going into detail..
- description:
- placeholder: My device couldn't boot jailbroken. I have checked ... using ..., none of the solutions I've been given are working for me. I don't know what to do.
- validations:
- required: true
- - type: checkboxes
- id: familiarity
- attributes:
- label: Familiarity with palera1n
- description: Are you familiar with palera1n and how to use it?
- options:
- - label: I am familiar with palera1n and how to use it!
- required: false
- - type: checkboxes
- id: familiarity-command-line
- attributes:
- label: Familiarity with CLI
- description: Are you familiar with the command-line in anyway? (i.e. Terminal.app, Konsole)
- options:
- - label: I am familiar with the command-line!
- required: false
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index 03a9f05..0000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,906 +0,0 @@
-name: Build palera1n
-
-on:
- push:
- paths:
- - 'src/**'
- - 'docs/**'
- - 'patches/**'
- - 'include/**'
- - 'Makefile'
- - 'CMakeLists.txt'
- - '.github/workflows/build.yml'
- pull_request:
- paths:
- - 'src/**'
- - 'docs/**'
- - 'patches/**'
- - 'include/**'
- - 'Makefile'
- - 'CMakeLists.txt'
- - '.github/workflows/build.yml'
- workflow_dispatch:
-
-jobs:
- build-docs:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Install dependencies (packages)
- run: |
- sudo apt-get -y update
- sudo apt-get -y install mandoc make
-
- - name: Build Documentation
- run: |
- make -j$(nproc) docs
- mkdir -p ready/docs
- cp docs/*.html docs/mandoc.css docs/palera1n.1 ready/docs
-
- - name: Get branch name
- id: branch-name
- uses: tj-actions/branch-names@v9
-
- - name: Upload artifact
- if: ${{ github.event_name != 'pull_request' }}
- uses: wangyucode/sftp-upload-action@v1.4.8
- with:
- host: ${{ secrets.NICKCHAN_FTP_HOST }}
- port: ${{ secrets.NICKCHAN_FTP_PORT }}
- username: palera1n
- password: ${{ secrets.NICKCHAN_FTP_PASS }}
- forceUpload: true
- dryRun: false
- localDir: 'ready/'
- remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
-
- build-darwin:
- strategy:
- matrix:
- include:
- - arch: x86_64
- gnu_triple: x86_64-apple-darwin
- os: macosx
- minos: 10.8
- - arch: arm64
- gnu_triple: aarch64-apple-darwin
- os: macosx
- minos: 11.0
- - arch: arm64
- gnu_triple: aarch64-apple-darwin
- os: iphoneos
- minos: 7.0
- runs-on: macos-15
- env:
- MBEDTLS_VERSION: 3.5.2
- READLINE_VERSION: 8.2
- LIBIMOBILEDEVICE_COMMIT: ed0d66d0341562731bb19928dfe48155509fa7a7
- LIBIRECOVERY_COMMIT: 7ce02c347b7c26e59498e6af31c9da51018d0fa1
- LIBIMOBILEDEVICE_GLUE_COMMIT: 362f7848ac89b74d9dd113b38b51ecb601f76094
- LIBPLIST_COMMIT: 2117b8fdb6b4096455bd2041a63e59a028120136
- LIBUSBMUXD_COMMIT: a7f0543fb1ecb20ac7121c0fd77297200e0e43fc
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Install dependencies (packages)
- run: |
- sudo /usr/local/bin/pip3 install jsonschema jinja2
- brew install make autoconf automake pkg-config gnu-sed gettext libtool
- sudo rm -rf /usr/local/Frameworks/Python*
- curl -LO https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus7/ldid_macosx_x86_64
- sudo install -m755 ldid_macosx_x86_64 /usr/local/bin/ldid
-
- - name: Download dependencies (embedded binaries)
- run: |
- echo "SDK=$(xcrun -sdk ${{ matrix.os }} --show-sdk-path)" >> $GITHUB_ENV
-
- - name: Select correct Xcode
- run: |
- sudo xcode-select -s /Applications/Xcode_16.2.app
-
- - name: Setup environment
- run: |
- mkdir sysroot
- echo "DESTDIR=$(pwd)/sysroot" >> $GITHUB_ENV
- echo "PREFIX=/usr/local" >> $GITHUB_ENV
- echo "PKG_CONFIG_PATH=$(pwd)/sysroot/usr/local/lib/pkgconfig" >> $GITHUB_ENV
- echo "CONFIGURE_ARGS=--prefix=/usr/local --disable-shared --enable-static --build=x86_64-apple-darwin --host=${{ matrix.gnu_triple }}" >> $GITHUB_ENV
- echo "CC=$(xcrun --find cc)" >> $GITHUB_ENV
- echo "CXX=$(xcrun --find c++)" >> $GITHUB_ENV
- echo "CPP=$(xcrun --find cc) -E" >> $GITHUB_ENV
- echo "CFLAGS=-g -Os -isystem ${{ env.SDK }}/usr/include/c++/v1 -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Os -g -flto=full -Wl,-object_path_lto,lto.o -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
- echo "CPPFLAGS=-g -Os -isystem ${{ env.SDK }}/usr/include/c++/v1 -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isysroot ${{ env.SDK }} -isystem $(pwd)/sysroot/usr/local/include -Wno-error-implicit-function-declaration -Os -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
- echo "CXXFLAGS=-stdlib=libc++ -g -Os -isystem$(TARGET_SYSROOT)/usr/include/c++/v1 -isysroot ${{ env.SDK }} -arch ${{ matrix.arch }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -isystem $(pwd)/sysroot/usr/local/include -Os -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
- echo "LDFLAGS=-g -Wl,-dead_strip -arch ${{ matrix.arch }} -isysroot ${{ env.SDK }} -m${{ matrix.os }}-version-min=${{ matrix.minos }} -L$(pwd)/sysroot/usr/local/lib" >> $GITHUB_ENV
- echo "CFLAGS_FOR_BUILD=-arch $(uname -m) -isysroot $(xcrun -sdk macosx --show-sdk-path) -Os" >> $GITHUB_ENV
- echo "CXXFLAGS_FOR_BUILD=-stdlib=libc++ -arch $(uname -m) -isysroot $(xcrun -sdk macosx --show-sdk-path) -Os" >> $GITHUB_ENV
- echo "CPPFLAGS_FOR_BUILD=-arch $(uname -m) -isysroot $(xcrun -sdk macosx --show-sdk-path) -Wno-error-implicit-function-declaration -Os" >> $GITHUB_ENV
- echo "LDFLAGS_FOR_BUILD=-Wl,-dead_strip" >> $GITHUB_ENV
-
- - name: Prepare iPhoneOS environment
- if: matrix.os == 'iphoneos'
- run: |
- echo "FAKE_PLATFORM=2" >> $GITHUB_ENV
- echo "FAKE_SDK=7.0" >> $GITHUB_ENV
- echo "FAKE_MINOS=7.0" >> $GITHUB_ENV
-
- - name: Prepare headers
- if: matrix.os != 'macosx'
- run: |
- mkdir -p sysroot/{{,System}/Library/Frameworks,/usr/{local/include/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch},lib/pkgconfig,/local/lib}}
- MACOSX_SYSROOT=$(xcrun -sdk macosx --show-sdk-path)
- TARGET_SYSROOT=$(xcrun -sdk ${{ matrix.os }} --show-sdk-path)
- cp -af ${MACOSX_SYSROOT}/usr/include/{arpa,bsm,hfs,net,xpc,netinet,servers,timeconv.h,launch.h} sysroot/usr/local/include
- cp -af ${MACOSX_SYSROOT}/usr/include/objc/objc-runtime.h sysroot/usr/local/include/objc
- cp -af ${MACOSX_SYSROOT}/usr/include/libkern/{OSDebug.h,OSKextLib.h,OSReturn.h,OSThermalNotification.h,OSTypes.h,machine} sysroot/usr/local/include/libkern
- cp -af ${MACOSX_SYSROOT}/usr/include/kern sysroot/usr/local/include
- cp -af ${MACOSX_SYSROOT}/usr/include/sys/{tty*,ptrace,kern*,random,reboot,user,vnode,disk,vmmeter,conf}.h sysroot/usr/local/include/sys
- cp -af ${MACOSX_SYSROOT}/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/sys/disklabel.h sysroot/usr/local/include/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} sysroot/usr/local/include/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 sysroot/usr/local/include/Security
- cp -af ${MACOSX_SYSROOT}/usr/include/{ar,bootstrap,launch,libc,libcharset,localcharset,nlist,NSSystemDirectories,tzfile,vproc}.h sysroot/usr/local/include
- cp -af ${MACOSX_SYSROOT}/usr/include/mach/{*.defs,{mach_vm,shared_region}.h} sysroot/usr/local/include/mach
- cp -af ${MACOSX_SYSROOT}/usr/include/mach/machine/*.defs sysroot/usr/local/include/mach/machine
- cp -af ${MACOSX_SYSROOT}/usr/include/rpc/pmap_clnt.h sysroot/usr/local/include/rpc
- cp -af ${MACOSX_SYSROOT}/usr/include/rpcsvc/yp{_prot,clnt}.h sysroot/usr/local/include/rpcsvc
- cp -af ${TARGET_SYSROOT}/usr/include/mach/machine/thread_state.h sysroot/usr/local/include/mach/machine
- cp -af ${TARGET_SYSROOT}/usr/include/mach/arm sysroot/usr/local/include/mach
- cp -af ${MACOSX_SYSROOT}/System/Library/Frameworks/IOKit.framework/Headers/* sysroot/usr/local/include/IOKit
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/stdlib.h > sysroot/usr/local/include/stdlib.h
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/time.h > sysroot/usr/local/include/time.h
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/unistd.h > sysroot/usr/local/include/unistd.h
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/mach/task.h > sysroot/usr/local/include/mach/task.h
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/mach/mach_host.h > sysroot/usr/local/include/mach/mach_host.h
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/ucontext.h > sysroot/usr/local/include/ucontext.h
- gsed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < ${TARGET_SYSROOT}/usr/include/signal.h > sysroot/usr/local/include/signal.h
- gsed -E /'__API_UNAVAILABLE'/d < ${TARGET_SYSROOT}/usr/include/pthread.h > sysroot/usr/local/include/pthread.h
- gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// sysroot/usr/local/include/IOKit/IOKitLib.h
-
- - name: Check dependencies cache
- run: |
- echo "target: ${{ matrix.os }}-${{ matrix.arch }}" > cache.txt
- echo "mbedtls ${{ env.MBEDTLS_VERSION }}" >> cache.txt
- echo "readline: ${{ env.READLINE_VERSION }}" >> cache.txt
- echo "libimobiledevice: ${{ env.LIBIMOBILEDEVICE_COMMIT }}" >> cache.txt
- echo "libirecovery: ${{ env.LIBIRECOVERY_COMMIT }}" >> cache.txt
- echo "libimobiledevice-glue: ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }}" >> cache.txt
- echo "libplist: ${{ env.LIBPLIST_COMMIT }}" >> cache.txt
- echo "libusbmuxd: ${{ env.LIBUSBMUXD_COMMIT }}" >> cache.txt
- echo "cc: $($(xcrun --find cc) --version)" >> cache.txt
- echo "CACHE_TXT_CHECKSUM=sysroot-$(shasum -a 512 cache.txt | cut -d' ' -f1)" >> $GITHUB_ENV
-
- - name: Download cached sysroot
- id: sysroot_cache
- uses: actions/cache@v3
- with:
- path: sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
- key: sysroot-${{ env.CACHE_TXT_CHECKSUM }}
-
- - name: Extract cached sysroot
- if: steps.sysroot_cache.outputs.cache-hit == 'true'
- run: |
- xz -dcT0 sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz | tar -x
-
- - name: Setup sysroot
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- mkdir -p $(pwd)/sysroot/usr/local/lib
- ln -sf $(pwd)/sysroot/usr/local/lib{,64}
-
- - name: Download dependencies (source code)
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- curl -LOOOOOO \
- https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${{ env.MBEDTLS_VERSION }}.tar.gz \
- https://mirror-hk.koddos.net/gnu/readline/readline-${{ env.READLINE_VERSION }}.tar.gz
-
- tar -xf v${{ env.MBEDTLS_VERSION }}.tar.gz
- tar -xf readline-${{ env.READLINE_VERSION }}.tar.gz
- git clone --depth=1 https://github.com/libimobiledevice/libplist
- git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice-glue
- git clone --depth=1 https://github.com/libimobiledevice/libirecovery
- git clone --depth=1 https://github.com/libimobiledevice/libusbmuxd
- git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
- cd libplist && git fetch origin ${{ env.LIBPLIST_COMMIT }} && git reset --hard ${{ env.LIBPLIST_COMMIT }} && cd ..
- cd libirecovery && git fetch origin ${{ env.LIBIRECOVERY_COMMIT }} && git reset --hard ${{ env.LIBIRECOVERY_COMMIT }} && cd ..
- cd libimobiledevice-glue && git fetch origin ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && cd ..
- cd libimobiledevice && git fetch origin ${{ env.LIBIMOBILEDEVICE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_COMMIT }} && cd ..
- cd libusbmuxd && git fetch origin ${{ env.LIBUSBMUXD_COMMIT }} && git reset --hard ${{ env.LIBUSBMUXD_COMMIT }} && cd ..
-
- - name: Build Mbed TLS
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd mbedtls-${{ env.MBEDTLS_VERSION }}
- cat ../patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch | patch -sN -d . -p1
- mkdir build
- cd build
- SDKROOT="${{ env.SDK }}" cmake .. \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_CROSSCOMPILING=true \
- -DCMAKE_SYSTEM_NAME=Darwin \
- -DCMAKE_C_COMPILER="${{ env.CC }}" \
- -DCMAKE_C_FLAGS='${{ env.CFLAGS }}' \
- -DCMAKE_FIND_ROOT_PATH="${{ env.DESTDIR }}" \
- -DCMAKE_INSTALL_PREFIX="${{ env.PREFIX }}" \
- -DMBEDTLS_PYTHON_EXECUTABLE="/usr/local/bin/python3" \
- -DENABLE_TESTING=OFF \
- -DENABLE_PROGRAMS=OFF \
- -DMBEDTLS_FATAL_WARNINGS=OFF \
- -DCMAKE_INSTALL_SYSCONFDIR="/etc"
- gmake -j$(sysctl -n hw.ncpu) \
- SDKROOT="${{ env.SDK }}"
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build readline
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd readline-${{ env.READLINE_VERSION }}
- CC=clang CXX=clang++ ./configure ${{ env.CONFIGURE_ARGS }} ac_cv_type_sig_atomic_t=no
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libplist
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libplist
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }} --without-cython
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libimobiledevice-glue
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libimobiledevice-glue
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }}
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libirecovery
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- sudo cp -a sysroot/usr/local/* /usr/local
- cd libirecovery
- autoreconf -fiv
- if [ "${{ matrix.os }}" != "macosx" ]; then
- gsed -i '/case kIOUSBTransactionTimeout/d' src/libirecovery.c
- fi
- ./configure ${{ env.CONFIGURE_ARGS }}
- echo -e 'all:\ninstall:' > tools/Makefile
- make -j$(sysctl -n hw.ncpu) LIBS="-lncurses"
- make -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- install -m644 src/.libs/libirecovery-1.0.a ${{ env.DESTDIR }}${{ env.PREFIX }}/lib
- cd ..
-
- - name: Build libusbmuxd
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libusbmuxd
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }}
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libimobiledevice
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libimobiledevice
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }} --with-mbedtls --disable-debug --disable-wireless-pairing
- echo -e 'all:\ninstall:' > tools/Makefile
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build palera1n
- run: |
- cp -a sysroot/${{ env.PREFIX }}/{include,lib} dep_root
- find dep_root -name '*.dylib' -delete
- find dep_root -name '*.la' -delete
- gmake -j$(sysctl -n hw.ncpu) ROOTFUL=1
- cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}
- dsymutil palera1n-${{ matrix.os }}-${{ matrix.arch }}
- strip palera1n-${{ matrix.os }}-${{ matrix.arch }}
-
- - name: Build palera1n (Development)
- run: |
- gmake -j$(sysctl -n hw.ncpu) clean
- gmake -j$(sysctl -n hw.ncpu) DEV_BUILD=1 TUI=1 ROOTFUL=1
- cp src/palera1n palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
-
- - name: Prepare artifact
- run: |
- mkdir -p ready/build_depends
- tar -zcf ready/build_depends/dep_root-${{ matrix.os }}-${{ matrix.arch }}.tgz dep_root
- if [ "${{ matrix.os }}" == "macosx" ]; then
- ldid -S palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
- else
- ldid -Ssrc/usb.xml palera1n-${{ matrix.os }}-${{ matrix.arch }}{,.development}
- fi
-
- - name: Get branch name
- id: branch-name
- uses: tj-actions/branch-names@v9
-
- - name: Upload artifact
- if: ${{ github.event_name != 'pull_request' }}
- uses: wangyucode/sftp-upload-action@v1.4.8
- with:
- host: ${{ secrets.NICKCHAN_FTP_HOST }}
- port: ${{ secrets.NICKCHAN_FTP_PORT }}
- username: palera1n
- password: ${{ secrets.NICKCHAN_FTP_PASS }}
- forceUpload: true
- dryRun: false
- localDir: 'ready/'
- remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
-
- - name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build
- if: ${{ github.event_name != 'pull_request' }}
- uses: actions/upload-artifact@v4
- with:
- name: palera1n-${{ matrix.os }}-${{ matrix.arch }}
- path: palera1n-${{ matrix.os }}-${{ matrix.arch }}
- retention-days: 1
-
- - name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build (Development)
- if: ${{ github.event_name != 'pull_request' }}
- uses: actions/upload-artifact@v4
- with:
- name: palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
- path: palera1n-${{ matrix.os }}-${{ matrix.arch }}.development
- retention-days: 1
-
-
- - name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} debug symbols
- if: ${{ github.event_name != 'pull_request' }}
- uses: actions/upload-artifact@v4
- with:
- name: palera1n-${{ matrix.os }}-${{ matrix.arch }}.dSYM
- path: palera1n-${{ matrix.os }}-${{ matrix.arch }}.dSYM
- retention-days: 1
-
- - name: Generate cached sysroot archive
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- tar -c sysroot | xz -zce9T 0 > sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
-
- darwin-dist:
- if: ${{ github.event_name != 'pull_request' }}
- runs-on: macos-latest
- needs: build-darwin
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Setup Procursus
- uses: beerpiss/procursus-action@v2.0.2
- with:
- packages: sed coreutils
- cache: true
- mirror: 'https://apt.procurs.us/'
-
- - name: Download all Darwin artifacts
- uses: actions/download-artifact@v4
-
- - name: Prepare artifact
- run: |
- lipo -create -arch arm64 ./palera1n-macosx-arm64/palera1n-macosx-arm64 -arch x86_64 ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 -output palera1n-macos
- lipo -create -arch arm64 ./palera1n-macosx-arm64.development/palera1n-macosx-arm64.development -arch x86_64 ./palera1n-macosx-x86_64.development/palera1n-macosx-x86_64.development -output palera1n-macos.development
- mkdir -p palera1n-macos.dSYM/Contents/Resources/DWARF
- cp ./palera1n-macosx-x86_64.dSYM/Contents/Info.plist palera1n-macos.dSYM/Contents
- lipo -create -arch arm64 palera1n-macosx-arm64.dSYM/Contents/Resources/DWARF/palera1n-macosx-arm64 -arch x86_64 palera1n-macosx-x86_64.dSYM/Contents/Resources/DWARF/palera1n-macosx-x86_64 -output palera1n-macos.dSYM/Contents/Resources/DWARF/palera1n-macos
- mkdir -p ready/{debian,binaries,debug_symbols,binaries_development}
- cp palera1n-macos.development ready/binaries_development/palera1n-macos-universal.development
- cp palera1n-macos ready/binaries/palera1n-macos-universal
- cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/binaries/palera1n-macos-x86_64
- cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/binaries/palera1n-macos-arm64
- cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/binaries/palera1n-iphoneos-arm64
- cp ./palera1n-macosx-x86_64.development/palera1n-macosx-x86_64.development ready/binaries_development/palera1n-macos-x86_64.development
- cp ./palera1n-macosx-arm64.development/palera1n-macosx-arm64.development ready/binaries_development/palera1n-macos-arm64.development
- cp ./palera1n-iphoneos-arm64.development/palera1n-iphoneos-arm64.development ready/binaries_development/palera1n-iphoneos-arm64.development
- zip -r9 ready/debug_symbols/palera1n-iphoneos-arm64.dSYM.zip palera1n-iphoneos-arm64.dSYM
- zip -r9 ready/debug_symbols/palera1n-macosx-arm64.dSYM.zip palera1n-macosx-arm64.dSYM
- zip -r9 ready/debug_symbols/palera1n-macosx-x86_64.dSYM.zip palera1n-macosx-x86_64.dSYM
- zip -r9 ready/debug_symbols/palera1n-macos.dSYM.zip palera1n-macos.dSYM
-
- - name: Build debs
- run: |
- make -j$(sysctl -n hw.ncpu) docs
- version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
-
- # Darwin x86_64
- mkdir -p stage/DEBIAN
- mkdir -p stage/opt/procursus/bin
- mkdir -p stage/opt/procursus/usr/share/man/man1
- cp packaging/control.macosx stage/DEBIAN/control
-
- gsed 's|@DEB_ARCH@|darwin-amd64|g' -i stage/DEBIAN/control
- gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
-
- ginstall -Dm644 ready/binaries/palera1n-macos-x86_64 stage/opt/procursus/bin/palera1n
- zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
- chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
- chmod 755 stage/opt/procursus/bin/palera1n
-
- dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-amd64.deb
- rm -rf stage
-
- # Darwin arm64
- mkdir -p stage/DEBIAN
- mkdir -p stage/opt/procursus/bin
- mkdir -p stage/opt/procursus/usr/share/man/man1
- cp packaging/control.macosx stage/DEBIAN/control
-
- gsed 's|@DEB_ARCH@|darwin-arm64|g' -i stage/DEBIAN/control
- gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
-
- ginstall -Dm644 ready/binaries/palera1n-macos-arm64 stage/opt/procursus/bin/palera1n
- zstd -c19 docs/palera1n.1 > stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
- chmod 644 stage/opt/procursus/usr/share/man/man1/palera1n.1.zst
- chmod 755 stage/opt/procursus/bin/palera1n
-
- dpkg-deb --root-owner-group -Zzstd -b stage palera1n_darwin-arm64.deb
- rm -rf stage
-
- # iPhoneOS
- mkdir -p stage/DEBIAN
- mkdir -p stage/usr/bin
- mkdir -p stage/usr/share/man/man1
- cp packaging/control stage/DEBIAN/control
-
- gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
- gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
-
- ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/usr/bin/palera1n
- zstd -c19 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.zst
- chmod 644 stage/usr/share/man/man1/palera1n.1.zst
- chmod 755 stage/usr/bin/palera1n
-
- dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm.deb
- rm -rf stage
-
- # iPhoneOS (rootless)
- mkdir -p stage/DEBIAN
- mkdir -p stage/var/jb/usr/bin
- mkdir -p stage/var/jb/usr/share/man/man1
- cp packaging/control stage/DEBIAN/control
-
- gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
- gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
-
- ginstall -Dm644 ready/binaries/palera1n-iphoneos-arm64 stage/var/jb/usr/bin/palera1n
- zstd -c19 docs/palera1n.1 > stage/var/jb/usr/share/man/man1/palera1n.1.zst
- chmod 644 stage/var/jb/usr/share/man/man1/palera1n.1.zst
- chmod 755 stage/var/jb/usr/bin/palera1n
-
- dpkg-deb --root-owner-group -Zzstd -b stage palera1n_iphoneos-arm64.deb
- rm -rf stage
-
- mv palera1n*.deb ready/debian
-
- - name: Save build tag
- run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt
-
- - name: Upload build tag
- uses: actions/upload-artifact@v4
- with:
- name: build-tag
- path: build-tag.txt
-
- - name: Get branch name
- id: branch-name
- uses: tj-actions/branch-names@v9
-
- - name: Upload artifact
- if: ${{ github.event_name != 'pull_request' }}
- uses: wangyucode/sftp-upload-action@v1.4.8
- with:
- host: ${{ secrets.NICKCHAN_FTP_HOST }}
- port: ${{ secrets.NICKCHAN_FTP_PORT }}
- username: palera1n
- password: ${{ secrets.NICKCHAN_FTP_PASS }}
- forceUpload: true
- dryRun: false
- localDir: 'ready/'
- remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
-
- build-Linux:
- strategy:
- matrix:
- triple:
- - i486-linux-musl
- - x86_64-linux-musl
- - armel-linux-musleabi
- - aarch64-linux-musl
- runs-on: ubuntu-latest
- env:
- MBEDTLS_VERSION: 3.5.2
- LIBUSB_VERSION: 1.0.27
- READLINE_VERSION: 8.2
- GPM_VERSION: 1.20.7
- LIBIMOBILEDEVICE_COMMIT: ed0d66d0341562731bb19928dfe48155509fa7a7
- LIBIRECOVERY_COMMIT: 7ce02c347b7c26e59498e6af31c9da51018d0fa1
- LIBIMOBILEDEVICE_GLUE_COMMIT: 362f7848ac89b74d9dd113b38b51ecb601f76094
- USBMUXD_COMMIT: bc0b91ca856811f4393318dc83db6dc3c1ac326d
- LIBPLIST_COMMIT: 2117b8fdb6b4096455bd2041a63e59a028120136
- LIBUSBMUXD_COMMIT: a7f0543fb1ecb20ac7121c0fd77297200e0e43fc
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Install build dependencies (packages)
- run: |
- sudo apt-get remove -y libssl-dev libreadline-dev
- sudo apt-get install -y pkg-config autoconf automake autopoint mandoc
- sudo pip3 install jsonschema jinja2
-
- - name: Download toolchain checksum
- run: |
- curl -u ${{ secrets.ACTIONS_RESOURCES_LOGIN }} -LO https://static.palera.in/action-resources/musl-cross/SHA512SUMS
- echo "TOOLCHAIN_CHECKSUM="$(grep ${{ matrix.triple }}-cross.tar.zst SHA512SUMS | cut -d' ' -f1) >> $GITHUB_ENV
-
- - name: Download toolchain (cached)
- id: toolchain_cache
- uses: actions/cache@v3
- with:
- path: ${{ matrix.triple }}-cross.tar.zst
- key: ${{ matrix.triple }}-${{ env.TOOLCHAIN_CHECKSUM }}-toolchain
-
- - name: Download toolchain
- if: steps.toolchain_cache.outputs.cache-hit != 'true'
- run: |
- curl -u ${{ secrets.ACTIONS_RESOURCES_LOGIN }} -LO https://static.palera.in/action-resources/musl-cross/${{ matrix.triple }}-cross.tar.zst
-
- - name: Setup environment
- run: |
- tar --zstd -xf ${{ matrix.triple }}-cross.tar.zst
- mkdir sysroot
- echo "$(pwd)/${{ matrix.triple }}-cross/bin" >> $GITHUB_PATH
- case ${{ matrix.triple }} in
- i486-linux-musl)
- echo "CHECKRA1N_NAME=linux-x86" >> $GITHUB_ENV
- echo "ARCH_NAME=i386" >> $GITHUB_ENV
- ;;
- x86_64-linux-musl)
- echo "CHECKRA1N_NAME=linux-x86_64" >> $GITHUB_ENV
- echo "ARCH_NAME=amd64" >> $GITHUB_ENV
- ;;
- armel-linux-musleabi)
- echo "CHECKRA1N_NAME=linux-armel" >> $GITHUB_ENV
- echo "ARCH_NAME=armel" >> $GITHUB_ENV
- ;;
- aarch64-linux-musl)
- echo "CHECKRA1N_NAME=linux-arm64" >> $GITHUB_ENV
- echo "ARCH_NAME=arm64" >> $GITHUB_ENV
- ;;
- esac
- echo "PKG_CONFIG_PATH=$(pwd)/sysroot/usr/local/lib/pkgconfig" >> $GITHUB_ENV
- echo "CFLAGS=-g -fdata-sections -ffunction-sections -I$(pwd)/sysroot/usr/local/include -L$(pwd)/sysroot/usr/local/lib -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
- echo "CXXFLAGS=-g -fdata-sections -ffunction-sections -I$(pwd)/sysroot/usr/local/include -L$(pwd)/sysroot/usr/local/lib -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" >> $GITHUB_ENV
- echo "LDFLAGS=-g -Wl,--gc-sections -fdata-sections -ffunction-sections -I$(pwd)/sysroot/usr/local/include -L$(pwd)/sysroot/usr/local/lib" >> $GITHUB_ENV
- echo "INSTALL=$(command -v install) --strip-program=${{ matrix.triple }}-strip" >> $GITHUB_ENV
- echo "DESTDIR=$(pwd)/sysroot" >> $GITHUB_ENV
- echo "PREFIX=/usr/local" >> $GITHUB_ENV
- echo "CONFIGURE_ARGS=--build=x86_64-linux-gnu --host=${{ matrix.triple }} --prefix=/usr/local --disable-shared --enable-static" >> $GITHUB_ENV
- echo "CROSS_COMPILE=${{ matrix.triple }}-" >> $GITHUB_ENV
-
- - name: Check dependencies cache
- run: |
- echo "target: ${{ matrix.triple }}" > cache.txt
- echo "mbedtls ${{ env.MBEDTLS_VERSION }}" >> cache.txt
- echo "readline: ${{ env.READLINE_VERSION }}" >> cache.txt
- echo "libimobiledevice: ${{ env.LIBIMOBILEDEVICE_COMMIT }}" >> cache.txt
- echo "libirecovery: ${{ env.LIBIRECOVERY_COMMIT }}" >> cache.txt
- echo "libimobiledevice-glue: ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }}" >> cache.txt
- echo "libplist: ${{ env.LIBPLIST_COMMIT }}" >> cache.txt
- echo "libusbmuxd: ${{ env.LIBUSBMUXD_COMMIT }}" >> cache.txt
- echo "usbmuxd: ${{ env.USBMUXD_COMMIT }}" >> cache.txt
- echo "cc: $(${{ env.CROSS_COMPILE }}gcc --version)" >> cache.txt
- echo "CACHE_TXT_CHECKSUM=sysroot-$(sha512sum cache.txt | cut -d' ' -f1)" >> $GITHUB_ENV
-
- - name: Download cached sysroot
- id: sysroot_cache
- uses: actions/cache@v3
- with:
- path: sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
- key: sysroot-${{ env.CACHE_TXT_CHECKSUM }}
-
- - name: Extract cached sysroot
- if: steps.sysroot_cache.outputs.cache-hit == 'true'
- run: |
- xz -dcT0 sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz | tar -x
-
- - name: Setup sysroot
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- mkdir -p $(pwd)/sysroot/usr/local/lib
- ln -sf $(pwd)/sysroot/usr/local/lib{,64}
-
- - name: Download dependencies (source code)
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- curl -LOOOOOOO \
- https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${{ env.MBEDTLS_VERSION }}.tar.gz \
- https://github.com/libusb/libusb/releases/download/v${{ env.LIBUSB_VERSION }}/libusb-${{ env.LIBUSB_VERSION }}.tar.bz2 \
- https://mirror-hk.koddos.net/gnu/readline/readline-${{ env.READLINE_VERSION }}.tar.gz \
- https://github.com/telmich/gpm/archive/refs/tags/${{ env.GPM_VERSION }}.tar.gz
-
- tar -xf v${{ env.MBEDTLS_VERSION }}.tar.gz
- tar -xjf libusb-${{ env.LIBUSB_VERSION }}.tar.bz2
- tar -xf readline-${{ env.READLINE_VERSION }}.tar.gz
- tar -xf ${{ env.GPM_VERSION }}.tar.gz
- git clone --depth=1 https://github.com/libimobiledevice/libplist
- git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice-glue
- git clone --depth=1 https://github.com/libimobiledevice/libirecovery
- git clone --depth=1 https://github.com/libimobiledevice/libusbmuxd
- git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
- git clone --depth=1 https://github.com/libimobiledevice/usbmuxd
- cd libplist && git fetch origin ${{ env.LIBPLIST_COMMIT }} && git reset --hard ${{ env.LIBPLIST_COMMIT }} && cd ..
- cd libirecovery && git fetch origin ${{ env.LIBIRECOVERY_COMMIT }} && git reset --hard ${{ env.LIBIRECOVERY_COMMIT }} && cd ..
- cd libimobiledevice-glue && git fetch origin ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_GLUE_COMMIT }} && cd ..
- cd usbmuxd && git fetch origin ${{ env.USBMUXD_COMMIT }} && git reset --hard ${{ env.USBMUXD_COMMIT }} && cd ..
- cd libimobiledevice && git fetch origin ${{ env.LIBIMOBILEDEVICE_COMMIT }} && git reset --hard ${{ env.LIBIMOBILEDEVICE_COMMIT }} && cd ..
- cd libusbmuxd && git fetch origin ${{ env.LIBUSBMUXD_COMMIT }} && git reset --hard ${{ env.LIBUSBMUXD_COMMIT }} && cd ..
-
- - name: Build Mbed TLS
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd mbedtls-${{ env.MBEDTLS_VERSION }}
- cat ../patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch | patch -sN -d . -p1
- mkdir build
- if [ "${{ matrix.triple }}" = "i486-linux-musl" ]; then sed -i '/define MBEDTLS_AESNI_C/d' include/mbedtls/mbedtls_config.h; fi
- cd build
- cmake .. \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_CROSSCOMPILING=true \
- -DCMAKE_SYSTEM_NAME=Linux \
- -DCMAKE_SYSTEM_PROCESSOR=$(echo ${{ matrix.triple }} | cut -d- -f1) \
- -DCMAKE_C_COMPILER='${{ env.CROSS_COMPILE }}gcc' \
- -DCMAKE_C_FLAGS='${{ env.CFLAGS }}' \
- -DCMAKE_CXX_FLAGS='${{ env.CXXFLAGS }}' \
- -DCMAKE_FIND_ROOT_PATH="${{ env.DESTDIR }}" \
- -DCMAKE_INSTALL_PREFIX="${{ env.PREFIX }}" \
- -DENABLE_TESTING=OFF \
- -DENABLE_PROGRAMS=OFF \
- -DCMAKE_INSTALL_SYSCONFDIR="/etc"
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libusb
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libusb-${{ env.LIBUSB_VERSION }}
- ./configure ${{ env.CONFIGURE_ARGS }} --disable-udev
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build readline
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd readline-${{ env.READLINE_VERSION }}
- ./configure ${{ env.CONFIGURE_ARGS }}
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build GPM
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd gpm-${{ env.GPM_VERSION }}
- cat ../patches/gpm/*.patch | patch -sN -d . -p1
- ./autogen.sh
- ./configure \
- ${{ env.CONFIGURE_ARGS }}
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libplist
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libplist
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }} --without-cython
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libimobiledevice-glue
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libimobiledevice-glue
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }}
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libirecovery (sorta)
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- sudo mv /usr/local /usr/local.bak
- sudo ln -s ${{ env.DESTDIR }}${{ env.PREFIX }} /usr/local
- cd libirecovery
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }}
- echo -e 'all:\ninstall:' > tools/Makefile
- make -ij$(nproc)
- make -ij$(nproc) install DESTDIR=${{ env.DESTDIR }}
- install -m644 src/.libs/libirecovery-1.0.a ${{ env.DESTDIR }}${{ env.PREFIX }}/lib
- cd ..
-
- - name: Build libusbmuxd
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libusbmuxd
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }}
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
-
- - name: Build libimobiledevice
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd libimobiledevice
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }} --with-mbedtls --disable-debug --disable-wireless-pairing
- echo -e 'all:\ninstall:' > tools/Makefile
- make -j$(nproc)
- make -j$(nproc) install DESTDIR=${{ env.DESTDIR }}
- cd ..
- sudo rm /usr/local
- sudo mv /usr/local.bak /usr/local
-
- - name: Build usbmuxd
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- cd usbmuxd
- autoreconf -fiv
- ./configure ${{ env.CONFIGURE_ARGS }} --without-systemd
- ${{ matrix.triple }}-gcc ${{ env.CFLAGS }} -I${{ env.DESTDIR }}/${{ env.PREFIX }}/include/libusb-1.0 src/*.c \
- -DHAVE_CONFIG_H -no-pie \
- -I. -static ${{ env.LDFLAGS }}} -limobiledevice-1.0 -lusbmuxd-2.0 -limobiledevice-glue-1.0 \
- -lplist-2.0 -lusb-1.0 -lmbedtls -lmbedcrypto -lmbedx509 -lpthread -o usbmuxd
- mkdir -p ${{ env.DESTDIR }}/${{ env.PREFIX }}/sbin
- ${{ matrix.triple }}-objcopy --only-keep-debug usbmuxd usbmuxd.debug
- ${{ matrix.triple }}-strip --strip-debug --strip-unneeded usbmuxd
- ${{ matrix.triple }}-objcopy --add-gnu-debuglink=usbmuxd.debug usbmuxd
- install -m755 usbmuxd usbmuxd.debug ${{ env.DESTDIR }}/${{ env.PREFIX }}/sbin
- cd ..
-
- - name: Build palera1n
- run: |
- cp -a ${{ env.DESTDIR }}/${{ env.PREFIX }}/{include,lib} dep_root
- find dep_root -name '*.so' -delete
- find dep_root -name '*.la' -delete
- CC="${{ matrix.triple }}-gcc" make -j$(nproc) ROOTFUL=1
- cp src/palera1n palera1n.release
-
- - name: Seperate debug symbols
- run: |
- ${{ matrix.triple }}-objcopy --only-keep-debug palera1n.release palera1n.debug
- ${{ matrix.triple }}-strip --strip-debug --strip-unneeded palera1n.release
- ${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug palera1n.release
- chmod -x palera1n.debug
-
- - name: Build palera1n (Development)
- run: |
- CC="${{ matrix.triple }}-gcc" make -j$(nproc) clean
- CC="${{ matrix.triple }}-gcc" make -j$(nproc) DEV_BUILD=1 ROOTFUL=1
- cp src/palera1n palera1n.development
-
- - name: Prepare artifact
- run: |
- mkdir -p ready/{binaries,debian,binaries_development,build_depends,debug_symbols} usbmuxd-static
- mv palera1n.debug ready/debug_symbols/palera1n-${{ env.CHECKRA1N_NAME }}.debug
- mv palera1n.release ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }}
- mv palera1n.development ready/binaries_development/palera1n-${{ env.CHECKRA1N_NAME }}.development
- tar -zcf ready/build_depends/dep_root_${{ matrix.triple }}.tgz dep_root
- install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}
- install -m755 sysroot/${{ env.PREFIX }}/sbin/usbmuxd.debug usbmuxd-static/usbmuxd-${{ env.CHECKRA1N_NAME }}.debug
-
- - name: Build debs
- run: |
- version=$(git describe --dirty --tags --abbrev=7 | sed 's|^v||' | sed 's|-beta|~beta|')
-
- make -j$(nproc) docs
- mkdir -p stage/DEBIAN
- mkdir -p stage/usr/bin
- mkdir -p stage/usr/share/man/man1
- cp packaging/control stage/DEBIAN/control
-
- sed 's|@DEB_ARCH@|${{ env.ARCH_NAME }}|g' -i stage/DEBIAN/control
- sed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
-
- install -Dm644 ready/binaries/palera1n-${{ env.CHECKRA1N_NAME }} stage/usr/bin/palera1n
- gzip -c9 docs/palera1n.1 > stage/usr/share/man/man1/palera1n.1.gz
- chmod 755 stage/usr/bin/palera1n
- chmod 644 stage/usr/share/man/man1/palera1n.1.gz
-
- dpkg-deb --root-owner-group -b stage palera1n_${{ env.ARCH_NAME }}.deb
- mv palera1n*.deb ready/debian
- rm -rf stage
-
- - name: Get branch name
- id: branch-name
- uses: tj-actions/branch-names@v9
-
- - name: Upload artifact
- if: ${{ github.event_name != 'pull_request' }}
- uses: wangyucode/sftp-upload-action@v1.4.8
- with:
- host: ${{ secrets.NICKCHAN_FTP_HOST }}
- port: ${{ secrets.NICKCHAN_FTP_PORT }}
- username: palera1n
- password: ${{ secrets.NICKCHAN_FTP_PASS }}
- forceUpload: true
- dryRun: false
- localDir: 'ready/'
- remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
-
- - name: Upload usbmuxd artifact
- if: ${{ github.event_name != 'pull_request' }}
- uses: wangyucode/sftp-upload-action@v1.4.8
- with:
- host: ${{ secrets.NICKCHAN_FTP_HOST }}
- port: ${{ secrets.NICKCHAN_FTP_PORT }}
- username: palera1n
- password: ${{ secrets.NICKCHAN_FTP_PASS }}
- forceUpload: true
- dryRun: false
- localDir: 'usbmuxd-static/'
- remoteDir: "/palera1n/artifacts/usbmuxd-static"
-
- - name: Generate cached sysroot archive
- if: steps.sysroot_cache.outputs.cache-hit != 'true'
- run: |
- tar -c sysroot | xz -zce9T 0 > sysroot-${{ env.CACHE_TXT_CHECKSUM }}.txz
-
- finish-build:
- runs-on: ubuntu-latest
- if: ${{ github.event_name != 'pull_request' }}
- needs: [build-docs, build-darwin, darwin-dist, build-Linux]
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Get branch name
- id: branch-name
- uses: tj-actions/branch-names@v9
-
- - name: Download build tag
- uses: actions/download-artifact@v4
- with:
- name: build-tag
-
- - uses: geekyeggo/delete-artifact@v2
- with:
- name: '*'
- failOnError: false
-
- - name: Send Discord build message
- run: |
- COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -1 --reverse` &&
- (curl "${{ secrets.DISCORD_WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"[palera1n:${{ steps.branch-name.outputs.ref_branch }}] Nightly Build ${{ github.run_number }}\",\"url\":\"https://github.com/palera1n/palera1n/actions/runs/${GITHUB_RUN_ID}\",\"color\":2829617,\"fields\":[{\"name\":\"Build tag\",\"value\":\"- \`$(cat build-tag.txt | sed 's|\n||')\`\"},{\"name\":\"Destination\",\"value\":\"- https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}\"},{\"name\":\"Documentation\",\"value\":\"- [palera1n.1.html](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/docs/palera1n.1.html)\"},{\"name\":\"Main Artifacts\",\"value\":\"- [palera1n-iphoneos-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-iphoneos-arm64)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-x86)\n- [palera1n-linux-x86_64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-linux-x86_64)\n- [palera1n-macos-universal](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/binaries/palera1n-macos-universal)\"}],\"footer\":{\"text\":\"${{ github.actor }}\", \"icon_url\": \"https://github.com/${{ github.actor }}.png\",\"timestamp\":\"$(date -u +"%FT%TZ")\"}}],\"username\":\"GitHub Actions\",\"avatar_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}")
-
diff --git a/.gitignore b/.gitignore
index ee8e4ef..03d924b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,29 +1,4 @@
-contrib/**
-dep_root/**
-!dep_root/.keep
-!contrib/.keep
-contrib/
-*.o
-dep_root*.tgz
-.vscode
-checkra1n*
-payload.c
-src/palera1n
-!xxd-embedded.h
-src/binpack.dmg
-src/ramdisk.dmg
-src/ramdisk.dmg.lzma
-src/xxd-*.c
+build/
.DS_Store
-!palera1n.1
-palera1n.1.html
-Payload
-docs/*.html
-build
-src/*.dmg.c
-.idea
-src/stage2/
-src/libcheckra1nhelper.dylib*
-src/Pongo.bin
-sysroot
-compile.sh
+src/exploit/payloads/
+src/exploit/userland/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..13c4532
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,62 @@
+# Project
+cmake_minimum_required(VERSION 3.10)
+project(palera1n VERSION 3.0)
+include(FetchContent)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED True)
+set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra -DWX_PRECOMP")
+
+# Option for GUI (wxWidgets)
+option(WITH_GUI "Build with wxWidgets GUI" OFF)
+option(WITH_STATIC "Build with static wxWidgets" OFF)
+
+# Architectures
+set(CMAKE_OSX_ARCHITECTURES "arm64")
+set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
+
+# Deps
+if(WITH_GUI)
+if(WITH_STATIC)
+ set(wxBUILD_SHARED OFF)
+ FetchContent_Declare(
+ wxWidgets
+ GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets.git
+ GIT_SHALLOW ON
+ )
+ FetchContent_MakeAvailable(wxWidgets)
+ set(WX_LIBRARIES wxWidgets::core wxWidgets::base wxWidgets::net)
+else()
+ find_package(wxWidgets REQUIRED COMPONENTS core base net)
+ include(${wxWidgets_USE_FILE})
+ set(WX_LIBRARIES ${wxWidgets_LIBRARIES})
+endif()
+endif()
+
+# Files
+file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "src/*.cpp" "src/*.c" "src/*.h" "src/*.hpp")
+
+if(APPLE AND WITH_GUI)
+ add_executable(palera1n MACOSX_BUNDLE ${SOURCES})
+ set_target_properties(palera1n PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/Info.plist)
+elseif(APPLE)
+ add_executable(palera1n ${SOURCES})
+else()
+ add_executable(palera1n WIN32 ${SOURCES} resources/main.exe.manifest)
+endif()
+
+if(APPLE)
+ find_library(IOKIT IOKit)
+ find_library(COREFOUNDATION CoreFoundation)
+ target_link_libraries(palera1n PRIVATE ${IOKIT} ${COREFOUNDATION})
+endif()
+
+if(WITH_GUI)
+if(WITH_STATIC)
+ target_link_libraries(palera1n PRIVATE wxcore wxnet)
+else()
+ target_link_libraries(palera1n PRIVATE ${wxWidgets_LIBRARIES})
+endif()
+target_compile_definitions(palera1n PRIVATE WITH_GUI)
+endif()
diff --git a/Makefile b/Makefile
index 37db306..d4b2925 100644
--- a/Makefile
+++ b/Makefile
@@ -1,95 +1,29 @@
-SRC = $(shell pwd)
-DEP = $(SRC)/dep_root
-STRIP = strip
-CC ?= cc
-CFLAGS += -isystem $(DEP)/include -I$(SRC)/include -I$(SRC) -D_XOPEN_SOURCE=500
-CFLAGS += -Wall -Wextra -Wno-unused-parameter -DPALERAIN_VERSION=\"2.1\" -DHAVE_LIBIMOBILEDEVICE
-CFLAGS += -Wno-unused-variable -I$(SRC)/src -std=c99 -pedantic-errors -D_C99_SOURCE -D_POSIX_C_SOURCE=200112L
-LIBS += $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a
-LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread -lm
-ifeq ($(TARGET_OS),)
-TARGET_OS = $(shell uname -s)
-UNAME = $(TARGET_OS)
-else
-UNAME = $(shell uname -s)
-endif
-ifeq ($(TARGET_OS),Darwin)
-CFLAGS += -Wno-nullability-extension
-ifeq (,$(findstring version-min=, $(CFLAGS)))
-CFLAGS += -mmacosx-version-min=10.8
-endif
-LDFLAGS += -Wl,-dead_strip
-LIBS += -framework CoreFoundation -framework IOKit
-else
-CFLAGS += -fdata-sections -ffunction-sections
-LDFLAGS += -Wl,--gc-sections
-endif
-LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a
+.PHONY: payloads palera1n palera1n_xcode clean
-ifeq ($(TUI),1)
-ifeq ($(TARGET_OS),Linux)
-LIBS += $(DEP)/lib/libgpm.a
-endif
-endif
+WITH_GUI ?= 0
+WITH_STATIC ?= 0
+BUILD_TYPE ?= Debug
-ifeq ($(DEV_BUILD),1)
-CFLAGS += -O0 -g -DDEV_BUILD -fno-omit-frame-pointer
-ifeq ($(ASAN),1)
-BUILD_STYLE=ASAN
-CFLAGS += -fsanitize=address,undefined -fsanitize-address-use-after-return=runtime
-else ifeq ($(TSAN),1)
-BUILD_STYLE=TSAN
-CFLAGS += -fsanitize=thread,undefined
-else
-BUILD_STYLE = DEVELOPMENT
-endif
-else
-CFLAGS += -Os -g
-BUILD_STYLE = RELEASE
-endif
-LIBS += -lc
+payloads:
+ @mkdir -p src/exploit/payloads
+ @for file in payloads/*; do \
+ echo " XXD $$file"; \
+ xxd -i $$file > src/exploit/$$file.h; \
+ done
-ifeq ($(TARGET_OS),Linux)
-ifneq ($(shell echo '$(BUILD_STYLE)' | grep -q '[A-Z]\+SAN' && echo 1),1)
-LDFLAGS += -static -no-pie
-endif
-endif
+palera1n: payloads
+ @cmake -S . -B build \
+ -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
+ -DWITH_GUI=$(WITH_GUI) \
+ -DWITH_STATIC=$(WITH_STATIC) && \
+ cmake --build build -- -j$(sysctl -n hw.ncpu)
-ifneq ($(BAKERAIN_DEVELOPE_R),)
-CFLAGS += -DBAKERAIN_DEVELOPE_R="\"$(BAKERAIN_DEVELOPE_R)\""
-endif
-
-BUILD_NUMBER := $(shell git rev-list --count HEAD)
-BUILD_TAG := $(shell git describe --dirty --tags --abbrev=7)
-BUILD_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
-BUILD_COMMIT := $(shell git rev-parse HEAD)
-
-CFLAGS += -DBUILD_STYLE="\"$(BUILD_STYLE)\"" -DBUILD_TAG="\"$(BUILD_TAG)\""
-CFLAGS += -DBUILD_NUMBER="\"$(BUILD_NUMBER)\"" -DBUILD_BRANCH="\"$(BUILD_BRANCH)\""
-CFLAGS += -DBUILD_COMMIT="\"$(BUILD_COMMIT)\""
-
-CPATH =
-LIBRARY_PATH =
-
-export SRC DEP UNAME CC CFLAGS LDFLAGS LIBS SHELL TARGET_OS DEV_BUILD BUILD_DATE BUILD_TAG BUILD_WHOAMI BUILD_STYLE BUILD_NUMBER BUILD_BRANCH
-
-all: palera1n
-
-palera1n: download-deps
- $(MAKE) -C src
+palera1n_xcode: payloads
+ @cmake -S . -B build \
+ -G Xcode \
+ -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
+ -DWITH_GUI=$(WITH_GUI) \
+ -DWITH_STATIC=$(WITH_STATIC)
clean:
- $(MAKE) -C src clean
- $(MAKE) -C docs clean
-
-download-deps:
- $(MAKE) -C src $(patsubst %, resources/%, checkra1n-macos checkra1n-linux-arm64 checkra1n-linux-armel checkra1n-linux-x86 checkra1n-linux-x86_64 checkra1n-kpf-pongo ramdisk.dmg binpack.dmg Pongo.bin)
-
-docs:
- $(MAKE) -C docs
-
-distclean: clean
- $(MAKE) -C src distclean
-
-.PHONY: all palera1n clean docs distclean
-
+ @rm -rf build
diff --git a/README.md b/README.md
index e82e73e..aef1c52 100644
--- a/README.md
+++ b/README.md
@@ -1,133 +1 @@
-# palera1n
-[](https://github.com/palera1n/palera1n/releases)
-[](https://github.com/palera1n/palera1n/releases)
-[](https://github.com/palera1n/palera1n/blob/main/LICENSE)
-
-
-Jailbreak for A8 through A11, T2 devices, on iOS/iPadOS/tvOS 15.0, bridgeOS 5.0 and higher.
-
-
-
-
-|  |
-|:--: |
-| A screenshot of palera1n being used in a Terminal |
-
-## Device Support
-
-
-
-| iPhone(s) | iPad(s) | iPod(s) | Apple TV(s) |
-|- |- |- |- |
-| iPhone 6s | iPad mini 4 | iPod Touch (7th generation) | Apple TV HD |
-| iPhone 6s Plus | iPad (5th generation) | | Apple TV 4K (1st generation) |
-| iPhone SE (2016) | iPad (6th generation) | | |
-| iPhone 7 | iPad (7th generation) | | |
-| iPhone 7 Plus | iPad Pro (9.7") | | |
-| iPhone 8 | iPad Pro (12.9") (1st generation) | | |
-| iPhone 8 Plus | iPad Pro (10.5") | | |
-| iPhone X | iPad Pro (12.9") (2nd generation) | | |
-| | iPad Air 2 | | |
-
-
-> Note that on `A11` (iPhone X, 8, 8 Plus), **you must disable your passcode while in the jailbroken state** (on iOS 16, you need to **reset your device** before proceeding with palera1n).
-
-
-
-Apple T2 Device Support (click to expand)
-
-| Apple T2 |
-|- |
-| Apple T2 iMac20,1 |
-| Apple T2 iMac20,2 |
-| |
-| Apple T2 MacBookAir8,1 |
-| Apple T2 MacBookAir8,2 |
-| Apple T2 MacBookAir9,1 |
-| |
-| Apple T2 MacBookPro15,1 |
-| Apple T2 MacBookPro15,2 |
-| Apple T2 MacBookPro15,3 |
-| Apple T2 MacBookPro15,4 |
-| Apple T2 MacBookPro16,1 |
-| Apple T2 MacBookPro16,2 |
-| Apple T2 MacBookPro16,3 |
-| Apple T2 MacBookPro16,4 |
-| |
-| Apple T2 iMacPro1,1 |
-| Apple T2 Macmini8,1 |
-| Apple T2 MacPro7,1 |
-| |
-| iBridge2,11 (Unknown Mac) |
-| iBridge2,13 (Unknown Mac) |
-
-
-
-
-
-
-## Computer Requirements
-1. **USB-A** cables are recommended to use, USB-C to may have issues with palera1n and getting into DFU mode.
-> Due to USB-C cables having different accessory IDs, your device may not be able to be recognized when using USB-C due to not being able to assert to its USB voltage pin.
-
-2. **Linux or macOS computer**
-> AMD CPUs (not AMD Mobile) have an issue where it causes them to have a very low success rate with checkm8 exploit. It is not recommended that you use them with palera1n.
-
-> USB-C port on Apple Silicon Macs *may* require manual unplugging and replugging of the lightning cable after checkm8 exploit. This problem may be solved by connecting via USB hub, though extensions can vary.
-
-## Usage
-```
-Usage: palera1n [-DEhpvVdsSLRnPI] [-e boot arguments] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file] [-i checkra1n file]
-
- --version Print version
- --force-revert Remove jailbreak
- -d, --demote Demote
- -D, --dfuhelper Exit after entering DFU
- -e, --boot-args XNU boot arguments
- -E, --enter-recovery Enter recovery mode
- -h, --help Show this help
- -i, --override-checkra1n Override checkra1n
- -k, --override-pongo Override Pongo image
- -K, --override-kpf Override kernel patchfinder
- -L, --jbinit-log-to-file Make jbinit log to /cores/jbinit.log (can be read from sandbox while jailbroken)
- -n, --exit-recovery Exit recovery mode
- -I, --device-info Print info about the connected device
- -o, --override-overlay Override overlay
- -p, --pongo-shell Boots to PongoOS shell
- -P, --pongo-full Boots to a PongoOS shell with default images already uploaded
- -r, --override-ramdisk Override ramdisk
- -R, --reboot-device Reboot connected device in normal mode
- -s, --safe-mode Enter safe mode
- -S, --no-colors Disable colors on the command line
- -v, --debug-logging Enable debug logging
- This option can be repeated for extra verbosity.
- -V, --verbose-boot Verbose boot
-
-Environmental variables:
- TMPDIR temporary diretory (path the built-in checkra1n will be extracted to)
-```
-
-## Installing
-Visit https://palera.in
-
-## Disclaimers
-We are **NOT** responsible for any data loss, or the result of a device being bricked. When using palera1n, the user should accept responsibility if anything happens to their device during the process.
-- If your device is stuck in recovery, please run futurerestore `--exit-recovery`, or use `irecovery -n`, or `palera1n -n`.
-- If you're unable to get out of recovery via these methods please restore with iTunes or Finder.
-- palera1n **will not work** in VirtualBox, VMware or any virtual machine that doesn't support PCI passthrough.
-
-## Troubleshooting
-Make sure you're following the guides provided [here](https://palera.in), also when asking for support make sure you provide full details on your device, such as:
-- iPhone/iPad/iPod/Apple TV
-- iOS Version
-- Passcode enabled?
-- Verbose from palera1n (specifying `-Vv` within palera1n)
-- Panic logs, if panicked then send latest `panic-full` log from your device.
-
-Create an issue here: https://github.com/palera1n/palera1n/issues/new/choose
-
-## Credits
-
-[All credits for palera1n can be found here](https://palera.in/)
-
-If proper credit isn't shown please message us or create an issue.
+read `Makefile` for build instructions
diff --git a/assets/image-1.png b/assets/image-1.png
deleted file mode 100644
index 2920da8..0000000
Binary files a/assets/image-1.png and /dev/null differ
diff --git a/dep_root/.keep b/dep_root/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/docs/Makefile b/docs/Makefile
deleted file mode 100644
index 25b8e54..0000000
--- a/docs/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-PAGES = palera1n.1.html p1ctl.8.html
-
-all: $(PAGES)
-
-%.html: %
- mandoc -T html -O style=mandoc.css $< > $@
-
-clean:
- rm -f $(PAGES)
diff --git a/docs/mandoc.css b/docs/mandoc.css
deleted file mode 100644
index 6a315d8..0000000
--- a/docs/mandoc.css
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $OpenBSD: mandoc.css,v 1.35 2021/03/30 19:23:50 schwarze Exp $ */
-/*
- * Standard style sheet for mandoc(1) -Thtml and man.cgi(8).
- *
- * Written by Ingo Schwarze .
- * I place this file into the public domain.
- * Permission to use, copy, modify, and distribute it for any purpose
- * with or without fee is hereby granted, without any conditions.
- */
-
-/* Global defaults. */
-
-html {
- --bg: #FFFFFF;
- --fg: #000000; }
-body { background: var(--bg);
- color: var(--fg);
- font-family: monospace,Helvetica,Arial,sans-serif;
- max-width: 80ch;
- margin: 1em auto;
- padding: 0 1ch;
- }
-h1 { font-size: 110%; }
-table { margin-top: 0em;
- margin-bottom: 0em;
- border-collapse: collapse; }
-/* Some browsers set border-color in a browser style for tbody,
- * but not for table, resulting in inconsistent border styling. */
-tbody { border-color: inherit; }
-tr { border-color: inherit; }
-td { vertical-align: top;
- padding-left: 0.2em;
- padding-right: 0.2em;
- border-color: inherit; }
-ul, ol, dl { margin-top: 0em;
- margin-bottom: 0em; }
-li, dt { margin-top: 1em; }
-pre { font-family: inherit; }
-
-.permalink { border-bottom: thin dotted;
- color: inherit;
- font: inherit;
- text-decoration: inherit; }
-* { clear: both }
-
-/* Search form and search results. */
-
-form {
- position: sticky;
- top: 0px;
- background-color: var(--bg);
- z-index: 1;
-}
-
-fieldset { border: thin solid silver;
- border-radius: 0.3em;
- text-align: center; }
-input[name=expr] {
- width: 25%; }
-
-table.results { margin-top: 1em;
- margin-left: 2em;
- font-size: smaller; }
-
-/* Header and footer lines. */
-
-table.head { width: 100%;
- border-bottom: 1px dotted #808080;
- margin-bottom: 1em;
- font-size: smaller;
- overflow-wrap: anywhere; }
-td.head-vol { text-align: center; }
-td.head-rtitle {
- text-align: right; }
-
-table.foot { width: 100%;
- border-top: 1px dotted #808080;
- margin-top: 1em;
- font-size: smaller;
- overflow-wrap: anywhere; }
-td.foot-os { text-align: right; }
-
-table.Nm {
- overflow-wrap:anywhere;
-}
-
-/* Sections and paragraphs. */
-
-.manual-text {
- margin-left: 3.8em; }
-h1.Sh { margin-top: 1.2em;
- margin-bottom: 0.6em;
- margin-left: -3.2em; }
-h2.Ss { margin-top: 1.2em;
- margin-bottom: 0.6em;
- margin-left: -1.2em;
- font-size: 105%; }
-.Pp { margin: 0.6em 0em; }
-
-/* Displays and lists. */
-
-.Bd-indent { margin-left: 3.8em; }
-
-.Bl-bullet { list-style-type: disc;
- padding-left: 1em; }
-.Bl-dash { list-style-type: none;
- padding-left: 0em; }
-.Bl-dash > li:before {
- content: "\2014 "; }
-.Bl-item { list-style-type: none;
- padding-left: 0em; }
-.Bl-compact > li {
- margin-top: 0em; }
-
-.Bl-enum { padding-left: 2em; }
-.Bl-compact > li {
- margin-top: 0em; }
-
-.Bl-diag > dt {
- font-style: normal;
- font-weight: bold; }
-.Bl-diag > dd {
- margin-left: 0em; }
-.Bl-hang > dd {
- margin-left: 5.5em; }
-.Bl-inset > dd {
- margin-left: 0em; }
-.Bl-ohang > dd {
- margin-left: 0em; }
-.Bl-tag { margin-top: 0.6em;
- margin-left: 5.5em; }
-.Bl-tag > dt {
- float: left;
- margin-top: 0em;
- margin-left: -5.5em;
- padding-right: 0.5em;
- vertical-align: top; }
-.Bl-tag > dd {
- clear: right;
- column-count: 1; /* Force block formatting context. */
- width: 100%;
- margin-top: 0em;
- margin-left: 0em;
- margin-bottom: 0.6em;
- vertical-align: top; }
-.Bl-compact { margin-top: 0em; }
-.Bl-compact > dd {
- margin-bottom: 0em; }
-.Bl-compact > dt {
- margin-top: 0em; }
-
-.Bl-column > tbody > tr > td {
- margin-top: 1em; }
-.Bl-compact > tbody > tr > td {
- margin-top: 0em; }
-
-.Rs { font-style: normal;
- font-weight: normal; }
-.RsB { font-style: italic;
- font-weight: normal; }
-.RsI { font-style: italic;
- font-weight: normal; }
-.RsJ { font-style: italic;
- font-weight: normal; }
-.RsT { text-decoration: underline; }
-
-.tbl td { vertical-align: middle; }
-
-.HP { margin-left: 3.8em;
- text-indent: -3.8em; }
-
-/* Semantic markup for command line utilities. */
-
-code.Nm { font-style: normal;
- font-weight: bold;
- font-family: inherit;
- overflow-wrap: normal; }
-.Fl { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Cm { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Ar { font-style: italic;
- font-weight: normal; }
-.Op { display: inline; }
-.Ic { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Ev { font-style: normal;
- font-weight: normal;
- font-family: monospace; }
-.Pa { font-style: italic;
- font-weight: normal; }
-
-/* Semantic markup for function libraries. */
-
-code.In { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Fd { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Ft { font-style: italic;
- font-weight: normal; }
-.Fn { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Fa { font-style: italic;
- font-weight: normal; }
-.Vt { font-style: italic;
- font-weight: normal; }
-.Va { font-style: italic;
- font-weight: normal; }
-.Dv { font-style: normal;
- font-weight: normal;
- font-family: monospace; }
-.Er { font-style: normal;
- font-weight: normal;
- font-family: monospace; }
-
-/* Various semantic markup. */
-
-.Cd { font-style: normal;
- font-weight: bold;
- font-family: inherit; }
-.Ad { font-style: italic;
- font-weight: normal; }
-.Ms { font-style: normal;
- font-weight: bold; }
-
-/* Physical markup. */
-
-.Bf { display: inline; }
-.No { font-style: normal;
- font-weight: normal; }
-.Em { font-style: italic;
- font-weight: normal; }
-.Sy { font-style: normal;
- font-weight: bold; }
-.Li { font-style: normal;
- font-weight: normal;
- font-family: monospace; }
-
-/* Overrides to avoid excessive margins on small devices. */
-
-@media (max-width: 37.5em) {
-.manual-text {
- margin-left: 0.5em; }
-h1.Sh, h2.Ss { margin-left: 0em; }
-.Bd-indent { margin-left: 2em; }
-.Bl-hang > dd {
- margin-left: 2em; }
-.Bl-tag { margin-left: 2em; }
-.Bl-tag > dt {
- margin-left: -2em; }
-.HP { margin-left: 2em;
- text-indent: -2em; }
-}
-
-/* Overrides for a dark color scheme for accessibility. */
-
-@media (prefers-color-scheme: dark) {
-html { --bg: #000000;
- --fg: #FFFFFF; }
-:link { color: #BAD7FF; }
-:visited { color: #BAD7FF; }
-}
-
diff --git a/docs/p1ctl.8 b/docs/p1ctl.8
deleted file mode 100644
index 1702d5f..0000000
--- a/docs/p1ctl.8
+++ /dev/null
@@ -1,109 +0,0 @@
-.\"-
-.\" Copyright (c.Xc 2024 Nick Chan
-.\" SPDX-License-Identifier: MIT
-.\"
-.Dd "6 April 2024"
-.Dt p1ctl 8
-.Sh NAME
-.Nm p1ctl
-.Nd command-line access to palera1n loader
-.Sh SYNOPSIS
-.Nm
-.Ar subcommand
-.Op subcommand options
-.Op subcommand arguments
-.Sh DESCRIPTION
-.Nm
-provide a command-line interface to the graphical palera1n loader.
-.Pp
-.Nm
-interfaces with the palera1n daemon as well as palera1n's launchd hook.
-
-.Sh SUBCOMMANDS
-.Bl -tag -width -indent
-.It Xo Ar bootstrap Op Fl s
-.Op Fl S Ar password
-.Ar bootstrap-file
-.Xc
-Deploy a bootstrap from a zstd compressed tarball. With no additional options specified,
-a new password for the mobile user will be prompted for. The bootstrap you are deploying
-must match the jailbreak type (rootful or rootless) you are using.
-.Bl -tag -width -indent
-.It Fl s
-Do not prompt for the password and do not set the mobile password.
-.It Fl S Ar password
-Do not prompt and set the mobile password to the password specified.
-.El
-.Pp
-.Em NOTE:
-Unlike the graphical palera1n loader, this command only deploys the bootstrap itself,
-it does not add additional repositories nor install additional packages.
-.It Xo Ar exitsafe
-.Xc
-Exit
-.Nm palera1n
-safe mode, and trigger a userspace reboot. This command will succeed
-even if the device is not currently in safe mode. In this case, a userspace reboot
-is still triggered.
-.Pp
-.Em NOTE:
-Many tweak injection packages also provide their own safe mode, p1ctl does not
-recognize and cannot control those safe modes.
-.It Xo Ar help Op Ar subcommand
-.Xc
-Prints help text. If
-.Ar subcommand
-is specified, print help about the subcommand.
-.It Xo Ar kbase
-.Xc
-Print a hexadecimal representation of the kernel base.
-.It Xo Ar kslide
-.Xc
-Print a hexadecimal representation of the kernel slide.
-.It Xo Ar palera1n_flags
-.Xc
-Print a representation of the palera1n flags, which corresponds to the options passed
-to
-.Xr palera1n 1
-as well as hints to the palera1n userspace stack set by
-.Nm PongoOS
-\[char46]
-By default, a hexadecimal representation of the flags will be printed.
-.Bl -tag -width -indent
-.It Fl d
-Read the flags from the ramdisk block device instead of getting them by interfacing with palera1n daemon.
-.It Fl s
-Print a string representation of the flags. Each line will contain one flag, and the strings always start
-with palerain_option_, and unknown flags are represented as palerain_option_undefined.
-.El
-.It Xo Ar reboot-userspace
-.Xc
-Unmount /Developer if mounted and then reboot the userspace.
-This command exists because the /Developer mount will be broken
-after a plain userspace reboot, which breaks debugging in Xcode.
-.Nm palera1n
-also hooks the
-.Xr reboot3 3
-call so that rebooting userspace using
-.Xr launchctl 1
-does not break the /Developer mount.
-.It Xo Ar reload
-.Xc
-Causes the
-.Nm palera1n
-launchd hook to re-probe the environment and update its internal state.
-This will affect the internal environmental variables passed onto new processes,
-and is typically used after bootstrapping or reverting installs.
-.It Xo Ar revert-install
-.Xc
-Remove jailbreak files from the device. This command is not supported on rootful with fakefs. On rootful with realfs, the device will reboot after issuing this command.
-.Pp
-To remove jailbreak files on rootful with fakefs, use
-.Xr palera1n 1
-on your computer with the
-.Fl -force-revert
-.Fl f
-options instead.
-.El
-.Sh SEE ALSO
-.Xr palera1n 1
diff --git a/docs/palera1n.1 b/docs/palera1n.1
deleted file mode 100644
index 9b209b4..0000000
--- a/docs/palera1n.1
+++ /dev/null
@@ -1,396 +0,0 @@
-.\"-
-.\" Copyright (c) 2024 Nick Chan
-.\" SPDX-License-Identifier: MIT
-.\"
-.Dd "23 December 2024"
-.Dt palera1n 1
-.Sh NAME
-.Nm palera1n
-.Nd arm64 iOS/iPadOS/tvOS 15.0-26.0, bridgeOS 5.0-10.0 jailbreaking tool
-.Sh SYNOPSIS
-.Nm
-.Op Fl cCdDEfhIlLnpRsSTvV
-.Op Fl e Ar Boot arguments
-.Op Fl k Ar Pongo image
-.Op Fl o Ar overlay file
-.Op Fl r Ar ramdisk file
-.Op Fl K Ar KPF file
-.Op Fl i Ar checkra1n file
-.Op Fl -version
-.Op Fl -force-revert
-.Sh DESCRIPTION
-.Nm
-jailbreaks an arm64 (arm64e excluded) iOS/iPadOS/tvOS 15.0-26.0, bridgeOS 5.0-10.0 device,
-utilizing the
-.Em checkm8
-bootROM exploit.
-.Pp
-.Nm
-provides rootful and rootless jailbreak modes.
-On iOS/iPadOS 15.0 and later and on tvOS 18.2 or later,
-.Nm
-is able to jailbreak the device in fakefs-rootful mode, where /
-is writable, as well as rootless mode, where / cannot be written to.
-On tvOS and bridgeOS,
-only rootful is supported. On versions where fakefs-rootful is not
-applicable, palera1n modifies the actual root filesystem instead
-of making a fakefs.
-.Pp
-Due to the nature of the
-.Em checkm8
-exploit,
-.Nm
-is semi-tethered. That is, you must run the
-.Nm
-tool after the device reboot in order to enter the jailbroken state.
-However, it is not required for the device to boot.
-.Pp
-On A11 devices, that is, iPhone 8, iPhone 8 Plus and iPhone X, the passcode cannot
-be used.
-.Pp
-On iOS 15, the passcode must be off while jailbroken.
-.Pp
-On iOS 16, the passcode must be off since restore, and
-.Sy Reset All Contents and Settings
-from settings app counts as a restore.
-A backup may be used in this case.
-.Pp
-In the remainder of this document, the term "iOS" and "iPadOS" will be used interchangably
-as the difference is negligible as far as the jailbreak is concerened.
-.Pp
-.Sh SUPPORTED DEVICES
-As described above, arm64 iOS 15.0-18.0 devices are supported, here is an explicit
-list of supported devicecs:
-
-.Bl -tag -compact
-.It iPhone 6s
-.It iPhone 6s Plus
-.It iPhone SE (2016)
-.It iPhone 7
-.It iPhone 7 Plus
-.It iPhone 8
-.It iPhone 8 Plus
-.It iPhone X
-.El
-
-.Bl -tag -compact
-.It iPad mini 4
-.It iPad Air 2
-.It iPad (5th generation)
-.It iPad (6th generation)
-.It iPad (7th generation)
-.It iPad Pro (9.7")
-.It iPad Pro (12.9") (1st generation)
-.It iPad Pro (10.5")
-.It iPad Pro (12.9") (2nd generation)
-.El
-
-.Bl -tag -compact
-.It iPod Touch (7th generation)
-.El
-
-.Bl -tag -compact
-.It Apple TV HD
-.It Apple TV 4K (1st generation)
-.El
-
-.Bl -tag -compact
-.It Apple T2 iMacPro1,1
-.It Apple T2 MacBookPro15,1
-.It Apple T2 MacBookPro15,2
-.It Apple T2 Macmini8,1
-.It Apple T2 MacPro7,1
-.It Apple T2 MacBookPro15,3
-.It Apple T2 MacBookAir8,1
-.It Apple T2 MacBookPro15,4
-.It Apple T2 MacBookAir8,2
-.It Apple T2 MacBookPro16,1
-.It Apple T2 MacBookAir9,1
-.It Apple T2 MacBookPro16,2
-.It Apple T2 iMac20,1
-.It Apple T2 iMac20,2
-.It Apple T2 MacBookPro16,3
-.It Apple T2 MacBookPro16,4
-.El
-
-Support for the A8 HomePod on Darwin 21 and above could be added,
-but it is currently unsupported.
-
-arm64e devices will NEVER be supported.
-
-.Sh OPTIONS
-.Bl -tag -width -indent
-.It Fl -version
-Prints the program version and exit.
-.It Fl -force-revert
-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 , -fakefs ,
-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 , -fakefs
-\[char46]
-.It Fl B , -setup-fakefs-partial
-Like
-.Fl c , -setup-fakefs
-but the size of the created fakefs is smaller at the expense of having unwritable
-parts in rarely-written paths. When jailbreaking 16 GB devices, this option must be used
-when setting up fakefs for rootful, as they do not have enough storage for full fakefs.
-This flag is supported on iOS/iPadOS 15.0 or later and tvOS 18.2 or later, as they
-require fakefs for rootful.
-.It Fl c , -setup-fakefs
-When used with
-.Fl f , -fakefs ,
-creates the new APFS volume required for rootful. Will fail if one already exists.
-This flag is supported on iOS/iPadOS 15.0 or later and tvOS 18.2 or later, as they
-require fakefs for rootful.
-.It Fl C , -clean-fakefs
-This option is not currently supported and is a no-operation in this version of
-.Nm
-\[char46]
-.It Fl d , -demote
-Set the effective production fuse to 0, so as to enable hardware debugging features.
-.It Fl D , -dfuhelper
-Execute the DFU helper to guide the user into putting the device into DFU mode
-then exit.
-.It Fl e , -boot-args Ar boot arguments
-Specify custom XNU kernel command line. Additionally, the
-.Em wdt=-1
-argument is used during fakefs setup.
-.It Fl E , -enter-recovery
-Exit after entering recovery mode.
-.It Fl f , -fakefs
-Proceed in rootful mode. Despite its name, this applies to both full, partial fakefs, as well as realfs, and it still applies even when trying to force revert.
-.It Fl h , -help
-Prints help text.
-.It Fl i , -checkra1n-file Ar checkra1n file
-Specify the path to a custom checkra1n file.
-.It Fl k , -override-pongo Ar pongo file
-Override PongoOS image. The raw image, named
-.Em Pongo.bin
-when built, should be used. PongoOS 2.6.0 or later is required.
-.It Fl K , -override-kpf Ar KPF file
-Override the kernel patchfinder PongoOS module. The module is required to support setting
-root filesystem in paleinfo with
-.Em rootfs
-command. If in doubt, use
-.Sy https://github.com/palera1n/PongoOS
-iOS15 branch or your own fork of it.
-.It Fl l , -rootless
-Proceed in rootless mode. This option is only supported on iOS/iPadOS.
-.It Fl n , -exit-recovery
-Exit recovery mode and exit.
-.It Fl o , -override-overlay Ar overlay file
-Specify the path to a custom overlay file, which is then mounted onto /cores/binpack
-during boot, if the default ramdisk is used. The default ramdisk expects the overlay
-to contain a folder named
-.Em Applications
-at the root of it, as well as a dmg named
-.Em loader.dmg
-at the root of it. Otherwise, the device will not boot. It is also expected that it
-contains a shell, a ssh server, and various command line utilities.
-.It Fl p , -pongo-shell
-Exit after booting into a clean PongoOS shell
-.It Fl P , -pongo-full
-Like
-.Fl p , -pongo-shell
-but default images and options have been uploaded and applied respectively.
-.It Fl r , -override-ramdisk Ar ramdisk file
-Override the ramdisk. At a very minimum, it should contain
-.Em /cores/ploosh
-as well as a fake dyld
-.Em /usr/lib/dyld
-where the logic is expected to be in.
-.It Fl R , -reboot-device
-Reboot device in normal mode and exit.
-.It Fl s , -safe-mode
-Enter safe mode. An alert will be displayed on iOS/iPadOS/tvOS. Jailbreak daemons nor early boot executable files
-specified (see
-.Sy FILES
-section below) will be executed. The loader app and the built in SSH server can still be used,
-as well as any jailbreak-specific apps you have installed.
-.It Fl S , -no-colors
-Disable colors on the command line. External programs like checkra1n clones may still output colors.
-.It Fl T , -telnetd
-Enable the TELNET daemon on port 46, all interfaces. Please note that there is no authentication and is therefore insecure.
-.It Fl v , -debug-logging
-Enable debug logging. The option may be repeated for extra verbosity.
-.It Fl V , -verbose-boot
-Boots the device in verbose mode, allowing boot logs to be seen.
-.It Fl I , -device-info
-Prints info about device and exits.
-.El
-.Sh ENVIRONMENTAL VARIABLES
-.Bl -tag -width -indent
-.It Ev TMPDIR
-This environmental variable should contain the a directory for temporary
-files. Without the
-.Fl i , -override-checkra1n
-option, files must be executable from it as the built-in checkra1n file
-is extracted and executed here. When not set, /tmp is used.
-.El
-.Sh EXAMPLES
-To (re-)jailbreak in rootless mode:
-.Pp
-.Dl "palera1n -l"
-.Pp
-To setup fakefs for rootful mode:
-.Pp
-.Dl "palera1n -fc"
-.Pp
-After the device has rebooted into recovery mode, follow the following example.
-.Pp
-To re-jailbreak in rootful mode:
-.Pp
-.Dl "palera1n -f"
-.Pp
-To remove the jailbreak in rootful mode:
-.Pp
-.Dl "palera1n --force-revert -f"
-.Pp
-To remove the jailbreak in rootless mode:
-.Pp
-.Dl "palera1n --force-revert"
-.Pp
-To verbose boot in rootful mode:
-.Pp
-.Dl "palera1n -Vf"
-.Pp
-To create a partial fakefs with bind mounts:
-.Pp
-.Dl "palera1n -Bf"
-.Pp
-To exit recovery mode:
-.Pp
-.Dl "palera1n -n"
-.Pp
-.Sh CAVEATS
-.Pp
-.Em -v
-is not a real XNU boot argument. It is interpreted by iBoot. However, since XNU
-boot arguments are set in PongoOS, which is ran after iBoot has ran, it does nothing.
-To verbose boot, use the
-.Fl V , -verbose-boot
-option when jailbreaking.
-.Pp
-Fakefs takes up around 5-10 GB of storage, and takes up to 10 minutes to setup.
-.Pp
-iOS 15.0 requires DER entitlements, and iOS 15.1 requires hash agility in code signatures.
-As a result, binaries with the old code signature format need to be resigned with a recent
-version of the Procursus fork of
-.Xr ldid 1
-before they can be ran on a device jailbroken with
-.Nm
-\[char46]
-.Pp
-When using rootful mode, the
-.Fl f , -fakefs
-flag must be specified at all times. It does not matter whether you want to create fakefs,
-create partial fakefs, rejailbreak or remove jailbreak.
-.Pp
-Due to a stock bug, using the
-.Fl V , -verbose-boot
-option might cause some versions for tvOS to crash and not boot.
-.Pp
-Offical Apple USB-C cables as well as some other USB-C cables cannot be used to enter DFU mode.
-USB-A cable with male USB-C to female USB-A adapter works fine.
-.Sh POST INSTALLATION (iOS/iPadOS)
-The palera1n loader app will take up to 1 minute to appear on the homescreen after the
-device has booted. If it does not appear, you can try using the shortcut:
-.Pp
-.Lk https://www.icloud.com/shortcuts/8cd5f489c8854ee0ab9ee38f2e62f87d
-.Pp
-to open it. After opening the loader app, select a package manager to install.
-This will also bootstrap your device.
-.Pp
-A built-in SSH server runs on port 44 on loopback interfaces.
-.Sh POST INSTALLATION (tvOS)
-.Pp
-The palera1n loader app will appear on homescreen. Open the loader and select a package manager to install.
-This will also bootstrap your device.
-.Pp
-A built-in SSH server runs on port 44 on all interfaces.
-.Sh POST INSTALLATION (bridgeOS)
-.Pp
-A built-in SSH server runs on port 44 on all interfaces.
-.Pp
-Bootstrapping is currently not supported on this device.
-.Sh FILES
-During the jailbreak process, a temporary filesystem is mounted on /cores as a place
-to stash jailbreak files needed during the boot process. No files are ever written
-onto the actual disk if you do not use the SSH server to write files or using the
-loader app to install additional jailbreak files.
-
-.Bl -tag -width "/var/jb/Library/LaunchDaemons"
-.It Pa /cores
-The location of the temporary filesystem where jailbreak files are stashed during boot.
-.It Pa /Library/LaunchDaemons
-The directory where jailbreak-specific
-.Xr launchd.plist 5
-property list files should be placed on rootful.
-.It Pa /var/jb/Library/LaunchDaemons
-The directory where jailbreak-specific
-.Xr launchd.plist 5
-property list files should be placed on rootless.
-.It Pa /etc/rc.d
-The directory where executable files that needs to be executed during boot, before
-daemons are launched, are placed on rootful. They are executed after all filesystems
-has been mounted.
-.It Pa /var/jb/etc/rc.d
-The directory where executable files that needs to be executed during boot, before
-daemons are launched, are placed on rootless. They are executed after all filesystems
-has been mounted.
-.El
-.Sh BUGS
-.Nm
-may crash if the machine it is running on has non-compliant USB devices plugged in.
-.Pp
-.Nm
-will fail to initialize on Linux when there are no USB devices plugged in.
-Usually this is not a problem on PCs since the built-in root hubs are also
-USB devices. However, on platforms such as Apple Silicon Macs in Linux, since
-there are no built-in USB hubs, at least one USB device needs to be manually
-plugged in for palera1n to be initialized.
-.Pp
-The exploit may also work less reliably on some hosts, like AMD desktops, or some MediaTek devices.
-.Pp
-The built-in SSH server might be not accessible with password after bootstrapping rootful,
-since the bootstrap uses a custom crypt() function that is not supported
-by the built-in SSH server.
-.Pp
-There are no DFU instructions for iBridge T2 as there are no known ways to connect to the T2's USB
-interface when macOS has been booted.
-.Sh DEPRECATED AND REMOVED FUNCTIONALITY
-There was an option in
-.Nm
-to force create the fakefs even when one already exists (which would overwrite
-the existing fakefs), by setting the palerain_option_setup_rootful_forced flag
-in palera1n flags. This option was removed because using
-.Fl -force-revert
-and
-.Fl c
-at the same time has exactly the same effect.
-.Pp
-The hook that enabled
-.Sy launchctl runstats
-has been removed, since it leaks memory in launchd.
-.Sh SEE ALSO
-.Xr launchd 8
-.Xr launchd.plist 5
-.Xr ldid 1
-.Xr p1ctl 8
-.Sh HISTORY
-The
-.Nm
-jailbreak was first written by Nebula and Mineek on September 26, 2022, as a shell
-script. Tweak support with DEVELOPMENT kernels are added on October 2, 2022. RELEASE
-kernel support is added on November 14, 2022. iOS 16 Support is added on
-December 13, 2022. Later, the first attempt to rewrite palera1n into C begins on January
-01 2023. The
-.Nm
-utility described here is the second attempt, which first started on January 16, 2023,
-using checkra1n 1337 and a custom KPF.
-Something happened on August 15, 2023.
diff --git a/include/ANSI-color-codes.h b/include/ANSI-color-codes.h
deleted file mode 100644
index 09bab04..0000000
--- a/include/ANSI-color-codes.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * This is free and unencumbered software released into the public domain.
- *
- * For more information, please refer to
- */
-
-#ifndef ANSI_COLOR_CODES_H
-#define ANSI_COLOR_CODES_H
-
-//Regular text
-#define BLK "\033[0;30m"
-#define RED "\033[0;31m"
-#define GRN "\033[0;32m"
-#define YEL "\033[0;33m"
-#define BLU "\033[0;34m"
-#define MAG "\033[0;35m"
-#define CYN "\033[0;36m"
-#define WHT "\033[0;37m"
-
-//Regular bold text
-#define BBLK "\033[1;30m"
-#define BRED "\033[1;31m"
-#define BGRN "\033[1;32m"
-#define BYEL "\033[1;33m"
-#define BBLU "\033[1;34m"
-#define BMAG "\033[1;35m"
-#define BCYN "\033[1;36m"
-#define BWHT "\033[1;37m"
-
-//Regular underline text
-#define UBLK "\033[4;30m"
-#define URED "\033[4;31m"
-#define UGRN "\033[4;32m"
-#define UYEL "\033[4;33m"
-#define UBLU "\033[4;34m"
-#define UMAG "\033[4;35m"
-#define UCYN "\033[4;36m"
-#define UWHT "\033[4;37m"
-
-//Regular background
-#define BLKB "\033[40m"
-#define REDB "\033[41m"
-#define GRNB "\033[42m"
-#define YELB "\033[43m"
-#define BLUB "\033[44m"
-#define MAGB "\033[45m"
-#define CYNB "\033[46m"
-#define WHTB "\033[47m"
-
-//High intensty background
-#define BLKHB "\033[0;100m"
-#define REDHB "\033[0;101m"
-#define GRNHB "\033[0;102m"
-#define YELHB "\033[0;103m"
-#define BLUHB "\033[0;104m"
-#define MAGHB "\033[0;105m"
-#define CYNHB "\033[0;106m"
-#define WHTHB "\033[0;107m"
-
-//High intensty text
-#define HBLK "\033[0;90m"
-#define HRED "\033[0;91m"
-#define HGRN "\033[0;92m"
-#define HYEL "\033[0;93m"
-#define HBLU "\033[0;94m"
-#define HMAG "\033[0;95m"
-#define HCYN "\033[0;96m"
-#define HWHT "\033[0;97m"
-
-//Bold high intensity text
-#define BHBLK "\033[1;90m"
-#define BHRED "\033[1;91m"
-#define BHGRN "\033[1;92m"
-#define BHYEL "\033[1;93m"
-#define BHBLU "\033[1;94m"
-#define BHMAG "\033[1;95m"
-#define BHCYN "\033[1;96m"
-#define BHWHT "\033[1;97m"
-
-//Reset
-#define reset "\033[0m"
-#define CRESET "\033[0m"
-#define COLOR_RESET "\033[0m"
-
-#endif
diff --git a/include/palerain.h b/include/palerain.h
deleted file mode 100644
index baf708b..0000000
--- a/include/palerain.h
+++ /dev/null
@@ -1,226 +0,0 @@
-#ifndef PALERAIN_H
-#define PALERAIN_H
-
-#if defined(__APPLE__)
-#define NSIG __DARWIN_NSIG
-#endif
-
-#include "xxd-embedded.h"
-#include "paleinfo.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define LOG(loglevel, ...) p1_log(loglevel, __FILE__, __LINE__, __func__, __VA_ARGS__)
-#define CLEAR() printf("\33[2K\r");
-#define palerain_option_case(x) (512 + x)
-#define palerain_option_version 129
-#define CMD_LEN_MAX 512
-#define OVERRIDE_MAGIC 0xd803b376
-
-#define palerain_option_case_version palerain_option_case(0)
-#define palerain_option_case_force_revert palerain_option_case(1)
-#define palerain_option_case_libcheckra1nhelper_path palerain_option_case(2)
-#define palerain_option_case_cli palerain_option_case(3)
-
-
-#ifdef USE_LIBUSB
-#include
-
-#define USB_RET_SUCCESS LIBUSB_SUCCESS
-#define USB_RET_NOT_RESPONDING LIBUSB_ERROR_OTHER
-#define USB_RET_IO LIBUSB_ERROR_IO
-#define USB_RET_NO_DEVICE LIBUSB_ERROR_NO_DEVICE
-typedef int32_t usb_ret_t;
-typedef libusb_device_handle *usb_device_handle_t;
-
-typedef struct stuff
-{
- pthread_t th;
- libusb_device *dev;
- usb_device_handle_t handle;
-} stuff_t;
-usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, int len);
-#else
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpedantic"
-#include
-#include
-#include
-#pragma clang diagnostic pop
-
-#define USB_RET_SUCCESS KERN_SUCCESS
-#define USB_RET_NOT_RESPONDING kIOReturnNotResponding
-#define USB_RET_IO kIOReturnNotReady
-#define USB_RET_NO_DEVICE kIOReturnNoDevice
-
-typedef IOReturn usb_ret_t;
-typedef IOUSBInterfaceInterface245 **usb_device_handle_t;
-
-typedef struct
-{
- pthread_t th;
- volatile uint64_t regID;
- IOUSBDeviceInterface245 **dev;
- usb_device_handle_t handle;
-} stuff_t;
-usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len);
-#endif
-
-#ifndef PALERAIN_VERSION
-#define PALERAIN_VERSION "2.2.1"
-#endif
-
-#if defined(__APPLE__)
-#include
-#include
-#else
-#define MH_MAGIC_64 0xfeedfacf
-#define MH_CIGAM_64 0xcffaedfe
-#define MH_KEXT_BUNDLE 0xb
-
-typedef int32_t cpu_type_t;
-typedef int32_t cpu_subtype_t;
-
-#define CPU_ARCH_ABI64 0x01000000
-#define CPU_TYPE_ARM ((cpu_type_t) 12)
-#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
-
-struct mach_header_64
-{
- uint32_t magic; /* mach magic number identifier */
- cpu_type_t cputype; /* cpu specifier */
- cpu_subtype_t cpusubtype; /* machine specifier */
- uint32_t filetype; /* type of file */
- uint32_t ncmds; /* number of load commands */
- uint32_t sizeofcmds; /* the size of all the load commands */
- uint32_t flags; /* flags */
- uint32_t reserved; /* reserved */
-};
-#endif
-
-typedef void *(*pthread_start_t)(void *);
-
-// Keep in sync with Pongo
-#define PONGO_USB_VENDOR 0x05ac
-#define PONGO_USB_PRODUCT 0x4141
-#define CMD_LEN_MAX 512
-#define UPLOADSZ_MAX (1024 * 1024 * 128)
-
-typedef enum {
- LOG_FATAL = 0,
- LOG_ERROR = 1,
- LOG_WARNING = 2,
- LOG_INFO = 3,
- LOG_VERBOSE = 4,
- LOG_VERBOSE2 = 5,
- LOG_VERBOSE3 = 6,
- LOG_VERBOSE4 = 7,
- LOG_VERBOSE5 = 8,
-} log_level_t;
-
-typedef struct {
- uint64_t ecid;
- char* productType;
- char* productVersion;
- char* buildVersion;
- char* CPUArchitecture;
- const char* displayName;
-} devinfo_t;
-
-typedef struct {
- int mode;
- int cpid;
- char product_type[0x20];
- char display_name[0x20];
- char iboot_ver[0x20];
-} recvinfo_t;
-
-typedef struct {
- uint32_t magic; /* 0xd803b376*/
- unsigned char* ptr; /* pointer to the override file in memory */
- uint32_t len; /* length of override file */
- unsigned char* orig_ptr; /* pointer to the overriden file */
- uint32_t orig_len; /* length of the overriden file */
- int fd; /* file descriptor of the override file */
-} override_file_t;
-
-typedef unsigned char niarelap_file_t[];
-
-extern unsigned int verbose;
-
-extern char* pongo_path;
-#ifdef TUI
-extern bool tui_started;
-#endif
-
-extern uint64_t palerain_flags;
-extern uint64_t* palerain_flags_p;
-
-extern pthread_t dfuhelper_thread, pongo_thread;
-extern int pongo_thr_running, dfuhelper_thr_running;
-
-extern niarelap_file_t *kpf_to_upload_1, *ramdisk_to_upload_1, *overlay_to_upload_1;
-extern niarelap_file_t **kpf_to_upload, **ramdisk_to_upload, **overlay_to_upload;
-extern override_file_t override_ramdisk, override_kpf, override_overlay;
-
-extern uint64_t palerain_flags;
-extern pthread_mutex_t log_mutex;
-
-extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
-
-extern int pongo_thr_running, dfuhelper_thr_running;
-extern bool device_has_booted;
-extern char xargs_cmd[0x270];
-extern char palerain_flags_cmd[0x30];
-extern char* ext_checkra1n;
-
-void thr_cleanup(void* ptr);
-void* dfuhelper(void* ptr);
-int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, const char* __restrict format, ...);
-/* devhelper helpers */
-void devinfo_free(devinfo_t *dev);
-bool cpid_is_arm64(unsigned int cpid);
-/* devhelper commands */
-int subscribe_cmd(usbmuxd_event_cb_t device_event_cb, irecv_device_event_cb_t irecv_event_cb);
-int unsubscribe_cmd(void);
-int devinfo_cmd(devinfo_t *dev, const char *udid);
-int enter_recovery_cmd(const char* udid);
-int reboot_cmd(const char* udid);
-int passstat_cmd(unsigned char* status, const char* udid);
-int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid);
-int autoboot_cmd(const uint64_t ecid);
-int exitrecv_cmd(const uint64_t ecid);
-
-int exec_checkra1n(void);
-int override_file(override_file_t *finfo, niarelap_file_t** orig, unsigned int *orig_len, char *filename);
-void* pongo_helper(void* ptr);
-const unsigned char *
-boyermoore_horspool_memmem(const unsigned char* haystack, size_t hlen,
- const unsigned char* needle, size_t nlen);
-
-
-usb_ret_t USBControlTransfer(usb_device_handle_t handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint32_t wLength, void *data, uint32_t *wLenDone);
-const char *usb_strerror(usb_ret_t err);
-int wait_for_pongo(void);
-int tui(void);
-int optparse(int argc, char* argv[]);
-
-bool get_spin(void);
-bool set_spin(bool val);
-bool get_found_pongo(void);
-void* pongo_helper(void* _);
-bool set_found_pongo(bool val);
-uint64_t get_ecid_wait_for_dfu(void);
-uint64_t set_ecid_wait_for_dfu(uint64_t ecid);
-
-void io_start(stuff_t *stuff);
-void io_stop(stuff_t *stuff);
-
-void print_credits(void);
-
-#endif
diff --git a/include/tui.h b/include/tui.h
deleted file mode 100644
index fc5e944..0000000
--- a/include/tui.h
+++ /dev/null
@@ -1,184 +0,0 @@
-#ifndef TUI_H
-#define TUI_H
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define WIDTH 76
-#define HEIGHT 19
-
-#define CHECKBOX_STATE(flags, opt) (flags & opt) != 0 ? '*' : ' '
-
-#define STR_HELPER(x) #x
-#define STR(x) STR_HELPER(x)
-
-#define CLEAR_SCREEN printf("\033[2J")
-#define RESETFONT printf("\x1b[0m")
-#define PRINTAT(x, y, str) printf("\x1b[%d;%dH%s", y, x, str)
-#define PRINTATT(x, y, str) PRINTAT(tui_x_offset + x, tui_y_offset + y, str)
-#define PRINTATLEN(x, y, str, len) printf("\x1b[%d;%dH%." STR(len) "s", y, x, str)
-#define PRINTATLENT(x, y, str, len) PRINTATLEN(tui_x_offset + x, tui_y_offset + y, str, len)
-#define MOVETO(x, y) printf("\x1b[%d;%dH", y, x)
-#define MOVETOT(x, y) MOVETO(tui_x_offset + x, tui_y_offset + y)
-#define SETCOLOR(fg, bg) printf("\x1b[%d;%dm", fg, bg)
-#define SETCOLORA(fg, bg, a) printf("\x1b[" STR(fg) ";" STR(bg) ";" STR(a) "m")
-#define COLOR(fg, bg) "\x1b[" STR(fg) ";" STR(bg) "m"
-#define FG_BLACK 30
-#define FG_YELLOW 33
-#define FG_BLUE 34
-#define FG_WHITE 37
-#define BG_BLACK 40
-#define BG_YELLOW 43
-#define BG_BLUE 44
-#define BG_WHITE 47
-#define NONE 0
-#define BOLD 1
-extern bool supports_bright_colors;
-#define FG_BRIGHT_BLACK 90
-#define FG_BRIGHT_WHITE 97
-#define BG_BRIGHT_BLACK 100
-#define BG_BRIGHT_WHITE 107
-#define G1D4(set) printf("\x1b\x29%c", set)
-#define DSGON putchar('\x0e'); G1D4('0')
-#define DSGOFF putchar('\x0f'); G1D4('B')
-#define MOUSEON printf("\x1b[?1003h")
-#define MOUSEOFF printf("\x1b[?1003l")
-#define CIVIS printf("\x1b[?25l")
-#define CNORM printf("\x1b[?25h")
-#define SMCUP printf("\x1b[?1049h")
-#define RMCUP printf("\x1b[?1049l")
-#define DRAWLINE(x, y, len) \
- MOVETO(x, y); \
- DSGON; \
- for (int i = 0; i < len; i++) { \
- putchar(0x71); \
- } \
- DSGOFF;
-#define DRAWLINET(x, y, len) DRAWLINE(tui_x_offset + x, tui_y_offset + y, len)
-
-typedef enum tui_screens {
- ERROR_SCREEN = -1,
- EXIT_SCREEN = 0,
- MAIN_SCREEN = 1,
- OPTIONS_SCREEN = 2,
- ENTER_DFU_SCREEN = 3,
- JAILBREAK_SCREEN = 4,
- ENTER_RECOVERY_SCREEN = 5
-} tui_screen_t;
-
-typedef struct bitfield_checkbox_info {
- uint64_t* flags_p;
- uint64_t opt;
-} tui_bit_info_t;
-
-tui_screen_t tui_screen_main(void);
-void tui_screen_main_redraw(void);
-tui_screen_t tui_screen_options(void);
-void tui_screen_options_redraw(void);
-tui_screen_t tui_screen_enter_recovery(void);
-void tui_screen_enter_recovery_redraw(void);
-tui_screen_t tui_screen_enter_dfu(void);
-void tui_screen_enter_dfu_redraw(void);
-tui_screen_t tui_screen_jailbreak(void);
-void tui_screen_jailbreak_redraw(void);
-
-int redraw_screen(void);
-
-void tui_draw_rectangle(int x1, int y1, int x2, int y2);
-
-#ifdef BUILD_TAG
-#define TUI_VERSION BUILD_TAG
-#else
-#define TUI_VERSION "Unknown Version"
-#endif
-
-extern int tui_x_offset;
-extern int tui_y_offset;
-
-extern int tui_mouse_x;
-extern int tui_mouse_y;
-
-enum {
- TUI_INPUT_NONE,
- TUI_INPUT_LEFT,
- TUI_INPUT_RIGHT,
- TUI_INPUT_UP,
- TUI_INPUT_DOWN,
- TUI_INPUT_MOUSE_MOVE,
- TUI_INPUT_MOUSE_DOWN,
- TUI_INPUT_MOUSE_UP,
- TUI_INPUT_SELECT,
- TUI_INPUT_TAB,
- TUI_INPUT_TAB_BACK,
- TUI_INPUT_BACKSPACE,
- TUI_INPUT_ESCAPE,
-};
-
-enum {
- TUI_EVENT_INPUT,
- TUI_EVENT_CONNECTED_DEVICES_CHANGED,
- TUI_EVENT_JAILBREAK_STATUS_CHANGED
-};
-
-int tui_get_input(void);
-void *tui_input_thread(void *arg);
-int tui_get_event(void);
-int tui_try_get_event(void);
-
-extern int tui_last_event;
-extern int tui_last_input;
-extern sem_t *tui_event_semaphore;
-extern char tui_last_key;
-
-void tui_devhelper(void);
-
-enum tui_device_mode {
- TUI_DEVICE_MODE_NORMAL,
- TUI_DEVICE_MODE_RECOVERY,
- TUI_DEVICE_MODE_DFU
-};
-
-struct tui_connected_device {
- uint64_t ecid;
- char udid[44];
- char version[0x20];
- bool arm64;
- enum tui_device_mode mode;
- char product_type[0x20];
- char display_name[0x20];
- unsigned int cpid;
- bool requires_passcode_disabled;
- bool passcode_state;
- struct tui_connected_device *next;
-};
-
-extern struct tui_connected_device *tui_connected_devices;
-
-void tui_jailbreak(void);
-extern bool tui_is_jailbreaking;
-extern int tui_jailbreak_stage;
-extern char *tui_jailbreak_status;
-
-void tui_jailbreak_status_changed(void);
-
-extern bool tui_is_restarting;
-void tui_terminate(int sig);
-
-extern bool tui_options_safe_mode;
-extern bool tui_options_verbose_boot;
-extern bool tui_options_force_revert;
-extern bool tui_options_flower_chain;
-
-extern char tui_options_boot_args[0x1e0 + 1];
-
-#endif
diff --git a/include/xxd-embedded.h b/include/xxd-embedded.h
deleted file mode 100644
index e63d671..0000000
--- a/include/xxd-embedded.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef XXD_EMBEDDED_H
-#define XXD_EMBEDDED_H
-
-#if defined(__APPLE__)
-#include
-#endif
-
-#include
-
-extern uint8_t checkra1n[];
-extern uint32_t checkra1n_len;
-
-extern uint8_t checkra1n_kpf_pongo_lzma[];
-extern uint32_t checkra1n_kpf_pongo_lzma_len;
-
-extern uint8_t ramdisk_dmg_lzma[];
-extern uint32_t ramdisk_dmg_lzma_len;
-
-extern uint8_t binpack_dmg[];
-extern uint32_t binpack_dmg_len;
-
-extern uint8_t Pongo_bin[];
-extern uint32_t Pongo_bin_len;
-
-#if defined(__APPLE__) && (TARGET_OS_IPHONE || defined(DEV_BUILD) || defined(FORCE_HELPER))
-extern uint8_t libcheckra1nhelper_dylib[];
-extern uint32_t libcheckra1nhelper_dylib_len;
-#endif
-
-#endif
diff --git a/packaging/control b/packaging/control
deleted file mode 100644
index 10bf74c..0000000
--- a/packaging/control
+++ /dev/null
@@ -1,22 +0,0 @@
-Package: palera1n
-Name: palera1n
-Version: @DEB_VERSION@
-Architecture: @DEB_ARCH@
-Maintainer: palera1n team
-Author: palera1n team
-Depends: usbmuxd
-Section: Utilities
-Priority: optional
-Homepage: https://palera.in
-Description: iOS 15.0+ semi-tethered checkm8 jailbreak
- palera1n is an iOS/iPadOS 15.0+ semi tethered jailbreak
- based on the checkm8 exploit.
- .
- palera1n is able to jailbreak the device in fakefs-rootful mode,
- where / is writable, as well as rootless mode, where / cannot be
- written to.
- .
- IMPORTANT: This does NOT make palera1n untethered or allow you to
- jailbreak your current device without a computer. It just allows
- you to jailbreak another iDevice using this device, given you have
- an appropriate cable. Also, the success rate is likely to be bad.
diff --git a/packaging/control.macosx b/packaging/control.macosx
deleted file mode 100644
index f8b00e3..0000000
--- a/packaging/control.macosx
+++ /dev/null
@@ -1,16 +0,0 @@
-Package: palera1n
-Name: palera1n
-Version: @DEB_VERSION@
-Architecture: @DEB_ARCH@
-Maintainer: palera1n team
-Author: palera1n team
-Section: Utilities
-Priority: optional
-Homepage: https://palera.in
-Description: iOS 15.0+ semi-tethered checkm8 jailbreak
- palera1n is an iOS/iPadOS 15.0+ semi tethered jailbreak
- based on the checkm8 exploit.
- .
- palera1n is able to jailbreak the device in fakefs-rootful mode,
- where / is writable, as well as rootless mode, where / cannot be
- written to.
diff --git a/patches/gpm/001_missing_V_option.patch b/patches/gpm/001_missing_V_option.patch
deleted file mode 100644
index cb35a27..0000000
--- a/patches/gpm/001_missing_V_option.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Description: Add no-op option -V for compatibility
-
-Index: b/src/daemon/cmdline.c
-===================================================================
---- a/src/daemon/cmdline.c 2008-05-29 02:26:08.000000000 +0300
-+++ b/src/daemon/cmdline.c 2008-06-11 05:46:23.000000000 +0300
-@@ -32,7 +32,7 @@
- void cmdline(int argc, char **argv)
- {
- extern struct options option;
-- char options[]="a:A::b:B:d:Dg:hi:kl:m:Mo:pr:R::s:S:t:Tuv23";
-+ char options[]="a:A::b:B:d:Dg:hi:kl:m:Mo:pr:R::s:S:t:TuvV23";
- int opt;
-
- /* initialize for the dual mouse */
-@@ -81,6 +81,7 @@ void cmdline(int argc, char **argv)
- case 'u': option.autodetect = 1; break;
- case 'T': opt_test++; break;
- case 'v': printf(GPM_MESS_VERSION "\n"); exit(0);
-+ case 'V': /* Compat code */ break;
- case '2': (which_mouse->opt_three) = -1; break;
- case '3': (which_mouse->opt_three) = 1; break;
- default: exit(usage("commandline"));
diff --git a/patches/gpm/014_has_mouse_control.patch b/patches/gpm/014_has_mouse_control.patch
deleted file mode 100644
index a29ac54..0000000
--- a/patches/gpm/014_has_mouse_control.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Description: source code of gpm_has_mouse_control helper
-
-Index: b/contrib/control/gpm_has_mouse_control.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ b/contrib/control/gpm_has_mouse_control.c 2007-12-10 08:25:45.000000000 +0200
-@@ -0,0 +1,20 @@
-+#include
-+#include
-+#include
-+#include
-+#include
-+
-+int main (int argc, char **argv)
-+{
-+ int fd;
-+ int mode;
-+ fd = open ("/dev/tty0", O_RDONLY);
-+ if (fd == -1)
-+ fd = open ("/dev/vc/0", O_RDONLY);
-+ if (fd == -1)
-+ perror ("open");
-+ if (ioctl (fd, KDGETMODE, &mode) != 0)
-+ perror ("ioctl");
-+ exit(mode);
-+}
-+
-Index: b/contrib/control/Makefile
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ b/contrib/control/Makefile 2007-12-10 08:25:45.000000000 +0200
-@@ -0,0 +1,7 @@
-+CC := gcc
-+
-+all: gpm_has_mouse_control.c
-+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o gpm_has_mouse_control -Wall gpm_has_mouse_control.c
-+
-+clean:
-+ -rm -f gpm_has_mouse_control
diff --git a/patches/gpm/031_max_consoles.patch b/patches/gpm/031_max_consoles.patch
deleted file mode 100644
index 26d7124..0000000
--- a/patches/gpm/031_max_consoles.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-Description: Use MAX_NR_CONSOLES instead of MAX_VC
-
---- a/src/daemon/gpm.c
-+++ b/src/daemon/gpm.c
-@@ -93,7 +93,7 @@
- int fifofd=-1;
-
- int eventFlag=0;
--Gpm_Cinfo *cinfo[MAX_VC+1];
-+Gpm_Cinfo *cinfo[MAX_NR_CONSOLES+1];
-
- time_t last_selection_time;
- time_t opt_age_limit = 0;
---- a/src/daemon/old_main.c
-+++ b/src/daemon/old_main.c
-@@ -141,7 +141,7 @@
- signal(SIGWINCH,gpm_killed); /* reinstall handler */
-
- /* and notify clients */
-- for(i=0; inext) kill(ci->data.pid,SIGWINCH);
- }
-@@ -214,7 +214,7 @@
- /*........................ got request */
-
- /* itz 10-22-96 check _all_ clients, not just those on top! */
-- for (i=0; pending && (i<=MAX_VC); i++) {
-+ for (i=0; pending && (i<=MAX_NR_CONSOLES); i++) {
- Gpm_Cinfo* ci;
- for (ci = cinfo[i]; pending && ci; ci = ci->next) {
- if (FD_ISSET(ci->fd,&selSet)) {
---- a/src/daemon/processconn.c
-+++ b/src/daemon/processconn.c
-@@ -67,8 +67,8 @@
- return -1;
- }
-
-- if((vc = request->vc) > MAX_VC) {
-- gpm_report(GPM_PR_DEBUG, GPM_MESS_REQUEST_ON, vc, MAX_VC);
-+ if((vc = request->vc) > MAX_NR_CONSOLES) {
-+ gpm_report(GPM_PR_DEBUG, GPM_MESS_REQUEST_ON, vc, MAX_NR_CONSOLES);
- free(info);
- close(newfd);
- return -1;
---- a/src/daemon/processrequest.c
-+++ b/src/daemon/processrequest.c
-@@ -41,7 +41,7 @@
-
- gpm_report(GPM_PR_INFO, GPM_MESS_CON_REQUEST, ci->fd, vc);
-
-- if (vc>MAX_VC) return -1;
-+ if (vc>MAX_NR_CONSOLES) return -1;
-
- /* itz 10-22-96 this shouldn't happen now */
- if (vc==-1) gpm_report(GPM_PR_OOPS, GPM_MESS_UNKNOWN_FD);
---- a/src/headers/daemon.h
-+++ b/src/headers/daemon.h
-@@ -26,6 +26,7 @@
- */
- #include "gpm.h" /* Gpm_Event */
- #include /* fd_set */
-+#include /* for cinfo -- to be moved to os/linux in 2.x! */
-
- /*************************************************************************
- * Types / structures
-@@ -104,13 +105,6 @@
- * Macros
- */
-
--/* How many virtual consoles are managed? */
--#ifndef MAX_NR_CONSOLES
--# define MAX_NR_CONSOLES 64 /* this is always sure */
--#endif
--
--#define MAX_VC MAX_NR_CONSOLES /* doesn't work before 1.3.77 */
--
- /* for adding a mouse; add_mouse */
- #define GPM_ADD_DEVICE 0
- #define GPM_ADD_TYPE 1
-@@ -174,7 +168,7 @@
- extern int eventFlag;
- extern struct winsize win;
-
--extern Gpm_Cinfo *cinfo[MAX_VC+1];
-+extern Gpm_Cinfo *cinfo[MAX_NR_CONSOLES+1];
-
- extern struct mouse_features mouse_table[3],
- *which_mouse; /*the current one*/
---- a/src/headers/gpmCfg.h
-+++ b/src/headers/gpmCfg.h
-@@ -32,14 +32,6 @@
- #include
- #endif
-
--/* FIXME: still needed ?? */
--/* How many virtual consoles are managed? */
--#ifndef MAX_NR_CONSOLES
--# define MAX_NR_CONSOLES 64 /* this is always sure */
--#endif
--
--#define MAX_VC MAX_NR_CONSOLES /* doesn't work before 1.3.77 */
--
- /* How many buttons may the mouse have? */
- /* #define MAX_BUTTONS 3 ===> not used, it is hardwired :-( */
-
diff --git a/patches/gpm/080_cross-compile.patch b/patches/gpm/080_cross-compile.patch
deleted file mode 100644
index 15c3589..0000000
--- a/patches/gpm/080_cross-compile.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Description: Add AC_CANONICAL_HOST
-
---- a/configure.ac.footer
-+++ b/configure.ac.footer
-@@ -35,6 +35,8 @@
- # Find programs
- #
-
-+AC_CANONICAL_HOST
-+
- AC_PROG_CC
- AC_PROG_LIBTOOL
- AC_PROG_INSTALL
diff --git a/patches/gpm/092_fix-format-not-a-string-literal-and-no-format-arguments.patch b/patches/gpm/092_fix-format-not-a-string-literal-and-no-format-arguments.patch
deleted file mode 100644
index 87e5958..0000000
--- a/patches/gpm/092_fix-format-not-a-string-literal-and-no-format-arguments.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Fix FTBFS with -Wformat-security
-Author: Axel Beckert
-Bug-Debian: https://bugs.debian.org/888792
-Bug-Debian: https://bugs.debian.org/888797
-
---- a/src/lib/report-lib.c
-+++ b/src/lib/report-lib.c
-@@ -47,7 +47,7 @@
- log_level = LOG_CRIT; break;
- }
- #ifdef HAVE_VSYSLOG
-- syslog(log_level, string);
-+ syslog(log_level, "%s", string);
- vsyslog(log_level, text, ap);
- #else
- fprintf(stderr,"%s[%s(%d)]:\n",string,file,line);
diff --git a/patches/gpm/093_fix-typos.patch b/patches/gpm/093_fix-typos.patch
deleted file mode 100644
index 3e940b4..0000000
--- a/patches/gpm/093_fix-typos.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-Description: Fix spelling errors found by lintian
-Author: Axel Beckert
-
---- a/doc/FAQ
-+++ b/doc/FAQ
-@@ -132,7 +132,7 @@
- to keep hold of processor time for at least 1 second).
- - no pnp vendor will be able to support three buttons any more (no
- more mouse protocols, all mice must behave the same).
-- - similary, only 1200 baud devices (any serial device) are supported,
-+ - similarly, only 1200 baud devices (any serial device) are supported,
- because the initialization string of pnp devices only tells
- the vendor and release, with no information about required
- port configuration.
---- a/doc/doc.gpm.in
-+++ b/doc/doc.gpm.in
-@@ -394,7 +394,7 @@
- automatically forces the @emph{repeater} (@samp{\-R}) option on.
-
- @item \-o @var{list-of-extra-options}
-- The option works similary to the ``\-o'' option of mount; it is
-+ The option works similarly to the ``\-o'' option of mount; it is
- used to specify a list of ``extra options'' that are specific
- to each mouse type. The list is comma-separated. The options
- @samp{dtr}, @samp{rts} or @samp{both} are used by the serial
---- a/src/daemon/old_main.c
-+++ b/src/daemon/old_main.c
-@@ -190,7 +190,7 @@
- /*....................................... got mouse, process event */
- /*
- * Well, actually, run a loop to maintain inlining of functions without
-- * lenghtening the file. This is not too clean a code, but it works....
-+ * lengthening the file. This is not too clean a code, but it works....
- */
-
- for (i=1; i <= 1+opt_double; i++) {
---- a/src/mice.c
-+++ b/src/mice.c
-@@ -122,7 +122,7 @@
- break;
- }
- if (p->type == ARGV_END) { /* not found */
-- fprintf(stderr, "%s: Uknown option \"%s\" for pointer \"%s\"\n",
-+ fprintf(stderr, "%s: Unknown option \"%s\" for pointer \"%s\"\n",
- option.progname, argv[i], argv[0]);
- errors++;
- continue;
---- a/src/prog/mouse-test.c
-+++ b/src/prog/mouse-test.c
-@@ -524,7 +524,7 @@
- Gpm_Event event;
-
- if (packetsize!=cur->this->packetlen) {
-- REMOVETYPE(cur,"different packet lenght");
-+ REMOVETYPE(cur,"different packet length");
- continue;
- }
-
---- a/src/synaptics.c
-+++ b/src/synaptics.c
-@@ -2471,7 +2471,7 @@
- #define PS2_SCALE_11 0xE6 /* Set scale to 1:1 */
-
-
--/* Normal ps2 responce */
-+/* Normal ps2 response */
- #define PS2_ERROR 0xFC /* Error, after a reset,resend or disconnect*/
- #define PS2_ACK 0xFA /* Command acknowledge */
- #define PS2_READY 0xAA /* Send after a calibration or ERROR */
-@@ -2538,7 +2538,7 @@
- }
-
- # ifdef DEBUG_PUTBYTE_ACK
-- gpm_report(GPM_PR_DEBUG,"Responce %X to byte %X",ack,b);
-+ gpm_report(GPM_PR_DEBUG,"Response %X to byte %X",ack,b);
- # endif
-
- return ack;
-@@ -2565,11 +2565,11 @@
-
- /* Do some sanity checking */
- if((response[0] & 0xFC) != 0x84) {
-- gpm_report (GPM_PR_ERR,"Byte 0 of stick device responce is not valid");
-+ gpm_report (GPM_PR_ERR,"Byte 0 of stick device response is not valid");
- return -1;
- }
- if((response[3] & 0xCC) != 0xC4) {
-- gpm_report (GPM_PR_ERR,"Byte 3 of stick device responce is not valid");
-+ gpm_report (GPM_PR_ERR,"Byte 3 of stick device response is not valid");
- return -1;
- }
- }
-@@ -2844,7 +2844,7 @@
- byte status,id_code = PS2_MOUSE_IDCODE;
- byte reset_cmd = PS2_RESET;
-
-- gpm_report(GPM_PR_DEBUG,"Reseting Synaptic PS/2 %s\n",(stick?"Stick":"Touchpad"));
-+ gpm_report(GPM_PR_DEBUG,"Resetting Synaptic PS/2 %s\n",(stick?"Stick":"Touchpad"));
-
- /* Send reset command without eating the ack. */
- if(!stick) {
-@@ -2871,11 +2871,11 @@
- usleep(750000);
-
- if ( (status = syn_ps2_getbyte(fd,stick)) != PS2_READY ){
-- gpm_report(GPM_PR_ERR,"Reseting PS/2 Device failed: No READY, got %02X.\n"
-+ gpm_report(GPM_PR_ERR,"Resetting PS/2 Device failed: No READY, got %02X.\n"
- "Check pc_keyb.c for reconnect smartness.\n",status);
- }
- if ( (id_code = syn_ps2_getbyte(fd,stick)) != PS2_MOUSE_IDCODE){
-- gpm_report(GPM_PR_ERR,"Reseting PS/2 Device failed: Wrong ID, got %02X.\n",id_code);
-+ gpm_report(GPM_PR_ERR,"Resetting PS/2 Device failed: Wrong ID, got %02X.\n",id_code);
- }
-
- }
-@@ -3155,7 +3155,7 @@
-
- void syn_serial_reset(int fd)
- {
-- gpm_report (GPM_PR_INFO,"Reseting Synaptic Serial Touchpad.");
-+ gpm_report (GPM_PR_INFO,"Resetting Synaptic Serial Touchpad.");
-
- syn_serial_set_mode (fd, (RELATIVE_MODE |
- HIGH_REPORT_RATE |
-@@ -3247,7 +3247,7 @@
-
- void syn_ps2_reset (int fd)
- {
-- gpm_report (GPM_PR_INFO,"Reseting Synaptic PS/2 Touchpad.");
-+ gpm_report (GPM_PR_INFO,"Resetting Synaptic PS/2 Touchpad.");
-
- /* Stop incoming motion data (of whatever kind absolute/relative). */
- tp_ps2_disable_data(fd);
diff --git a/patches/gpm/094_gpm-1.20.7-glibc-2.26-1.patch b/patches/gpm/094_gpm-1.20.7-glibc-2.26-1.patch
deleted file mode 100644
index 1a6868e..0000000
--- a/patches/gpm/094_gpm-1.20.7-glibc-2.26-1.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Origin: http://download.nutyx.org/x86_64/rolling/cli/gpm/gpm-1.20.7-consolidated-1.patch
-Bug: https://github.com/telmich/gpm/issues/21
-Bug-Debian: https://bugs.debian.org/886903
-Bug-LFS: https://wiki.linuxfromscratch.org/blfs/ticket/9616#ticket
-Author: tnut from nutyx.org, https://github.com/tnut
-Description: Fix FTBFS with glibc 2.26
-
---- a/src/daemon/open_console.c
-+++ b/src/daemon/open_console.c
-@@ -24,6 +24,10 @@
- #include /* ioctl */
- #include /* major() */
-
-+#ifdef HAVE_SYS_SYSMACROS_H
-+#include /* major() w/newer glibc */
-+#endif
-+
- /* Linux specific (to be outsourced in gpm2 */
- #include /* for serial console check */
- #include /* for serial console check */
---- a/src/prog/gpm-root.y
-+++ b/src/prog/gpm-root.y
-@@ -443,6 +443,7 @@
- }
-
- /*---------------------------------------------------------------------*/
-+#if 0
- static int f_debug_one(FILE *f, Draw *draw)
- {
- DrawItem *ip;
-@@ -465,6 +466,7 @@
- #undef LINE
- return 0;
- }
-+#endif
-
- int f_debug(int mode, DrawItem *self, int uid)
- {
-@@ -960,10 +962,8 @@
- /*------------*/
- static inline void scr_restore(int fd, FILE *f, unsigned char *buffer, int vc)
- {
-- int x,y, dumpfd;
-+ int dumpfd;
- char dumpname[20];
--
-- x=buffer[2]; y=buffer[3];
-
- /* WILL NOT WORK WITH DEVFS! FIXME! */
- sprintf(dumpname,"/dev/vcsa%i",vc);
-@@ -1196,11 +1196,7 @@
- LOG_DAEMON : LOG_USER);
- /* reap your zombies */
- childaction.sa_handler=reap_children;
--#if defined(__GLIBC__)
-- __sigemptyset(&childaction.sa_mask);
--#else /* __GLIBC__ */
-- childaction.sa_mask=0;
--#endif /* __GLIBC__ */
-+ sigemptyset(&childaction.sa_mask);
- childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
- sigaction(SIGCHLD,&childaction,NULL);
-
diff --git a/patches/gpm/095_fix-compilation-with-gcc-10.patch b/patches/gpm/095_fix-compilation-with-gcc-10.patch
deleted file mode 100644
index c8be146..0000000
--- a/patches/gpm/095_fix-compilation-with-gcc-10.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Description: FTBFS with gcc-10 due to -fno-commons
-Author: Sergei Trofimovich
-Reviewed-By: Helmut Grohne
-Origin: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f7e2ac82fc5a1847c132057fb7de1a996d66c76
-Forwarded: https://github.com/telmich/gpm/pull/37
-Bug: https://github.com/telmich/gpm/pull/37
-Bug-Gentoo: https://bugs.gentoo.org/705878
-Bug-Debian: https://bugs.debian.org/953266
-
---- a/src/headers/daemon.h
-+++ b/src/headers/daemon.h
-@@ -176,7 +176,7 @@
- extern Gpm_Type mice[];
- extern Gpm_Type *repeated_type;
-
--time_t last_selection_time;
-+extern time_t last_selection_time;
-
-
-
diff --git a/patches/gpm/096_fix-compilation-against-musl-libc.patch b/patches/gpm/096_fix-compilation-against-musl-libc.patch
deleted file mode 100644
index cfb8b1c..0000000
--- a/patches/gpm/096_fix-compilation-against-musl-libc.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-Description: Add musl support
- * Use SA_NODEFER instead of its non-standard alias SA_NOMASK.
- * Add missing sys/select.h and fcntl.h includes.
- * Use standard sigemptyset unconditionally.
- * Define SA_INTERRUPT if it's not defined (historical no-op).
- * With these changes gpm builds against musl libc.
-Author: Szabolcs Nagy
-Bug-Debian: https://bugs.debian.org/813751
-
---- a/src/lib/liblow.c
-+++ b/src/lib/liblow.c
-@@ -179,7 +179,7 @@
- /* Reincarnation. Prepare for another death early. */
- sigemptyset(&sa.sa_mask);
- sa.sa_handler = gpm_suspend_hook;
-- sa.sa_flags = SA_NOMASK;
-+ sa.sa_flags = SA_NODEFER;
- sigaction (SIGTSTP, &sa, 0);
-
- /* Pop the gpm stack by closing the useless connection */
-@@ -386,7 +386,7 @@
-
- /* if signal was originally ignored, job control is not supported */
- if (gpm_saved_suspend_hook.sa_handler != SIG_IGN) {
-- sa.sa_flags = SA_NOMASK;
-+ sa.sa_flags = SA_NODEFER;
- sa.sa_handler = gpm_suspend_hook;
- sigaction(SIGTSTP, &sa, 0);
- }
---- a/src/prog/display-buttons.c
-+++ b/src/prog/display-buttons.c
-@@ -36,6 +36,7 @@
- #include /* printf() */
- #include /* time() */
- #include /* errno */
-+#include /* fd_set, FD_ZERO */
- #include /* gpm information */
-
- /* display resulting data */
---- a/src/prog/display-coords.c
-+++ b/src/prog/display-coords.c
-@@ -37,6 +37,7 @@
- #include /* printf() */
- #include /* time() */
- #include /* errno */
-+#include /* fd_set, FD_ZERO */
- #include /* gpm information */
-
- /* display resulting data */
---- a/src/prog/gpm-root.y
-+++ b/src/prog/gpm-root.y
-@@ -1197,6 +1197,9 @@
- /* reap your zombies */
- childaction.sa_handler=reap_children;
- sigemptyset(&childaction.sa_mask);
-+#ifndef SA_INTERRUPT
-+#define SA_INTERRUPT 0
-+#endif
- childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
- sigaction(SIGCHLD,&childaction,NULL);
-
---- a/contrib/control/gpm_has_mouse_control.c
-+++ b/contrib/control/gpm_has_mouse_control.c
-@@ -1,4 +1,4 @@
--#include
-+#include
- #include
- #include
- #include
diff --git a/patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch b/patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch
deleted file mode 100644
index 4212647..0000000
--- a/patches/mbedtls/0001-Allow-empty-x509-cert-issuer.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From a2d012f3ba459f6debe636b576ad9aeab7b3c2aa Mon Sep 17 00:00:00 2001
-From: Nick Chan
-Date: Sat, 27 May 2023 23:50:23 +0800
-Subject: [PATCH] Allow empty x509 cert issuer
-
----
- library/x509_crt.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/library/x509_crt.c b/library/x509_crt.c
-index cf62532f2..ef25b3d77 100644
---- a/library/x509_crt.c
-+++ b/library/x509_crt.c
-@@ -1061,13 +1061,13 @@ static int x509_crt_parse_der_core(mbedtls_x509_crt *crt,
-
- if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
- MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) != 0) {
-- mbedtls_x509_crt_free(crt);
-- return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);
-+ /*mbedtls_x509_crt_free(crt);
-+ return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);*/
- }
-
- if ((ret = mbedtls_x509_get_name(&p, p + len, &crt->issuer)) != 0) {
-- mbedtls_x509_crt_free(crt);
-- return ret;
-+ /*mbedtls_x509_crt_free(crt);
-+ return ret;*/
- }
-
- crt->issuer_raw.len = p - crt->issuer_raw.p;
---
-2.39.1
-
diff --git a/payloads/Pongo.bin b/payloads/Pongo.bin
new file mode 100644
index 0000000..490b1aa
Binary files /dev/null and b/payloads/Pongo.bin differ
diff --git a/payloads/shellcode.bin b/payloads/shellcode.bin
new file mode 100644
index 0000000..14c424e
Binary files /dev/null and b/payloads/shellcode.bin differ
diff --git a/payloads/yolo_s8000.bin b/payloads/yolo_s8000.bin
new file mode 100644
index 0000000..bce02a2
Binary files /dev/null and b/payloads/yolo_s8000.bin differ
diff --git a/payloads/yolo_s8001.bin b/payloads/yolo_s8001.bin
new file mode 100644
index 0000000..8e6abfc
Binary files /dev/null and b/payloads/yolo_s8001.bin differ
diff --git a/payloads/yolo_s8003.bin b/payloads/yolo_s8003.bin
new file mode 100644
index 0000000..9e812e5
Binary files /dev/null and b/payloads/yolo_s8003.bin differ
diff --git a/payloads/yolo_t7000.bin b/payloads/yolo_t7000.bin
new file mode 100644
index 0000000..dc12d93
Binary files /dev/null and b/payloads/yolo_t7000.bin differ
diff --git a/payloads/yolo_t7001.bin b/payloads/yolo_t7001.bin
new file mode 100644
index 0000000..262f4df
Binary files /dev/null and b/payloads/yolo_t7001.bin differ
diff --git a/payloads/yolo_t8010.bin b/payloads/yolo_t8010.bin
new file mode 100644
index 0000000..6fb0107
Binary files /dev/null and b/payloads/yolo_t8010.bin differ
diff --git a/payloads/yolo_t8011.bin b/payloads/yolo_t8011.bin
new file mode 100644
index 0000000..6e557bd
Binary files /dev/null and b/payloads/yolo_t8011.bin differ
diff --git a/payloads/yolo_t8015.bin b/payloads/yolo_t8015.bin
new file mode 100644
index 0000000..d76d511
Binary files /dev/null and b/payloads/yolo_t8015.bin differ
diff --git a/resources/Info.plist b/resources/Info.plist
new file mode 100644
index 0000000..11254bc
--- /dev/null
+++ b/resources/Info.plist
@@ -0,0 +1,16 @@
+
+
+
+
+ CFBundleIdentifier
+ palera.in.palera1n
+ CFBundleDevelopmentRegion
+ English
+ CFBundlePackageType
+ APPL
+ NSPrincipalClass
+ NSApplication
+ NSHighResolutionCapable
+
+
+
diff --git a/resources/ios-entitlements.xml b/resources/ios-entitlements.xml
new file mode 100644
index 0000000..f7077f9
--- /dev/null
+++ b/resources/ios-entitlements.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ platform-application
+
+ com.apple.private.security.no-container
+
+ com.apple.security.iokit-user-client-class
+
+ IOUserClient
+
+
+
diff --git a/resources/main.exe.manifest b/resources/main.exe.manifest
new file mode 100644
index 0000000..3107f64
--- /dev/null
+++ b/resources/main.exe.manifest
@@ -0,0 +1,9 @@
+
+
+
+
+ true
+ PerMonitorV2
+
+
+
\ No newline at end of file
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index 11ba5f8..0000000
--- a/src/Makefile
+++ /dev/null
@@ -1,197 +0,0 @@
-all: palera1n
-
-OBJDIR = obj
-GENDIR = gen
-RESOURCES_DIR = resources
-
-C_SRC = $(wildcard *.c)
-OBJS = $(patsubst %,$(OBJDIR)/%,$(C_SRC:.c=.c.o))
-
-ifeq (,$(findstring macosx, $(CFLAGS)))
-ifneq (,$(findstring version-min=, $(CFLAGS)))
-ifneq ($(NO_EMBED_HELPER),1)
-C_SRC += $(GENDIR)/gen-libcheckra1nhelper.dylib.c
-endif
-endif
-endif
-
-ifeq ($(NO_EMBED_HELPER),1)
-CFLAGS += -DNO_EMBED_HELPER
-endif
-
-ifeq ($(DFUHELPER_AUTO_ONLY),1)
-CFLAGS += -DDFUHELPER_AUTO_ONLY
-endif
-
-ifeq ($(FORCE_HELPER),1)
-ifneq ($(NO_EMBED_HELPER),1)
-C_SRC += $(GENDIR)/gen-libcheckra1nhelper.dylib.c
-endif
-CFLAGS += -DFORCE_HELPER
-BUILD_OPTIONS += FORCE_HELPER
-endif
-
-ifneq ($(NO_RAMDISK),1)
-C_SRC += $(GENDIR)/gen-ramdisk.dmg.lzma.c
-else
-CFLAGS += -DNO_RAMDISK -DRAMDISK_COMPRESSED_SIZE=\"0\"
-BUILD_OPTIONS += NO_RAMDISK
-endif
-ifneq ($(NO_KPF),1)
-C_SRC += $(GENDIR)/gen-checkra1n-kpf-pongo.lzma.c
-else
-CFLAGS += -DNO_KPF
-BUILD_OPTIONS += NO_KPF
-endif
-ifneq ($(NO_OVERLAY),1)
-C_SRC += $(GENDIR)/gen-binpack.dmg.c
-else
-CFLAGS += -DNO_OVERLAY
-BUILD_OPTIONS += NO_OVERLAY
-endif
-ifneq ($(NO_CHECKRAIN),1)
-C_SRC += $(GENDIR)/gen-checkra1n.c
-else
-CFLAGS += -DNO_CHECKRAIN
-BUILD_OPTIONS += NO_CHECKRAIN
-endif
-
-ifneq ($(NO_CUSTOM_PONGO),1)
-C_SRC += $(GENDIR)/gen-Pongo.bin.c
-else
-CFLAGS += -DNO_CUSTOM_PONGO
-BUILD_OPTIONS += NO_CUSTOM_PONGO
-endif
-
-ifeq ($(TUI),1)
-BUILD_OPTIONS += TUI
-CFLAGS += -DTUI
-endif
-
-CHECKRA1N_VERSION ?= 0.1337.3
-LIPO = lipo
-LDID = ldid
-
-ifeq ($(TARGET_OS),Darwin)
-ifneq ($(USE_LIBUSB),1)
-else
-LIBS += -framework SystemConfiguration -framework Security
-BUILD_OPTIONS += USE_LIBUSB
-endif
-# add lto and debug symbols for lto
-CFLAGS += -flto=full -g
-LDFLAGS += -Wl,-object_path_lto,obj/lto.o
-else
-USE_LIBUSB = 1
-endif
-
-ifeq ($(USE_LIBUSB),1)
-CFLAGS += -DUSE_LIBUSB=1
-LIBS += $(DEP)/lib/libusb-1.0.a
-endif
-
-ifneq ($(ROOTFUL),0)
-CFLAGS += -DROOTFUL=1
-BUILD_OPTIONS += ROOTFUL
-endif
-
-ifeq ($(BUILD_OPTIONS),)
-BUILD_OPTIONS = (none)
-endif
-
-CFLAGS += -DBUILD_OPTIONS=\""$(BUILD_OPTIONS)"\"
-
-ifeq ($(TARGET_OS),Linux)
-ifeq ($(UNAME),Linux)
-ifeq ($(CHECKRA1N_NAME),)
-ifeq ($(shell arch),x86_64)
-CHECKRA1N_NAME := linux-x86_64
-else ifeq ($(shell arch | grep -q 'i[3-7]86' && echo 1),1)
-CHECKRA1N_NAME := linux-x86
-else ifeq ($(shell arch | grep -v '\(arm\|aarch\)[a-z]\?\+64' | grep -q arm && echo 1),1)
-CHECKRA1N_NAME := linux-armel
-else ifeq ($(shell arch | grep -q '\(arm\|aarch\)[a-z]\?\+64' && echo 1),1)
-CHECKRA1N_NAME := linux-arm64
-endif
-endif
-endif
-endif
-
-$(RESOURCES_DIR)/checkra1n-%:
- curl -Lfo $@ https://assets.checkra.in/downloads/preview/$(CHECKRA1N_VERSION)/$$(echo $@ | cut -d/ -f2)
- chmod 755 $@
-
-$(RESOURCES_DIR)/checkra1n: $(RESOURCES_DIR)/checkra1n-macos usb.xml
-ifeq ($(TARGET_OS),Darwin)
-ifneq (,$(findstring arm64, $(CFLAGS)))
- $(LIPO) -thin arm64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
-else ifneq (,$(findstring x86_64, $(CFLAGS)))
- $(LIPO) -thin x86_64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
-else ifeq ($(shell arch),i386)
- $(LIPO) -thin x86_64 -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
-else
- $(LIPO) -thin $(shell arch) -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n-macos
-endif
-ifeq (,$(findstring macosx, $(CFLAGS)))
-ifneq (,$(findstring version-min=, $(CFLAGS)))
- vtool -remove-build-version 1 -replace -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n
- vtool -set-build-version $(FAKE_PLATFORM) $(FAKE_MINOS) $(FAKE_SDK) -replace -output $(RESOURCES_DIR)/checkra1n $(RESOURCES_DIR)/checkra1n
- install_name_tool -change /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit /System/Library/Frameworks/IOKit.framework/IOKit $(RESOURCES_DIR)/checkra1n
- install_name_tool -change /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation $(RESOURCES_DIR)/checkra1n
- $(LDID) -Susb.xml $(RESOURCES_DIR)/checkra1n
-endif
-endif
-else
- cp $(RESOURCES_DIR)/checkra1n-$(CHECKRA1N_NAME) $(RESOURCES_DIR)/checkra1n
-endif
-
-$(GENDIR)/gen-%.c: $(RESOURCES_DIR)/%
- echo '#include ' > $(RESOURCES_DIR)/../$@
- cd $(RESOURCES_DIR) && xxd -iC $$(echo $< | cut -d/ -f2) | sed -e 's/unsigned int/uint32_t/' -e 's/unsigned char/uint8_t/' >> ../$@
-
-
-$(OBJDIR)/pongo_helper.c.o: pongo_helper.c $(wildcard ../include/*.h) $(RESOURCES_DIR)/ramdisk.dmg $(RESOURCES_DIR)/checkra1n-kpf-pongo
- $(CC) -c -o $@ $(CFLAGS) -DRAMDISK_UNCOMPRESSED_SIZE="\"$$(wc -c < $(RESOURCES_DIR)/ramdisk.dmg | tr -d ' ')\"" -DKPF_UNCOMPRESSED_SIZE="\"$$(wc -c < $(RESOURCES_DIR)/checkra1n-kpf-pongo | tr -d ' ')\"" $<
-
-$(OBJDIR)/%.c.o: $(GENDIR)/gen-%.c $(wildcard ../include/*.h)
- $(CC) $(CFLAGS) -c -o $<
-
-$(OBJDIR)/%.c.o: %.c $(wildcard ../include/*.h)
- $(CC) $(CFLAGS) -c -o $@ $<
-
-palera1n: $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o palera1n
-ifeq (,$(findstring macosx, $(CFLAGS)))
-ifneq (,$(findstring version-min=, $(CFLAGS)))
- $(LDID) -Susb.xml palera1n
-endif
-endif
-
-$(RESOURCES_DIR)/libcheckra1nhelper.dylib: chkstk.S
- $(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o $@
-
-$(RESOURCES_DIR)/checkra1n-kpf-pongo:
- curl -Lfo $@ https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/checkra1n-kpf-pongo
-
-$(RESOURCES_DIR)/ramdisk.dmg.lzma: $(RESOURCES_DIR)/ramdisk.dmg
- xz --format=lzma -vfc6ekT 0 $< > $@
-
-$(RESOURCES_DIR)/checkra1n-kpf-pongo.lzma: $(RESOURCES_DIR)/checkra1n-kpf-pongo
- xz --format=lzma -vfc6ekT 0 $< > $@
-
-$(RESOURCES_DIR)/ramdisk.dmg:
- curl -Lfo $@ https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
-
-$(RESOURCES_DIR)/binpack.dmg:
- curl -Lfo $@ https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
-
-$(RESOURCES_DIR)/Pongo.bin:
- curl -Lfo $@ https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/Pongo.bin
-
-clean:
- rm -rf $(OBJDIR)/*.o $(GENDIR)/*.c $(GENDIR)/*.o palera1n palera1n.dSYM libcheckra1nhelper.dylib
-
-distclean: clean
- rm -rf $(RESOURCES_DIR)/*
-
-.PHONY: all clean
diff --git a/src/boyermoore_memmem.c b/src/boyermoore_memmem.c
deleted file mode 100644
index 6a37f26..0000000
--- a/src/boyermoore_memmem.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include
-#include
-
-const unsigned char *
-boyermoore_horspool_memmem(const unsigned char* haystack, size_t hlen,
- const unsigned char* needle, size_t nlen)
-{
- size_t scan = 0;
- size_t bad_char_skip[UCHAR_MAX + 1]; /* Officially called:
- * bad character shift */
-
- /* Sanity checks on the parameters */
- if (nlen <= 0 || !haystack || !needle)
- return NULL;
-
- /* ---- Preprocess ---- */
- /* Initialize the table to default value */
- /* When a character is encountered that does not occur
- * in the needle, we can safely skip ahead for the whole
- * length of the needle.
- */
- for (scan = 0; scan <= UCHAR_MAX; scan = scan + 1)
- bad_char_skip[scan] = nlen;
-
- /* C arrays have the first byte at [0], therefore:
- * [nlen - 1] is the last byte of the array. */
- size_t last = nlen - 1;
-
- /* Then populate it with the analysis of the needle */
- for (scan = 0; scan < last; scan = scan + 1)
- bad_char_skip[needle[scan]] = last - scan;
-
- /* ---- Do the matching ---- */
-
- /* Search the haystack, while the needle can still be within it. */
- while (hlen >= nlen)
- {
- /* scan from the end of the needle */
- for (scan = last; haystack[scan] == needle[scan]; scan = scan - 1)
- if (scan == 0) /* If the first byte matches, we've found it. */
- {
- return haystack;
- }
-
- /* otherwise, we need to skip some bytes and start again.
- Note that here we are getting the skip value based on the last byte
- of needle, no matter where we didn't match. So if needle is: "abcd"
- then we are skipping based on 'd' and that value will be 4, and
- for "abcdd" we again skip on 'd' but the value will be only 1.
- The alternative of pretending that the mismatched character was
- the last character is slower in the normal case (E.g. finding
- "abcd" in "...azcd..." gives 4 by using 'd' but only
- 4-2==2 using 'z'. */
- hlen -= bad_char_skip[haystack[last]];
- haystack += bad_char_skip[haystack[last]];
- }
-
- return NULL;
-}
diff --git a/src/chkstk.S b/src/chkstk.S
deleted file mode 100644
index 3b6ba6b..0000000
--- a/src/chkstk.S
+++ /dev/null
@@ -1,65 +0,0 @@
-#define _PTHREAD_STRUCT_DIRECT_STACKADDR_OFFSET -48
-#define _PTHREAD_STRUCT_DIRECT_STACKBOTTOM_OFFSET -40
-
-.align 4
-_thread_chkstk_darwin:
- .globl ___chkstk_darwin
-___chkstk_darwin: // %w9/x9 == alloca size
- stp x10, x11, [sp, #-16]
-
- // validate that the frame pointer is on our stack (no alt stack)
- mrs x10, TPIDRRO_EL0
-
- // (%sp - pthread_self()->stackaddr) > 0 ?
-#if defined(__ARM64_ARCH_8_32__)
- ubfx x9, x9, #0, #32
- ldur w11, [x10, _PTHREAD_STRUCT_DIRECT_STACKADDR_OFFSET]
-#else
- ldur x11, [x10, _PTHREAD_STRUCT_DIRECT_STACKADDR_OFFSET]
-#endif
- subs x11, sp, x11
- b.hs Lprobe
-
- // %sp <= pthread_self()->stackbottom ?
-#if defined(__ARM64_ARCH_8_32__)
- ldur w11, [x10, _PTHREAD_STRUCT_DIRECT_STACKBOTTOM_OFFSET]
-#else
- ldur x11, [x10, _PTHREAD_STRUCT_DIRECT_STACKBOTTOM_OFFSET]
-#endif
- mov x10, sp
- cmp x10, x11
- b.ls Lprobe
-
- // %sp - (uintptr_t)%x9 < pthread_self()->stackbottom ?
- subs x10, x10, x9
- b.lo Lcrash
- cmp x10, x11
- b.lo Lcrash
-
-Lexit:
- ldp x10, x11, [sp, #-16]
- ret
-
-Lcrash:
- // POSIX mandates that stack overflow crashes with SIGSEGV
- // so load an address in the guard page and dereference it
- //
- // x11 contains pthread_self()->stackbottom already
- ldr x11, [x11, #-8]
- // if main_thread caused stack growth with setrlimit()
- // fall into Lprobe and eventually cause SIGSEGV.
-
-Lprobe:
- mov x10, sp
- cmp x9, #0x1000
- b.lo Lend
-Lloop:
- sub x10, x10, #0x1000
- ldr x11, [x10]
- sub x9, x9, #0x1000
- cmp x9, #0x1000
- b.hi Lloop
-Lend:
- sub x10, x10, x9
- ldr x11, [x10]
- b Lexit
diff --git a/src/credits.c b/src/credits.c
deleted file mode 100644
index 1641279..0000000
--- a/src/credits.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include
-
-#ifndef BAKERAIN_DEVELOPE_R
-#define BAKERAIN_DEVELOPE_R "kok3shidoll"
-#endif
-#define THE_PLUSH "Ploosh"
-
-#define NEKO_DEVELOPE_R "HAHALOSAH"
-
-#define T void
-#define R print_credits(void) {
-#define O fprintf(
-#define U stderr,
-#define B "#\n# palera1n: " BUILD_TAG " \n#\n"
-#define L "# ======== Made by =======\n"
-#define E "# Made by: Nick Chan, " THE_PLUSH ", Khcrysalis, Mineek, staturnz, " BAKERAIN_DEVELOPE_R ", " NEKO_DEVELOPE_R " \n"
-#define M "# ======== Thanks to =======\n"
-#define A "# Thanks to: llsc12, Nebula, Lrdsnow, nikias (libimobiledevice),\n"
-#define K "# checkra1n team (Siguza, axi0mx, littlelailo et al.),\n"
-#define I "# Procursus Team (Hayden Seay, Cameron Katri, Keto et.al)\n"
-#define N "# ==========================\n\n"
-#define G );
-#define S }
-
-T R O U B L E M A K I N G S
diff --git a/src/devhelper.c b/src/devhelper.c
deleted file mode 100644
index 87e5ab2..0000000
--- a/src/devhelper.c
+++ /dev/null
@@ -1,405 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifdef WIN32
-#include
-#include
-#else
-#include
-#include
-#include
-#include
-#include
-#endif
-#include
-#include
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#ifdef HAVE_LIB_TV_CONTROL
-#include
-#endif
-
-#include
-
-irecv_device_event_context_t irecvctx = NULL;
-usbmuxd_subscription_context_t usbmuxdctx = NULL;
-
-void devinfo_free(devinfo_t *dev) {
- free(dev->buildVersion);
- free(dev->productType);
- free(dev->productVersion);
- free(dev->CPUArchitecture);
- return;
-}
-
-bool cpid_is_arm64(unsigned int cpid) {
- /*
- * ========== 0x6000 ===========
- * M1 Pro, M1 Max, etc.
- * ========== 0x7000 ===========
- * (ARM64) A8(X)
- * ========== 0x7002 ===========
- * S1
- * ========== 0x8000 ===========
- * (ARM64) A9 (Samsung), A9X
- * ========== 0x8002 ===========
- * S1P, S2, T1
- * ========== 0x8003 ===========
- * (ARM64) A9 (TSMC)
- * ========== 0x8004 ===========
- * S3 - S5
- * ========== 0x8010 ===========
- * (ARM64) A10(X) - A11, T2
- * ========== 0x8020 ===========
- * A12, M1, M2, etc
- * ========== 0x8700 ===========
- * iPod SoCs
- * ========== 0x8747 ===========
- * Haywire
- * ========== 0x8900 ===========
- * S5L8900 - A6(X)
- * ========== 0x8960 ===========
- * (ARM64) A7
- */
- return (
- cpid == 0x8960 || cpid == 0x7000 || cpid == 0x7001 ||
- cpid == 0x8000 || cpid == 0x8001 || cpid == 0x8003 ||
- cpid == 0x8010 || cpid == 0x8011 || cpid == 0x8012 ||
- cpid == 0x8015
- );
-}
-
-int subscribe_cmd(usbmuxd_event_cb_t device_event_cb, irecv_device_event_cb_t irecv_event_cb)
-{
- int ret;
- if ((ret = usbmuxd_events_subscribe(&usbmuxdctx, device_event_cb, NULL))) return ret;
- if ((ret = irecv_device_event_subscribe(&irecvctx, irecv_event_cb, NULL))) return ret;
- return 0;
-}
-
-int unsubscribe_cmd(void)
-{
- int ret;
- if ((ret = usbmuxd_events_unsubscribe(usbmuxdctx))) return ret;
- if ((ret = irecv_device_event_unsubscribe(irecvctx))) return ret;
- irecvctx = NULL;
- usbmuxdctx = NULL;
- return 0;
-}
-
-int devinfo_cmd(devinfo_t *dev, const char *udid)
-{
- int ret;
- uint64_t this_ecid = 0;
- char *productType = NULL;
- char *productVersion = NULL;
- char *buildVersion = NULL;
- const char *displayName = NULL;
- char *CPUArchitecture = NULL;
- idevice_t device = NULL;
- lockdownd_client_t lockdown = NULL;
- if ((ret = idevice_new_with_options(&device, udid, IDEVICE_LOOKUP_USBMUX)) != IDEVICE_E_SUCCESS)
- {
- LOG(LOG_ERROR, "Error connecting to device: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- if ((ret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n")) != LOCKDOWN_E_SUCCESS)
- {
- (void)idevice_free(device);
- LOG(LOG_ERROR, "Device is not in normal mode: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- plist_t node = NULL;
- if ((ret = lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node)) != LOCKDOWN_E_SUCCESS)
- {
- (void)lockdownd_client_free(lockdown);
- (void)idevice_free(device);
- LOG(LOG_ERROR, "Error getting ECID: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- plist_get_uint_val(node, &this_ecid);
- plist_free(node);
-
- node = NULL;
- if ((ret = lockdownd_get_value(lockdown, NULL, "ProductType", &node)) != LOCKDOWN_E_SUCCESS)
- {
- (void)lockdownd_client_free(lockdown);
- (void)idevice_free(device);
- LOG(LOG_ERROR, "Error getting product type: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- plist_get_string_val(node, &productType);
- plist_free(node);
-
- node = NULL;
- if ((ret = lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node)) != LOCKDOWN_E_SUCCESS)
- {
- (void)lockdownd_client_free(lockdown);
- (void)idevice_free(device);
- LOG(LOG_ERROR, "Error getting CPU type: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- plist_get_string_val(node, &CPUArchitecture);
- plist_free(node);
-
- node = NULL;
- if ((ret = lockdownd_get_value(lockdown, NULL, "ProductVersion", &node)) != LOCKDOWN_E_SUCCESS)
- {
- (void)lockdownd_client_free(lockdown);
- (void)idevice_free(device);
- LOG(LOG_ERROR, "Error getting product version: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- plist_get_string_val(node, &productVersion);
- plist_free(node);
-
- node = NULL;
- if ((ret = lockdownd_get_value(lockdown, NULL, "BuildVersion", &node)) != LOCKDOWN_E_SUCCESS)
- {
- (void)lockdownd_client_free(lockdown);
- (void)idevice_free(device);
- LOG(LOG_ERROR, "Error getting build version: %d (%s)", ret, lockdownd_strerror(ret));
- return -1;
- }
- plist_get_string_val(node, &buildVersion);
- plist_free(node);
- (void)lockdownd_client_free(lockdown);
- (void)idevice_free(device);
-
- irecv_device_t rcvydev;
- if (irecv_devices_get_device_by_product_type(productType, &rcvydev) == IRECV_E_SUCCESS)
- {
- displayName = rcvydev->display_name;
- } else
- {
- displayName = productType;
- }
- dev->buildVersion = buildVersion;
- dev->ecid = this_ecid;
- dev->CPUArchitecture = CPUArchitecture;
- dev->displayName = displayName;
- dev->productType = productType;
- dev->productVersion = productVersion;
- return 0;
-}
-
-int enter_recovery_cmd(const char* udid) {
- idevice_t device = NULL;
- lockdownd_client_t lockdown = NULL;
- if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS) {
- LOG(LOG_ERROR, "Could not connect to device");
- return -1;
- }
- lockdownd_error_t ldret = lockdownd_client_new(device, &lockdown, "palera1n");
- if (ldret != LOCKDOWN_E_SUCCESS) {
- LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
- return -1;
- }
- ldret = lockdownd_enter_recovery(lockdown);
- if (ldret == LOCKDOWN_E_SESSION_INACTIVE) {
- lockdownd_client_free(lockdown);
- lockdown = NULL;
- ldret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n");
- if (ldret != LOCKDOWN_E_SUCCESS) {
- LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
- return -1;
- }
- ldret = lockdownd_enter_recovery(lockdown);
- }
- if (ldret != LOCKDOWN_E_SUCCESS) {
- LOG(LOG_ERROR, "Could not trigger entering recovery mode: %s", lockdownd_strerror(ldret));
- return -1;
- }
- lockdownd_client_free(lockdown);
- idevice_free(device);
- return 0;
-}
-
-int reboot_cmd(const char* udid) {
- idevice_t device = NULL;
- lockdownd_client_t lockdown = NULL;
- if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS) {
- LOG(LOG_ERROR, "Could not connect to device");
- return -1;
- } else {
- diagnostics_relay_client_t diag = NULL;
- if (diagnostics_relay_client_start_service(device, &diag, "palera1n") == DIAGNOSTICS_RELAY_E_SUCCESS) {
- if (diagnostics_relay_restart(diag, DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT) != DIAGNOSTICS_RELAY_E_SUCCESS) {
- LOG(LOG_ERROR, "Could not reboot device.");
- }
- (void)diagnostics_relay_goodbye(diag);
- (void)diagnostics_relay_client_free(diag);
- } else {
- LOG(LOG_ERROR, "Could not connect to device.");
- return -1;
- }
- idevice_free(device);
- }
- return 0;
-}
-
-int passstat_cmd(unsigned char* status, const char* udid) {
- lockdownd_error_t lerr = LOCKDOWN_E_SUCCESS;
- diagnostics_relay_error_t derr = DIAGNOSTICS_RELAY_E_SUCCESS;
-
- idevice_t dev = NULL;
- lockdownd_client_t lockdown = NULL;
- lockdownd_service_descriptor_t service = NULL;
- diagnostics_relay_client_t diagnostics_client = NULL;
- plist_t node = NULL;
- plist_t keys = NULL;
- plist_t status_node = NULL;
- plist_t value_node = NULL;
-
- if (idevice_new(&dev, udid) != IDEVICE_E_SUCCESS)
- {
- LOG(LOG_ERROR, "Error detecting device type");
- return -1;
- }
- lerr = lockdownd_client_new_with_handshake(dev, &lockdown, "idevicediagnostics");
- if ((lerr != LOCKDOWN_E_SUCCESS) || !lockdown)
- {
- idevice_free(dev);
- LOG(LOG_ERROR, "Error connecting to lockdownd (lockdownd error %d: (%s))", lerr, lockdownd_strerror(lerr));
- return -1;
- }
- lerr = lockdownd_start_service(lockdown, "com.apple.mobile.diagnostics_relay", &service);
- if ((lerr != LOCKDOWN_E_SUCCESS) || !service)
- lerr = lockdownd_start_service(lockdown, "com.apple.iosdiagnostics.relay", &service);
-
- lockdownd_client_free(lockdown);
- if ((lerr != LOCKDOWN_E_SUCCESS) || !service)
- {
- idevice_free(dev);
- LOG(LOG_ERROR, "Error starting diagnostics service (lockdownd error %d: (%s))\nUnlock the device and try again.", lerr, lockdownd_strerror(lerr));
- return -1;
- }
- derr = diagnostics_relay_client_new(dev, service, &diagnostics_client);
- if ((derr != DIAGNOSTICS_RELAY_E_SUCCESS) || !diagnostics_client)
- {
- lockdownd_service_descriptor_free(service);
- idevice_free(dev);
- LOG(LOG_ERROR, "Error starting diagnostics client (diagnostics error %d)", derr);
- return -1;
- }
- keys = plist_new_array();
- plist_array_append_item(keys, plist_new_string("xsaMbRQ5rQ+eyKMKG+ZSSg"));
- derr = diagnostics_relay_query_mobilegestalt(diagnostics_client, keys, &node);
-
- plist_free(keys);
- (void)diagnostics_relay_client_free(diagnostics_client);
- (void)lockdownd_service_descriptor_free(service);
- (void)idevice_free(dev);
-
- if (derr != DIAGNOSTICS_RELAY_E_SUCCESS || !node)
- {
- LOG(LOG_ERROR, "Error getting passcode state (lockdownd error %d: (%s))", lerr, lockdownd_strerror(lerr));
- return -1;
- }
- status_node = plist_access_path(node, 2, "MobileGestalt", "Status");
- if (!status_node)
- {
- plist_free(node);
- LOG(LOG_ERROR, "Error getting passcode state (invalid status node)");
- return -1;
- }
- char* passstat_status;
- plist_get_string_val(status_node, &passstat_status);
- if (!status || strncmp(passstat_status, "Succ", 4))
- {
- if (passstat_status)
- free(passstat_status);
- passstat_status = NULL;
- plist_free(node);
- LOG(LOG_ERROR, "Error getting passcode state (invalid status)");
- return -1;
- }
-
- free(passstat_status);
- value_node = plist_access_path(node, 2, "MobileGestalt", "xsaMbRQ5rQ+eyKMKG+ZSSg");
- if (!value_node)
- {
- plist_free(node);
- LOG(LOG_ERROR, "Error getting passcode state (invalid value node)");
- return -1;
- }
- uint8_t passcode_state = 2;
- plist_get_bool_val(value_node, &passcode_state);
- plist_free(node);
- *status = passcode_state;
- LOG(LOG_VERBOSE4, "Passcode state: %hhu", *status);
- return 0;
-}
-
-int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
- irecv_client_t client = NULL;
- irecv_error_t err = irecv_open_with_ecid(&client, ecid);
- if (err != IRECV_E_SUCCESS) goto err;
- int mode = 0;
- err = irecv_get_mode(client, &mode);
- if (err != IRECV_E_SUCCESS) goto err;
- char *ibootver = NULL;
- err = irecv_getenv(client, "build-version", &ibootver);
- if (err != IRECV_E_SUCCESS) goto err;
- irecv_device_t device;
- err = irecv_devices_get_device_by_client(client, &device);
- if (err != IRECV_E_SUCCESS) goto err;
- info->mode = mode;
- info->cpid = device->chip_id;
- snprintf(info->product_type, 0x20, "%s", device->product_type);
- snprintf(info->display_name, 0x20, "%s", device->display_name);
- snprintf(info->iboot_ver, 0x20, "%s", (ibootver) ? ibootver : "");
- free(ibootver);
- irecv_close(client);
- return 0;
-err:
- LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
- return -1;
-}
-
-int autoboot_cmd(const uint64_t ecid) {
- irecv_client_t client = NULL;
- irecv_error_t err = irecv_open_with_ecid(&client, ecid);
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_setenv(client, "auto-boot", "true");
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_saveenv(client);
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_close(client);
- if (err != IRECV_E_SUCCESS) goto err;
- return 0;
-err:
- LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
- return -1;
-}
-
-int exitrecv_cmd(const uint64_t ecid) {
- irecv_client_t client = NULL;
- irecv_error_t err = irecv_open_with_ecid(&client, ecid);
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_setenv(client, "auto-boot", "true");
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_saveenv(client);
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_reboot(client);
- if (err != IRECV_E_SUCCESS) goto err;
- err = irecv_close(client);
- if (err != IRECV_E_SUCCESS) goto err;
- return 0;
-err:
- LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
- return -1;
-}
diff --git a/src/dfuhelper.c b/src/dfuhelper.c
deleted file mode 100644
index e639012..0000000
--- a/src/dfuhelper.c
+++ /dev/null
@@ -1,364 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#define FORMAT_KEY_VALUE 1
-#define FORMAT_XML 2
-
-#define NO_PHYSICAL_HOME_BUTTON (cpid == 0x8015 || (cpid == 0x8010 && (bdid == 0x08 || bdid == 0x0a || bdid == 0x0c || bdid == 0x0e)))
-#define IS_APPLE_TV_HD (cpid == 0x7000 && bdid == 0x34)
-#define IS_APPLE_TV_4K (cpid == 0x8011 && bdid == 0x02)
-#define IS_APPLE_HOME1 (cpid == 0x7000 && bdid == 0x38)
-#define IS_APPLE_HOME2 (cpid == 0x7000 && bdid == 0x1a)
-#define IS_APPLE_HOME (IS_APPLE_HOME1 || IS_APPLE_HOME1)
-#define IS_APPLETV (IS_APPLE_TV_4K || IS_APPLE_TV_HD || IS_APPLE_HOME)
-
-int dfuhelper_thr_running = false;
-
-static void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
- for (int i = time2; i < time; i++) {
- printf(
- (palerain_flags & palerain_option_no_colors)
- ? "\r\033[K%s (%d)"
- : BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2
- );
- fflush(stdout);
- sleep(1);
- if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
- }
- printf(
- (palerain_flags & palerain_option_no_colors)
- ? "\r%s (%d)"
- : CYN "\r%s (%d)" CRESET, text, time2
- );
- if (time2 == 0) puts("");
-}
-
-static int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
- devinfo_t dev;
- int ret;
- ret = devinfo_cmd(&dev, usbmuxd_device->udid);
- if (ret != 0) {
- LOG(LOG_ERROR, "Unable to get device information");
- return 0;
- }
- if (strcmp(dev.CPUArchitecture, "arm64")) {
- devinfo_free(&dev);
- LOG(LOG_WARNING, "Ignoring non-arm64 device...");
- LOG(LOG_WARNING, "palera1n doesn't and never will work on A12+ (arm64e)");
- return -1;
- }
-
- if ((palerain_flags & palerain_option_device_info)) {
- printf("Mode: normal\n");
- printf("ProductType: %s\n", dev.productType);
- printf("Architecture: %s\n", dev.CPUArchitecture);
- printf("Version: %s\n", dev.productVersion);
- printf("DisplayName: %s\n", dev.displayName);
-
- device_has_booted = true;
- set_spin(0);
- unsubscribe_cmd();
- return 0;
- }
-
- /* For Booting Linux etc */
- if (!getenv("PALERA1N_BYPASS_PASSCODE_CHECK") &&
- !strncmp(dev.productType, "iPhone10,", strlen("iPhone10,")
- )) {
- if (!(palerain_flags & palerain_option_device_info))
- LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
- unsigned char passcode_state = 0;
- ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
- if (ret != 0) {
- LOG(LOG_ERROR, "Failed to get passcode state");
- devinfo_free(&dev);
- return -1;
- }
- if (passcode_state) {
- LOG(LOG_ERROR, "Passcode must be disabled on this device");
- if (!(palerain_flags & palerain_option_device_info))
- LOG(LOG_ERROR, "Additionally, passcode must never be set since a restore on iOS 16+");
- devinfo_free(&dev);
- return -1;
- }
- }
-
- if (getenv("PALERA1N_BYPASS_PASSCODE_CHECK"))
- LOG(LOG_WARNING, "Bypassed passcode check");
-
- if (verbose > 1) {
- /* (LOG_VERBOSE - 3) or below*/
- LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
- } else {
- /* At least (LOG_VERBOSE2 - 3) */
- LOG(LOG_INFO, "Entering recovery mode");
- }
- enter_recovery_cmd(usbmuxd_device->udid);
- devinfo_free(&dev);
- if ((palerain_flags & palerain_option_enter_recovery)) {
- device_has_booted = true;
- set_spin(0);
- unsubscribe_cmd();
- }
- return 0;
-}
-
-static bool conditional(uint64_t ecid) {
- return get_ecid_wait_for_dfu() != ecid;
-}
-
-static void* connected_recovery_mode(struct irecv_device_info* info) {
- int ret;
- uint64_t ecid;
- uint32_t cpid, bdid;
- cpid = info->cpid;
- ecid = info->ecid;
- bdid = info->bdid;
- info = NULL;
- if (!cpid_is_arm64(cpid)) {
- LOG(LOG_WARNING, "Ignoring non-arm64 device...");
- return NULL;
- }
- sleep(1);
- ret = autoboot_cmd(ecid);
- if (ret) {
- LOG(LOG_ERROR, "Cannot set auto-boot back to true");
- return NULL;
- }
-#if !defined(DFUHELPER_AUTO_ONLY)
- if (IS_APPLE_TV_4K) {
- LOG(LOG_INFO, "Depending on your connection method, you might need to press a button on your cable/board during reboot");
- }
- LOG(LOG_INFO, "Press Enter when ready for DFU mode");
- getchar();
-#endif
- if (IS_APPLETV) {
- if (IS_APPLE_TV_HD) {
- step(10, 8, "Hold menu + play button", NULL, 0);
- set_ecid_wait_for_dfu(ecid);
- ret = exitrecv_cmd(ecid);
- if (ret) {
- LOG(LOG_ERROR, "Cannot exit recovery mode");
- set_ecid_wait_for_dfu(0);
- return NULL;
- }
- printf("\r\033[K");
- step(8, 0, "Hold menu + play button", conditional, ecid);
- } else if (IS_APPLE_TV_4K) {
- step(2, 0, "About to reboot device", NULL, 0);
- set_ecid_wait_for_dfu(ecid);
- ret = exitrecv_cmd(ecid);
- if (ret) {
- LOG(LOG_ERROR, "Cannot exit recovery mode");
- set_ecid_wait_for_dfu(0);
- return NULL;
- }
- step(4, 0, "Waiting for device to reconnect in DFU mode", conditional, ecid);
- } else if (IS_APPLE_HOME) {
- step(6, 4, "Put device in upside down orientation", NULL, 0);
- set_ecid_wait_for_dfu(ecid);
- ret = exitrecv_cmd(ecid);
- if (ret) {
- LOG(LOG_ERROR, "Cannot exit recovery mode");
- set_ecid_wait_for_dfu(0);
- return NULL;
- }
- step(4, 0, "Put device upside down orientation", conditional, ecid);
- }
- } else if (cpid != 0x8012) {
- if (NO_PHYSICAL_HOME_BUTTON)
- step(4, 2, "Hold volume down + side button", NULL, 0);
- else
- step(4, 2, "Hold home + power button", NULL, 0);
- set_ecid_wait_for_dfu(ecid);
- ret = exitrecv_cmd(ecid);
- if (ret) {
- LOG(LOG_ERROR, "Cannot exit recovery mode");
- set_ecid_wait_for_dfu(0);
- return NULL;
- }
- printf("\r\033[K");
- if (NO_PHYSICAL_HOME_BUTTON) {
- step(2, 0, "Hold volume down + side button", NULL, 0);
- step(10, 0, "Hold volume down button", conditional, ecid);
- } else {
- step(2, 0, "Hold home + power button", NULL, 0);
- step(10, 0, "Hold home button", conditional, ecid);
- }
- }
- if (get_ecid_wait_for_dfu() == ecid) {
- LOG(LOG_WARNING, "Whoops, device did not enter DFU mode");
- LOG(LOG_INFO, "Waiting for device to reconnect...");
- set_ecid_wait_for_dfu(0);
- return NULL;
- }
- set_ecid_wait_for_dfu(0);
- pthread_exit(NULL);
- return NULL;
-}
-
-static void* connected_dfu_mode(struct irecv_device_info* info) {
- if (get_ecid_wait_for_dfu() == info->ecid) {
- set_ecid_wait_for_dfu(0);
- puts("");
- LOG(LOG_INFO, "Device entered DFU mode successfully");
- }
- unsigned int bdid = info->bdid;
- unsigned int cpid = info->cpid;
- if (IS_APPLE_HOME) {
- step(2, 0, "Put device in upright orientation", NULL, 0);
- }
- set_spin(0);
- unsubscribe_cmd();
- pthread_exit(NULL);
- return NULL;
-}
-
-static void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
- if (event->device.conn_type != CONNECTION_TYPE_USB) return;
- switch (event->event) {
- case UE_DEVICE_ADD:
- LOG(LOG_VERBOSE, "Normal mode device connected");
- if ((palerain_flags & palerain_option_exit_recovery)) {
- break;
- } else if ((palerain_flags & palerain_option_reboot_device)) {
- int ret = reboot_cmd(event->device.udid);
- if (!ret) {
- LOG(LOG_INFO, "Restarted device");
- set_spin(0);
- unsubscribe_cmd();
- }
- pthread_exit(NULL);
- break;
- }
- connected_normal_mode(&event->device);
- break;
- case UE_DEVICE_REMOVE:
- LOG(LOG_VERBOSE, "Normal mode device disconnected");
- break;
- }
-}
-
-static void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
- pthread_t recovery_thread, dfu_thread;
- int ret;
-
- switch(event->type) {
- case IRECV_DEVICE_ADD:
- if (event->mode == IRECV_K_RECOVERY_MODE_1 ||
- event->mode == IRECV_K_RECOVERY_MODE_2 ||
- event->mode == IRECV_K_RECOVERY_MODE_3 ||
- event->mode == IRECV_K_RECOVERY_MODE_4) {
- if (!(palerain_flags & palerain_option_device_info))
- LOG(LOG_VERBOSE, "Recovery mode device %" PRIu64 " connected", event->device_info->ecid);
- if ((palerain_flags & palerain_option_exit_recovery)) {
- ret = exitrecv_cmd(event->device_info->ecid);
- if (!ret) {
- LOG(LOG_INFO, "Exited recovery mode");
- device_has_booted = true;
- set_spin(0);
- unsubscribe_cmd();
- } else {
- LOG(LOG_WARNING, "Could not exit recovery mode");
- }
- if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
- pthread_exit(NULL);
- break;
- }
-
- if ((palerain_flags & palerain_option_device_info)) {
- recvinfo_t info;
- ret = recvinfo_cmd(&info, event->device_info->ecid);
- if (ret) {
- LOG(LOG_WARNING, "Could not get info from device");
- } else {
- printf("Mode: Recovery\n");
- printf("ProductType: %s\n", info.product_type);
- printf("DisplayName: %s\n", info.display_name);
-
- device_has_booted = true;
- set_spin(0);
- unsubscribe_cmd();
- }
- if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
- pthread_exit(NULL);
- break;
- }
-
- if ((palerain_flags & palerain_option_enter_recovery) ||
- (palerain_flags & palerain_option_reboot_device)) return;
- pthread_create(&recovery_thread, NULL, (pthread_start_t)connected_recovery_mode, event->device_info);
- } else if (event->mode == IRECV_K_DFU_MODE) {
- if (!(palerain_flags & palerain_option_device_info))
- LOG(LOG_VERBOSE, "DFU mode device %" PRIu64 " connected", event->device_info->ecid);
-
- if ((palerain_flags & palerain_option_device_info)) {
- recvinfo_t info;
- ret = recvinfo_cmd(&info, event->device_info->ecid);
- if (ret) {
- LOG(LOG_WARNING, "Could not get info from device");
- } else {
- printf("Mode: DFU\n");
- printf("ProductType: %s\n", info.product_type);
- printf("DisplayName: %s\n", info.display_name);
-
- device_has_booted = true;
- set_spin(0);
- unsubscribe_cmd();
- }
- if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
- pthread_exit(NULL);
- break;
- }
-
- if (
- (palerain_flags & palerain_option_exit_recovery) ||
- (palerain_flags & palerain_option_enter_recovery) ||
- (palerain_flags & palerain_option_reboot_device)) {
- break;
- }
- pthread_create(&dfu_thread, NULL, (pthread_start_t)connected_dfu_mode, event->device_info);
- }
- break;
- case IRECV_DEVICE_REMOVE:
- LOG(LOG_VERBOSE, "Recovery mode device disconnected");
- break;
- }
-}
-
-void *dfuhelper(void* ptr) {
- dfuhelper_thr_running = true;
- set_spin(1);
- subscribe_cmd(device_event_cb, irecv_device_event_cb);
- while (get_spin()) {
- sleep(1);
- };
- dfuhelper_thr_running = false;
- return 0;
-}
diff --git a/src/exec_checkra1n.c b/src/exec_checkra1n.c
deleted file mode 100644
index 113ce61..0000000
--- a/src/exec_checkra1n.c
+++ /dev/null
@@ -1,206 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if defined(__APPLE__)
-#include
-#endif
-
-extern char **environ;
-extern char* gOverrideLibcheckra1nHelper;
-
-#include
-#ifdef TUI
-#include
-#endif
-#include
-char* pongo_path = NULL;
-bool external_pongo = false;
-char* ext_checkra1n = NULL;
-
-#define tmpdir getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR")
-
-int exec_checkra1n(void) {
- LOG(LOG_INFO, "About to execute checkra1n");
- int fd_checkra1n, fd_pongo, ret;
- char* checkra1n_path = NULL;
-#ifndef NO_CUSTOM_PONGO
- if (pongo_path == NULL) {
- pongo_path = malloc(strlen(tmpdir) + 20);
- if (pongo_path == NULL) {
- LOG(LOG_FATAL, "memory allocation failed\n");
- return -1;
- }
- snprintf(pongo_path, strlen(tmpdir) + 20, "%s/Pongo.bin.XXXXXX", tmpdir);
- fd_pongo = mkstemp(pongo_path);
- if (fd_pongo == -1) {
- LOG(LOG_FATAL, "Cannot open temporary file %s: %d (%s)", pongo_path, errno, strerror(errno));
- free(pongo_path);
- return -1;
- }
- ssize_t didWrite_Pongo_bin = write(fd_pongo, Pongo_bin, Pongo_bin_len);
- if (didWrite_Pongo_bin != (ssize_t)Pongo_bin_len) {
- LOG(LOG_FATAL, "Size written to %s does not match expected: %zd != %" PRIu32 ": %d (%s)", pongo_path, didWrite_Pongo_bin, Pongo_bin_len, errno, strerror(errno));
- close(fd_pongo);
- unlink(pongo_path);
- free(pongo_path);
- pongo_path = NULL;
- return -1;
- }
- } else external_pongo = true;
-#endif
- if (ext_checkra1n != NULL) {
- checkra1n_path = ext_checkra1n;
- } else {
- checkra1n_path = malloc(strlen(tmpdir) + 20);
- if (checkra1n_path == NULL) {
- LOG(LOG_FATAL, "memory allocation failed\n");
- return -1;
- }
- snprintf(checkra1n_path, strlen(tmpdir) + 20, "%s/checkra1n.XXXXXX", tmpdir);
- fd_checkra1n = mkstemp(checkra1n_path);
- if (fd_checkra1n == -1) {
- LOG(LOG_FATAL, "Cannot open temporary file %s: %d (%s)", checkra1n_path, errno, strerror(errno));
- free(checkra1n_path);
- checkra1n_path = NULL;
- return -1;
- }
- ssize_t didWrite_checkra1n = write(fd_checkra1n, checkra1n, checkra1n_len);
- if (didWrite_checkra1n != (ssize_t)checkra1n_len) {
- LOG(LOG_FATAL, "Size written to %s does not match expected: %zd != %" PRIu32 ": %d (%s)", checkra1n_path, didWrite_checkra1n, checkra1n_len, errno, strerror(errno));
- close(fd_checkra1n);
- unlink(checkra1n_path);
- free(checkra1n_path);
- checkra1n_path = NULL;
- return -1;
- }
- close(fd_checkra1n);
- ret = chmod(checkra1n_path, 0700);
- if (ret) {
- LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", checkra1n_path, errno, strerror(errno));
- unlink(checkra1n_path);
- free(checkra1n_path);
- checkra1n_path = NULL;
- return -1;
- }
- }
-#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
- char* libcheckra1nhelper_dylib_path = NULL;
- {
- struct utsname name;
- uname(&name);
- unsigned long darwinMajor = strtoul(name.release, NULL, 10);
- assert(darwinMajor != 0);
-#if !defined(FORCE_HELPER)
- if (darwinMajor < 20) {
-#endif
- if (gOverrideLibcheckra1nHelper) {
- libcheckra1nhelper_dylib_path = gOverrideLibcheckra1nHelper;
- goto setenv_ra1n;
- }
- libcheckra1nhelper_dylib_path = malloc(strlen(tmpdir) + 40);
- if (libcheckra1nhelper_dylib_path == NULL) {
- LOG(LOG_FATAL, "memory allocation failed\n");
- return -1;
- }
- snprintf(libcheckra1nhelper_dylib_path, strlen(tmpdir) + 40, "%s/libcheckra1nhelper.dylib.XXXXXX", tmpdir);
- int helper_fd = mkstemp(libcheckra1nhelper_dylib_path);
- if (helper_fd == -1) {
- LOG(LOG_FATAL, "Cannot open temporary file: %d (%s)", errno, strerror(errno));
- return -1;
- }
- ssize_t didWrite_libcheckra1nhelper = write(helper_fd, libcheckra1nhelper_dylib, libcheckra1nhelper_dylib_len);
- if ((unsigned int)didWrite_libcheckra1nhelper != libcheckra1nhelper_dylib_len) {
- LOG(LOG_FATAL, "Size written does not match expected: %zd != %" PRIu32 ": %d (%s)", didWrite_libcheckra1nhelper, libcheckra1nhelper_dylib_len, errno, strerror(errno));
- close(helper_fd);
- unlink(libcheckra1nhelper_dylib_path);
- return -1;
- }
- close(helper_fd);
- ret = chmod(libcheckra1nhelper_dylib_path, 0700);
- if (ret) {
- LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", libcheckra1nhelper_dylib_path, errno, strerror(errno));
- unlink(libcheckra1nhelper_dylib_path);
- return -1;
- }
-setenv_ra1n:
- setenv("DYLD_INSERT_LIBRARIES", libcheckra1nhelper_dylib_path, 1);
-#if !defined(FORCE_HELPER)
- }
-#endif
- }
-#endif
- char args[0x10] = "-E";
- if ((palerain_flags & palerain_option_demote)) strncat(args, "d", 0xf);
- if (!(palerain_flags & palerain_option_checkrain_is_clone)) {
- strncat(args, "p", 0xf);
- if (verbose >= 2) strncat(args, "v", 0xf);
- if ((palerain_flags & palerain_option_no_colors)) strncat(args, "n", 0xf);
- } else {
- strncat(args, "R", 0xf);
- }
- LOG(LOG_VERBOSE5, "%s", args);
- if (pongo_path != NULL) LOG(LOG_VERBOSE5, "%s", pongo_path);
- pid_t pid;
- posix_spawn_file_actions_t action;
- posix_spawn_file_actions_init(&action);
-#ifdef TUI
- if (tui_is_jailbreaking) {
- // silence checkra1n
- posix_spawn_file_actions_addopen(&action, 1, "/dev/null", O_WRONLY, 0);
- posix_spawn_file_actions_addopen(&action, 2, "/dev/null", O_WRONLY, 0);
- }
-#endif
- ret = posix_spawn(&pid, checkra1n_path, &action, NULL, (char* []){
- checkra1n_path,
- args,
- "-k",
- pongo_path,
- NULL
- }, environ);
- posix_spawn_file_actions_destroy(&action);
- if (ret) {
- LOG(LOG_FATAL, "Cannot posix spawn %s: %d (%s)", checkra1n_path, errno, strerror(errno));
- if (ext_checkra1n != NULL) unlink(checkra1n_path);
- return -1;
- }
- LOG(LOG_VERBOSE2, "%s spawned successfully", checkra1n_path);
- sleep(2);
- if (ext_checkra1n == NULL) {
- unlink(checkra1n_path);
- free(checkra1n_path);
- checkra1n_path = NULL;
- }
- waitpid(pid, NULL, 0);
- if (!external_pongo && pongo_path != NULL) {
- unlink(pongo_path);
- }
- if (pongo_path != NULL) free(pongo_path);
- pongo_path = NULL;
-#if defined(__APPLE__) && defined(__arm64__) && (TARGET_OS_IPHONE || defined(FORCE_HELPER))
- if (libcheckra1nhelper_dylib_path != NULL) {
- if (!gOverrideLibcheckra1nHelper) unlink(libcheckra1nhelper_dylib_path);
- unsetenv("DYLD_INSERT_LIBRARIES");
- unsetenv("DYLD_FORCE_FLAT_NAMESPACE");
- if (!gOverrideLibcheckra1nHelper) free(libcheckra1nhelper_dylib_path);
- libcheckra1nhelper_dylib_path = NULL;
- }
-#endif
- return 0;
-}
diff --git a/src/fake_embedded.c b/src/fake_embedded.c
deleted file mode 100644
index 48d3ce1..0000000
--- a/src/fake_embedded.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include
-
-#ifdef NO_KPF
-unsigned char* checkra1n_kpf_pongo_lzma = NULL;
-unsigned int checkra1n_kpf_pongo_lzma_len = 0;
-#endif
-
-#ifdef NO_RAMDISK
-unsigned char* ramdisk_dmg_lzma = NULL;
-unsigned int ramdisk_dmg_lzma_len = 0;
-#endif
-
-#ifdef NO_CHECKRAIN
-unsigned char* checkra1n = NULL;
-unsigned int checkra1n_len = 0;
-#endif
-
-#ifdef NO_OVERLAY
-unsigned char* binpack_dmg = NULL;
-unsigned int binpack_dmg_len = 0;
-#endif
-
-#ifdef NO_CUSTOM_PONGO
-unsigned char* Pongo_bin = NULL;
-unsigned int Pongo_bin_len = 0;
-#endif
-
-#ifdef NO_EMBED_HELPER
-unsigned char* libcheckra1nhelper_dylib = NULL;
-unsigned int libcheckra1nhelper_dylib_len = 0;
-#endif
diff --git a/src/gen/.gitignore b/src/gen/.gitignore
deleted file mode 100644
index 5761abc..0000000
--- a/src/gen/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.o
diff --git a/src/gen/resources b/src/gen/resources
deleted file mode 120000
index 945c9b4..0000000
--- a/src/gen/resources
+++ /dev/null
@@ -1 +0,0 @@
-.
\ No newline at end of file
diff --git a/src/lock_vars.c b/src/lock_vars.c
deleted file mode 100644
index 7da4219..0000000
--- a/src/lock_vars.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-
-pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
-
-bool spin, found_pongo = 0;
-uint64_t ecid_wait_for_dfu = 0;
-
-static bool get_locked_bool(bool* val, pthread_mutex_t* mutex) {
- // fprintf(stderr, "%s: val = %p mutex = %p\n", __func__, (void*)val, (void*)mutex);
- pthread_mutex_lock(mutex);
- bool ret = *val;
- pthread_mutex_unlock(mutex);
- return ret;
-}
-
-static bool set_locked_bool(bool* val, bool newval, pthread_mutex_t* mutex) {
- // fprintf(stderr, "%s: val = %p mutex = %p, newval = %d\n", __func__, (void*)val, (void*)mutex, newval);
- pthread_mutex_lock(mutex);
- *val = newval;
- pthread_mutex_unlock(mutex);
- return newval;
-}
-
-bool get_spin(void) {
- return get_locked_bool(&spin, &spin_mutex);
-}
-
-bool set_spin(bool newval) {
- return set_locked_bool(&spin, newval, &spin_mutex);
-}
-
-bool get_found_pongo(void) {
- return get_locked_bool(&found_pongo, &found_pongo_mutex);
-}
-
-bool set_found_pongo(bool val) {
- return set_locked_bool(&found_pongo, val, &found_pongo_mutex);
-}
-
-uint64_t get_ecid_wait_for_dfu(void) {
- LOG(LOG_VERBOSE5, "locking ecid wait for dfu mutex for get");
- pthread_mutex_lock(&ecid_dfu_wait_mutex);
- uint64_t ret = ecid_wait_for_dfu;
- LOG(LOG_VERBOSE5, "UN-locking ecid wait for dfu mutex, ecid_wait_for_dfu value is %llu", ret);
- pthread_mutex_unlock(&ecid_dfu_wait_mutex);
- return ret;
-}
-
-uint64_t set_ecid_wait_for_dfu(uint64_t ecid) {
- LOG(LOG_VERBOSE5, "locking ecid wait for dfu mutex for set ecid_wait_for_dfu = %llu", ecid);
- pthread_mutex_lock(&ecid_dfu_wait_mutex);
- ecid_wait_for_dfu = ecid;
- LOG(LOG_VERBOSE5, "UN-locking ecid wait for dfu mutex afrer setting ecid_wait_for_dfu");
- pthread_mutex_unlock(&ecid_dfu_wait_mutex);
- return ecid;
-}
diff --git a/src/log.c b/src/log.c
deleted file mode 100644
index 982c0c9..0000000
--- a/src/log.c
+++ /dev/null
@@ -1,107 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#ifdef TUI
-#include
-#endif
-
-int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, const char *__restrict format, ...)
-{
-#ifdef TUI
- if (tui_started) return 0;
-#endif
- if (verbose >= 5
-#ifdef TUI
- && !(palerain_flags & palerain_option_tui)
-#endif
- ) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
- int ret = 0;
- char type[0x10];
- char colour[0x10];
- char colour_bold[0x10];
- va_list args;
- va_start(args, format);
- if (verbose < (loglevel - 3) && loglevel > LOG_INFO) {
- if (verbose >= 5
-#ifdef TUI
- && !tui_started
-#endif
-) fprintf(stderr, "p1_log: hid log with high log level (%d < %d)\n", verbose, loglevel - 3);
- va_end(args);
- return 0;
- }
- switch (loglevel) {
- case LOG_FATAL:
- snprintf(type, 0x10, "%s", "!");
- snprintf(colour, 0x10, "%s", RED);
- snprintf(colour_bold, 0x10, "%s", BRED);
- break;
- case LOG_ERROR:
- snprintf(type, 0x10, "%s", "Error");
- snprintf(colour, 0x10, "%s", RED);
- snprintf(colour_bold, 0x10, "%s", BRED);
- break;
- case LOG_WARNING:
- snprintf(type, 0x10, "%s", "Warning");
- snprintf(colour, 0x10, "%s", YEL);
- snprintf(colour_bold, 0x10, "%s", BYEL);
- break;
- case LOG_INFO:
- snprintf(type, 0x10, "%s", "Info");
- snprintf(colour, 0x10, "%s", CYN);
- snprintf(colour_bold, 0x10, "%s", BCYN);
- break;
- default:
- assert(loglevel >= 0);
- snprintf(type, 0x10, "%s", "Verbose");
- snprintf(colour, 0x10, "%s", WHT);
- snprintf(colour_bold, 0x10, "%s", BWHT);
- break;
- }
- if ((palerain_flags & palerain_option_no_colors)) {
- colour[0] = '\0';
- colour_bold[0] = '\0';
- }
- {
- pthread_mutex_lock(&log_mutex);
- char timestring[0x80];
- time_t curtime;
- time(&curtime);
- struct tm* timeinfo = localtime(&curtime);
- if (!(palerain_flags & palerain_option_no_colors))
- snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET);
- else
- snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
- if (verbose >= 2 && !(palerain_flags & palerain_option_no_colors)) {
- printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold);
- } else if (!(palerain_flags & palerain_option_no_colors)) {
- printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
- } else if (verbose >= 2 && (palerain_flags & palerain_option_no_colors)) {
- printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold);
- } else if ((palerain_flags & palerain_option_no_colors)) {
- printf(" - %s %s<%s>: ", timestring, colour_bold, type);
- }
- printf("%s", colour);
- ret = vprintf(format, args);
- va_end(args);
-
- if (verbose < 2 && !(palerain_flags & palerain_option_no_colors))
- printf(CRESET "\n");
- else if (!(palerain_flags & palerain_option_no_colors))
- printf("\n%s-%s\n", colour, CRESET);
- else if (verbose < 2)
- printf("\n");
- else
- printf("\n%s-\n", colour);
- fflush(stdout);
- }
- pthread_mutex_unlock(&log_mutex);
- return ret;
-}
diff --git a/src/main.c b/src/main.c
deleted file mode 100644
index 99d6cab..0000000
--- a/src/main.c
+++ /dev/null
@@ -1,190 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-
-#define CMD_LEN_MAX 512
-#define OVERRIDE_MAGIC 0xd803b376
-
-unsigned int verbose = 0;
-/* we want to write to them so don't use string literals */
-char xargs_cmd[0x270] = { 'x', 'a', 'r', 'g', 's', '\0' },
- palerain_flags_cmd[0x30] = { 'd', 'e', 'a', 'd', 'b', 'e', 'e', 'f', '\0' };
-extern char** environ;
-
-niarelap_file_t* kpf_to_upload_1 = &checkra1n_kpf_pongo_lzma;
-niarelap_file_t* ramdisk_to_upload_1 = &ramdisk_dmg_lzma;
-niarelap_file_t* overlay_to_upload_1 = &binpack_dmg;
-
-niarelap_file_t** kpf_to_upload = &kpf_to_upload_1;
-niarelap_file_t** ramdisk_to_upload = &ramdisk_to_upload_1;
-niarelap_file_t** overlay_to_upload = &overlay_to_upload_1;
-
-override_file_t override_ramdisk, override_kpf, override_overlay;
-
-uint64_t palerain_flags = 0;
-
-pthread_mutex_t log_mutex;
-pthread_t dfuhelper_thread, pongo_thread;
-
-void thr_cleanup(void* ptr) {
- *(int*)ptr = 0;
-}
-
-static int build_checks(void) {
-#ifndef NO_CHECKRAIN
-#if defined(__APPLE__)
- struct mach_header_64* c1_header = (struct mach_header_64*)&checkra1n[0];
- if (c1_header->magic != MH_MAGIC_64 && c1_header->magic != MH_CIGAM_64) {
- LOG(LOG_FATAL, "Broken build: checkra1n is not a thin Mach-O");
- return -1;
- }
- if (c1_header->cputype != _mh_execute_header.cputype) {
- LOG(LOG_FATAL, "Broken build: checkra1n CPU type does not match palera1n CPU type");
- return -1;
- }
-#endif
- if (checkra1n_len <= (UCHAR_MAX + 1)) {
- LOG(LOG_FATAL, "checkra1n too small");
- }
- if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char *)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) {
- palerain_flags |= palerain_option_checkrain_is_clone;
- }
-#endif
- return 0;
-}
-
-#ifdef TUI
-bool tui_started = false;
-#endif
-
-#ifdef USE_LIBUSB
-void log_cb(libusb_context *ctx, enum libusb_log_level level, const char *str) {
- LOG(level + 0, "%s", str);
-}
-#endif
-
-// save argc, argv, and envp for restarting
-
-int saved_argc;
-char** saved_argv;
-char** saved_envp;
-
-static int palera1n(int argc, char *argv[], char *envp[]) {
- saved_argc = argc;
- saved_argv = argv;
- saved_envp = envp;
-
- print_credits();
- int ret = 0;
- pthread_mutex_init(&log_mutex, NULL);
- pthread_mutex_init(&spin_mutex, NULL);
- pthread_mutex_init(&found_pongo_mutex, NULL);
- pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
- if ((ret = build_checks())) return ret;
- if ((ret = optparse(argc, argv))) goto cleanup;
- if (!(palerain_flags & palerain_option_device_info) && (palerain_flags & palerain_option_palerain_version)) goto normal_exit;
-#ifdef TUI
- if ((palerain_flags & palerain_option_tui) || (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) && !(palerain_flags & palerain_option_cli))) {
- ret = tui();
- if (ret) goto cleanup;
- else goto normal_exit;
- }
-#endif
-#ifdef USE_LIBUSB
- {
- libusb_set_log_cb(NULL, log_cb, LIBUSB_LOG_CB_GLOBAL);
- libusb_context* ctx = NULL;
- int test_libusb = libusb_init(&ctx);
- if (test_libusb) {
- LOG(LOG_ERROR, "cannot initialize libusb: %d (%s)\n", test_libusb, libusb_strerror(test_libusb));
- libusb_exit(ctx);
- goto cleanup;
- }
- libusb_exit(ctx);
- }
-#endif
-
- if (!(palerain_flags & palerain_option_device_info))
- LOG(LOG_INFO, "Waiting for devices");
-
- if (getenv("USBMUXD_SOCKET_ADDRESS") == NULL && access("/var/run/usbmuxd", F_OK) != 0)
- LOG(LOG_WARNING, "/var/run/usbmuxd not found, normal mode device detection will not work.");
-
- pthread_create(&pongo_thread, NULL, pongo_helper, NULL);
- pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
- pthread_join(dfuhelper_thread, NULL);
- set_spin(0);
- if ((palerain_flags & (palerain_option_dfuhelper_only |
- palerain_option_reboot_device |
- palerain_option_exit_recovery |
- palerain_option_enter_recovery |
- palerain_option_device_info)
- ) || device_has_booted)
- goto normal_exit;
- pthread_cancel(pongo_thread);
- pthread_join(pongo_thread, NULL);
- if (exec_checkra1n()) goto cleanup;
-
- if ((palerain_flags & (palerain_option_pongo_exit | palerain_option_demote)))
- goto normal_exit;
- set_spin(1);
- sleep(2);
- pthread_create(&pongo_thread, NULL, pongo_helper, NULL);
- pthread_join(pongo_thread, NULL);
- while (get_spin())
- {
- sleep(1);
- }
-normal_exit:
-cleanup:
- if (override_kpf.magic == OVERRIDE_MAGIC) {
- munmap(override_kpf.ptr, (size_t)override_kpf.len);
- close(override_kpf.fd);
- }
- if (override_ramdisk.magic == OVERRIDE_MAGIC) {
- munmap(override_ramdisk.ptr, (size_t)override_ramdisk.len);
- close(override_ramdisk.fd);
- }
- if (override_overlay.magic == OVERRIDE_MAGIC) {
- munmap(override_overlay.ptr, (size_t)override_overlay.len);
- close(override_overlay.fd);
- }
- if (ext_checkra1n != NULL) free(ext_checkra1n);
- pthread_mutex_destroy(&log_mutex);
- pthread_mutex_destroy(&spin_mutex);
- pthread_mutex_destroy(&found_pongo_mutex);
- pthread_mutex_destroy(&ecid_dfu_wait_mutex);
- return ret;
-}
-
-
-int main (int argc, char* argv[], char* envp[]) {
- return palera1n(argc, argv, envp);
-}
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..2f8024b
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,165 @@
+#include // isatty, STDIN_FILENO
+#include // getenv
+#include
+#include
+#include
+#include
+
+#if defined(__APPLE__)
+#include
+#include
+#include
+#endif
+
+#ifdef WITH_GUI
+# include
+#endif
+
+#include "utils/constants.h"
+#include "utils/log.h"
+#include "utils/paleinfo.h"
+
+void print_credits() {
+ printf(
+ ":: ========================== ::\n"
+ ":: palera1n: " PALERAIN_VERSION "\n"
+ ":: ========================== ::\n\n"
+ );
+}
+
+void print_usage(char* argv) {
+ printf(
+ "Usage: %s [OPTIONS]\n\n"
+ " -h, --help Print usage information\n"
+ " -v, --version Print version\n\n"
+ "Options:\n"
+ " --cli Use command line interface\n"
+ #ifdef WITH_GUI
+ " --gui Use graphical user interface\n"
+ #endif
+ " --force-revert Force environment reversion\n"
+ " -l, --rootless Enable rootless mode (standard)\n"
+ " -f, --rootful Enable rootful mode\n"
+ " -c, --setup-fakefs Setup fake filesystem\n"
+ " -B, --setup-partial-fakefs Setup partial fake filesystem\n"
+ " -s, --safe-mode Enable safe mode\n"
+ " -T, --telnetd Enable TELNET daemon on port 46 (insecure)\n"
+ " -V, --verbose-boot Enable verbose booting\n"
+ , argv
+ );
+}
+
+void parse_arguments(int argc, char* argv[]) {
+ int options;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'v'},
+ {"cli", no_argument, NULL, 1},
+ #ifdef WITH_GUI
+ {"gui", no_argument, NULL, 3},
+ #endif
+ {"force-revert", no_argument, NULL, 0},
+ {"rootless", no_argument, NULL, 'l'},
+ {"rootful", no_argument, NULL, 'f'},
+ {"setup-fakefs", no_argument, NULL, 'c'},
+ {"setup-partial-fakefs", no_argument, NULL, 'B'},
+ {"safe-mode", no_argument, NULL, 's'},
+ {"telnetd", no_argument, NULL, 'T'},
+ {"verbose-boot", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0}
+ };
+
+ #ifdef WITH_GUI
+ if (isatty(STDIN_FILENO) && getenv("LLVM_PROFILE_FILE") == nullptr) {
+ palerain_flags &= ~palerain_option_gui;
+ palerain_flags |= palerain_option_cli;
+ } else {
+ palerain_flags &= ~palerain_option_cli;
+ palerain_flags |= palerain_option_gui;
+ }
+ #else
+ palerain_flags |= palerain_option_cli;
+ #endif
+
+ while ((options = getopt_long(argc, argv, "hvlf:", long_options, &option_index)) != -1) {
+ switch (options) {
+ case 'h': // --help
+ print_usage(argv[0]);
+ exit(1);
+ case 'v': // --version
+ exit(0);
+ case 1: // --cli
+ palerain_flags &= ~palerain_option_tui;
+ palerain_flags &= ~palerain_option_gui;
+ palerain_flags |= palerain_option_cli;
+ break;
+ #ifdef WITH_GUI
+ case 3: // --gui
+ palerain_flags &= ~palerain_option_cli;
+ palerain_flags &= ~palerain_option_tui;
+ palerain_flags |= palerain_option_gui;
+ break;
+ #endif
+ case 0: // --force-revert
+ palerain_flags |= palerain_option_force_revert;
+ 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
+ palerain_flags |= palerain_option_setup_rootful;
+ break;
+ case 'B': // --setup-partial-fakefs
+ palerain_flags |= palerain_option_setup_partial_root;
+ break;
+ case 's': // --safe-mode
+ palerain_flags |= palerain_option_safemode;
+ break;
+ case 'T': // --telnetd
+ palerain_flags |= palerain_option_telnetd;
+ break;
+ case 'V': // --verbose-boot
+ palerain_flags |= palerain_option_verbose_boot;
+ break;
+ case '?':
+ LOG("Unknown option");
+ print_usage(argv[0]);
+ exit(1);
+ default: break;
+ }
+ }
+
+ if (!(palerain_flags & palerain_option_gui)) {
+ if (!(palerain_flags & palerain_option_rootful) && !(palerain_flags & palerain_option_rootless)) {
+ LOG("You must specify either -l, --rootless or -f, --rootful.\n");
+ print_usage(argv[0]);
+ exit(1);
+ }
+ }
+}
+
+int main(int argc, char* argv[], char* envp[]) {
+ print_credits();
+ parse_arguments(argc, argv);
+ LOG("palera1n_flags: %llu", palerain_flags);
+
+ #ifdef WITH_GUI
+ if (palerain_flags & palerain_option_gui) {
+ wxEntryStart(argc, argv);
+ wxTheApp->CallOnInit();
+ wxTheApp->OnRun();
+ wxTheApp->OnExit();
+ wxEntryCleanup();
+ return 0;
+ }
+ #endif
+
+ return 0;
+}
diff --git a/src/obj/.gitignore b/src/obj/.gitignore
deleted file mode 100644
index 5761abc..0000000
--- a/src/obj/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.o
diff --git a/src/obj/gen b/src/obj/gen
deleted file mode 120000
index 945c9b4..0000000
--- a/src/obj/gen
+++ /dev/null
@@ -1 +0,0 @@
-.
\ No newline at end of file
diff --git a/src/optparse.c b/src/optparse.c
deleted file mode 100644
index 5220116..0000000
--- a/src/optparse.c
+++ /dev/null
@@ -1,467 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifdef TUI
-#include
-#endif
-
-uint64_t* palerain_flags_p = &palerain_flags;
-char* gOverrideLibcheckra1nHelper = NULL;
-
-static struct option longopts[] = {
- {"setup-partial-fakefs", no_argument, NULL, 'B'},
- {"setup-fakefs", no_argument, NULL, 'c'},
- {"clean-fakefs", no_argument, NULL, 'C'},
- {"dfuhelper", no_argument, NULL, 'D'},
- {"help", no_argument, NULL, 'h'},
- {"pongo-shell", no_argument, NULL, 'p'},
- {"pongo-full", no_argument, NULL, 'P'},
- {"debug-logging", no_argument, NULL, 'v'},
- {"verbose-boot", no_argument, NULL, 'V'},
- {"boot-args", required_argument, NULL, 'e'},
- {"fakefs", no_argument, NULL, 'f'},
- {"rootless", no_argument, NULL, 'l'},
- {"demote", no_argument, NULL, 'd'},
- {"force-revert", no_argument, NULL, palerain_option_case_force_revert},
- {"no-colors", no_argument, NULL, 'S'},
- {"safe-mode", no_argument, NULL, 's'},
- {"telnetd", no_argument, NULL, 'T'},
- {"version", no_argument, NULL, palerain_option_case_version},
- {"override-libcheckra1nhelper", required_argument, NULL, palerain_option_case_libcheckra1nhelper_path},
- {"override-pongo", required_argument, NULL, 'k'},
- {"override-overlay", required_argument, NULL, 'o'},
- {"override-ramdisk", required_argument, NULL, 'r'},
- {"override-kpf", required_argument, NULL, 'K'},
- {"override-checkra1n", required_argument, NULL, 'i'},
- {"reboot-device", no_argument, NULL, 'R'},
- {"exit-recovery", no_argument, NULL, 'n'},
- {"enter-recovery", no_argument, NULL, 'E'},
- {"device-info", no_argument, NULL, 'I'},
-#ifdef DEV_BUILD
- {"test1", no_argument, NULL, '1'},
- {"test2", no_argument, NULL, '2'},
-#endif
-#ifdef TUI
- {"tui", no_argument, NULL, 't'},
-#endif
- {"cli", no_argument, NULL, palerain_option_case_cli},
- {NULL, 0, NULL, 0}
-};
-
-static int usage(int e, char* prog_name)
-{
- fprintf(stderr,
- "Usage: %s [-"
- "DEhpvVldsSTLRnPI"
-#ifdef DEV_BUILD
- "12"
-#endif
-#ifdef ROOTFUL
- "cCfB"
-#endif
-#ifdef TUI
- "t"
-#endif
- "] [-e boot arguments] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file] [-i checkra1n file]\n"
- "Copyright (C) 2024, palera1n team, All Rights Reserved.\n\n"
- "iOS/iPadOS/tvOS 15.0-26.0, bridgeOS 5.0-10.0 arm64 jailbreaking tool\n\n"
- "\t--version\t\t\t\tPrint version\n"
- "\t--force-revert\t\t\t\tRemove jailbreak\n"
-#ifdef DEV_BUILD
- "\t-1, --test1\t\t\t\tSet palerain_option_test1\n"
- "\t-2, --test2\t\t\t\tSet palerain_option_test2\n"
-#endif
-#ifdef ROOTFUL
- "\t-B, --setup-partial-fakefs\t\tSetup partial fakefs\n"
- "\t-c, --setup-fakefs\t\t\tSetup fakefs\n"
- "\t-C, --clean-fakefs\t\t\tClean fakefs\n"
-#endif
- "\t-d, --demote\t\t\t\tDemote\n"
- "\t-D, --dfuhelper\t\t\t\tExit after entering DFU\n"
- "\t-e, --boot-args \tXNU boot arguments\n"
- "\t-E, --enter-recovery\t\t\tEnter recovery mode\n"
-#ifdef ROOTFUL
- "\t-f, --fakefs \t\t\t\tBoots fakefs\n"
-#endif
- "\t-h, --help\t\t\t\tShow this help\n"
- "\t-i, --override-checkra1n \t\tOverride checkra1n\n"
- "\t-k, --override-pongo \t\tOverride Pongo image\n"
- "\t-K, --override-kpf \t\tOverride kernel patchfinder\n"
-#ifdef ROOTFUL
- "\t-l, --rootless\t\t\t\tBoots rootless. This is the default\n"
-#endif
- "\t-L, --jbinit-log-to-file\t\tMake jbinit log to /cores/jbinit.log (can be read from sandbox while jailbroken)\n"
- "\t-n, --exit-recovery\t\t\tExit recovery mode\n"
- "\t-I, --device-info\t\t\tPrint info about the connected device\n"
- "\t-o, --override-overlay \t\tOverride overlay\n"
- "\t-p, --pongo-shell\t\t\tBoots to PongoOS shell\n"
- "\t-P, --pongo-full\t\t\tBoots to a PongoOS shell with default images already uploaded\n"
- "\t-r, --override-ramdisk \t\tOverride ramdisk\n"
- "\t-R, --reboot-device\t\t\tReboot connected device in normal mode\n"
- "\t-s, --safe-mode\t\t\t\tEnter safe mode\n"
- "\t-S, --no-colors\t\t\t\tDisable colors on the command line\n"
- "\t-T, --telnetd\t\t\t\tEnable TELNET daemon on port 46 (insecure)\n"
- "\t-v, --debug-logging\t\t\tEnable debug logging\n"
- "\t\tThis option can be repeated for extra verbosity.\n"
- "\t-V, --verbose-boot\t\t\tVerbose boot\n"
-
-#ifdef TUI
- "\t-t, --tui\t\t\t\tForce interactive TUI\n"
- "\t--cli\t\t\t\t\tForce cli mode\n"
-#endif
- "\nEnvironmental variables:\n"
- "\tTMPDIR\t\ttemporary diretory (path the built-in checkra1n will be extracted to)\n"
- ,
- prog_name);
- exit(e);
-}
-
-int optparse(int argc, char* argv[]) {
- int opt;
- int index;
- while ((opt = getopt_long(argc, argv,
- "DEhpvVlLdsSTtRnPIe:o:r:K:k:i:"
-#ifdef DEV_BUILD
- "12"
-#endif
-#ifdef ROOTFUL
- "fCcB"
-#endif
- ,longopts, NULL)) != -1)
- {
- switch (opt) {
-#ifdef ROOTFUL
- case 'B':
- palerain_flags |= palerain_option_setup_partial_root;
- palerain_flags |= palerain_option_setup_rootful;
- break;
- case 'c':
- palerain_flags |= palerain_option_setup_rootful;
- break;
- case 'C':
- palerain_flags |= palerain_option_clean_fakefs;
- break;
-#endif
- case 'p':
- palerain_flags |= palerain_option_pongo_exit;
- break;
- case 'P':
- palerain_flags |= palerain_option_pongo_full;
- break;
- case 'D':
- palerain_flags |= palerain_option_dfuhelper_only;
- break;
- case 'h':
- usage(0, argv[0]);
- assert(0);
- case 'v':
- verbose++;
- break;
- case 'V':
- palerain_flags |= palerain_option_verbose_boot;
-#ifdef TUI
- tui_options_verbose_boot = true;
-#endif
- break;
- case 'e':
- if (strlen(optarg) > (sizeof(xargs_cmd) - 0x20)) {
- LOG(LOG_FATAL, "Boot arguments too long");
- return -1;
- }
- snprintf(xargs_cmd, sizeof(xargs_cmd), "xargs %s", optarg);
-#ifdef TUI
- snprintf(tui_options_boot_args, sizeof(tui_options_boot_args), "%s", optarg);
-#endif
- break;
-#ifdef ROOTFUL
- case 'f':
- palerain_flags |= palerain_option_rootful;
- palerain_flags &= ~palerain_option_rootless;
- break;
-#endif
- case 'l':
- palerain_flags &= ~palerain_option_rootful;
- palerain_flags |= palerain_option_rootless;
- break;
- case 'L':
- palerain_flags |= palerain_option_jbinit_log_to_file;
- break;
- case 'd':
- palerain_flags |= palerain_option_demote;
- break;
- case 'E':
- palerain_flags |= palerain_option_enter_recovery;
- break;
- case 's':
- palerain_flags |= palerain_option_safemode;
-#ifdef TUI
- tui_options_safe_mode = true;
-#endif
- break;
- case 'T':
- palerain_flags |= palerain_option_telnetd;
- break;
- case 'k':
- if (access(optarg, F_OK) != 0) {
- LOG(LOG_FATAL, "Cannot access pongo file at %s: %d (%s)", optarg, errno, strerror(errno));
- return -1;
- }
- pongo_path = malloc(strlen(optarg) + 1);
- if (pongo_path == NULL) {
- LOG(LOG_FATAL, "memory allocation failed");
- return -1;
- }
- snprintf(pongo_path, strlen(optarg) + 1, "%s", optarg);
- break;
- case 'o':
- if (override_file(&override_overlay, overlay_to_upload, &binpack_dmg_len, optarg))
- return 1;
- break;
- case 'r':
- if (override_file(&override_ramdisk, ramdisk_to_upload, &ramdisk_dmg_lzma_len, optarg))
- return 1;
- break;
- case 'K':
- if (override_file(&override_kpf, kpf_to_upload, &checkra1n_kpf_pongo_lzma_len, optarg))
- return 1;
- struct mach_header_64* hdr = (struct mach_header_64*)override_kpf.ptr;
- if (hdr->magic != MH_MAGIC_64 && hdr->magic != MH_CIGAM_64) {
- LOG(LOG_FATAL, "Invalid kernel patchfinder: Not thin 64-bit Mach-O");
- return -1;
- } else if (hdr->filetype != MH_KEXT_BUNDLE) {
- LOG(LOG_FATAL, "Invalid kernel patchfinder: Not a kext bundle");
- return -1;
- } else if (hdr->cputype != CPU_TYPE_ARM64) {
- LOG(LOG_FATAL, "Invalid kernel patchfinder: CPU type is not arm64");
- return -1;
- }
- break;
- case 'i': {};
- struct stat st;
- if (stat(optarg, &st) != 0) {
- LOG(LOG_FATAL, "cannot stat external checkra1n file: %d (%s)", errno, strerror(errno));
- return -1;
- } else if (!(st.st_mode & S_IXUSR) && !(st.st_mode & S_IXGRP) && !(st.st_mode & S_IXOTH)) {
- LOG(LOG_FATAL, "%s is not executable", optarg);
- return -1;
- } else if (!S_ISREG(st.st_mode)) {
- LOG(LOG_FATAL, "%s is not a regular file", optarg);
- return -1;
- }
- if (st.st_size < (UCHAR_MAX+1)) {
- LOG(LOG_FATAL, "%s too small", optarg);
- return -1;
- }
- int checkra1n_fd = open(optarg, O_RDONLY);
- if (checkra1n_fd == -1) {
- LOG(LOG_FATAL, "Cannot open %s: %d (%s)", optarg, errno, strerror(errno));
- return -1;
- }
- void* addr = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, checkra1n_fd, 0);
- if (addr == MAP_FAILED) {
- LOG(LOG_ERROR, "Failed to map file %s: %d (%s)", optarg, errno, strerror(errno));
- return -1;
- }
- if (boyermoore_horspool_memmem(addr, st.st_size, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL)
- {
- palerain_flags |= palerain_option_checkrain_is_clone;
- LOG(LOG_VERBOSE3, "%s is checkra1n clone", optarg);
- }
- else
- {
- palerain_flags &= ~palerain_option_checkrain_is_clone;
- LOG(LOG_VERBOSE3, "%s is checkra1n", optarg);
- }
- munmap(addr, st.st_size);
- close(checkra1n_fd);
- ext_checkra1n = calloc(1, strlen(optarg) + 1);
- snprintf(ext_checkra1n, strlen(optarg) + 1, "%s", optarg);
- break;
- case 'R':
- palerain_flags |= palerain_option_reboot_device;
- break;
- case 'n':
- palerain_flags |= palerain_option_exit_recovery;
- break;
- case 'I':
- palerain_flags |= palerain_option_device_info;
- break;
- case 'S':
- palerain_flags |= palerain_option_no_colors;
- break;
-#ifdef TUI
- case 't':
- palerain_flags |= palerain_option_tui;
- break;
-#endif
- case palerain_option_case_cli:
- palerain_flags |= palerain_option_cli;
- break;
-#ifdef DEV_BUILD
- case '1':
- palerain_flags |= palerain_option_test1;
- break;
- case '2':
- palerain_flags |= palerain_option_test2;
- break;
-#endif
- case palerain_option_case_force_revert:
- palerain_flags |= palerain_option_force_revert;
-#ifdef TUI
- tui_options_force_revert = true;
-#endif
- break;
- case palerain_option_case_version:
- palerain_flags |= palerain_option_palerain_version;
- break;
- case palerain_option_case_libcheckra1nhelper_path:
- printf("meow\n");
- gOverrideLibcheckra1nHelper = calloc(1, strlen(optarg) + 1);
- if (!gOverrideLibcheckra1nHelper) {
- return -1;
- }
- snprintf(gOverrideLibcheckra1nHelper, strlen(optarg) + 1, "%s", optarg);
- break;
- default:
- usage(1, argv[0]);
- break;
- }
- }
- if ((palerain_flags & palerain_option_palerain_version)) {
- printf(
- "palera1n " PALERAIN_VERSION "\n"
- BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
- "Build style: " BUILD_STYLE "\n"
- "Build tag: " BUILD_TAG "\n"
-#ifdef USE_LIBUSB
- "USB backend: libusb\n"
-#else
- "USB backend: IOKit\n"
-#endif
- "Build options: " BUILD_OPTIONS "\n"
- );
- return 0;
- }
-
- if (palerain_flags & palerain_option_telnetd) {
- LOG(LOG_WARNING, "telnetd is enabled, this is a security hole");
- }
-
- if ((palerain_flags & (palerain_option_tui)) && (palerain_flags & (palerain_option_cli))) {
- LOG(LOG_FATAL, "cannot specify both --tui and --cli");
- return -1;
- }
-
- if ((palerain_flags & (palerain_option_exit_recovery | palerain_option_enter_recovery | palerain_option_reboot_device | palerain_option_device_info | palerain_option_dfuhelper_only | palerain_option_pongo_exit | palerain_option_pongo_full)) > 0) {
- palerain_flags &= ~palerain_option_tui;
- palerain_flags |= palerain_option_cli;
- } else {
-#ifdef ROOTFUL
- if ((palerain_flags & (palerain_option_rootless | palerain_option_rootful)) == 0) {
- LOG(LOG_FATAL, "Please specify rootful (-f) or rootless (-l)");
- return -1;
- }
-#else
- palerain_flags |= palerain_option_rootless;
-#endif
- }
-
- snprintf(palerain_flags_cmd, 0x30, "palera1n_flags 0x%" PRIx64, palerain_flags);
- LOG(LOG_VERBOSE3, "palerain_flags: %s", palerain_flags_cmd);
- if (override_kpf.magic == OVERRIDE_MAGIC) {
- LOG(LOG_VERBOSE4, "kpf override length %" PRIu32 " -> %" PRIu32, override_kpf.orig_len, checkra1n_kpf_pongo_lzma_len);
- LOG(LOG_VERBOSE4, "kpf override ptr %p -> %p", override_kpf.orig_ptr, **kpf_to_upload);
- }
- if (override_ramdisk.magic == OVERRIDE_MAGIC) {
- LOG(LOG_VERBOSE4, "ramdisk override length %" PRIu32 " -> %" PRIu32, override_ramdisk.orig_len, ramdisk_dmg_lzma_len);
- LOG(LOG_VERBOSE4, "ramdisk override ptr %p -> %p", override_ramdisk.orig_ptr, **ramdisk_to_upload);
- }
- if (override_overlay.magic == OVERRIDE_MAGIC) {
- LOG(LOG_VERBOSE4, "overlay override length %" PRIu32 " -> %" PRIu32, override_overlay.orig_len, binpack_dmg_len);
- LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
- }
-#ifdef ROOTFUL
- if (!(palerain_flags & palerain_option_rootful)) {
- if ((palerain_flags & palerain_option_setup_rootful)) {
- LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
- return -1;
- }
- }
-#endif
- if (!(
- (palerain_flags & palerain_option_dfuhelper_only) ||
- (palerain_flags & palerain_option_enter_recovery) ||
- (palerain_flags & palerain_option_exit_recovery) ||
- (palerain_flags & palerain_option_reboot_device)))
- {
-#ifdef NO_CHECKRAIN
- if (checkra1n_len == 0 && ext_checkra1n == NULL)
- {
- LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
- return -1;
- }
- if (!((palerain_flags & palerain_option_pongo_exit) || (palerain_flags & palerain_option_pongo_exit)))
- {
-#ifdef NO_KPF
- if (checkra1n_kpf_pongo_lzma_len == 0)
- {
- LOG(LOG_FATAL, "kernel patchfinder omitted in build but no override specified");
- return -1;
- }
-#endif
- }
-#endif
-
-#ifdef NO_EMBED_HELPER
- if (libcheckra1nhelper_dylib_len == 0 && gOverrideLibcheckra1nHelper == NULL) {
- LOG(LOG_FATAL, "checkra1n helper omitted in build but no override specified");
- return -1;
- }
-#endif
- }
-
- for (index = optind; index < argc; index++)
- {
- if (!strcmp("windows", argv[index]))
- {
- fprintf(stderr,
- "Windows not really using for manipulating OSX images,\n"
- "compiled in mingw tool for this working unstable and incorrectly\n");
- return -2;
- }
- else
- {
- fprintf(stderr, "%s: unknown argument: %s\n", argv[0], argv[index]);
- usage(1, argv[0]);
- }
- }
- if (verbose >= 2) setenv("LIBUSB_DEBUG", "1", 1);
-
- if (verbose >= 3)
- {
- libusbmuxd_set_debug_level(verbose - 2);
- irecv_set_debug_level(1);
- setenv("LIBUSB_DEBUG", "2", 1);
- }
- if (verbose >= 4) {
- idevice_set_debug_level(1);
- setenv("LIBUSB_DEBUG", "3", 1);
- }
- if (verbose >= 5)
- setenv("LIBUSB_DEBUG", "4", 1);
- return 0;
-}
diff --git a/src/override_file.c b/src/override_file.c
deleted file mode 100644
index 857aebf..0000000
--- a/src/override_file.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include