mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-24 02:59:49 +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
@@ -1,7 +1,7 @@
|
||||
SRC = $(shell pwd)
|
||||
DEP = $(SRC)/dep_root
|
||||
CC = cc
|
||||
CFLAGS += -mmacosx-version-min=10.8 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -Os -Wall -Wextra
|
||||
CFLAGS += -mmacosx-version-min=10.8 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -Os -Wall -Wextra -arch arm64
|
||||
LIBS = $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a $(DEP)/lib/libplist-2.0.a $(DEP)/lib/libimobiledevice-glue-1.0.a -pthread
|
||||
LIBS += $(DEP)/lib/libcrypto.35.tbd $(DEP)/lib/libssl.35.tbd $(DEP)/lib/libusb-1.0.a
|
||||
LIBS += -framework CoreFoundation -framework SystemConfiguration -framework IOKit -framework Security
|
||||
|
||||
+3
-1
@@ -6,8 +6,10 @@ LIPO = lipo
|
||||
checkra1n: checkra1n-macos
|
||||
ifneq (,$(findstring arm64, $(CFLAGS)))
|
||||
$(LIPO) -thin arm64 -output checkra1n checkra1n-macos
|
||||
else
|
||||
else ifneq (,$(findstring x86_64, $(CFLAGS)))
|
||||
$(LIPO) -thin x86_64 -output checkra1n checkra1n-macos
|
||||
else
|
||||
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos
|
||||
endif
|
||||
|
||||
checkra1n.c: checkra1n checkra1n-kpf-pongo
|
||||
|
||||
+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);
|
||||
|
||||
+7
-2
@@ -83,6 +83,7 @@ usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
#if defined(__linux__)
|
||||
// We only get here on ENOMEM
|
||||
FILE *f = fopen("/sys/module/usbcore/parameters/usbfs_memory_mb", "r");
|
||||
if(f)
|
||||
@@ -101,9 +102,10 @@ usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len)
|
||||
maxLen = (uint32_t)(max << 19);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// Just 8MB by default?
|
||||
maxLen = 0x800000;
|
||||
// Just 1MB by default?
|
||||
maxLen = 0x100000;
|
||||
}
|
||||
}
|
||||
// If we get here, we have to chunk our data
|
||||
@@ -144,12 +146,15 @@ static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_e
|
||||
return r;
|
||||
}
|
||||
|
||||
/* nah there would not be a kernel driver for pongoOS in Darwin */
|
||||
#if !defined(__APPLE__)
|
||||
r = libusb_detach_kernel_driver(handle, 0);
|
||||
if(r != LIBUSB_SUCCESS && r != LIBUSB_ERROR_NOT_FOUND)
|
||||
{
|
||||
ERR("libusb_detach_kernel_driver: %s", libusb_error_name(r));
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
r = libusb_set_configuration(handle, 1);
|
||||
if(r != LIBUSB_SUCCESS)
|
||||
|
||||
Reference in new issue
Block a user