More options

This commit is contained in:
Nick Chan committed 2023-01-18 16:02:43 +08:00
1 parent abfd306bdd
commit f67415067f
4 files changed
+139 -14

No files matched your search

+37 -12
View File
@@ -24,16 +24,20 @@
#include "ANSI-color-codes.h"
#include "common.h"
#include "checkra1n.h"
#include "kerninfo.h"
#define CMD_LEN_MAX 512
int verbose = 0;
unsigned int verbose = 0;
int enable_fakefs = 0;
int do_pongo_sleep = 0;
int demote = 0;
char xargs_cmd[0x270] = "xargs serial=3 wdt=-1";
char checkrain_flags_cmd[0x20] = "checkra1n_flags 0x0";
char fakefs[512];
uint32_t checkrain_flags = 0;
int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxname, char *__restrict format, ...)
{
int ret = 0;
@@ -60,7 +64,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
printf(BWHT "[Verbose] " WHT);
break;
}
if (verbose >= 1 || loglevel < LOG_VERBOSE)
if (verbose >= (loglevel - 3) || loglevel < LOG_VERBOSE)
{
ret = vprintf(format, args);
va_end(args);
@@ -83,18 +87,16 @@ void *pongo_usb_callback(void *arg)
upload_pongo_file(handle, checkra1n_kpf_pongo, checkra1n_kpf_pongo_len);
issue_pongo_command(handle, "modload");
issue_pongo_command(handle, "kpf_flags 0x00000000");
issue_pongo_command(handle, "checkra1n_flags 0x00000000");
if (enable_fakefs)
{
issue_pongo_command(handle, checkrain_flags_cmd);
if (enable_fakefs) {
issue_pongo_command(handle, fakefs);
}
else
{
} else {
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, "dtpatch md0");
}
issue_pongo_command(handle, xargs_cmd);
issue_pongo_command(handle, "kpf");
@@ -113,16 +115,21 @@ static struct option longopts[] = {
{"debug-logging", no_argument, NULL, 'V'},
{"boot-args", required_argument, NULL, 'e'},
{"rootfs", required_argument, NULL, 'f'},
{"rootless", required_argument, NULL, 'l'},
{"demote", required_argument, NULL, 'd'},
{"rootless", no_argument, NULL, 'l'},
{"demote", no_argument, NULL, 'd'},
{"force-revert", no_argument, NULL, checkrain_option_force_revert},
{"safe-mode", no_argument, NULL, 's'},
{"version", no_argument, NULL, palerain_option_version},
{NULL, 0, NULL, 0}};
int usage(int e)
{
fprintf(stderr,
"Usage: %s [-DhpPvld] [-e boot arguments] [-f root device]\n"
"Usage: %s [-DhpPvlds] [-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--version\t\t\t\tPrint version\n"
"\t--force-revert\t\t\t\tRemove jailbreak (on rootless)\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"
@@ -132,6 +139,7 @@ int usage(int e)
"\t-e, --boot-args <boot arguments>\tXNU boot arguments\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-s, --safe-mode\t\t\t\tEnter safe mode (on rootless)\n"
"\t-d, --demote\t\t\t\tDemote\n",
getprogname());
exit(e);
@@ -140,12 +148,13 @@ int usage(int e)
bool dfuhelper_only = false;
bool pongo_exit = false;
bool start_from_pongo = false;
bool palerain_version = false;
int main(int argc, char *argv[])
{
int opt;
int index;
while ((opt = getopt_long(argc, argv, "DhpPve:f:ld", longopts, NULL)) != -1)
while ((opt = getopt_long(argc, argv, "DhpPvldse:f:", longopts, NULL)) != -1)
{
switch (opt)
{
@@ -177,11 +186,27 @@ int main(int argc, char *argv[])
case 'd':
demote = 1;
break;
case 's':
checkrain_flags |= checkrain_option_safemode;
break;
case checkrain_option_force_revert:
checkrain_flags |= checkrain_option_force_revert;
break;
case palerain_option_version:
palerain_version = true;
break;
default:
usage(1);
break;
}
}
if (palerain_version) {
printf("palera1n %s\n", PALERAIN_VERSION);
return 0;
}
snprintf(checkrain_flags_cmd, 0x20, "checkra1n_flags 0x%x", checkrain_flags);
LOG(LOG_VERBOSE2, "checkrain_flags: %s\n", checkrain_flags_cmd);
for (index = optind; index < argc; index++)
{
if (!strcmp("windows", argv[index]))