mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-26 19:19:48 +01:00
still need to detect when the previous command is done
This commit is contained in:
1 parent
43a8f51145
commit
15262b8acf
7 files changed
+42
-11
No files matched your search
@@ -10,3 +10,5 @@ payload.c
|
|||||||
src/palera1n
|
src/palera1n
|
||||||
palera1n*
|
palera1n*
|
||||||
!checkra1n.h
|
!checkra1n.h
|
||||||
|
src/binpack.dmg
|
||||||
|
src/ramdisk.dmg
|
||||||
@@ -7,4 +7,10 @@ extern unsigned int checkra1n_len;
|
|||||||
extern unsigned char checkra1n_kpf_pongo[];
|
extern unsigned char checkra1n_kpf_pongo[];
|
||||||
extern unsigned int checkra1n_kpf_pongo_len;
|
extern unsigned int checkra1n_kpf_pongo_len;
|
||||||
|
|
||||||
|
extern unsigned char ramdisk_dmg[];
|
||||||
|
extern unsigned int ramdisk_dmg_len;
|
||||||
|
|
||||||
|
extern unsigned char binpack_dmg[];
|
||||||
|
extern unsigned int binpack_dmg_len;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+3
-1
@@ -12,9 +12,11 @@ else
|
|||||||
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos
|
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos
|
||||||
endif
|
endif
|
||||||
|
|
||||||
checkra1n.c: checkra1n checkra1n-kpf-pongo
|
checkra1n.c: checkra1n checkra1n-kpf-pongo ramdisk.dmg binpack.dmg
|
||||||
xxd -iC checkra1n > checkra1n.c
|
xxd -iC checkra1n > checkra1n.c
|
||||||
xxd -iC checkra1n-kpf-pongo >> checkra1n.c
|
xxd -iC checkra1n-kpf-pongo >> checkra1n.c
|
||||||
|
xxd -iC ramdisk.dmg >> checkra1n.c
|
||||||
|
xxd -iC binpack.dmg >> checkra1n.c
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ typedef struct {
|
|||||||
// set this value to 0 gracefully exit
|
// set this value to 0 gracefully exit
|
||||||
extern int spin;
|
extern int spin;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
extern int demote;
|
||||||
|
|
||||||
extern bool dfuhelper_only;
|
extern bool dfuhelper_only;
|
||||||
extern bool pongo_exit;
|
extern bool pongo_exit;
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ void exec_checkra1n() {
|
|||||||
LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
LOG(LOG_FATAL, "Cannot chmod %s: %d (%s)", checkra1n_path, errno, strerror(errno));
|
||||||
unlink(checkra1n_path);
|
unlink(checkra1n_path);
|
||||||
}
|
}
|
||||||
char* args = "-pvE";
|
char args[0x10] = "-pE";
|
||||||
if (verbose < 2) args = "-pE";
|
if (demote) strcat(args, "d");
|
||||||
|
if (verbose >= 2) strcat(args, "v");
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char* checkra1n_argv[] = {
|
char* checkra1n_argv[] = {
|
||||||
checkra1n_path,
|
checkra1n_path,
|
||||||
|
|||||||
+25
-8
@@ -30,6 +30,7 @@
|
|||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int enable_fakefs = 0;
|
int enable_fakefs = 0;
|
||||||
int do_pongo_sleep = 0;
|
int do_pongo_sleep = 0;
|
||||||
|
int demote = 0;
|
||||||
char xargs_cmd[0x270] = "xargs serial=3 wdt=-1";
|
char xargs_cmd[0x270] = "xargs serial=3 wdt=-1";
|
||||||
char fakefs[512];
|
char fakefs[512];
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
|
|||||||
|
|
||||||
int issue_pongo_command(usb_device_handle_t handle, char *command)
|
int issue_pongo_command(usb_device_handle_t handle, char *command)
|
||||||
{
|
{
|
||||||
|
sleep(1);
|
||||||
int ret;
|
int ret;
|
||||||
size_t len = strlen(command);
|
size_t len = strlen(command);
|
||||||
if (len > (CMD_LEN_MAX - 2)) {
|
if (len > (CMD_LEN_MAX - 2)) {
|
||||||
@@ -87,7 +89,6 @@ int issue_pongo_command(usb_device_handle_t handle, char *command)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto bad;
|
goto bad;
|
||||||
ret = USBControlTransfer(handle, 0x21, 3, 0, 0, (uint32_t)len, buf, NULL);
|
ret = USBControlTransfer(handle, 0x21, 3, 0, 0, (uint32_t)len, buf, NULL);
|
||||||
sleep(1);
|
|
||||||
bad:
|
bad:
|
||||||
if (ret != USB_RET_SUCCESS) {
|
if (ret != USB_RET_SUCCESS) {
|
||||||
if (ret == USB_RET_NOT_RESPONDING)
|
if (ret == USB_RET_NOT_RESPONDING)
|
||||||
@@ -109,7 +110,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
|
|||||||
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
LOG(LOG_VERBOSE, "Uploaded %llu bytes to PongoOS", (unsigned long long)buf_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleep(1);
|
sleep(2);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,15 +121,20 @@ void *pongo_usb_callback(void *arg)
|
|||||||
if (found_pongo) return NULL;
|
if (found_pongo) return NULL;
|
||||||
found_pongo = 1;
|
found_pongo = 1;
|
||||||
usb_device_handle_t handle = *(usb_device_handle_t *)arg;
|
usb_device_handle_t handle = *(usb_device_handle_t *)arg;
|
||||||
sleep(1);
|
|
||||||
issue_pongo_command(handle, "fuse lock");
|
issue_pongo_command(handle, "fuse lock");
|
||||||
issue_pongo_command(handle, "sep auto");
|
issue_pongo_command(handle, "sep auto");
|
||||||
upload_pongo_file(handle, checkra1n_kpf_pongo, checkra1n_kpf_pongo_len);
|
upload_pongo_file(handle, checkra1n_kpf_pongo, checkra1n_kpf_pongo_len);
|
||||||
issue_pongo_command(handle, "modload");
|
issue_pongo_command(handle, "modload");
|
||||||
|
issue_pongo_command(handle, "kpf_flags 0x00000000");
|
||||||
|
issue_pongo_command(handle, "checkra1n_flags 0x00000000");
|
||||||
if (enable_fakefs) {
|
if (enable_fakefs) {
|
||||||
issue_pongo_command(handle, fakefs);
|
issue_pongo_command(handle, fakefs);
|
||||||
} else {
|
} else {
|
||||||
assert(0);
|
strcat(xargs_cmd, " rootdev=md0");
|
||||||
|
upload_pongo_file(handle, ramdisk_dmg, ramdisk_dmg_len);
|
||||||
|
issue_pongo_command(handle, "ramdisk");
|
||||||
|
upload_pongo_file(handle, binpack_dmg, binpack_dmg_len);
|
||||||
|
issue_pongo_command(handle, "overlay");
|
||||||
}
|
}
|
||||||
issue_pongo_command(handle, xargs_cmd);
|
issue_pongo_command(handle, xargs_cmd);
|
||||||
issue_pongo_command(handle, "bootx");
|
issue_pongo_command(handle, "bootx");
|
||||||
@@ -146,12 +152,14 @@ static struct option longopts[] = {
|
|||||||
{"debug-logging", no_argument, NULL, 'V'},
|
{"debug-logging", no_argument, NULL, 'V'},
|
||||||
{"boot-args", required_argument, NULL, 'e'},
|
{"boot-args", required_argument, NULL, 'e'},
|
||||||
{"rootfs", required_argument, NULL, 'f'},
|
{"rootfs", required_argument, NULL, 'f'},
|
||||||
|
{"rootless", required_argument, NULL, 'l'},
|
||||||
|
{"demote", required_argument, NULL, 'l'},
|
||||||
{NULL, 0, NULL, 0}};
|
{NULL, 0, NULL, 0}};
|
||||||
|
|
||||||
int usage(int e)
|
int usage(int e)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [-DhpPv] [-e boot arguments] [-f root device]\n"
|
"Usage: %s [-DhpPvld] [-e boot arguments] [-f root device]\n"
|
||||||
"Copyright (C) 2023, palera1n team, All Rights Reserved.\n\n"
|
"Copyright (C) 2023, palera1n team, All Rights Reserved.\n\n"
|
||||||
"iOS/iPadOS 15+ arm64 jailbreaking tool\n\n"
|
"iOS/iPadOS 15+ arm64 jailbreaking tool\n\n"
|
||||||
"\t-D, --dfuhelper-only\t\t\tExit after entering DFU\n"
|
"\t-D, --dfuhelper-only\t\t\tExit after entering DFU\n"
|
||||||
@@ -161,7 +169,9 @@ int usage(int e)
|
|||||||
"\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\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, --rootfs <root device>\t\tBoots rootful setup on <root device>\n",
|
"\t-f, --rootfs <root device>\t\tBoots rootful setup on <root device>\n"
|
||||||
|
"\t-l, --rootless\t\t\t\tBoots rootless. This is the default\n"
|
||||||
|
"\t-d, --demote\t\t\t\tDemote\n",
|
||||||
getprogname());
|
getprogname());
|
||||||
exit(e);
|
exit(e);
|
||||||
}
|
}
|
||||||
@@ -174,7 +184,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
int index;
|
int index;
|
||||||
while ((opt = getopt_long(argc, argv, "DhpPve:f:", longopts, NULL)) != -1)
|
while ((opt = getopt_long(argc, argv, "DhpPve:f:ld", longopts, NULL)) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
@@ -200,6 +210,12 @@ int main(int argc, char *argv[])
|
|||||||
snprintf(fakefs, sizeof(fakefs), "dtpatch %s", optarg);
|
snprintf(fakefs, sizeof(fakefs), "dtpatch %s", optarg);
|
||||||
enable_fakefs = 1;
|
enable_fakefs = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
enable_fakefs = 0;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
demote = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(1);
|
usage(1);
|
||||||
break;
|
break;
|
||||||
@@ -226,9 +242,9 @@ int main(int argc, char *argv[])
|
|||||||
putenv("LIBUSB_DEBUG=3");
|
putenv("LIBUSB_DEBUG=3");
|
||||||
}
|
}
|
||||||
if (verbose >= 4) putenv("LIBUSB_DEBUG=4");
|
if (verbose >= 4) putenv("LIBUSB_DEBUG=4");
|
||||||
LOG(LOG_INFO, "Waiting for devices");
|
|
||||||
if (start_from_pongo == true)
|
if (start_from_pongo == true)
|
||||||
goto pongo;
|
goto pongo;
|
||||||
|
LOG(LOG_INFO, "Waiting for devices");
|
||||||
do_pongo_sleep = 1;
|
do_pongo_sleep = 1;
|
||||||
pthread_t dfuhelper_thread;
|
pthread_t dfuhelper_thread;
|
||||||
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
|
||||||
@@ -241,6 +257,7 @@ int main(int argc, char *argv[])
|
|||||||
pongo:
|
pongo:
|
||||||
spin = true;
|
spin = true;
|
||||||
if (do_pongo_sleep) sleep(2);
|
if (do_pongo_sleep) sleep(2);
|
||||||
|
else LOG(LOG_INFO, "Waiting for PongoOS devices...");
|
||||||
wait_for_pongo();
|
wait_for_pongo();
|
||||||
while (spin) {
|
while (spin) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ struct stuff
|
|||||||
|
|
||||||
static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *arg)
|
static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *arg)
|
||||||
{
|
{
|
||||||
|
LOG(LOG_VERBOSE, "PongoOS USB Device connected\n");
|
||||||
stuff_t *stuff = arg;
|
stuff_t *stuff = arg;
|
||||||
if(stuff->handle)
|
if(stuff->handle)
|
||||||
{
|
{
|
||||||
@@ -179,6 +180,7 @@ 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)
|
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;
|
stuff_t *stuff = arg;
|
||||||
if(stuff->dev != dev)
|
if(stuff->dev != dev)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user