implement rootful setup and revert

This commit is contained in:
Nick Chan committed 2023-01-27 22:06:43 +08:00
1 parent ed2ca6066f
commit ee355b34d0
4 files changed
+28 -9

No files matched your search

+2 -2
View File
@@ -43,7 +43,7 @@ jobs:
- name: Download dependencies (embedded binaries)
run: |
cd src
curl -LOOO https://github.com/guacaplushy/checkp4le/raw/main/binaries/checkra1n-kpf-pongo \
curl -LOOO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/checkra1n-kpf-pongo \
https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg \
https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
cd ..
@@ -381,7 +381,7 @@ jobs:
- name: Download dependencies (embedded binaries)
run: |
cd src
curl -LOOO https://github.com/guacaplushy/checkp4le/raw/main/binaries/checkra1n-kpf-pongo \
curl -LOOO https://cdn.nickchan.lol/palera1n/c-rewrite/deps/checkra1n-kpf-pongo \
https://cdn.nickchan.lol/palera1n/c-rewrite/deps/binpack.dmg \
https://cdn.nickchan.lol/palera1n/c-rewrite/deps/ramdisk.dmg
cd ..
+4 -2
View File
@@ -54,8 +54,10 @@
#define checkrain_option_force_revert (1 << 7) /* keep this at 7 */
// palera1n option
#define palerain_option_rootful (1 << 0)
#define palerain_option_jbinit_log_to_file (1 << 1)
#define palerain_option_rootful (1 << 0) /* rootful jailbreak */
#define palerain_option_jbinit_log_to_file (1 << 1) /* log to /cores/jbinit.log */
#define palerain_option_setup_rootful (1 << 2) /* create fakefs */
#define palerain_option_setup_rootful_forced (1 << 3) /* create fakefs over an existing one */
#define PALEINFO_MAGIC 'PLSH'
#define PALEINFO_CIGAM 'HSLP'
+18 -4
View File
@@ -13,6 +13,8 @@
#include "common.h"
static struct option longopts[] = {
{"setup-fakefs", no_argument, NULL, 'c'},
{"setup-fakefs-forced", no_argument, NULL, 'C'},
{"dfuhelper", no_argument, NULL, 'D'},
{"help", no_argument, NULL, 'h'},
{"pongo-shell", no_argument, NULL, 'p'},
@@ -32,16 +34,19 @@ static struct option longopts[] = {
{"override-ramdisk", required_argument, NULL, 'r'},
{"override-kpf", required_argument, NULL, 'K'},
{"disable-ohio", no_argument, NULL, 'O'},
{NULL, 0, NULL, 0}};
{NULL, 0, NULL, 0}
};
static int usage(int e, char* prog_name)
{
fprintf(stderr,
"Usage: %s [-DhpPvVldsOL] [-e boot arguments] [-f root device] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file]\n"
"Usage: %s [-cCDhpPvVldsOL] [-e boot arguments] [-f root device] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file]\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--force-revert\t\t\t\tRemove jailbreak\n"
"\t-c, --setup-fakefs\t\t\tSetup fakefs\n"
"\t-C, --setup-fakefs-forced\t\tSetup fakefs and overwrite any existing ones\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"
@@ -67,9 +72,18 @@ static int usage(int e, char* prog_name)
int optparse(int argc, char* argv[]) {
int opt;
int index;
while ((opt = getopt_long(argc, argv, "DhpvVldsOLe:f:o:r:K:k:", longopts, NULL)) != -1)
while ((opt = getopt_long(argc, argv, "cCDhpvVldsOLe:f:o:r:K:k:", longopts, NULL)) != -1)
{
switch (opt) {
case 'c':
palerain_flags |= palerain_option_setup_rootful;
kpf_flags |= checkrain_option_verbose_boot;
break;
case 'C':
palerain_flags |= palerain_option_setup_rootful;
palerain_flags |= palerain_option_setup_rootful_forced;
kpf_flags |= checkrain_option_verbose_boot;
break;
case 'p':
pongo_exit = true;
break;
+4 -1
View File
@@ -29,6 +29,10 @@ void *pongo_usb_callback(void *arg) {
if (found_pongo)
return NULL;
found_pongo = 1;
strncat(xargs_cmd, " rootdev=md0", 0x270);
if (checkrain_option_enabled(palerain_flags, palerain_option_setup_rootful)) {
strncat(xargs_cmd, " wdt=-1", 0x270);
}
LOG(LOG_INFO, "Found PongoOS USB Device");
usb_device_handle_t handle = *(usb_device_handle_t *)arg;
issue_pongo_command(handle, NULL);
@@ -44,7 +48,6 @@ void *pongo_usb_callback(void *arg) {
issue_pongo_command(handle, rootfs_cmd);
issue_pongo_command(handle, dtpatch_cmd);
}
strncat(xargs_cmd, " rootdev=md0", 0x270);
upload_pongo_file(handle, **ramdisk_to_upload, ramdisk_dmg_len);
issue_pongo_command(handle, "ramdisk");
upload_pongo_file(handle, **overlay_to_upload, binpack_dmg_len);