Compare commits

..
Author SHA1 Message Date
Nick Chan 91c5de6408 docs: s/17.0/17.1/ 2023-10-26 10:33:14 +08:00
samara d65877f851 chore: why use mirror 2023-10-23 20:59:31 -07:00
Nick Chan 3df6791ebd actions: build a static linux usbmuxd 2023-10-14 18:23:02 +08:00
samara 06a93e697b chore: minor spelling mistake 2023-10-02 16:41:51 -07:00
Nick Chan ffad44ce10 docs/palera1n.1: minor formatting and version fixes 2023-10-02 23:02:55 +08:00
alexia 4775c8ab23 chore: update palera1n-ios description (#399)
Added a note saying it is not an untether, and about bad success rate.
2023-08-08 04:28:43 -07:00
kok3shidoll 7992b1e2a9 Makefile: Change Pongo.bin and kpf paths 2023-07-28 03:18:02 +09:00
samara 3fdb75b9fa chore: change readme 2023-07-27 05:57:29 -07:00
samara 3b0d8ece54 chore: Update Makefile 2023-07-16 11:09:47 -07:00
Nebula 7a20bc0ad9 ci(darwin-dist): cp palera1n-iphoneos-arm64 to ready/ 2023-07-14 13:43:48 -04:00
Nebula 0194d5296a ci(sftp): temporarily downgrade sftp-upload-action to v1.4.8 2023-07-14 13:24:54 -04:00
Nick Chan ef55859eb0 optparse: remove some dead dtpatch code 2023-07-08 20:03:15 +08:00
Nick Chan b5db51c1ac docs: s/16.5/16.5.1/g 2023-07-08 18:35:46 +08:00
Nick Chan 5106372a4b dfuhelper: changes 2023-07-08 04:41:43 +08:00
Nick Chan 6686fdd1a4 Makefile: Update NAME 2023-07-08 04:41:41 +08:00
Nick Chan 48eb11ada0 tui: fix options menu 2023-07-08 03:55:19 +08:00
Nick Chan f72ad75db2 chore: fix tui build compiler errors 2023-07-08 03:55:19 +08:00
Nick Chan 4a8fb113ae increase size of palera1n_flags 2023-07-08 03:55:18 +08:00
Nick Chan 03a0a5db6b paleinfo v2 2023-07-08 03:53:55 +08:00
samara 8b56b01cee chore: Update README.md :3c 2023-07-06 02:59:30 -07:00
Nick Chan 52d20c8e5b docs: do not mention options that does not appear in help menu 2023-07-02 03:56:55 +08:00
Nick Chan b0ac19e4d1 Do not implicitly set any build settings 2023-07-02 03:47:00 +08:00
Nebula e8d4e857dd fix(ci): make upload action use password 2023-07-01 14:34:18 -04:00
Nebula bf549b8f86 ci(sftp): update to sftp-upload-action v2.0.2 2023-06-28 15:38:43 -04:00
Nick Chan b79ac3176f ci: do not use palera1n-ios, just palera1n-iphoneos-arm64 2023-06-27 19:12:40 +08:00
flower e12216dc5e feat: update docs link 2023-06-22 17:42:45 -07:00
Tom E f7603371f6 Update to checkra1n 0.1337.2 2023-06-06 10:11:11 -04:00
flower f80e2a8849 Update build.yml 2023-06-03 16:06:40 -07:00
flower a30e2ef32a ci: remove symlink for now 2023-05-29 11:21:39 -07:00
flower 2825ccaf17 ci: attempt to fix finish-build symlink v5 2023-05-29 11:03:00 -07:00
flower e1e0304b98 ci: attempt to fix finish-build symlink v4 2023-05-29 11:00:41 -07:00
flower 5f4ef51da9 ci: attempt to fix finish-build symlink v3 2023-05-29 10:48:41 -07:00
flower 98f7d032eb ci: attempt to fix finish-build symlink v2 2023-05-29 10:33:52 -07:00
flower 5b32d61a1e ci: attempt to fix finish-build symlink 2023-05-29 10:15:30 -07:00
flower fd80f9e63f feat: "latest" symlink 2023-05-29 09:53:58 -07:00
flower 52ff0b2e62 feat: different destinations for run_number (#393)
* chore: create separate dirs

* chore: fix up naming

* feat: Update embed to include actor

* fix: fixup embed

* fix: attempt to fix embed v3
2023-05-29 09:03:00 -07:00
Nick Chan aa0c3a77b3 deps: patch mbedtls 3.4.0 take 2 2023-05-27 23:51:40 +08:00
Nick Chan a5fbf1b18b deps: update MbedTLS to 3.4.0
96% tests passed, 5 tests failed out of 113

Total Test time (real) =  84.57 sec

The following tests FAILED:
	 42 - debug-suite (Failed)
	 80 - pkcs7-suite (Failed)
	109 - ssl-suite (Failed)
	112 - x509parse-suite (Failed)
	113 - x509write-suite (Failed)
2023-05-27 20:56:58 +08:00
flower 7d3bf14ea6 chore: Remove changes from embed 2023-05-24 14:41:14 -07:00
flower a8325474cf chore: Update README.md 2023-05-21 03:03:04 -07:00
flower 8a09d2670a chore: s/16.4.1/16.5 2023-05-21 02:37:56 -07:00
Nick Chan 30d8241e2d s/16.4.1/16.5 2023-05-20 00:59:04 +08:00
staturnz e33d50860b chore: update ramdisk download url 2023-05-17 23:49:23 -05:00
fenfenS 3b4340525d usb_libusb.c: initialize variable stuff.handle (#392)
initialize stuff.handle, or function FoundDevice would return directly.
2023-05-18 01:58:02 +08:00
staturnz e6033f31cc chore: update readme links 2023-05-17 08:11:00 -05:00
flower c14d93b008 ci: actual branch name 2023-05-14 20:44:10 -07:00
flower ed48d4fcb4 ci: change field 2023-05-14 20:30:24 -07:00
flower 2541330a07 ci: change embed design 2023-05-14 20:27:03 -07:00
flower 58aaf508fc ci: fix timestamp v3 2023-05-14 20:03:55 -07:00
flower e6644c0601 ci: fix timestamp v2 2023-05-14 19:49:57 -07:00
flower 194f568363 ci: fix timestamp 2023-05-14 19:15:47 -07:00
Nebula 963fbb6ed8 ci: other discord alert changes 2023-05-14 21:29:59 -04:00
Nebula 88185b7a88 ci: add timestamp to discord alert 2023-05-14 21:27:03 -04:00
Nebula 3c6213774b ci: hate 2023-05-14 21:15:28 -04:00
Nebula c35d199809 ci: Discord build message improvements 2023-05-14 21:04:38 -04:00
Nebula 67ca5a9d24 ci: do not trigger discord alert on PR 2023-05-14 20:11:12 -04:00
Nebula 8edc991786 ci: add Discord build message 2023-05-14 20:09:06 -04:00
Nick Chan f59ef6dcee 0xallie
[palera1n/palera1n] New comment on commit 1ca25ce
usedqq
2023-05-01 01:31:05 +08:00
Nick Chan 1ca25ceca8 clarify about clean fakefs and /var 2023-05-01 01:28:59 +08:00
Nick Chan 0a0410d506 -C, --clean-fakefs 2023-05-01 01:20:11 +08:00
Nick Chan 5f8b503ae3 skill issue 2023-04-30 01:20:39 +08:00
Nick Chan 9e253f98f4 -D_XOPEN_SOURCE=500 2023-04-30 01:10:08 +08:00
0x6ff d17af1fbc7 chore: fix inconsistencies inside control files for .deb creation (#388)
* chore: fix inconsistency

* chore: fix inconsistency 2
2023-04-29 12:48:34 -04:00
Nick Chan f3920b883d remove _GNU_SOURCE 2023-04-28 11:08:34 +08:00
Tom E 1abfdf5441 might or might not have accidentally deleted this 2023-04-27 17:34:19 -04:00
Tom E 1c3613c669 Fix the A9 and lower restart bug. 2023-04-27 16:29:23 -04:00
Nick Chan 627f9b3363 reserved kerninfo values 2023-04-27 23:10:28 +08:00
ねむい 388ae6f296 update palera1n.1: PongoOS url 2023-04-27 15:57:42 +09:00
ねむい 24a09bc44d Update readme: apple silicon macs 2023-04-27 15:57:30 +09:00
Nick Chan 5ea3237772 update credits 2023-04-26 14:07:26 +08:00
Nick Chan 9c094fc19f fix some compiler warnings 2023-04-25 02:00:00 +08:00
Nick Chan 2912dfd8c0 update palera1n.1 2023-04-25 00:11:18 +08:00
Nick Chan a3fa59eaa8 sneak 2023-04-24 03:43:25 +08:00
Nick Chan 290bcb143e Revert "fix: limd-glue FTBFS with latest libplist"
This reverts commit 1422d45a9f.
2023-04-22 22:19:00 +08:00
Nick Chan bb9fdde26e Revert "fix harder"
This reverts commit fe565b97ad.
2023-04-22 22:18:52 +08:00
justtryingthingsout a9e72b579e Add more error checking and improved readability 2023-04-20 20:47:37 +08:00
Nick Chan fe565b97ad fix harder 2023-04-19 11:29:40 +08:00
Nick Chan 1422d45a9f fix: limd-glue FTBFS with latest libplist 2023-04-19 11:22:38 +08:00
Nick Chan 869f0fc070 s/16.4/16.4.1/ 2023-04-18 19:21:46 +08:00
0x6ff cc1a865a86 chore: elaborate on ignoring non arm64 device (#382)
people don't read.
to save people from asking in the Discord what "Ignoring non-arm64 device.." means, elaborate.
2023-04-15 15:33:07 -04:00
30 changed files with 619 additions and 773 deletions

No files matched your search

+100 -20
View File
@@ -24,7 +24,7 @@ on:
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -39,6 +39,10 @@ jobs:
mkdir ready
cp docs/*.html docs/mandoc.css docs/palera1n.1 ready
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Upload artifact
if: ${{ github.event_name != 'pull_request' }}
uses: wangyucode/[email protected]
@@ -46,11 +50,11 @@ jobs:
host: ${{ secrets.NICKCHAN_FTP_HOST }}
port: ${{ secrets.NICKCHAN_FTP_PORT }}
username: palera1n
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
password: ${{ secrets.NICKCHAN_FTP_PASS }}
forceUpload: true
dryRun: false
localDir: 'ready/'
remoteDir: '/palera1n/artifacts/c-rewrite'
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref_name }}/${{ github.run_number }}"
build-darwin:
strategy:
@@ -70,7 +74,7 @@ jobs:
minos: 7.0
runs-on: macos-12
env:
MBEDTLS_VERSION: 3.3.0
MBEDTLS_VERSION: 3.4.0
READLINE_VERSION: 8.2
SLANG_VERSION: 2.3.3
NEWT_VERSION: 0.52.23
@@ -325,6 +329,10 @@ jobs:
mkdir -p ready
tar -zcf ready/dep_root-${{ matrix.os }}-${{ matrix.arch }}.tgz dep_root
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Upload artifact
if: ${{ github.event_name != 'pull_request' }}
uses: wangyucode/[email protected]
@@ -332,11 +340,11 @@ jobs:
host: ${{ secrets.NICKCHAN_FTP_HOST }}
port: ${{ secrets.NICKCHAN_FTP_PORT }}
username: palera1n
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
password: ${{ secrets.NICKCHAN_FTP_PASS }}
forceUpload: true
dryRun: false
localDir: 'ready/'
remoteDir: '/palera1n/artifacts/c-rewrite'
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref }}/${{ github.run_number }}"
- name: Upload ${{ matrix.os }} thin ${{ matrix.arch }} build
if: ${{ github.event_name != 'pull_request' }}
@@ -353,7 +361,7 @@ jobs:
name: palera1n-${{ matrix.os }}-${{ matrix.arch }}.dSYM
path: palera1n-${{ matrix.os }}-${{ matrix.arch }}.dSYM
retention-days: 1
darwin-dist:
if: ${{ github.event_name != 'pull_request' }}
runs-on: macos-latest
@@ -369,7 +377,7 @@ jobs:
with:
packages: sed coreutils
cache: true
mirror: 'https://procursus.itsnebula.net/'
mirror: 'https://apt.procurs.us/'
- name: Download all Darwin artifacts
uses: actions/download-artifact@v3
@@ -385,8 +393,8 @@ jobs:
cp palera1n-macos ready/palera1n-macos-universal
cp ./palera1n-macosx-x86_64/palera1n-macosx-x86_64 ready/palera1n-macos-x86_64
cp ./palera1n-macosx-arm64/palera1n-macosx-arm64 ready/palera1n-macos-arm64
cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/palera1n-ios
zip -r9 ready/palera1n-ios.dSYM.zip palera1n-iphoneos-arm64.dSYM
cp ./palera1n-iphoneos-arm64/palera1n-iphoneos-arm64 ready/palera1n-iphoneos-arm64
zip -r9 ready/palera1n-iphoneos-arm64.dSYM.zip palera1n-iphoneos-arm64.dSYM
zip -r9 ready/palera1n-macos.dSYM.zip palera1n-macos.dSYM
- name: Build debs
@@ -437,7 +445,7 @@ jobs:
gsed 's|@DEB_ARCH@|iphoneos-arm|g' -i stage/DEBIAN/control
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
ginstall -Dm644 ready/palera1n-ios stage/usr/bin/palera1n
ginstall -Dm644 ready/palera1n-iphoneos-arm64 stage/usr/bin/palera1n
ginstall -Dm644 docs/palera1n.1 stage/usr/share/man/man1/palera1n.1
chmod +x stage/usr/bin/palera1n
@@ -454,13 +462,26 @@ jobs:
gsed 's|@DEB_ARCH@|iphoneos-arm64|g' -i stage/DEBIAN/control
gsed "s|@DEB_VERSION@|$version|g" -i stage/DEBIAN/control
ginstall -Dm644 ready/palera1n-ios stage/var/jb/usr/bin/palera1n
ginstall -Dm644 ready/palera1n-iphoneos-arm64 stage/var/jb/usr/bin/palera1n
ginstall -Dm644 docs/palera1n.1 stage/var/jb/usr/share/man/man1/palera1n.1
chmod +x stage/var/jb/usr/bin/palera1n
dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm64.deb
mv palera1n*.deb ready/
rm -rf stage
- 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@v3
with:
name: build-tag
path: build-tag.txt
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Upload artifact
if: ${{ github.event_name != 'pull_request' }}
@@ -469,11 +490,11 @@ jobs:
host: ${{ secrets.NICKCHAN_FTP_HOST }}
port: ${{ secrets.NICKCHAN_FTP_PORT }}
username: palera1n
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
password: ${{ secrets.NICKCHAN_FTP_PASS }}
forceUpload: true
dryRun: false
localDir: 'ready/'
remoteDir: '/palera1n/artifacts/c-rewrite'
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref }}/${{ github.run_number }}"
build-Linux:
strategy:
@@ -485,7 +506,7 @@ jobs:
- aarch64-linux-musl
runs-on: ubuntu-latest
env:
MBEDTLS_VERSION: 3.3.0
MBEDTLS_VERSION: 3.4.0
LIBUSB_VERSION: 1.0.26
READLINE_VERSION: 8.2
SLANG_VERSION: 2.3.3
@@ -580,6 +601,7 @@ jobs:
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
- name: Build Mbed TLS
run: |
@@ -729,9 +751,25 @@ jobs:
sudo rm /usr/local
sudo mv /usr/local.bak /usr/local
- name: Build usbmuxd
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 sysroot/${{ env.PREFIX }}/{include,lib} dep_root
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)
@@ -742,13 +780,15 @@ jobs:
${{ matrix.triple }}-strip --strip-debug --strip-unneeded src/palera1n
${{ matrix.triple }}-objcopy --add-gnu-debuglink=palera1n.debug src/palera1n
chmod -x palera1n.debug
- name: Prepare artifact
run: |
mkdir ready
mkdir ready usbmuxd-static
mv palera1n.debug ready/palera1n-${{ env.CHECKRA1N_NAME }}.debug
mv src/palera1n ready/palera1n-${{ env.CHECKRA1N_NAME }}
tar -zcf ready/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: |
@@ -771,6 +811,10 @@ jobs:
mv palera1n*.deb ready/
rm -rf stage
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Upload artifact
if: ${{ github.event_name != 'pull_request' }}
uses: wangyucode/[email protected]
@@ -778,8 +822,44 @@ jobs:
host: ${{ secrets.NICKCHAN_FTP_HOST }}
port: ${{ secrets.NICKCHAN_FTP_PORT }}
username: palera1n
privateKey: ${{ secrets.NICKCHAN_FTP_KEY }}
password: ${{ secrets.NICKCHAN_FTP_PASS }}
forceUpload: true
dryRun: false
localDir: 'ready/'
remoteDir: '/palera1n/artifacts/c-rewrite'
remoteDir: "/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch || github.ref }}/${{ github.run_number }}"
- name: Upload usbmuxd artifact
if: ${{ github.event_name != 'pull_request' }}
uses: wangyucode/[email protected]
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"
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@v3
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: Download build tag
uses: actions/download-artifact@v3
with:
name: build-tag
- 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 }}/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 }}/palera1n-iphoneos-arm64)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/$${{ steps.branch-name.outputs.ref_branch }}/${{ github.run_number }}/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 }}/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 }}/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\"}")
+4 -4
View File
@@ -1,14 +1,14 @@
NAME = bakepale
NAME = Dusk
SRC = $(shell pwd)
DEP = $(SRC)/dep_root
STRIP = strip
CC ?= cc
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC)
CFLAGS += -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\" -Wall -Wextra -Wno-unused-parameter
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC) -D_XOPEN_SOURCE=500
CFLAGS += -Wall -Wextra -Wno-unused-parameter -DPALERAIN_VERSION=\"2.0.0\"
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
LIBS += $(DEP)/lib/libimobiledevice-glue-1.0.a $(DEP)/lib/libplist-2.0.a -pthread -lm
ifeq ($(TARGET_OS),)
TARGET_OS = $(shell uname -s)
endif
+28 -65
View File
@@ -1,39 +1,34 @@
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://cdn.discordapp.com/attachments/1028398976640229380/1088049124441604136/IMG_0033.png">
<img align="left" height="120" src="https://cdn.discordapp.com/attachments/1017854329887129611/1073858292159352862/thing.png" alt="palera1n logo" style="float: left;"/>
</picture>
<h3 align="right">An iOS 15.0-16.4 work-in-progress, <br>semi-tethered checkm8 jailbreak</h3>
<center>
<a href="#"><img src="https://cdn.discordapp.com/attachments/1103485261196832779/1126450758523572285/pxd.png" alt="Logo"></a>
</center>
<p align="right" >
<strong><a href="https://cdn.nickchan.lol/palera1n/c-rewrite/releases/v2.0.0-beta.4/palera1n.1.html">Usage</a></strong>
•
<strong><a href="https://github.com/palera1n/palera1n/graphs/contributors">Contributors</a></strong>
•
<strong><a href="https://dsc.gg/palera1n">Discord</a></strong>
•
<strong><a href="https://twitter.com/palera1n">Twitter</a></strong>
<p align="center">
<a href="https://cdn.nickchan.lol/palera1n/c-rewrite/releases/v2.0.0-beta.7/palera1n.1.html">Documentation</a> •
<a href="https://ios.cfw.guide/installing-palera1n">Installation Guide</a> •
<a href="#requirements">Requirements</a> •
<a href="https://discord.gg/palera1n">Support Discord</a> •
<a href="https://palera.in">Website</a>
</p>
<div class="clear"></div>
## If you want a jailbreak, you should read the [guide](https://palera.in).
## Information
This is the official repo for the palera1n project, a jailbreak for arm64 devices on iOS 15.0+
### You can obtain v2.0.0 beta [here](https://github.com/palera1n/palera1n/releases).
If you need an older v2.0.0 beta, please get it [here](https://github.com/palera1n/palera1n-c/releases/tag/v2.0.0-beta.4).
- Loader application used in palera1n can be found [here](https://github.com/palera1n/loader).
- palera1ns jbinit can be found [here](https://github.com/palera1n/jbinit).
- palera1ns custom PongoOS can be found [here](https://github.com/palera1n/pongoos).
# Warnings
- This palera1n rewrite has noticeably different arguments compared to the shell version of palera1n.
- Highly recommended that you take a look at how to use palera1n-c [here](https://cdn.nickchan.lol/palera1n/c-rewrite/releases/v2.0.0-beta.1/palera1n.1.html).
Website & credits can be found at https://palera.in (scroll down for credits).
- This does **NOT** support tethered creation or booting. You must use the older [shell version of palera1n](https://github.com/palera1n/palera1n/tree/legacy) (clone with `-b legacy`).
## Warnings
We are **NOT** responsible for any data loss, or the result of a device being bricked. The user of this program accepts responsibility should something happen to their device. While nothing should happen, jailbreaking has risks in itself.
- If your device is stuck in recovery, please run futurerestore `--exit-recovery`, or use `irecovery -n`.
- We are **NOT** responsible for any data loss, or the result of a device being bricked. The user of this program accepts responsibility should something happen to their device. While nothing should happen, jailbreaking has risks in itself.
- If your device is stuck in recovery, please run futurerestore `--exit-recovery`, or use `irecovery -n`.
- If you're unable to get out of recovery via these methods please restore with iTunes or Finder.
- palera1n will never work in VirtualBox, VMware or any virtual machine that doesn't support PCI passthrough.
# Requirements
- A checkm8 vulnerable iOS device on iOS 15.x or 16.x (`A8` - `A11`)
- If using rootful, you will need **5-10GB of space** for the fakefs. This means 16GB devices cannot use the full fakefs creation. However, you can change the arguments to `-Bf` to create a fakefs with bind mounts, so it uses a smaller size, at the expense having unwritable parts in rarely-written paths, and then boot it
## Requirements
- A checkm8 vulnerable iOS device on iOS 15+ (`A8` - `A11`)
- On `A11`, **you must disable your passcode while in the jailbroken state** (on iOS 16, you need to **reset your device** before proceeding with palera1n).
- **USB-A** cables are recommended to use, USB-C may have issues with palera1n and getting into DFU mode.<details><summary>Technical explanation</summary>The BootROM will only enter DFU if it detects USB voltage, which boils down to checking whether a certain pin is asserted from the Tristar chip. The Tristar does this based on the cable's accessory ID, and apparently USB-A and USB-C cables have different accessory IDs, and the one of the USB-C cables makes the Tristar not assert the USB voltage pin.</details>
@@ -41,8 +36,12 @@ If you need an older v2.0.0 beta, please get it [here](https://github.com/palera
- A Linux or macOS computer
- AMD CPUs (not AMD Mobile) have an issue [with (likely) their USB controllers] that causes them to have a very low success rate with checkm8. It is not recommended that you use them with palera1n.
- If your device does not successfully jailbreak, try a computer with an Intel or other CPU
- Apple Silicon Macs with USB-C
- 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.
# Need help?
## Need help?
Make sure you provide full details on your device, such as:
- iDevice
@@ -50,42 +49,6 @@ Make sure you provide full details on your device, such as:
- Passcode enabled?
- Logs, if panicked then send latest `panic-full` log from your iDevice.
Using `-V` and `-v` would help with debugging.
Using `-VvL` would help with debugging.
Join the [Support Discord](https://dsc.gg/palera1n), and create a thread in [#support](https://discord.com/channels/1028398973452570725/1028730487700738130) or ask in [#general](https://discord.com/channels/1028398973452570725/1028398976640229380).
# Credits
<details><summary>palera1n-c Contributors and Credits</summary>
<p>
- [Nick Chan](https://github.com/asdfugil) for the rewrite
- [Nebula](https://github.com/itsnebulalol) - palera1n owner and manager
- [Mineek](https://github.com/mineek)
- [Tom](https://github.com/plooshi) for updated ploosh kpf and universal loader
- [Lakhan Lothiyi](https://github.com/llsc12) for palera1n loader app
- [checkra1n](https://github.com/checkra1n) for the base of the kpf
- [the Procursus Team](https://github.com/ProcursusTeam) for the amazing [bootstrap](https://github.com/ProcursusTeam/Procursus)
- [Évelyne](https://github.com/evelyneee) for [ElleKit](https://github.com/evelyneee/ellekit), rootless tweak injection
- [Sam Bingner](https://github.com/sbingner) for [Substitute](https://github.com/sbingner/substitute), rootful tweak injection
</details>
</p>
<br>
<p align="center">
Thank you so much to our Patreons that make the future development possible! You may sub <a href="https://patreon.com/palera1n">here</a>, if you'd like to.</br>
</p>
<p align="center">
<a href="https://github.com/samh06"><img width=64 style="border-radius: 25%;" src="https://user-images.githubusercontent.com/18669106/206333607-881d7ca1-f3bf-4e18-b620-25de0c527315.png"></img></a>
<a href="https://havoc.app"><img width=64 style="border-radius: 25%;" src="https://docs.havoc.app/img/standard_icon.png"></img></a>
<a href="https://twitter.com/yyyyyy_public"><img width=64 style="border-radius: 25%;" src="https://cdn.discordapp.com/attachments/1054239098006683688/1072587455779328040/image.png?size=400"></img></a>
<a href="https://twitter.com/0xSp00kyb0t"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1603601553226620935/1t4yD1bD_400x400.jpg"></img></a>
<a href="https://chariz.com"><img width=64 src="https://chariz.com/img/favicon.png"></img></a>
<a href="https://twitter.com/stars6220"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1621062976982728706/pWVZQ-NO_400x400.jpg"></img></a>
<a href="https://github.com/TheFunnyMan16"><img width=64 style="border-radius: 25%;" src="https://cdn.discordapp.com/attachments/1050068822473842778/1082867264807772281/IMG_3942.jpg">
<a href="https://github.com/beast9265"><img width=64 style="border-radius: 25%;" src="https://avatars.githubusercontent.com/u/79794946?v=4"></img></a>
<a href="https://twitter.com/0x7FF7"><img width=64 style="border-radius: 25%;" src="https://pbs.twimg.com/profile_images/1630818481191919618/8MWaJ1F7_400x400.jpg"></img></a>
<a href="https://sideloadly.io/"><img width=64 style="border-radius: 25%;" src="https://sideloadly.io/icon.png"></img></a>
<a href="https://blog.stevesec.com/"><img width=64 style="border-radius: 25%;" src="https://blog.stevesec.com/img/avatar.jpg"></img>
<a href="https://github.com/0xilis/"><img width=64 style="border-radius: 25%;" src="https://github.com/0xilis.png"></img></a>
</p>
Join the [Support Discord](https://dsc.gg/palera1n)
+14 -87
View File
@@ -2,14 +2,14 @@
.\" Copyright (c) 2023 Nick Chan
.\" SPDX-License-Identifier: MIT
.\"
.Dd "20 March 2023"
.Dd "26 October 2023"
.Dt palera1n 1
.Sh NAME
.Nm palera1n
.Nd iOS 15.0-16.4 arm64 iOS/iPadOS jailbreaking tool
.Nd iOS 15.0-17.1 arm64 iOS/iPadOS jailbreaking tool
.Sh SYNOPSIS
.Nm
.Op Fl cCdDEfhIlLnpRsSvV
.Op Fl dDEhILnpRsSvV
.Op Fl e Ar Boot arguments
.Op Fl k Ar Pongo image
.Op Fl o Ar overlay file
@@ -20,15 +20,11 @@
.Op Fl -force-revert
.Sh DESCRIPTION
.Nm
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.4,
jailbreaks any iOS/iPadOS device with an arm64 (arm64e excluded) on iOS 15.0-16.5.1,
utilizing the
.Em checkm8
bootROM exploit.
.Pp
.Nm
is able to jailbreak the device in fakefs-rootful mode, where /
is writable, as well as rootless mode, where / cannot be written to.
.Pp
Due to the nature of the
.Em checkm8
exploit,
@@ -52,7 +48,7 @@ In the remainder of this document, the term "iOS" and "iPadOS" will be used inte
as the difference is negligible as far as the jailbreak is concerened.
.Pp
.Sh SUPPORTED DEVICES
As described above, arm64 iOS 15.0-16.4 devices are supported, here is an explicit
As described above, arm64 iOS 15.0-16.5.1 devices are supported, here is an explicit
list of supported devicecs:
.Bl -tag -compact
@@ -95,24 +91,7 @@ Prints the program version and exit.
Remove the jailbreak while keeping user data. Some jailbreak files may remain
after running this command. Additionally, jailbreak apps will remain on the
home screen on for a while even when the files are deleted as the icon cache
still has their icons. When used with
.Fl f , -rootful ,
this will actually boot the device in rootless mode then delete the jailbreak
files. As a result, using the loader app to install the jailbreak environment
is not supported when this option is used together with
.Fl f , -rootful
\[char46]
.It Fl 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 option currently does not work on iOS 16.
.It Fl c , -setup-fakefs
When used with
.Fl f , -rootful ,
creates the new APFS volume required for rootful on iOS/iPadOS. Will fail if one already exists.
still has their icons.
.It Fl d , -demote
Set the effective production fuse to 0, so as to enable hardware debugging features.
.It Fl D , -dfuhelper
@@ -123,13 +102,9 @@ Specify custom XNU kernel command line. The
.Em rootdev=md0
argument is used by
.Nm
and cannot be overriden. Additionally, the
.Em wdt=-1
argument is used during fakefs setup.
and cannot be overriden.
.It Fl E , -enter-recovery
Exit after entering recovery mode.
.It Fl f , -rootful
Proceed in rootful mode. This applies to both full fakefs and partial fakefs.
.It Fl h , -help
Prints help text.
.It Fl i , -checkra1n-file Ar checkra1n file
@@ -143,14 +118,8 @@ Override the kernel patchfinder PongoOS module. The module is required to suppor
root filesystem in paleinfo with
.Em rootfs
command. If in doubt, use
.Sy https://github.com/guacaplushy/PongoOS
.Sy https://github.com/palera1n/PongoOS
iOS15 branch or your own fork of it.
.It Fl l , -rootless
Proceed in rootless mode, this is the default when neither
.Fl l , -rootless
and
.Fl f , -rootful
is specified.
.Fl L , -jbinit-log-to-file
Makes jbinit log to
.Em /cores/jbinit.log
@@ -209,32 +178,10 @@ To (re-)jailbreak in rootless mode:
.Pp
.Dl "palera1n"
.Pp
To setup fakefs for rootful mode:
.Pp
.Dl "palera1n -fc"
.Pp
After the device has rebooted, 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"
@@ -248,8 +195,6 @@ To verbose boot, use the
.Fl V , -verbose-boot
option when jailbreaking.
.Pp
Fakefs takes up around 5-10 GB of storage, and take 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
@@ -257,11 +202,6 @@ version of the Procursus fork of
before they can be ran on a device jailbroken with
.Nm
\[char46]
.Pp
When using rootful mode, the
.Fl f , -rootful
flag must be specified at all times. It does not matter whether you want to create fakefs,
create partial fakefs, rejailbreak or remove jailbreak.
.Sh POST INSTALLATION
The palera1n loader app will take up to 30 seconds to appear on the homescreen after the
device has booted. If it does not appear, you can try using the shortcut:
@@ -286,18 +226,11 @@ The location of the temporary filesystem where jailbreak files are stash during
When
.Fl L
is used, the log file of jbinit.
.It Pa /Library/LaunchDaemons
The directory where jailbreak-specific
.Xr launchd.plist 5
property list files should be placed on rootful.
The log file of jbinit.
.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 filse that needs to be executed during boot, before
daemons are launched, are placed 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
@@ -311,22 +244,15 @@ may crash if the machine it is running on:
.Pp
The exploit may also work less reliably on some hosts, like AMD desktops, or some MediaTek devices.
.Pp
The device may randomly crash and reboot due to launchd receiving signal 7 (SIGEMT).
The device may randomly crash and reboot due to launchd exiting with code 7.
.Sh NOTES
.Nm
injects a dylib into launchd to allow the
.Sy launchctl runstats
command to be used on the device.
.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 fakefs functionality was removed.
.Sh SEE ALSO
.Xr launchd 8
.Xr launchd.plist 5
@@ -341,4 +267,5 @@ December 13, 2022. Later, the first attempt to rewrite palera1n into C begins on
01 2023. The
.Nm
utility described here is the second attempt, which first started on January 16, 2023,
using checkra1n 1337 and the plush KPF.
using checkra1n 1337 and a custom KPF.
Something happened on August 15, 2023.
-20
View File
@@ -1,20 +0,0 @@
curl -LOOOOOO \
https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v3.3.0.tar.gz \
https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 \
https://mirror-hk.koddos.net/gnu/readline/readline-8.2.tar.gz \
https://www.jedsoft.org/releases/slang/slang-2.3.3.tar.bz2 \
https://releases.pagure.org/newt/newt-0.52.23.tar.gz \
https://github.com/rpm-software-management/popt/archive/master-release.tar.gz
tar xf v3.3.0.tar.gz
tar xf libusb-1.0.26.tar.bz2
tar xf readline-8.2.tar.gz
tar xf slang-2.3.3.tar.bz2
tar xf newt-0.52.23.tar.gz
tar xf master-release.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
-143
View File
@@ -1,143 +0,0 @@
/*
* pongoOS - https://checkra.in
*
* Copyright (C) 2019-2022 checkra1n team
*
* This file is part of pongoOS.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef _KERNINFO_H
#define _KERNINFO_H
#include <stdbool.h>
#include <stdint.h>
#define MAX_BOOTARGS_LEN 256
#define checkrain_option_none 0x00000000
#define checkrain_option_all 0x7fffffff
#define checkrain_option_failure 0x80000000
// Host options
#define checkrain_option_verbose_logging (1 << 0)
#define checkrain_option_demote (1 << 1)
#define checkrain_option_early_exit (1 << 2)
#define checkrain_option_quick_mode (1 << 3)
#define checkrain_option_pongo_shell (1 << 4)
#define checkrain_option_pongo_full (1 << 5)
// KPF options
#define checkrain_option_verbose_boot (1 << 0)
// Global options
#define checkrain_option_safemode (1 << 0)
#define checkrain_option_bind_mount (1 << 1)
#define checkrain_option_overlay (1 << 2)
#define checkrain_option_force_revert (1 << 7) /* keep this at 7 */
// palera1n option
#define palerain_option_rootful (1 << 0) /* rootful jailbreak */
#define palerain_option_jbinit_log_to_file (1 << 1) /* log to /cores/jbinit.log */
#define palerain_option_setup_rootful (1 << 2) /* create fakefs */
#define palerain_option_setup_rootful_forced (1 << 3) /* create fakefs over an existing one */
#define palerain_option_setup_partial_root (1 << 4) /* fakefs creating should be partial */
#define palerain_option_checkrain_is_clone (1 << 5) /* supplied checkra1n is checkra1n clone */
#define palerain_option_rootless_livefs (1 << 6) /* mount root livefs on rootless */
#define palerain_option_no_ssv (1 << 7) /* no signed system volume */
#define palerain_option_force_fakefs (1 << 8) /* force fakefs, even without SSV */
#define palerain_option_rootless (1 << 9) /* rootless jailbreak */
#ifdef DEV_BUILD
#define palerain_option_test1 (1 << 29)
#define palerain_option_test2 (1 << 30)
#endif
// palerain host options
#define host_option_dfuhelper_only (1 << 0) /* dfuhelper only */
#define host_option_pongo_exit (1 << 1) /* boot to clean pongo shell */
#ifdef TUI
#define host_option_tui (1 << 2) /* use terminal user interface */
#else
#define host_option_res1 (1 << 2) /* reserved */
#endif
#define host_option_demote (1 << 3) /* Demote effective production fuse status */
// (1 << 4) is removed
#define host_option_pongo_full (1 << 5) /* Boot to pongo with default images and options */
#define host_option_palerain_version (1 << 6) /* Print version */
#define host_option_exit_recovery (1 << 7) /* Exit recovery mode */
#define host_option_reboot_device (1 << 8) /* Reboot device in normal mode */
#define host_option_enter_recovery (1 << 9) /* Enter recovery mode */
#define host_option_device_info (1 << 10) /* Print device info */
#define host_option_no_colors (1 << 11) /* no colors */
#define PALEINFO_MAGIC 'PLSH'
#define PALEINFO_CIGAM 'HSLP'
typedef uint32_t checkrain_option_t, *checkrain_option_p;
typedef enum {
jailbreak_capability_tfp0 = 1 << 0,
jailbreak_capability_userspace_reboot = 1 << 1,
jailbreak_capability_dyld_ignore_os = 1 << 2, // TODO: This needs a better name
} jailbreak_capability_t, *jailbreak_capability_p;
#define DEFAULT_CAPABILITIES (jailbreak_capability_tfp0|jailbreak_capability_userspace_reboot)
struct kerninfo {
uint64_t size;
uint64_t base;
uint64_t slide;
checkrain_option_t flags;
};
struct paleinfo {
uint32_t magic; // 'PLSH' / 0x504c5348
uint32_t version; // 1
checkrain_option_t flags;
char rootdev[0x10];
};
struct kpfinfo {
struct kerninfo k;
checkrain_option_t kpf_flags;
char bootargs[MAX_BOOTARGS_LEN];
};
#define checkrain_set_option(options, option, enabled) do { \
if (enabled) \
options = (checkrain_option_t)(options | option); \
else \
options = (checkrain_option_t)(options & ~option); \
} while (0);
static inline bool checkrain_option_enabled(checkrain_option_t flags, checkrain_option_t opt)
{
if(flags == checkrain_option_failure)
{
switch(opt)
{
case checkrain_option_safemode:
return true;
default:
return false;
}
}
return (flags & opt) != 0;
}
#endif
+65
View File
@@ -0,0 +1,65 @@
/*
* jbinit - https://github.com/palera1n/jbinit
*
* This file is part of jbinit
*
* SPDX-License-Identifier: MIT
*/
#ifndef PALEINFO_H
#define PALEINFO_H
#include <stdint.h>
#define PALEINFO_VERSION 2U
typedef uint64_t palerain_option_t;
// unified palera1n options
#define palerain_option_rootful (UINT64_C(1) << 0) /* rootful jailbreak */
#define palerain_option_rootless (UINT64_C(1) << 1) /* rootless jailbreak */
#define palerain_option_setup_rootful (UINT64_C(1) << 2) /* create fakefs */
/* reserved */
#define palerain_option_setup_partial_root (UINT64_C(1) << 4) /* fakefs creating should be partial */
#define palerain_option_checkrain_is_clone (UINT64_C(1) << 5) /* supplied checkra1n is checkra1n clone */
#define palerain_option_rootless_livefs (UINT64_C(1) << 6) /* mount root livefs on rootless */
// #define palerain_option_no_ssv (UINT64_C(1) << 7) /* no signed system volume */
// #define palerain_option_force_fakefs (UINT64_C(1) << 8) /* force fakefs, even without SSV */
#define palerain_option_clean_fakefs (UINT64_C(1) << 9) /* clean fakefs, but does not delete it */
#define palerain_option_tui (UINT64_C(1) << 10) /* terminal user interface */
// #define palerain_option_gui (UINT64_C(1) << 11) /* graphical user interface*/
#define palerain_option_dfuhelper_only (UINT64_C(1) << 12) /* dfuhelper only */
#define palerain_option_pongo_exit (UINT64_C(1) << 13) /* boot to clean pongo shell */
#define palerain_option_demote (UINT64_C(1) << 14) /* Demote effective production fuse status */
#define palerain_option_pongo_full (UINT64_C(1) << 15) /* Boot to pongo with default images and options */
#define palerain_option_palerain_version (UINT64_C(1) << 16) /* Print version */
#define palerain_option_exit_recovery (UINT64_C(1) << 17) /* Exit recovery mode */
#define palerain_option_reboot_device (UINT64_C(1) << 18) /* Reboot device in normal mode */
#define palerain_option_enter_recovery (UINT64_C(1) << 19) /* Enter recovery mode */
#define palerain_option_device_info (UINT64_C(1) << 20) /* Print device info */
#define palerain_option_no_colors (UINT64_C(1) << 21) /* no colors */
#define palerain_option_bind_mount (UINT64_C(1) << 22) /* bind mounts should be used (always true iOS 15+)*/
#define palerain_option_overlay (UINT64_C(1) << 23) /* there is an overlay (should always be true) */
#define palerain_option_force_revert (UINT64_C(1) << 24) /* Unjailbreak */
#define palerain_option_safemode (UINT64_C(1) << 25) /* Enter safe mode */
#define palerain_option_verbose_boot (UINT64_C(1) << 26) /* verbose boot */
#define palerain_option_jbinit_log_to_file (UINT64_C(1) << 50) /* make ramdisk log to file (jbinit2) */
#define palerain_option_setup_rootful_forced (UINT64_C(1) << 51) /* create fakefs over an existing one (jbinit2) */
#define palerain_option_flower_chain (UINT64_C(1) << 61) /* Flower chain */
#define palerain_option_test1 (UINT64_C(1) << 62) /* Developer test option 1 */
#define palerain_option_test2 (UINT64_C(1) << 63) /* Developer test option 2 */
#define PALEINFO_MAGIC 'PLSH'
/* paleinfo version 2, appended to ramdisk */
struct paleinfo {
uint32_t magic; /* 'PLSH' */
uint32_t version; /* 2 */
uint64_t kbase; /* kernel base */
uint64_t kslide; /* kernel slide */
uint64_t flags; /* unified palera1n flags */
char rootdev[0x10]; /* ex. disk0s1s8 */
}__attribute__((packed));
#endif
+11 -19
View File
@@ -6,7 +6,7 @@
#endif
#include "xxd-embedded.h"
#include "kerninfo.h"
#include "paleinfo.h"
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -22,14 +22,8 @@
#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)
#ifdef DEV_BUILD
#define palerain_option_case_ignore_ssv palerain_option_case(2)
#define palerain_option_case_force_fakefs palerain_option_case(3)
#define palerain_option_case_rootless_livefs palerain_option_case(4)
#endif
#define palerain_option_case_version palerain_option_case(0)
#define palerain_option_case_force_revert palerain_option_case(1)
#ifdef USE_LIBUSB
#include <libusb-1.0/libusb.h>
@@ -106,6 +100,8 @@ struct mach_header_64
};
#endif
typedef void *(*pthread_start_t)(void *);
// Keep in sync with Pongo
#define PONGO_USB_VENDOR 0x05ac
#define PONGO_USB_PRODUCT 0x4141
@@ -159,8 +155,8 @@ extern char* pongo_path;
extern bool tui_started;
#endif
extern checkrain_option_t host_flags;
extern checkrain_option_p host_flags_p;
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;
@@ -169,7 +165,7 @@ extern niarelap_file_t *kpf_to_upload_1, *ramdisk_to_upload_1, *overlay_to_uploa
extern niarelap_file_t **kpf_to_upload, **ramdisk_to_upload, **overlay_to_upload;
extern override_file_t override_ramdisk, override_kpf, override_overlay;
extern uint32_t checkrain_flags, palerain_flags, kpf_flags;
extern uint64_t palerain_flags;
extern pthread_mutex_t log_mutex;
extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
@@ -177,11 +173,7 @@ 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 checkrain_flags_cmd[0x20];
extern char palerain_flags_cmd[0x20];
extern char kpf_flags_cmd[0x20];
extern char dtpatch_cmd[0x20];
extern char rootfs_cmd[512];
extern char palerain_flags_cmd[0x30];
extern char* ext_checkra1n;
void thr_cleanup(void* ptr);
@@ -209,7 +201,7 @@ boyermoore_horspool_memmem(const unsigned char* haystack, size_t hlen,
const unsigned char* needle, size_t nlen);
extern void* pongo_usb_callback(void* arg);
extern void* pongo_usb_callback(stuff_t* arg);
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);
@@ -234,7 +226,7 @@ void print_credits(void);
#ifdef TUI
#include <newt.h>
newtComponent get_tui_log();
newtComponent get_tui_log(void);
newtComponent set_tui_log(newtComponent co);
#endif
#endif
+10 -10
View File
@@ -11,7 +11,7 @@
#include <locale.h>
#include <unistd.h>
#include <newt.h>
#include <kerninfo.h>
#include <paleinfo.h>
#define WIDTH 76
#define HEIGHT 19
@@ -20,7 +20,7 @@
#define PI_STEP_CURRENT NEWT_COLORSET_CUSTOM(1)
#define PI_STEP_OTHER NEWT_COLORSET_CUSTOM(2)
#define CHECKBOX_STATE(flags, opt) checkrain_option_enabled(flags, opt) ? '*' : ' '
#define CHECKBOX_STATE(flags, opt) (flags & opt) != 0 ? '*' : ' '
typedef enum tui_screens {
ERROR_SCREEN = -1,
@@ -33,17 +33,17 @@ typedef enum tui_screens {
} tui_screen_t;
typedef struct bitfield_checkbox_info {
checkrain_option_p flags_p;
checkrain_option_t opt;
uint64_t* flags_p;
uint64_t opt;
} tui_bit_info_t;
tui_screen_t tui_screen_main();
tui_screen_t tui_screen_options();
tui_screen_t tui_screen_enter_recovery();
tui_screen_t tui_screen_enter_dfu();
tui_screen_t tui_screen_jailbreak();
tui_screen_t tui_screen_main(void);
tui_screen_t tui_screen_options(void);
tui_screen_t tui_screen_enter_recovery(void);
tui_screen_t tui_screen_enter_dfu(void);
tui_screen_t tui_screen_jailbreak(void);
int redraw_screen();
int redraw_screen(void);
#endif
+7 -2
View File
@@ -8,10 +8,15 @@ Depends: usbmuxd
Section: Utilities
Priority: optional
Homepage: https://palera.in
Description: iOS 15.0-16.4 semi-tethered checkm8 jailbreak
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
Description: iOS 15.0-16.5.1 semi-tethered checkm8 jailbreak
palera1n is an iOS/iPadOS 15.0-16.5.1 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.
+2 -2
View File
@@ -7,8 +7,8 @@ Author: palera1n team
Section: Utilities
Priority: optional
Homepage: https://palera.in
Description: iOS 15.0-16.4 semi-tethered checkm8 jailbreak
palera1n is an iOS/iPadOS 15.0-15.3.1 semi tethered jailbreak
Description: iOS 15.0-16.5 semi-tethered checkm8 jailbreak
palera1n is an iOS/iPadOS 15.0-16.5 semi tethered jailbreak
based on the checkm8 exploit.
.
palera1n is able to jailbreak the device in fakefs-rootful mode,
@@ -1,6 +1,6 @@
From 632cdb6de3f1693fb90d60d81552b723e8dd5e84 Mon Sep 17 00:00:00 2001
From a2d012f3ba459f6debe636b576ad9aeab7b3c2aa Mon Sep 17 00:00:00 2001
From: Nick Chan <[email protected]>
Date: Wed, 25 Jan 2023 01:53:00 +0800
Date: Sat, 27 May 2023 23:50:23 +0800
Subject: [PATCH] Allow empty x509 cert issuer
---
@@ -8,25 +8,24 @@ Subject: [PATCH] Allow empty x509 cert issuer
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 0eee97cb6..46702f683 100644
index cf62532f2..ef25b3d77 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1185,14 +1185,14 @@ 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 ) );
@@ -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 );
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;
+5 -5
View File
@@ -56,7 +56,7 @@ BUILD_OPTIONS += TUI
CFLAGS += -DTUI
endif
CHECKRA1N_VERSION ?= 0.1337.1
CHECKRA1N_VERSION ?= 0.1337.2
LIPO = lipo
LDID = ldid
@@ -80,7 +80,7 @@ CFLAGS += -DUSE_LIBUSB=1
LIBS += $(DEP)/lib/libusb-1.0.a
endif
ifneq ($(ROOTFUL),0)
ifeq ($(ROOTFUL),1)
CFLAGS += -DROOTFUL=1
BUILD_OPTIONS += ROOTFUL
endif
@@ -137,16 +137,16 @@ libcheckra1nhelper.dylib: chkstk.S
$(CC) $(CFLAGS) $(LDFLAGS) -shared chkstk.S -o libcheckra1nhelper.dylib
checkra1n-kpf-pongo:
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/checkra1n-kpf-pongo
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/checkra1n-kpf-pongo
ramdisk.dmg:
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/jbinit_rootless/ramdisk.dmg
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
binpack.dmg:
curl -LO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg
Pongo.bin:
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/Pongo.bin
curl -LO https://cdn.nickchan.lol/palera1n/artifacts/kpf/iOS15/Pongo.bin
clean:
rm -rf *.o palera1n checkra1n checkra1n.c palera1n.dSYM libcheckra1nhelper.dylib
+3 -3
View File
@@ -1,7 +1,7 @@
#include <stdio.h>
#ifndef BAKERAIN_DEVELOPE_R
#define BAKERAIN_DEVELOPE_R "dora2ios"
#define BAKERAIN_DEVELOPE_R "kok3shidoll"
#endif
#define THE_PLUSH "Ploosh"
@@ -12,8 +12,8 @@
#define B stderr
#define L ,
#define E "# == palera1n-c == \n#\n"
#define M "# Made by: Nick Chan, " THE_PLUSH ", Mineek, Nebula, llsc12\n#\n"
#define A "# Thanks to: " BAKERAIN_DEVELOPE_R ", pythonplayer, tihmstar, nikias\n"
#define M "# Made by: Nick Chan, " THE_PLUSH ", Samara, Nebula, staturnz, " BAKERAIN_DEVELOPE_R " \n#\n"
#define A "# Thanks to: pythonplayer123, llsc12, Mineek, tihmstar, nikias\n"
#define K "# (libimobiledevice), checkra1n team (Siguza, axi0mx, littlelailo\n"
#define I "# et al.), Procursus Team (Hayden Seay, Cameron Katri, Keto et.al)\n\n"
#define N )
+78 -75
View File
@@ -76,27 +76,27 @@ bool cpid_is_arm64(unsigned int cpid) {
* ========== 0x8960 ===========
* (ARM64) A7
*/
if (
cpid == 0x8960 || cpid == 0x7000 || cpid == 0x7001
|| cpid == 0x8000 || cpid == 0x8001 || cpid == 0x8003
|| cpid == 0x8010 || cpid == 0x8011 || cpid == 0x8012
|| cpid == 0x8015
) return true;
return false;
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)
{
usbmuxd_events_subscribe(&usbmuxdctx, device_event_cb, NULL);
irecv_device_event_subscribe(&irecvctx, irecv_event_cb, NULL);
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)
{
usbmuxd_events_unsubscribe(usbmuxdctx);
irecv_device_event_unsubscribe(irecvctx);
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;
@@ -119,15 +119,15 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
}
if (lockdownd_client_new(device, &lockdown, "palera1n") != LOCKDOWN_E_SUCCESS)
{
idevice_free(device);
(void)idevice_free(device);
LOG(LOG_ERROR, "Device is not in normal mode.");
return -1;
}
plist_t node = NULL;
if (lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) != LOCKDOWN_E_SUCCESS)
{
lockdownd_client_free(lockdown);
idevice_free(device);
(void)lockdownd_client_free(lockdown);
(void)idevice_free(device);
LOG(LOG_ERROR, "Error getting ECID");
return -1;
}
@@ -137,8 +137,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
node = NULL;
if (lockdownd_get_value(lockdown, NULL, "ProductType", &node) != LOCKDOWN_E_SUCCESS)
{
lockdownd_client_free(lockdown);
idevice_free(device);
(void)lockdownd_client_free(lockdown);
(void)idevice_free(device);
LOG(LOG_ERROR, "Error getting product type");
return -1;
}
@@ -148,8 +148,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
node = NULL;
if (lockdownd_get_value(lockdown, NULL, "CPUArchitecture", &node) != LOCKDOWN_E_SUCCESS)
{
lockdownd_client_free(lockdown);
idevice_free(device);
(void)lockdownd_client_free(lockdown);
(void)idevice_free(device);
LOG(LOG_ERROR, "Error getting CPU type");
return -1;
}
@@ -159,8 +159,8 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
node = NULL;
if (lockdownd_get_value(lockdown, NULL, "ProductVersion", &node) != LOCKDOWN_E_SUCCESS)
{
lockdownd_client_free(lockdown);
idevice_free(device);
(void)lockdownd_client_free(lockdown);
(void)idevice_free(device);
LOG(LOG_ERROR, "Error getting product version");
return -1;
}
@@ -170,21 +170,21 @@ int devinfo_cmd(devinfo_t *dev, const char *udid)
node = NULL;
if (lockdownd_get_value(lockdown, NULL, "BuildVersion", &node) != LOCKDOWN_E_SUCCESS)
{
lockdownd_client_free(lockdown);
idevice_free(device);
(void)lockdownd_client_free(lockdown);
(void)idevice_free(device);
LOG(LOG_ERROR, "Error getting build version");
return -1;
}
plist_get_string_val(node, &buildVersion);
plist_free(node);
lockdownd_client_free(lockdown);
idevice_free(device);
(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
} else
{
displayName = productType;
}
@@ -209,23 +209,22 @@ int enter_recovery_cmd(const char* udid) {
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
return -1;
}
do {
ldret = lockdownd_enter_recovery(lockdown);
if (ldret == LOCKDOWN_E_SESSION_INACTIVE) {
lockdownd_client_free(lockdown);
lockdown = NULL;
if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, "palera1n"))) {
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
return -1;
}
ldret = lockdownd_enter_recovery(lockdown);
}
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 trigger entering recovery mode: %s", lockdownd_strerror(ldret));
LOG(LOG_ERROR, "Could not connect to lockdownd: %s", lockdownd_strerror(ldret));
return -1;
}
lockdownd_client_free(lockdown);
} while (0);
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;
}
@@ -242,8 +241,8 @@ int reboot_cmd(const char* udid) {
if (diagnostics_relay_restart(diag, DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT) != DIAGNOSTICS_RELAY_E_SUCCESS) {
LOG(LOG_ERROR, "Could not reboot device.");
}
diagnostics_relay_goodbye(diag);
diagnostics_relay_client_free(diag);
(void)diagnostics_relay_goodbye(diag);
(void)diagnostics_relay_client_free(diag);
} else {
LOG(LOG_ERROR, "Could not connect to device.");
return -1;
@@ -302,9 +301,9 @@ int passstat_cmd(unsigned char* status, const char* udid) {
derr = diagnostics_relay_query_mobilegestalt(diagnostics_client, keys, &node);
plist_free(keys);
diagnostics_relay_client_free(diagnostics_client);
lockdownd_service_descriptor_free(service);
idevice_free(dev);
(void)diagnostics_relay_client_free(diagnostics_client);
(void)lockdownd_service_descriptor_free(service);
(void)idevice_free(dev);
if (derr != DIAGNOSTICS_RELAY_E_SUCCESS || !node)
{
@@ -322,7 +321,7 @@ int passstat_cmd(unsigned char* status, const char* udid) {
plist_get_string_val(status_node, &passstat_status);
if (!status || strncmp(passstat_status, "Succ", 4))
{
if (passstat_status)
if (passstat_status)
free(passstat_status);
passstat_status = NULL;
plist_free(node);
@@ -349,20 +348,16 @@ int passstat_cmd(unsigned char* status, const char* udid) {
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) {
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
return -1;
}
if (err != IRECV_E_SUCCESS) goto err;
int mode = 0;
irecv_get_mode(client, &mode);
err = irecv_get_mode(client, &mode);
if (err != IRECV_E_SUCCESS) goto err;
char *ibootver = NULL;
irecv_getenv(client, "build-version", &ibootver);
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) {
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
return -1;
}
if (err != IRECV_E_SUCCESS) goto err;
info->mode = mode;
info->cpid = device->chip_id;
snprintf(info->product_type, 0x20, "%s", device->product_type);
@@ -371,33 +366,41 @@ int recvinfo_cmd(recvinfo_t* info, const uint64_t ecid) {
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) {
irecv_setenv(client, "auto-boot", "true");
irecv_saveenv(client);
irecv_close(client);
return 0;
} else {
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
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) {
irecv_setenv(client, "auto-boot", "true");
irecv_saveenv(client);
irecv_reboot(client);
irecv_close(client);
return 0;
} else {
LOG(LOG_ERROR, "libirecovery error: %d (%s)", err, irecv_strerror(err));
return -1;
}
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;
}
+110 -80
View File
@@ -36,12 +36,20 @@ int dfuhelper_thr_running = false;
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
for (int i = time2; i < time; i++) {
printf(checkrain_option_enabled(host_flags, host_option_no_colors) ? "\r\033[K%s (%d)" : BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2);
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(checkrain_option_enabled(host_flags, host_option_no_colors) ? "\r%s (%d)" : CYN "\r%s (%d)" CRESET, text, time2);
printf(
(palerain_flags & palerain_option_no_colors)
? "\r%s (%d)"
: CYN "\r%s (%d)" CRESET, text, time2
);
if (time2 == 0) puts("");
}
@@ -53,13 +61,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
LOG(LOG_ERROR, "Unable to get device information");
return 0;
}
if (strcmp(dev.CPUArchitecture, "arm64")) {
if (strncmp(dev.CPUArchitecture, "arm64", strlen("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 (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
if (!checkrain_option_enabled(host_flags, host_option_device_info))
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);
@@ -70,14 +79,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
}
if (passcode_state) {
LOG(LOG_ERROR, "Passcode must be disabled on this device");
if (!checkrain_option_enabled(host_flags, host_option_device_info))
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 (checkrain_option_enabled(host_flags, host_option_device_info)) {
if ((palerain_flags & palerain_option_device_info)) {
printf("Mode: normal\n");
printf("ProductType: %s\n", dev.productType);
printf("Architecture: %s\n", dev.CPUArchitecture);
@@ -89,10 +98,16 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
unsubscribe_cmd();
return 0;
}
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
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 (checkrain_option_enabled(host_flags, host_option_enter_recovery)) {
if ((palerain_flags & palerain_option_enter_recovery)) {
device_has_booted = true;
set_spin(0);
unsubscribe_cmd();
@@ -137,17 +152,14 @@ void* connected_recovery_mode(struct irecv_device_info* info) {
return NULL;
}
printf("\r\033[K");
bool nohome = NOHOME;
if (nohome)
if (NOHOME) {
step(2, 0, "Hold volume down + side button", NULL, 0);
else
step(2, 0, "Hold home + power button", NULL, 0);
if (nohome)
step(10, 0, "Hold volume down button", conditional, ecid);
else
step(10, 0, "Hold home button", conditional, ecid);
if (get_ecid_wait_for_dfu() != 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);
@@ -175,13 +187,15 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
switch (event->event) {
case UE_DEVICE_ADD:
LOG(LOG_VERBOSE, "Normal mode device connected");
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
if ((palerain_flags & palerain_option_exit_recovery)) {
break;
} else if (checkrain_option_enabled(host_flags, host_option_reboot_device)) {
reboot_cmd(event->device.udid);
LOG(LOG_INFO, "Restarted device");
set_spin(0);
unsubscribe_cmd();
} 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;
}
@@ -195,69 +209,85 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
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 (!checkrain_option_enabled(host_flags, host_option_device_info))
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
if (checkrain_option_enabled(host_flags, host_option_exit_recovery)) {
exitrecv_cmd(event->device_info->ecid);
LOG(LOG_INFO, "Exited recovery mode");
device_has_booted = true;
set_spin(0);
unsubscribe_cmd();
if (dfuhelper_thr_running) pthread_cancel(dfuhelper_thread);
pthread_exit(NULL);
break;
}
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
recvinfo_t info;
recvinfo_cmd(&info, event->device_info->ecid);
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 (checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
checkrain_option_enabled(host_flags, host_option_reboot_device)) return;
pthread_create(&recovery_thread, NULL, (void* (*)(void*))connected_recovery_mode, event->device_info);
} else if (event->mode == IRECV_K_DFU_MODE) {
if (!checkrain_option_enabled(host_flags, host_option_device_info))
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
if (checkrain_option_enabled(host_flags, host_option_device_info)) {
recvinfo_t info;
recvinfo_cmd(&info, event->device_info->ecid);
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 (
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
checkrain_option_enabled(host_flags, host_option_reboot_device)) {
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 %ld 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 %ld 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);
}
pthread_create(&dfu_thread, NULL, (void* (*)(void*))connected_dfu_mode, event->device_info);
}
break;
break;
case IRECV_DEVICE_REMOVE:
LOG(LOG_VERBOSE, "Recovery mode device disconnected");
break;
+3 -3
View File
@@ -126,11 +126,11 @@ int exec_checkra1n(void) {
#endif
checkra1n_exec: {};
char args[0x10] = "-E";
if (checkrain_option_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf);
if (!checkrain_option_enabled(host_flags, palerain_option_checkrain_is_clone)) {
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 (checkrain_option_enabled(host_flags, host_option_no_colors)) strncat(args, "n", 0xf);
if ((palerain_flags & palerain_option_no_colors)) strncat(args, "n", 0xf);
} else {
strncat(args, "R", 0xf);
}
+2 -2
View File
@@ -27,7 +27,7 @@
#include <ANSI-color-codes.h>
#include <palerain.h>
#include <xxd-embedded.h>
#include <kerninfo.h>
#include <paleinfo.h>
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
#ifdef TUI
@@ -90,7 +90,7 @@ uint64_t set_ecid_wait_for_dfu(uint64_t ecid) {
}
#ifdef TUI
newtComponent get_tui_log() {
newtComponent get_tui_log(void) {
pthread_mutex_lock(&tui_log_mutex);
newtComponent ret = tui_log_output;
pthread_mutex_unlock(&tui_log_mutex);
+10 -20
View File
@@ -11,22 +11,19 @@
#ifdef DEBUG
#define log_debug(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
#else
#define log_debug(...)
#define log_debug(...) do {} while (0)
#endif
#define log_error(...) fprintf(stderr, __VA_ARGS__); fputc('\n', stderr)
int lockdown_connect_handle(uint32_t handle)
{
int lockdown_connect_handle(uint32_t handle) {
int fd = usbmuxd_connect(handle, 62078);
if (fd < 0) {
log_debug("Can't connect to lockownd on device #%u", handle);
return fd;
}
return fd;
}
int lockdown_connect_udid(const char* udid)
{
int lockdown_connect_udid(const char* udid) {
usbmuxd_device_info_t device;
if (usbmuxd_get_device_by_udid(udid, &device) < 0) {
log_debug("Can't find device %s", udid);
@@ -35,8 +32,7 @@ int lockdown_connect_udid(const char* udid)
return lockdown_connect_handle(device.handle);
}
void lockdown_disconnect(int fd)
{
void lockdown_disconnect(int fd) {
usbmuxd_disconnect(fd);
}
@@ -56,8 +52,7 @@ static const int INTEGER_NODE_SIZE = sizeof(INTEGER_NODE)-1;
static const int STRING_NODE_SIZE = sizeof(STRING_NODE)-1;
static const int ERROR_KEY_NODE_SIZE = sizeof(ERROR_KEY_NODE)-1;
static void skip_ws(char** cur, char* end)
{
static void skip_ws(char** cur, char* end) {
char* p = *cur;
while (p < end && ((*p == ' ') || (*p == '\t') || (*p == '\r') || (*p == '\n'))) {
p++;
@@ -65,8 +60,7 @@ static void skip_ws(char** cur, char* end)
*cur = p;
}
static char* _send_request_and_get_reply(int fd, const char* request, uint32_t len, uint32_t* received)
{
static char* _send_request_and_get_reply(int fd, const char* request, uint32_t len, uint32_t* received) {
uint32_t sent_bytes = 0;
usbmuxd_send(fd, request, len, &sent_bytes);
if (sent_bytes != len) {
@@ -100,8 +94,7 @@ static char* _send_request_and_get_reply(int fd, const char* request, uint32_t l
return resp;
}
int lockdown_check_type(int fd, const char* type_match)
{
int lockdown_check_type(int fd, const char* type_match) {
unsigned char tmp[512];
uint32_t len = (uint32_t)snprintf((char*)tmp, 512, QUERY_TYPE_REQUEST);
uint32_t belen = htonl(len-4);
@@ -119,8 +112,7 @@ int lockdown_check_type(int fd, const char* type_match)
return result;
}
int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_t* value)
{
int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_t* value) {
char tmp[1024];
uint32_t len;
if (domain) {
@@ -159,8 +151,7 @@ int lockdown_get_uint_value(int fd, const char* domain, const char* key, uint64_
return 0;
}
int lockdown_get_string_value(int fd, const char* domain, const char* key, char** value)
{
int lockdown_get_string_value(int fd, const char* domain, const char* key, char** value) {
char tmp[1024];
uint32_t len;
if (domain) {
@@ -212,8 +203,7 @@ int lockdown_get_string_value(int fd, const char* domain, const char* key, char*
return 0;
}
int lockdown_enter_recovery(int fd)
{
int lockdown_enter_recovery(int fd) {
char tmp[512];
uint32_t len = (uint32_t)snprintf(tmp, 512, ENTER_RECOVERY_REQUEST);
*(uint32_t*)&tmp = htonl(len-4);
+10 -10
View File
@@ -12,7 +12,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
{
if (verbose >= 5
#ifdef TUI
&& !checkrain_option_enabled(host_flags, host_option_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;
@@ -57,12 +57,12 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
snprintf(colour_bold, 0x10, "%s", BWHT);
break;
}
if (checkrain_option_enabled(host_flags, host_option_no_colors)) {
if ((palerain_flags & palerain_option_no_colors)) {
colour[0] = '\0';
colour_bold[0] = '\0';
}
#ifdef TUI
if (checkrain_option_enabled(host_flags, host_option_tui) && tui_started) {
if ((palerain_flags & palerain_option_tui) && tui_started) {
newtComponent co = get_tui_log();
if (co == NULL) {
return 0; /* 0 bytes printed */
@@ -79,26 +79,26 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
time_t curtime;
time(&curtime);
struct tm* timeinfo = localtime(&curtime);
if (!checkrain_option_enabled(host_flags, host_option_no_colors))
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 && !checkrain_option_enabled(host_flags, host_option_no_colors)) {
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 (!checkrain_option_enabled(host_flags, host_option_no_colors)) {
} else if (!(palerain_flags & palerain_option_no_colors)) {
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
} else if (verbose >= 2 && checkrain_option_enabled(host_flags, host_option_no_colors)) {
} 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 (checkrain_option_enabled(host_flags, host_option_no_colors)) {
} 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 && !checkrain_option_enabled(host_flags, host_option_no_colors))
if (verbose < 2 && !(palerain_flags & palerain_option_no_colors))
printf(CRESET "\n");
else if (!checkrain_option_enabled(host_flags, host_option_no_colors))
else if (!(palerain_flags & palerain_option_no_colors))
printf("\n%s-%s\n", colour, CRESET);
else if (verbose < 2)
printf("\n");
+16 -19
View File
@@ -27,14 +27,13 @@
#include <ANSI-color-codes.h>
#include <palerain.h>
#include <xxd-embedded.h>
#include <kerninfo.h>
#include <paleinfo.h>
#define CMD_LEN_MAX 512
#define OVERRIDE_MAGIC 0xd803b376
unsigned int verbose = 0;
char xargs_cmd[0x270] = "xargs ", checkrain_flags_cmd[0x20] = "deadbeef", palerain_flags_cmd[0x20] = "deadbeef";
char kpf_flags_cmd[0x20] = "deadbeef", dtpatch_cmd[0x20] = "deadbeef", rootfs_cmd[512] = "deadbeef";
char xargs_cmd[0x270] = "xargs ", palerain_flags_cmd[0x30] = "deadbeef";
extern char** environ;
niarelap_file_t* kpf_to_upload_1 = &checkra1n_kpf_pongo;
@@ -47,7 +46,7 @@ niarelap_file_t** overlay_to_upload = &overlay_to_upload_1;
override_file_t override_ramdisk, override_kpf, override_overlay;
uint32_t checkrain_flags = 0, palerain_flags = 0, kpf_flags = 0;
uint64_t palerain_flags = 0;
pthread_mutex_t log_mutex;
pthread_t dfuhelper_thread, pongo_thread;
@@ -72,8 +71,8 @@ int build_checks(void) {
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) {
host_flags |= palerain_option_checkrain_is_clone;
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
#ifndef NO_KPF
@@ -81,8 +80,7 @@ int build_checks(void) {
if (kpf_hdr->magic != MH_MAGIC_64 && kpf_hdr->magic != MH_CIGAM_64) {
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not thin 64-bit Mach-O");
return -1;
} else
if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
} else if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not a kext bundle");
return -1;
} else if (kpf_hdr->cputype != CPU_TYPE_ARM64) {
@@ -112,10 +110,9 @@ int palera1n(int argc, char *argv[]) {
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
if ((ret = build_checks())) return ret;
if ((ret = optparse(argc, argv))) goto cleanup;
if (!checkrain_option_enabled(host_flags, host_option_device_info))
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) goto normal_exit;
if (!(palerain_flags & palerain_option_device_info) && (palerain_flags & palerain_option_palerain_version)) goto normal_exit;
#ifdef TUI
if (checkrain_option_enabled(host_flags, host_option_tui)) {
if ((palerain_flags & palerain_option_tui)) {
ret = tui();
if (ret) goto cleanup;
else goto normal_exit;
@@ -135,7 +132,7 @@ int palera1n(int argc, char *argv[]) {
}
#endif
if (!checkrain_option_enabled(host_flags, host_option_device_info))
if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_INFO, "Waiting for devices");
if (access("/var/run/usbmuxd", F_OK) != 0)
@@ -145,16 +142,16 @@ int palera1n(int argc, char *argv[]) {
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
pthread_join(dfuhelper_thread, NULL);
set_spin(0);
if (checkrain_option_enabled(host_flags, host_option_dfuhelper_only) ||
checkrain_option_enabled(host_flags, host_option_reboot_device) ||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
checkrain_option_enabled(host_flags, host_option_device_info) ||
device_has_booted)
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;
if (exec_checkra1n()) goto cleanup;
if (checkrain_option_enabled(host_flags, host_option_pongo_exit) || checkrain_option_enabled(host_flags, host_option_demote))
if ((palerain_flags & (palerain_option_pongo_exit | palerain_option_demote)))
goto normal_exit;
set_spin(1);
sleep(2);
+47 -84
View File
@@ -13,16 +13,15 @@
#include <errno.h>
#include <palerain.h>
#include <sys/mman.h>
#include <inttypes.h>
checkrain_option_t host_flags = 0;
checkrain_option_p host_flags_p = &host_flags;
uint64_t* palerain_flags_p = &palerain_flags;
static bool force_use_verbose_boot = false;
static struct option longopts[] = {
#ifdef ROOTFUL
{"setup-partial-fakefs", no_argument, NULL, 'B'},
{"setup-fakefs", no_argument, NULL, 'c'},
#endif
{"clean-fakefs", no_argument, NULL, 'c'},
{"dfuhelper", no_argument, NULL, 'D'},
{"help", no_argument, NULL, 'h'},
{"pongo-shell", no_argument, NULL, 'p'},
@@ -30,11 +29,8 @@ static struct option longopts[] = {
{"debug-logging", no_argument, NULL, 'v'},
{"verbose-boot", no_argument, NULL, 'V'},
{"boot-args", required_argument, NULL, 'e'},
#ifdef ROOTFUL
{"fakefs", no_argument, NULL, 'f'},
#endif
{"rootless", no_argument, NULL, 'l'},
{"jbinit-log-to-file", 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'},
@@ -52,9 +48,6 @@ static struct option longopts[] = {
#ifdef DEV_BUILD
{"test1", no_argument, NULL, '1'},
{"test2", no_argument, NULL, '2'},
{"ignore-ssv", no_argument, NULL, palerain_option_case_ignore_ssv},
{"rootless-livefs", no_argument, NULL, palerain_option_case_rootless_livefs},
{"force-fakefs", no_argument, NULL, palerain_option_case_force_fakefs},
#endif
#ifdef TUI
{"tui", no_argument, NULL, 't'},
@@ -66,44 +59,44 @@ static int usage(int e, char* prog_name)
{
fprintf(stderr,
"Usage: %s [-"
"DEhpvVldsSLRnPI"
"DEhpvVdsSLRnPI"
#ifdef DEV_BUILD
"12"
#endif
#ifdef ROOTFUL
"cfB"
"cCfBl"
#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) 2023, palera1n team, All Rights Reserved.\n\n"
"iOS/iPadOS 15.0-16.4 arm64 jailbreaking tool\n\n"
"iOS/iPadOS 15.0-16.5.1 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--ignore-ssv\t\t\t\tAssume the platform has no SSV\n"
"\t--force-fakefs\t\t\t\tAllow fakefs to be created and used even on platforms without SSV\n"
"\t--rootless-livefs\t\t\t\tMount the root livefs on rootless\n"
"\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 <boot arguments>\tXNU boot arguments\n"
"\t-E, --enter-recovery\t\t\tEnter recovery mode\n"
#ifdef ROOTFUL
"\t-f, --rootful \t\t\t\tSet jailbreak mode to rootful.\n"
"\t-f, --fakefs \t\t\t\tBoots fakefs\n"
#endif
"\t-h, --help\t\t\t\tShow this help\n"
"\t-i, --override-checkra1n <file>\t\tOverride checkra1n\n"
"\t-k, --override-pongo <file>\t\tOverride Pongo image\n"
"\t-K, --override-kpf <file>\t\tOverride kernel patchfinder\n"
"\t-l, --rootless\t\t\t\tSet jailbreak mode to rootless.\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"
@@ -132,35 +125,34 @@ int optparse(int argc, char* argv[]) {
int opt;
int index;
while ((opt = getopt_long(argc, argv,
"DEhpvVldsSLtRnPIe:o:r:K:k:i:"
"DEhpvVlLdsStRnPIe:o:r:K:k:i:"
#ifdef DEV_BUILD
"12"
#endif
#ifdef ROOTFUL
"fcB"
#endif
"fCcB"
,longopts, NULL)) != -1)
{
switch (opt) {
#ifdef ROOTFUL
case 'B':
palerain_flags |= palerain_option_setup_partial_root;
palerain_flags |= palerain_option_setup_rootful;
kpf_flags |= checkrain_option_verbose_boot;
palerain_flags |= palerain_option_verbose_boot;
break;
case 'c':
palerain_flags |= palerain_option_setup_rootful;
kpf_flags |= checkrain_option_verbose_boot;
palerain_flags |= palerain_option_verbose_boot;
break;
case 'C':
palerain_flags |= palerain_option_clean_fakefs;
break;
#endif
case 'p':
host_flags |= host_option_pongo_exit;
palerain_flags |= palerain_option_pongo_exit;
break;
case 'P':
host_flags |= host_option_pongo_full;
palerain_flags |= palerain_option_pongo_full;
break;
case 'D':
host_flags |= host_option_dfuhelper_only;
palerain_flags |= palerain_option_dfuhelper_only;
break;
case 'h':
usage(0, argv[0]);
@@ -169,7 +161,7 @@ int optparse(int argc, char* argv[]) {
verbose++;
break;
case 'V':
kpf_flags |= checkrain_option_verbose_boot;
palerain_flags |= palerain_option_verbose_boot;
force_use_verbose_boot = true;
break;
case 'e':
@@ -182,29 +174,25 @@ int optparse(int argc, char* argv[]) {
}
snprintf(xargs_cmd, sizeof(xargs_cmd), "xargs %s", optarg);
break;
#ifdef ROOTFUL
case 'f':
snprintf(rootfs_cmd, sizeof(rootfs_cmd), "rootfs %s", optarg);
snprintf(dtpatch_cmd, 0x20, "dtpatch %s", optarg);
palerain_flags |= palerain_option_rootful;
palerain_flags &= ~palerain_option_rootless;
break;
#endif
case 'l':
#ifdef ROOTFUL
palerain_flags &= ~palerain_option_rootful;
palerain_flags |= palerain_option_rootless;
#endif
break;
case 'L':
palerain_flags |= palerain_option_jbinit_log_to_file;
break;
case 'd':
host_flags |= host_option_demote;
palerain_flags |= palerain_option_demote;
break;
case 'E':
host_flags |= host_option_enter_recovery;
palerain_flags |= palerain_option_enter_recovery;
break;
case 's':
checkrain_flags |= checkrain_option_safemode;
palerain_flags |= palerain_option_safemode;
break;
case 'k':
if (access(optarg, F_OK) != 0) {
@@ -265,12 +253,12 @@ int optparse(int argc, char* argv[]) {
}
if (boyermoore_horspool_memmem(addr, st.st_size, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL)
{
host_flags |= palerain_option_checkrain_is_clone;
palerain_flags |= palerain_option_checkrain_is_clone;
LOG(LOG_VERBOSE3, "%s is checkra1n clone", optarg);
}
else
{
host_flags &= ~palerain_option_checkrain_is_clone;
palerain_flags &= ~palerain_option_checkrain_is_clone;
LOG(LOG_VERBOSE3, "%s is checkra1n", optarg);
}
munmap(addr, st.st_size);
@@ -279,20 +267,20 @@ int optparse(int argc, char* argv[]) {
snprintf(ext_checkra1n, strlen(optarg) + 1, "%s", optarg);
break;
case 'R':
host_flags |= host_option_reboot_device;
palerain_flags |= palerain_option_reboot_device;
break;
case 'n':
host_flags |= host_option_exit_recovery;
palerain_flags |= palerain_option_exit_recovery;
break;
case 'I':
host_flags |= host_option_device_info;
palerain_flags |= palerain_option_device_info;
break;
case 'S':
host_flags |= host_option_no_colors;
palerain_flags |= palerain_option_no_colors;
break;
#ifdef TUI
case 't':
host_flags |= host_option_tui;
palerain_flags |= palerain_option_tui;
break;
#endif
#ifdef DEV_BUILD
@@ -302,28 +290,19 @@ int optparse(int argc, char* argv[]) {
case '2':
palerain_flags |= palerain_option_test2;
break;
case palerain_option_case_force_fakefs:
palerain_flags |= palerain_option_case_force_fakefs;
break;
case palerain_option_case_rootless_livefs:
palerain_flags |= palerain_option_case_rootless_livefs;
break;
case palerain_option_case_ignore_ssv:
palerain_flags |= palerain_option_no_ssv;
break;
#endif
case palerain_option_case_force_revert:
checkrain_flags |= checkrain_option_force_revert;
palerain_flags |= palerain_option_force_revert;
break;
case palerain_option_case_version:
host_flags |= host_option_palerain_version;
palerain_flags |= palerain_option_palerain_version;
break;
default:
usage(1, argv[0]);
break;
}
}
if (checkrain_option_enabled(host_flags, host_option_palerain_version)) {
if ((palerain_flags & palerain_option_palerain_version)) {
printf(
"palera1n " PALERAIN_VERSION "\n"
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
@@ -341,17 +320,12 @@ int optparse(int argc, char* argv[]) {
return 0;
}
if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
kpf_flags &= ~checkrain_option_verbose_boot;
if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && (palerain_flags & palerain_option_setup_rootful)) {
palerain_flags &= ~palerain_option_verbose_boot;
}
snprintf(checkrain_flags_cmd, 0x20, "checkra1n_flags 0x%x", checkrain_flags);
snprintf(palerain_flags_cmd, 0x20, "palera1n_flags 0x%x", palerain_flags);
snprintf(kpf_flags_cmd, 0x20, "kpf_flags 0x%x", kpf_flags);
LOG(LOG_VERBOSE3, "checkrain_flags: %s", checkrain_flags_cmd);
snprintf(palerain_flags_cmd, 0x30, "palera1n_flags 0x%" PRIx64, palerain_flags);
LOG(LOG_VERBOSE3, "palerain_flags: %s", palerain_flags_cmd);
LOG(LOG_VERBOSE3, "kpf_flags: %s", kpf_flags_cmd);
LOG(LOG_VERBOSE3, "host_flags: 0x%x", host_flags);
if (override_kpf.magic == OVERRIDE_MAGIC) {
LOG(LOG_VERBOSE4, "kpf override length %u -> %u", override_kpf.orig_len, checkra1n_kpf_pongo_len);
LOG(LOG_VERBOSE4, "kpf override ptr %p -> %p", override_kpf.orig_ptr, **kpf_to_upload);
@@ -365,28 +339,17 @@ int optparse(int argc, char* argv[]) {
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
}
if (checkrain_option_enabled(palerain_flags, palerain_option_rootful) && checkrain_option_enabled(palerain_flags, palerain_option_rootless)) {
LOG(LOG_FATAL, "cannot have rootful and rootless at the same time");
return -1;
}
if (!checkrain_option_enabled(palerain_flags, palerain_option_rootful) && !checkrain_option_enabled(palerain_flags, palerain_option_rootless)) {
LOG(LOG_FATAL, "must have either rootful or rootless, use --help for help");
return -1;
}
if (!checkrain_option_enabled(palerain_flags, palerain_option_rootful)) {
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful_forced)) {
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;
}
}
if (!(
checkrain_option_enabled(host_flags, host_option_dfuhelper_only) ||
checkrain_option_enabled(host_flags, host_option_enter_recovery) ||
checkrain_option_enabled(host_flags, host_option_exit_recovery) ||
checkrain_option_enabled(host_flags, host_option_reboot_device)))
(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)
@@ -394,7 +357,7 @@ int optparse(int argc, char* argv[]) {
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
return -1;
}
if (!(checkrain_option_enabled(host_flags, host_option_pongo_exit) || checkrain_option_enabled(host_flags, host_option_pongo_exit)))
if (!((palerain_flags & palerain_option_pongo_exit) || (palerain_flags & palerain_option_pongo_exit)))
{
#ifdef NO_KPF
if (checkra1n_kpf_pongo_len == 0)
+10 -12
View File
@@ -29,24 +29,22 @@ void* pongo_helper(void* ptr) {
return NULL;
}
void *pongo_usb_callback(void *arg) {
void *pongo_usb_callback(stuff_t *arg) {
if (get_found_pongo())
return NULL;
set_found_pongo(1);
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
if ((palerain_flags & palerain_option_setup_rootful)) {
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
}
LOG(LOG_INFO, "Found PongoOS USB Device");
usb_device_handle_t handle = (((stuff_t *)arg)->handle);
usb_device_handle_t handle = arg->handle;
issue_pongo_command(handle, NULL);
issue_pongo_command(handle, "fuse lock");
issue_pongo_command(handle, "sep auto");
upload_pongo_file(handle, **kpf_to_upload, checkra1n_kpf_pongo_len);
issue_pongo_command(handle, "modload");
issue_pongo_command(handle, kpf_flags_cmd);
issue_pongo_command(handle, checkrain_flags_cmd);
issue_pongo_command(handle, palerain_flags_cmd);
if (checkrain_option_enabled(palerain_flags, palerain_option_rootful))
if ((palerain_flags & palerain_option_rootful))
{
issue_pongo_command(handle, "rootfs");
}
@@ -66,13 +64,13 @@ void *pongo_usb_callback(void *arg) {
issue_pongo_command(handle, "overlay");
}
issue_pongo_command(handle, xargs_cmd);
if (checkrain_option_enabled(host_flags, host_option_pongo_full)) goto done;
if ((palerain_flags & palerain_option_pongo_full)) goto done;
issue_pongo_command(handle, "bootx");
LOG(LOG_INFO, "Booting Kernel...");
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_partial_root)) {
if ((palerain_flags & palerain_option_setup_partial_root)) {
LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created.");
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
} else if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
} else if ((palerain_flags & palerain_option_setup_rootful)) {
LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created.");
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak.");
}
@@ -83,7 +81,7 @@ void *pongo_usb_callback(void *arg) {
done:
device_has_booted = true;
#ifdef USE_LIBUSB
libusb_unref_device(((stuff_t *)arg)->dev);
libusb_unref_device(arg->dev);
#endif
set_spin(0);
return NULL;
@@ -163,7 +161,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
if (verbose < 3 || verbose > 4) {
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
} else {
if (checkrain_option_enabled(host_flags, host_option_no_colors))
if ((palerain_flags & palerain_option_no_colors))
printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
else
printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
@@ -176,7 +174,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
void io_start(stuff_t *stuff)
{
int r = pthread_create(&stuff->th, NULL, &pongo_usb_callback, stuff);
int r = pthread_create(&stuff->th, NULL, (pthread_start_t)pongo_usb_callback, stuff);
if(r != 0)
{
ERR("pthread_create: %s", strerror(r));
+4 -4
View File
@@ -12,15 +12,15 @@
#include <palerain.h>
#include <tui.h>
int redraw_screen() {
int redraw_screen(void) {
return 0;
}
int destroy_window() {
int destroy_window(void) {
return 0;
}
int init_window() {
int init_window(void) {
setlocale(LC_ALL, NULL);
setenv(
"NEWT_COLORS",
@@ -61,7 +61,7 @@ int init_window() {
return 0;
}
int tui() {
int tui(void) {
int ret = 0;
if ((ret = init_window())) return ret;
ret = MAIN_SCREEN;
+1 -1
View File
@@ -12,4 +12,4 @@
#include <palerain.h>
#include <tui.h>
tui_screen_t tui_screen_enter_dfu() { return JAILBREAKING_SCREEN; }
tui_screen_t tui_screen_enter_dfu(void) { return JAILBREAKING_SCREEN; }
+1 -1
View File
@@ -12,4 +12,4 @@
#include <palerain.h>
#include <tui.h>
tui_screen_t tui_screen_enter_recovery() { return ENTER_DFU_SCREEN; }
tui_screen_t tui_screen_enter_recovery(void) { return ENTER_DFU_SCREEN; }
+1 -1
View File
@@ -12,4 +12,4 @@
#include <palerain.h>
#include <tui.h>
tui_screen_t tui_screen_jailbreak() { return EXIT_SCREEN; }
tui_screen_t tui_screen_jailbreak(void) { return EXIT_SCREEN; }
+1 -1
View File
@@ -12,7 +12,7 @@
#include <palerain.h>
#include <tui.h>
tui_screen_t tui_screen_main() {
tui_screen_t tui_screen_main(void) {
int ret = MAIN_SCREEN;
bool can_start = false;
newtCenteredWindow(WIDTH, HEIGHT, NULL);
+9 -11
View File
@@ -21,16 +21,14 @@ void bitfield_check_cb(newtComponent box, void* data) {
}
tui_screen_t tui_screen_options() {
tui_bit_info_t verbose_info = { &kpf_flags, checkrain_option_verbose_boot };
tui_screen_t tui_screen_options(void) {
tui_bit_info_t verbose_info = { &palerain_flags, palerain_option_verbose_boot };
tui_bit_info_t rootful_info = { &palerain_flags, palerain_option_rootful };
tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful };
tui_bit_info_t force_revert_info = { &checkrain_flags, checkrain_option_force_revert };
tui_bit_info_t safemode_info = { &checkrain_flags, checkrain_option_safemode };
tui_bit_info_t force_revert_info = { &palerain_flags, palerain_option_force_revert };
tui_bit_info_t safemode_info = { &palerain_flags, palerain_option_safemode };
tui_bit_info_t flower_chain_info = { &palerain_flags, palerain_option_flower_chain };
static checkrain_option_t flower_flags = 0, flower_option_flower_chain = (1 << 0);
tui_bit_info_t flower_chain_info = { &flower_flags, flower_option_flower_chain };
const char* bootargs_entered = NULL;
int ret = MAIN_SCREEN;
@@ -41,11 +39,11 @@ tui_screen_t tui_screen_options() {
newtTextboxSetText(optionsNotice, "You may set the following options. If you don't know what they mean you'll probably have no reason to set them.");
// newtTextboxSetColors(optionsNotice, NEWT_COLORSET_LABEL, NEWT_COLORSET_LABEL);
newtComponent verboseBootBox = newtCheckbox(1, 3, "Verbose boot", CHECKBOX_STATE(kpf_flags, checkrain_option_verbose_boot), NULL, NULL);
newtComponent verboseBootBox = newtCheckbox(1, 3, "Verbose boot", CHECKBOX_STATE(palerain_flags, palerain_option_verbose_boot), NULL, NULL);
newtComponent rootfulBox = newtCheckbox(1, 4, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL);
newtComponent rootfulSetupBox = newtCheckbox(1, 5, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL);
newtComponent forceRevertBox = newtCheckbox(1, 6, "Restore system", CHECKBOX_STATE(checkrain_flags, checkrain_option_force_revert), NULL, NULL);
newtComponent safeModeBox = newtCheckbox(1, 7, "Safe mode", CHECKBOX_STATE(checkrain_flags, checkrain_option_safemode), NULL, NULL);
newtComponent forceRevertBox = newtCheckbox(1, 6, "Restore system", CHECKBOX_STATE(palerain_flags, palerain_option_force_revert), NULL, NULL);
newtComponent safeModeBox = newtCheckbox(1, 7, "Safe mode", CHECKBOX_STATE(palerain_flags, palerain_option_safemode), NULL, NULL);
newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info);
newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info);
@@ -56,7 +54,7 @@ tui_screen_t tui_screen_options() {
newtComponent bootCmdlineLabel = newtLabel(1, 8, "Kernel command line:");
newtComponent bootCmdlineEntry = newtEntry(1, 9, &xargs_cmd[6], WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL);
newtComponent flowerChainBox = newtCheckbox(1, 10, "Flower chain", CHECKBOX_STATE(flower_flags, flower_option_flower_chain), NULL, NULL);
newtComponent flowerChainBox = newtCheckbox(1, 10, "Flower chain", CHECKBOX_STATE(palerain_flags, palerain_option_flower_chain), NULL, NULL);
newtComponentAddCallback(flowerChainBox, bitfield_check_cb, &flower_chain_info);
+51 -52
View File
@@ -114,12 +114,12 @@ usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, int len)
static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *arg)
{
LOG(LOG_VERBOSE, "PongoOS USB Device connected");
stuff_t *stuff = arg;
if(stuff->handle)
{
return LIBUSB_SUCCESS;
}
LOG(LOG_VERBOSE, "PongoOS USB Device connected");
libusb_device_handle *handle;
int r = libusb_open(dev, &handle);
@@ -162,12 +162,12 @@ static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_e
static int LostDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *arg)
{
LOG(LOG_VERBOSE, "PongoOS USB Device disconnected");
stuff_t *stuff = arg;
if(stuff->dev != dev)
{
return LIBUSB_SUCCESS;
}
LOG(LOG_VERBOSE, "PongoOS USB Device disconnected");
io_stop(stuff);
libusb_close(stuff->handle);
@@ -181,6 +181,7 @@ static int LostDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_ev
int wait_for_pongo(void)
{
stuff_t stuff;
stuff.handle = NULL;
libusb_hotplug_callback_handle hp[2];
libusb_context* ctx = NULL;
@@ -198,14 +199,6 @@ int wait_for_pongo(void)
return -1;
}
r = libusb_hotplug_register_callback(ctx, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, 0, PONGO_USB_VENDOR, PONGO_USB_PRODUCT, LIBUSB_HOTPLUG_MATCH_ANY, FoundDevice, &stuff, &hp[0]);
if(r != LIBUSB_SUCCESS)
{
ERR("libusb_hotplug: %s", libusb_error_name(r));
libusb_exit(ctx);
return -1;
}
r = libusb_hotplug_register_callback(ctx, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, 0, PONGO_USB_VENDOR, PONGO_USB_PRODUCT, LIBUSB_HOTPLUG_MATCH_ANY, LostDevice, &stuff, &hp[1]);
if(r != LIBUSB_SUCCESS)
{
@@ -214,55 +207,61 @@ int wait_for_pongo(void)
return -1;
}
libusb_device **list;
ssize_t sz = libusb_get_device_list(ctx, &list);
if(sz < 0)
{
ERR("libusb_get_device_list: %s", libusb_error_name((int)sz));
libusb_exit(ctx);
return -1;
}
for(ssize_t i = 0; i < sz; ++i)
{
struct libusb_device_descriptor desc;
r = libusb_get_device_descriptor(list[i], &desc);
if(r != LIBUSB_SUCCESS)
{
ERR("libusb_get_device_descriptor: %s", libusb_error_name(r));
// continue anyway
}
if(desc.idVendor != PONGO_USB_VENDOR || desc.idProduct != PONGO_USB_PRODUCT)
{
libusb_unref_device(list[i]);
continue;
}
r = FoundDevice(ctx, list[i], LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, &stuff);
for(ssize_t j = i + 1; j < sz; ++j)
{
libusb_unref_device(list[j]);
}
if(r != LIBUSB_SUCCESS)
{
libusb_free_device_list(list, 0);
libusb_exit(ctx);
return -1;
}
break;
}
libusb_free_device_list(list, 0);
while(get_spin())
{
while (1) {
r = libusb_handle_events(ctx);
if(r != LIBUSB_SUCCESS)
{
ERR("libusb_handle_events: %s", libusb_error_name(r));
break;
}
libusb_device **list;
ssize_t sz = libusb_get_device_list(ctx, &list);
bool done = false;
if(sz < 0)
{
ERR("libusb_get_device_list: %s", libusb_error_name((int)sz));
libusb_exit(ctx);
return -1;
}
for(ssize_t i = 0; i < sz; ++i)
{
struct libusb_device_descriptor desc;
r = libusb_get_device_descriptor(list[i], &desc);
if(r != LIBUSB_SUCCESS)
{
ERR("libusb_get_device_descriptor: %s", libusb_error_name(r));
// continue anyway
}
if(desc.idVendor != PONGO_USB_VENDOR || desc.idProduct != PONGO_USB_PRODUCT)
{
libusb_unref_device(list[i]);
continue;
}
r = FoundDevice(ctx, list[i], LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, &stuff);
for (ssize_t j = i; j < sz; ++j) {
libusb_unref_device(list[j]);
}
if(r != LIBUSB_SUCCESS)
{
libusb_free_device_list(list, 0);
libusb_exit(ctx);
return -1;
} else {
done = true;
}
break;
}
libusb_free_device_list(list, 0);
if (done) goto end;
}
libusb_exit(ctx);
return 0;
end:
libusb_exit(ctx);
return 0;
}
#endif