From a696c2b50f083acf697823c3e6ee76648fb2465f Mon Sep 17 00:00:00 2001 From: Nick Chan Date: Mon, 30 Jan 2023 23:25:19 +0800 Subject: [PATCH] Add -F option --- include/common.h | 2 +- src/optparse.c | 9 +++++++-- src/pongo_helper.c | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/common.h b/include/common.h index 272d89b..3317056 100644 --- a/include/common.h +++ b/include/common.h @@ -119,7 +119,7 @@ extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex; extern int enable_rootful, do_pongo_sleep, demote; extern int pongo_thr_running, dfuhelper_thr_running; -extern bool ohio, start_from_pongo; +extern bool ohio, start_from_pongo, pongo_full; extern char xargs_cmd[0x270]; extern char checkrain_flags_cmd[0x20]; extern char palerain_flags_cmd[0x20]; diff --git a/src/optparse.c b/src/optparse.c index f0b4ebd..c8e66f8 100644 --- a/src/optparse.c +++ b/src/optparse.c @@ -19,6 +19,7 @@ static struct option longopts[] = { {"dfuhelper", no_argument, NULL, 'D'}, {"help", no_argument, NULL, 'h'}, {"pongo-shell", no_argument, NULL, 'p'}, + {"pongo-full", no_argument, NULL, 'F'}, {"start-from-pongo", no_argument, NULL, 'P'}, {"debug-logging", no_argument, NULL, 'v'}, {"verbose-boot", no_argument, NULL, 'V'}, @@ -60,6 +61,7 @@ static int usage(int e, char* prog_name) "\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-F, --pongo-full\t\t\tBoots to a PongoOS shell with default images already uploaded\n" "\t-v, --debug-logging\t\t\tEnable debug logging\n" "\t\tThis option can be repeated for extra verbosity.\n" "\t-V, --verbose-boot\t\t\tVerbose boot\n" @@ -87,9 +89,9 @@ int optparse(int argc, char* argv[]) { int index; while ((opt = getopt_long(argc, argv, #ifdef DEV_BUILD - "cCDhpvVldsOLtfe:o:r:K:k:", + "cCDhpvVldsOLtfFe:o:r:K:k:", #else - "cCDhpvVldsOLfe:o:r:K:k:", + "cCDhpvVldsOLfFe:o:r:K:k:", #endif longopts, NULL)) != -1) { @@ -136,6 +138,9 @@ int optparse(int argc, char* argv[]) { snprintf(dtpatch_cmd, 0x20, "dtpatch %s", optarg); enable_rootful = 1; break; + case 'F': + pongo_full = 1; + break; case 'l': enable_rootful = 0; break; diff --git a/src/pongo_helper.c b/src/pongo_helper.c index 4403082..2d4cb8b 100644 --- a/src/pongo_helper.c +++ b/src/pongo_helper.c @@ -12,6 +12,7 @@ #include +bool pongo_full = 0; void* pongo_helper(void* ptr) { pongo_thr_running = 1; @@ -51,9 +52,10 @@ void *pongo_usb_callback(void *arg) { upload_pongo_file(handle, **overlay_to_upload, binpack_dmg_len); issue_pongo_command(handle, "overlay"); issue_pongo_command(handle, xargs_cmd); - issue_pongo_command(handle, "kpf"); - issue_pongo_command(handle, "bootux"); + if (pongo_full) goto done; + issue_pongo_command(handle, "bootx"); LOG(LOG_INFO, "Booting Kernel..."); +done: set_spin(0); return NULL; } \ No newline at end of file