mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-24 11:09:48 +02:00
pongo USB working consistently
This commit is contained in:
1 parent
3b1c9bbd5f
commit
81d1e5410e
4 files changed
+41
-11
No files matched your search
+30
-7
@@ -19,6 +19,8 @@
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <libimobiledevice/libimobiledevice.h>
|
||||
|
||||
#include "ANSI-color-codes.h"
|
||||
#include "common.h"
|
||||
#include "checkra1n.h"
|
||||
@@ -26,7 +28,10 @@
|
||||
#define CMD_LEN_MAX 512
|
||||
|
||||
int verbose = 0;
|
||||
int enable_fakefs = 0;
|
||||
int do_pongo_sleep = 0;
|
||||
char xargs_cmd[0x270] = "xargs serial=3 wdt=-1";
|
||||
char fakefs[512];
|
||||
|
||||
int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, char *__restrict format, ...)
|
||||
{
|
||||
@@ -120,7 +125,11 @@ void *pongo_usb_callback(void *arg)
|
||||
issue_pongo_command(handle, "sep auto");
|
||||
upload_pongo_file(handle, checkra1n_kpf_pongo, checkra1n_kpf_pongo_len);
|
||||
issue_pongo_command(handle, "modload");
|
||||
issue_pongo_command(handle, "dtpatch disk0s1s8");
|
||||
if (enable_fakefs) {
|
||||
issue_pongo_command(handle, fakefs);
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
issue_pongo_command(handle, xargs_cmd);
|
||||
issue_pongo_command(handle, "bootx");
|
||||
LOG(LOG_INFO, "Booting Kernel...");
|
||||
@@ -136,21 +145,23 @@ static struct option longopts[] = {
|
||||
{"start-from-pongo", no_argument, NULL, 'P'},
|
||||
{"debug-logging", no_argument, NULL, 'V'},
|
||||
{"boot-args", required_argument, NULL, 'e'},
|
||||
{"fakefs", required_argument, NULL, 'f'},
|
||||
{NULL, 0, NULL, 0}};
|
||||
|
||||
int usage(int e)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-DhpPV] [-e boot arguments]\n"
|
||||
"Usage: %s [-DhpPv] [-e boot arguments] [-f root device]\n"
|
||||
"Copyright (C) 2023, palera1n team, All Rights Reserved.\n\n"
|
||||
"iOS/iPadOS 15+ arm64 jailbreaking tool\n\n"
|
||||
"\t-D, --dfuhelper-only\t\t\tExit after entering DFU\n"
|
||||
"\t-h, --help\t\t\t\tShow this help\n"
|
||||
"\t-p, --pongo-shell\t\t\tBoots to PongoOS shell\n"
|
||||
"\t-P, --start-from-pongo\t\t\tStart with a PongoOS USB Device attached\n"
|
||||
"\t-V, --debug-logging\t\t\tEnable debug logging\n"
|
||||
"\t-v, --debug-logging\t\t\tEnable debug logging\n"
|
||||
"\t\tThis option can be repeated for extra verbosity.\n"
|
||||
"\t-e, --boot-args <boot arguments>\tXNU boot arguments\n",
|
||||
"\t-e, --boot-args <boot arguments>\tXNU boot arguments\n"
|
||||
"\t-f, --fakefs <root device>\tBoots fakefs on <root device>\n",
|
||||
getprogname());
|
||||
exit(e);
|
||||
}
|
||||
@@ -163,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int opt;
|
||||
int index;
|
||||
while ((opt = getopt_long(argc, argv, "DhpPVe:", longopts, NULL)) != -1)
|
||||
while ((opt = getopt_long(argc, argv, "DhpPve:f:", longopts, NULL)) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
@@ -179,12 +190,16 @@ int main(int argc, char *argv[])
|
||||
case 'h':
|
||||
usage(0);
|
||||
assert(0);
|
||||
case 'V':
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'e':
|
||||
snprintf(xargs_cmd, sizeof(xargs_cmd), "xargs %s", optarg);
|
||||
break;
|
||||
case 'f':
|
||||
snprintf(fakefs, sizeof(fakefs), "dtpatch %s", optarg);
|
||||
enable_fakefs = 1;
|
||||
break;
|
||||
default:
|
||||
usage(1);
|
||||
break;
|
||||
@@ -201,13 +216,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "palera1n: unknown argument: %s\n", argv[index]);
|
||||
fprintf(stderr, "%s: unknown argument: %s\n", getprogname(), argv[index]);
|
||||
usage(1);
|
||||
}
|
||||
}
|
||||
if (verbose >= 3) {
|
||||
irecv_set_debug_level(1);
|
||||
idevice_set_debug_level(1);
|
||||
putenv("LIBUSB_DEBUG=3");
|
||||
}
|
||||
if (verbose >= 4) putenv("LIBUSB_DEBUG=4");
|
||||
LOG(LOG_INFO, "Waiting for devices");
|
||||
if (start_from_pongo == true)
|
||||
goto pongo;
|
||||
do_pongo_sleep = 1;
|
||||
pthread_t dfuhelper_thread;
|
||||
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
||||
pthread_join(dfuhelper_thread, NULL);
|
||||
@@ -218,6 +240,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
pongo:
|
||||
spin = true;
|
||||
if (do_pongo_sleep) sleep(2);
|
||||
wait_for_pongo();
|
||||
while (spin) {
|
||||
sleep(1);
|
||||
|
||||
Reference in new issue
Block a user