paleinfo v2

This commit is contained in:
Nick Chan committed 2023-07-08 03:53:55 +08:00
1 parent 8b56b01cee
commit 03a0a5db6b
14 files changed
+173 -265

No files matched your search

+8
View File
@@ -124,6 +124,13 @@ iOS15 branch or your own fork of it.
Makes jbinit log to Makes jbinit log to
.Em /cores/jbinit.log .Em /cores/jbinit.log
This file may be viewed from sandboxed applications while jailbroken. This file may be viewed from sandboxed applications while jailbroken.
.It Fl l , -rootless
Proceed in rootless mode, this is the default when neither
.Fl l , -rootless
and
.Fl f , -fakefs
is specified.
>>>>>>> a8e6075 (paleinfo v2)
.It Fl n , -exit-recovery .It Fl n , -exit-recovery
Exit recovery mode and exit. Exit recovery mode and exit.
.It Fl o , -override-overlay Ar overlay file .It Fl o , -override-overlay Ar overlay file
@@ -226,6 +233,7 @@ The location of the temporary filesystem where jailbreak files are stash during
When When
.Fl L .Fl L
is used, the log file of jbinit. is used, the log file of jbinit.
The log file of jbinit.
.It Pa /var/jb/Library/LaunchDaemons .It Pa /var/jb/Library/LaunchDaemons
The directory where jailbreak-specific The directory where jailbreak-specific
.Xr launchd.plist 5 .Xr launchd.plist 5
-20
View File
@@ -1,20 +0,0 @@
curl -LOOOOOO \
https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v3.3.0.tar.gz \
https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 \
https://mirror-hk.koddos.net/gnu/readline/readline-8.2.tar.gz \
https://www.jedsoft.org/releases/slang/slang-2.3.3.tar.bz2 \
https://releases.pagure.org/newt/newt-0.52.23.tar.gz \
https://github.com/rpm-software-management/popt/archive/master-release.tar.gz
tar xf v3.3.0.tar.gz
tar xf libusb-1.0.26.tar.bz2
tar xf readline-8.2.tar.gz
tar xf slang-2.3.3.tar.bz2
tar xf newt-0.52.23.tar.gz
tar xf master-release.tar.gz
git clone --depth=1 https://github.com/libimobiledevice/libplist
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice-glue
git clone --depth=1 https://github.com/libimobiledevice/libirecovery
git clone --depth=1 https://github.com/libimobiledevice/libusbmuxd
git clone --depth=1 https://github.com/libimobiledevice/libimobiledevice
-135
View File
@@ -1,135 +0,0 @@
/*
* pongoOS - https://checkra.in
*
* Copyright (C) 2019-2022 checkra1n team
*
* This file is part of pongoOS.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef _KERNINFO_H
#define _KERNINFO_H
#include <stdbool.h>
#include <stdint.h>
#define MAX_BOOTARGS_LEN 256
#define checkrain_option_none 0x00000000
#define checkrain_option_all 0x7fffffff
#define checkrain_option_failure 0x80000000
// Host options
#define checkrain_option_verbose_logging (1 << 0)
#define checkrain_option_demote (1 << 1)
#define checkrain_option_early_exit (1 << 2)
#define checkrain_option_quick_mode (1 << 3)
#define checkrain_option_pongo_shell (1 << 4)
#define checkrain_option_pongo_full (1 << 5)
// KPF options
#define checkrain_option_verbose_boot (1 << 0)
// Global options
#define checkrain_option_safemode (1 << 0)
#define checkrain_option_bind_mount (1 << 1)
#define checkrain_option_overlay (1 << 2)
#define checkrain_option_force_revert (1 << 7) /* keep this at 7 */
// palera1n option
#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 palerain_option_setup_partial_root (1 << 4) /* fakefs creating should be partial */
#define palerain_option_checkrain_is_clone (1 << 5) /* supplied checkra1n is checkra1n clone */
#define palerain_option_rootless_livefs (1 << 6) /* mount root livefs on rootless */
/* reserved values */
// #define palerain_option_no_ssv (1 << 7) /* no signed system volume */
// #define palerain_option_force_fakefs (1 << 8) /* force fakefs, even without SSV */
// #define palerain_option_rootless (1 << 9) /* rootless jailbreak */
#define palerain_option_clean_fakefs (1 << 10) /* clean fakefs, but does not delete it */
#ifdef DEV_BUILD
#define palerain_option_test1 (1 << 29)
#define palerain_option_test2 (1 << 30)
#endif
// palerain host options
#define host_option_dfuhelper_only (1 << 0) /* dfuhelper only */
#define host_option_pongo_exit (1 << 1) /* boot to clean pongo shell */
#ifdef TUI
#define host_option_tui (1 << 2) /* use terminal user interface */
#else
#define host_option_res1 (1 << 2) /* reserved */
#endif
#define host_option_demote (1 << 3) /* Demote effective production fuse status */
// (1 << 4) is removed
#define host_option_pongo_full (1 << 5) /* Boot to pongo with default images and options */
#define host_option_palerain_version (1 << 6) /* Print version */
#define host_option_exit_recovery (1 << 7) /* Exit recovery mode */
#define host_option_reboot_device (1 << 8) /* Reboot device in normal mode */
#define host_option_enter_recovery (1 << 9) /* Enter recovery mode */
#define host_option_device_info (1 << 10) /* Print device info */
#define host_option_no_colors (1 << 11) /* no colors */
#define PALEINFO_MAGIC 'PLSH'
#define PALEINFO_CIGAM 'HSLP'
typedef uint32_t checkrain_option_t, *checkrain_option_p;
typedef enum {
jailbreak_capability_tfp0 = 1 << 0,
jailbreak_capability_userspace_reboot = 1 << 1,
jailbreak_capability_dyld_ignore_os = 1 << 2, // TODO: This needs a better name
} jailbreak_capability_t, *jailbreak_capability_p;
#define DEFAULT_CAPABILITIES (jailbreak_capability_tfp0|jailbreak_capability_userspace_reboot)
struct kerninfo {
uint64_t size;
uint64_t base;
uint64_t slide;
checkrain_option_t flags;
};
struct paleinfo {
uint32_t magic; // 'PLSH' / 0x504c5348
uint32_t version; // 1
checkrain_option_t flags;
char rootdev[0x10];
};
struct kpfinfo {
struct kerninfo k;
checkrain_option_t kpf_flags;
char bootargs[MAX_BOOTARGS_LEN];
};
#define checkrain_set_option(options, option, enabled) do { \
if (enabled) \
options = (checkrain_option_t)(options | option); \
else \
options = (checkrain_option_t)(options & ~option); \
} while (0);
static inline bool checkrain_options_enabled(checkrain_option_t flags, checkrain_option_t opt)
{
return (flags & opt) != 0;
}
#endif
+65
View File
@@ -0,0 +1,65 @@
/*
* jbinit - https://github.com/palera1n/jbinit
*
* This file is part of jbinit
*
* SPDX-License-Identifier: MIT
*/
#ifndef PALEINFO_H
#define PALEINFO_H
#include <stdint.h>
#define PALEINFO_VERSION 2U
typedef uint64_t palerain_option_t;
// unified palera1n options
#define palerain_option_rootful (1ULL << 0) /* rootful jailbreak */
#define palerain_option_rootless (1ULL << 1) /* rootless jailbreak */
#define palerain_option_setup_rootful (1ULL << 2) /* create fakefs */
/* reserved */
#define palerain_option_setup_partial_root (1ULL << 4) /* fakefs creating should be partial */
#define palerain_option_checkrain_is_clone (1ULL << 5) /* supplied checkra1n is checkra1n clone */
#define palerain_option_rootless_livefs (1ULL << 6) /* mount root livefs on rootless */
// #define palerain_option_no_ssv (1ULL << 7) /* no signed system volume */
// #define palerain_option_force_fakefs (1ULL << 8) /* force fakefs, even without SSV */
#define palerain_option_clean_fakefs (1ULL << 9) /* clean fakefs, but does not delete it */
#define palerain_option_tui (1ULL << 10) /* terminal user interface */
// #define palerain_option_gui (1ULL << 11) /* graphical user interface*/
#define palerain_option_dfuhelper_only (1ULL << 12) /* dfuhelper only */
#define palerain_option_pongo_exit (1ULL << 13) /* boot to clean pongo shell */
#define palerain_option_demote (1ULL << 14) /* Demote effective production fuse status */
#define palerain_option_pongo_full (1ULL << 15) /* Boot to pongo with default images and options */
#define palerain_option_palerain_version (1ULL << 16) /* Print version */
#define palerain_option_exit_recovery (1ULL << 17) /* Exit recovery mode */
#define palerain_option_reboot_device (1ULL << 18) /* Reboot device in normal mode */
#define palerain_option_enter_recovery (1ULL << 19) /* Enter recovery mode */
#define palerain_option_device_info (1ULL << 20) /* Print device info */
#define palerain_option_no_colors (1ULL << 21) /* no colors */
#define palerain_option_bind_mount (1ULL << 22) /* bind mounts should be used (always true iOS 15+)*/
#define palerain_option_overlay (1ULL << 23) /* there is an overlay (should always be true) */
#define palerain_option_force_revert (1ULL << 24) /* Unjailbreak */
#define palerain_option_safemode (1ULL << 25) /* Enter safe mode */
#define palerain_option_verbose_boot (1ULL << 26) /* verbose boot */
#define palerain_option_jbinit_log_to_file (1ULL << 50) /* make ramdisk log to file (jbinit2) */
#define palerain_option_setup_rootful_forced (1ULL << 51) /* create fakefs over an existing one (jbinit2) */
#define palerain_option_flower_chain (1ULL << 61) /* Flower chain */
#define palerain_option_test1 (1ULL << 62) /* Developer test option 1 */
#define palerain_option_test2 (1ULL << 63) /* Developer test option 2 */
#define PALEINFO_MAGIC 'PLSH'
/* paleinfo version 2, appended to ramdisk */
struct paleinfo {
uint32_t magic; /* 'PLSH' */
uint32_t version; /* 2 */
uint64_t kbase; /* kernel base */
uint64_t kslide; /* kernel slide */
uint64_t flags; /* unified palera1n flags */
char rootdev[0x10]; /* ex. disk0s1s8 */
}__attribute__((packed));
#endif
+4 -6
View File
@@ -6,7 +6,7 @@
#endif #endif
#include "xxd-embedded.h" #include "xxd-embedded.h"
#include "kerninfo.h" #include "paleinfo.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
@@ -155,8 +155,8 @@ extern char* pongo_path;
extern bool tui_started; extern bool tui_started;
#endif #endif
extern checkrain_option_t host_flags; extern uint64_t palerain_flags;
extern checkrain_option_p host_flags_p; extern uint64_t* palerain_flags_p;
extern pthread_t dfuhelper_thread, pongo_thread; extern pthread_t dfuhelper_thread, pongo_thread;
extern int pongo_thr_running, dfuhelper_thr_running; extern int pongo_thr_running, dfuhelper_thr_running;
@@ -165,7 +165,7 @@ extern niarelap_file_t *kpf_to_upload_1, *ramdisk_to_upload_1, *overlay_to_uploa
extern niarelap_file_t **kpf_to_upload, **ramdisk_to_upload, **overlay_to_upload; extern niarelap_file_t **kpf_to_upload, **ramdisk_to_upload, **overlay_to_upload;
extern override_file_t override_ramdisk, override_kpf, override_overlay; extern override_file_t override_ramdisk, override_kpf, override_overlay;
extern uint32_t checkrain_flags, palerain_flags, kpf_flags; extern uint64_t palerain_flags;
extern pthread_mutex_t log_mutex; extern pthread_mutex_t log_mutex;
extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex; extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
@@ -173,9 +173,7 @@ extern pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
extern int pongo_thr_running, dfuhelper_thr_running; extern int pongo_thr_running, dfuhelper_thr_running;
extern bool device_has_booted; extern bool device_has_booted;
extern char xargs_cmd[0x270]; extern char xargs_cmd[0x270];
extern char checkrain_flags_cmd[0x20];
extern char palerain_flags_cmd[0x20]; extern char palerain_flags_cmd[0x20];
extern char kpf_flags_cmd[0x20];
extern char dtpatch_cmd[0x20]; extern char dtpatch_cmd[0x20];
extern char rootfs_cmd[512]; extern char rootfs_cmd[512];
extern char* ext_checkra1n; extern char* ext_checkra1n;
+3 -3
View File
@@ -11,7 +11,7 @@
#include <locale.h> #include <locale.h>
#include <unistd.h> #include <unistd.h>
#include <newt.h> #include <newt.h>
#include <kerninfo.h> #include <paleinfo.h>
#define WIDTH 76 #define WIDTH 76
#define HEIGHT 19 #define HEIGHT 19
@@ -33,8 +33,8 @@ typedef enum tui_screens {
} tui_screen_t; } tui_screen_t;
typedef struct bitfield_checkbox_info { typedef struct bitfield_checkbox_info {
checkrain_option_p flags_p; uint64_t* flags_p;
checkrain_option_t opt; uint64_t opt;
} tui_bit_info_t; } tui_bit_info_t;
tui_screen_t tui_screen_main(); tui_screen_t tui_screen_main();
+18 -18
View File
@@ -37,7 +37,7 @@ int dfuhelper_thr_running = false;
void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) { void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond_arg) {
for (int i = time2; i < time; i++) { for (int i = time2; i < time; i++) {
printf( printf(
checkrain_options_enabled(host_flags, host_option_no_colors) (palerain_flags & palerain_option_no_colors)
? "\r\033[K%s (%d)" ? "\r\033[K%s (%d)"
: BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2 : BCYN "\r\033[K%s (%d)" CRESET, text, time - i + time2
); );
@@ -46,7 +46,7 @@ void step(int time, int time2, char *text, bool (*cond)(uint64_t), uint64_t cond
if (cond != NULL && cond(cond_arg)) pthread_exit(NULL); if (cond != NULL && cond(cond_arg)) pthread_exit(NULL);
} }
printf( printf(
checkrain_options_enabled(host_flags, host_option_no_colors) (palerain_flags & palerain_option_no_colors)
? "\r%s (%d)" ? "\r%s (%d)"
: CYN "\r%s (%d)" CRESET, text, time2 : CYN "\r%s (%d)" CRESET, text, time2
); );
@@ -68,7 +68,7 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
return -1; return -1;
} }
if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) { if (!strncmp(dev.productType, "iPhone10,", strlen("iPhone10,"))) {
if (!checkrain_options_enabled(host_flags, host_option_device_info)) if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType); LOG(LOG_VERBOSE2, "Product %s requires passcode to be disabled", dev.productType);
unsigned char passcode_state = 0; unsigned char passcode_state = 0;
ret = passstat_cmd(&passcode_state, usbmuxd_device->udid); ret = passstat_cmd(&passcode_state, usbmuxd_device->udid);
@@ -79,14 +79,14 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
} }
if (passcode_state) { if (passcode_state) {
LOG(LOG_ERROR, "Passcode must be disabled on this device"); LOG(LOG_ERROR, "Passcode must be disabled on this device");
if (!checkrain_options_enabled(host_flags, host_option_device_info)) if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_ERROR, "Additionally, passcode must never be set since a restore on iOS 16+"); LOG(LOG_ERROR, "Additionally, passcode must never be set since a restore on iOS 16+");
devinfo_free(&dev); devinfo_free(&dev);
return -1; return -1;
} }
} }
if (checkrain_options_enabled(host_flags, host_option_device_info)) { if ((palerain_flags & palerain_option_device_info)) {
printf("Mode: normal\n"); printf("Mode: normal\n");
printf("ProductType: %s\n", dev.productType); printf("ProductType: %s\n", dev.productType);
printf("Architecture: %s\n", dev.CPUArchitecture); printf("Architecture: %s\n", dev.CPUArchitecture);
@@ -101,7 +101,7 @@ int connected_normal_mode(const usbmuxd_device_info_t *usbmuxd_device) {
LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid); LOG(LOG_INFO, "Telling device with udid %s to enter recovery mode immediately", usbmuxd_device->udid);
enter_recovery_cmd(usbmuxd_device->udid); enter_recovery_cmd(usbmuxd_device->udid);
devinfo_free(&dev); devinfo_free(&dev);
if (checkrain_options_enabled(host_flags, host_option_enter_recovery)) { if ((palerain_flags & palerain_option_enter_recovery)) {
device_has_booted = true; device_has_booted = true;
set_spin(0); set_spin(0);
unsubscribe_cmd(); unsubscribe_cmd();
@@ -181,9 +181,9 @@ void device_event_cb(const usbmuxd_event_t *event, void* userdata) {
switch (event->event) { switch (event->event) {
case UE_DEVICE_ADD: case UE_DEVICE_ADD:
LOG(LOG_VERBOSE, "Normal mode device connected"); LOG(LOG_VERBOSE, "Normal mode device connected");
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) { if ((palerain_flags & palerain_option_exit_recovery)) {
break; break;
} else if (checkrain_options_enabled(host_flags, host_option_reboot_device)) { } else if ((palerain_flags & palerain_option_reboot_device)) {
int ret = reboot_cmd(event->device.udid); int ret = reboot_cmd(event->device.udid);
if (!ret) { if (!ret) {
LOG(LOG_INFO, "Restarted device"); LOG(LOG_INFO, "Restarted device");
@@ -211,9 +211,9 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
event->mode == IRECV_K_RECOVERY_MODE_2 || event->mode == IRECV_K_RECOVERY_MODE_2 ||
event->mode == IRECV_K_RECOVERY_MODE_3 || event->mode == IRECV_K_RECOVERY_MODE_3 ||
event->mode == IRECV_K_RECOVERY_MODE_4) { event->mode == IRECV_K_RECOVERY_MODE_4) {
if (!checkrain_options_enabled(host_flags, host_option_device_info)) if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid); LOG(LOG_VERBOSE, "Recovery mode device %ld connected", event->device_info->ecid);
if (checkrain_options_enabled(host_flags, host_option_exit_recovery)) { if ((palerain_flags & palerain_option_exit_recovery)) {
ret = exitrecv_cmd(event->device_info->ecid); ret = exitrecv_cmd(event->device_info->ecid);
if (!ret) { if (!ret) {
LOG(LOG_INFO, "Exited recovery mode"); LOG(LOG_INFO, "Exited recovery mode");
@@ -228,7 +228,7 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
break; break;
} }
if (checkrain_options_enabled(host_flags, host_option_device_info)) { if ((palerain_flags & palerain_option_device_info)) {
recvinfo_t info; recvinfo_t info;
ret = recvinfo_cmd(&info, event->device_info->ecid); ret = recvinfo_cmd(&info, event->device_info->ecid);
if (ret) { if (ret) {
@@ -247,14 +247,14 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
break; break;
} }
if (checkrain_options_enabled(host_flags, host_option_enter_recovery) || if ((palerain_flags & palerain_option_enter_recovery) ||
checkrain_options_enabled(host_flags, host_option_reboot_device)) return; (palerain_flags & palerain_option_reboot_device)) return;
pthread_create(&recovery_thread, NULL, (pthread_start_t)connected_recovery_mode, event->device_info); pthread_create(&recovery_thread, NULL, (pthread_start_t)connected_recovery_mode, event->device_info);
} else if (event->mode == IRECV_K_DFU_MODE) { } else if (event->mode == IRECV_K_DFU_MODE) {
if (!checkrain_options_enabled(host_flags, host_option_device_info)) if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid); LOG(LOG_VERBOSE, "DFU mode device %ld connected", event->device_info->ecid);
if (checkrain_options_enabled(host_flags, host_option_device_info)) { if ((palerain_flags & palerain_option_device_info)) {
recvinfo_t info; recvinfo_t info;
ret = recvinfo_cmd(&info, event->device_info->ecid); ret = recvinfo_cmd(&info, event->device_info->ecid);
if (ret) { if (ret) {
@@ -274,9 +274,9 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void* userdata) {
} }
if ( if (
checkrain_options_enabled(host_flags, host_option_exit_recovery) || (palerain_flags & palerain_option_exit_recovery) ||
checkrain_options_enabled(host_flags, host_option_enter_recovery) || (palerain_flags & palerain_option_enter_recovery) ||
checkrain_options_enabled(host_flags, host_option_reboot_device)) { (palerain_flags & palerain_option_reboot_device)) {
break; break;
} }
pthread_create(&dfu_thread, NULL, (pthread_start_t)connected_dfu_mode, event->device_info); pthread_create(&dfu_thread, NULL, (pthread_start_t)connected_dfu_mode, event->device_info);
+3 -3
View File
@@ -126,11 +126,11 @@ int exec_checkra1n(void) {
#endif #endif
checkra1n_exec: {}; checkra1n_exec: {};
char args[0x10] = "-E"; char args[0x10] = "-E";
if (checkrain_options_enabled(host_flags, host_option_demote)) strncat(args, "d", 0xf); if ((palerain_flags & palerain_option_demote)) strncat(args, "d", 0xf);
if (!checkrain_options_enabled(host_flags, palerain_option_checkrain_is_clone)) { if (!(palerain_flags & palerain_option_checkrain_is_clone)) {
strncat(args, "p", 0xf); strncat(args, "p", 0xf);
if (verbose >= 2) strncat(args, "v", 0xf); if (verbose >= 2) strncat(args, "v", 0xf);
if (checkrain_options_enabled(host_flags, host_option_no_colors)) strncat(args, "n", 0xf); if ((palerain_flags & palerain_option_no_colors)) strncat(args, "n", 0xf);
} else { } else {
strncat(args, "R", 0xf); strncat(args, "R", 0xf);
} }
+1 -1
View File
@@ -27,7 +27,7 @@
#include <ANSI-color-codes.h> #include <ANSI-color-codes.h>
#include <palerain.h> #include <palerain.h>
#include <xxd-embedded.h> #include <xxd-embedded.h>
#include <kerninfo.h> #include <paleinfo.h>
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex; pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
#ifdef TUI #ifdef TUI
+10 -10
View File
@@ -12,7 +12,7 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
{ {
if (verbose >= 5 if (verbose >= 5
#ifdef TUI #ifdef TUI
&& !checkrain_options_enabled(host_flags, host_option_tui) && !(palerain_flags & palerain_option_tui)
#endif #endif
) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname); ) fprintf(stderr, "p1_log: loglevel %d from %s:%d:%s()\n", loglevel, fname, lineno, fxname);
int ret = 0; int ret = 0;
@@ -57,12 +57,12 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
snprintf(colour_bold, 0x10, "%s", BWHT); snprintf(colour_bold, 0x10, "%s", BWHT);
break; break;
} }
if (checkrain_options_enabled(host_flags, host_option_no_colors)) { if ((palerain_flags & palerain_option_no_colors)) {
colour[0] = '\0'; colour[0] = '\0';
colour_bold[0] = '\0'; colour_bold[0] = '\0';
} }
#ifdef TUI #ifdef TUI
if (checkrain_options_enabled(host_flags, host_option_tui) && tui_started) { if ((palerain_flags & palerain_option_tui) && tui_started) {
newtComponent co = get_tui_log(); newtComponent co = get_tui_log();
if (co == NULL) { if (co == NULL) {
return 0; /* 0 bytes printed */ return 0; /* 0 bytes printed */
@@ -79,26 +79,26 @@ int p1_log(log_level_t loglevel, const char *fname, int lineno, const char *fxna
time_t curtime; time_t curtime;
time(&curtime); time(&curtime);
struct tm* timeinfo = localtime(&curtime); struct tm* timeinfo = localtime(&curtime);
if (!checkrain_options_enabled(host_flags, host_option_no_colors)) if (!(palerain_flags & palerain_option_no_colors))
snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET); snprintf(timestring, 0x80, "%s[%s%02d/%02d/%d %02d:%02d:%02d%s]", CRESET, HBLK, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, CRESET);
else else
snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); snprintf(timestring, 0x80, "[%02d/%02d/%d %02d:%02d:%02d]", timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_year - 100, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
if (verbose >= 2 && !checkrain_options_enabled(host_flags, host_option_no_colors)) { if (verbose >= 2 && !(palerain_flags & palerain_option_no_colors)) {
printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold); printf("%s| - %s%s <%s> " CRESET "%s" HBLU "%s" CRESET ":" BLU "%d" CRESET ":" BMAG "%s()" CRESET ": \n%s| ----> ", colour_bold, timestring, colour_bold, type, WHT, fname, lineno, fxname, colour_bold);
} else if (!checkrain_options_enabled(host_flags, host_option_no_colors)) { } else if (!(palerain_flags & palerain_option_no_colors)) {
printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET); printf(" - %s %s<%s>%s: ", timestring, colour_bold, type, CRESET);
} else if (verbose >= 2 && checkrain_options_enabled(host_flags, host_option_no_colors)) { } else if (verbose >= 2 && (palerain_flags & palerain_option_no_colors)) {
printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold); printf("%s| - %s%s <%s> %s:%d:%s(): \n%s| ----> ", colour_bold, timestring, colour_bold, type, fname, lineno, fxname, colour_bold);
} else if (checkrain_options_enabled(host_flags, host_option_no_colors)) { } else if ((palerain_flags & palerain_option_no_colors)) {
printf(" - %s %s<%s>: ", timestring, colour_bold, type); printf(" - %s %s<%s>: ", timestring, colour_bold, type);
} }
printf("%s", colour); printf("%s", colour);
ret = vprintf(format, args); ret = vprintf(format, args);
va_end(args); va_end(args);
if (verbose < 2 && !checkrain_options_enabled(host_flags, host_option_no_colors)) if (verbose < 2 && !(palerain_flags & palerain_option_no_colors))
printf(CRESET "\n"); printf(CRESET "\n");
else if (!checkrain_options_enabled(host_flags, host_option_no_colors)) else if (!(palerain_flags & palerain_option_no_colors))
printf("\n%s-%s\n", colour, CRESET); printf("\n%s-%s\n", colour, CRESET);
else if (verbose < 2) else if (verbose < 2)
printf("\n"); printf("\n");
+14 -14
View File
@@ -27,14 +27,14 @@
#include <ANSI-color-codes.h> #include <ANSI-color-codes.h>
#include <palerain.h> #include <palerain.h>
#include <xxd-embedded.h> #include <xxd-embedded.h>
#include <kerninfo.h> #include <paleinfo.h>
#define CMD_LEN_MAX 512 #define CMD_LEN_MAX 512
#define OVERRIDE_MAGIC 0xd803b376 #define OVERRIDE_MAGIC 0xd803b376
unsigned int verbose = 0; unsigned int verbose = 0;
char xargs_cmd[0x270] = "xargs ", checkrain_flags_cmd[0x20] = "deadbeef", palerain_flags_cmd[0x20] = "deadbeef"; char xargs_cmd[0x270] = "xargs ", palerain_flags_cmd[0x20] = "deadbeef";
char kpf_flags_cmd[0x20] = "deadbeef", dtpatch_cmd[0x20] = "deadbeef", rootfs_cmd[512] = "deadbeef"; char dtpatch_cmd[0x20] = "deadbeef", rootfs_cmd[512] = "deadbeef";
extern char** environ; extern char** environ;
niarelap_file_t* kpf_to_upload_1 = &checkra1n_kpf_pongo; niarelap_file_t* kpf_to_upload_1 = &checkra1n_kpf_pongo;
@@ -47,7 +47,7 @@ niarelap_file_t** overlay_to_upload = &overlay_to_upload_1;
override_file_t override_ramdisk, override_kpf, override_overlay; override_file_t override_ramdisk, override_kpf, override_overlay;
uint32_t checkrain_flags = 0, palerain_flags = 0, kpf_flags = 0; uint64_t palerain_flags = 0;
pthread_mutex_t log_mutex; pthread_mutex_t log_mutex;
pthread_t dfuhelper_thread, pongo_thread; pthread_t dfuhelper_thread, pongo_thread;
@@ -73,7 +73,7 @@ int build_checks(void) {
LOG(LOG_FATAL, "checkra1n too small"); LOG(LOG_FATAL, "checkra1n too small");
} }
if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char *)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) { if (boyermoore_horspool_memmem(&checkra1n[0], checkra1n_len, (const unsigned char *)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) {
host_flags |= palerain_option_checkrain_is_clone; palerain_flags |= palerain_option_checkrain_is_clone;
} }
#endif #endif
#ifndef NO_KPF #ifndef NO_KPF
@@ -111,9 +111,9 @@ int palera1n(int argc, char *argv[]) {
pthread_mutex_init(&ecid_dfu_wait_mutex, NULL); pthread_mutex_init(&ecid_dfu_wait_mutex, NULL);
if ((ret = build_checks())) return ret; if ((ret = build_checks())) return ret;
if ((ret = optparse(argc, argv))) goto cleanup; if ((ret = optparse(argc, argv))) goto cleanup;
if (!checkrain_options_enabled(host_flags, host_option_device_info) && checkrain_options_enabled(host_flags, host_option_palerain_version)) goto normal_exit; if (!(palerain_flags & palerain_option_device_info) && (palerain_flags & palerain_option_palerain_version)) goto normal_exit;
#ifdef TUI #ifdef TUI
if (checkrain_options_enabled(host_flags, host_option_tui)) { if ((palerain_flags & palerain_option_tui)) {
ret = tui(); ret = tui();
if (ret) goto cleanup; if (ret) goto cleanup;
else goto normal_exit; else goto normal_exit;
@@ -133,7 +133,7 @@ int palera1n(int argc, char *argv[]) {
} }
#endif #endif
if (!checkrain_options_enabled(host_flags, host_option_device_info)) if (!(palerain_flags & palerain_option_device_info))
LOG(LOG_INFO, "Waiting for devices"); LOG(LOG_INFO, "Waiting for devices");
if (access("/var/run/usbmuxd", F_OK) != 0) if (access("/var/run/usbmuxd", F_OK) != 0)
@@ -143,16 +143,16 @@ int palera1n(int argc, char *argv[]) {
pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL); pthread_create(&dfuhelper_thread, NULL, dfuhelper, NULL);
pthread_join(dfuhelper_thread, NULL); pthread_join(dfuhelper_thread, NULL);
set_spin(0); set_spin(0);
if (checkrain_options_enabled(host_flags, host_option_dfuhelper_only | if ((palerain_flags & (palerain_option_dfuhelper_only |
host_option_reboot_device | palerain_option_reboot_device |
host_option_exit_recovery | palerain_option_exit_recovery |
host_option_enter_recovery | palerain_option_enter_recovery |
host_option_device_info palerain_option_device_info)
) || device_has_booted) ) || device_has_booted)
goto normal_exit; goto normal_exit;
if (exec_checkra1n()) goto cleanup; if (exec_checkra1n()) goto cleanup;
if (checkrain_options_enabled(host_flags, host_option_pongo_exit | host_option_demote)) if ((palerain_flags & (palerain_option_pongo_exit | palerain_option_demote)))
goto normal_exit; goto normal_exit;
set_spin(1); set_spin(1);
sleep(2); sleep(2);
+32 -38
View File
@@ -13,9 +13,9 @@
#include <errno.h> #include <errno.h>
#include <palerain.h> #include <palerain.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <inttypes.h>
checkrain_option_t host_flags = 0; uint64_t* palerain_flags_p = &palerain_flags;
checkrain_option_p host_flags_p = &host_flags;
static bool force_use_verbose_boot = false; static bool force_use_verbose_boot = false;
static struct option longopts[] = { static struct option longopts[] = {
@@ -31,7 +31,6 @@ static struct option longopts[] = {
{"boot-args", required_argument, NULL, 'e'}, {"boot-args", required_argument, NULL, 'e'},
{"fakefs", no_argument, NULL, 'f'}, {"fakefs", no_argument, NULL, 'f'},
{"rootless", no_argument, NULL, 'l'}, {"rootless", no_argument, NULL, 'l'},
{"jbinit-log-to-file", no_argument, NULL, 'L'},
{"demote", no_argument, NULL, 'd'}, {"demote", no_argument, NULL, 'd'},
{"force-revert", no_argument, NULL, palerain_option_case_force_revert}, {"force-revert", no_argument, NULL, palerain_option_case_force_revert},
{"no-colors", no_argument, NULL, 'S'}, {"no-colors", no_argument, NULL, 'S'},
@@ -126,7 +125,7 @@ int optparse(int argc, char* argv[]) {
int opt; int opt;
int index; int index;
while ((opt = getopt_long(argc, argv, while ((opt = getopt_long(argc, argv,
"DEhpvVldsSLtRnPIe:o:r:K:k:i:" "DEhpvVlLdsStRnPIe:o:r:K:k:i:"
#ifdef DEV_BUILD #ifdef DEV_BUILD
"12" "12"
#endif #endif
@@ -137,23 +136,23 @@ int optparse(int argc, char* argv[]) {
case 'B': case 'B':
palerain_flags |= palerain_option_setup_partial_root; palerain_flags |= palerain_option_setup_partial_root;
palerain_flags |= palerain_option_setup_rootful; palerain_flags |= palerain_option_setup_rootful;
kpf_flags |= checkrain_option_verbose_boot; palerain_flags |= palerain_option_verbose_boot;
break; break;
case 'c': case 'c':
palerain_flags |= palerain_option_setup_rootful; palerain_flags |= palerain_option_setup_rootful;
kpf_flags |= checkrain_option_verbose_boot; palerain_flags |= palerain_option_verbose_boot;
break; break;
case 'C': case 'C':
palerain_flags |= palerain_option_clean_fakefs; palerain_flags |= palerain_option_clean_fakefs;
break; break;
case 'p': case 'p':
host_flags |= host_option_pongo_exit; palerain_flags |= palerain_option_pongo_exit;
break; break;
case 'P': case 'P':
host_flags |= host_option_pongo_full; palerain_flags |= palerain_option_pongo_full;
break; break;
case 'D': case 'D':
host_flags |= host_option_dfuhelper_only; palerain_flags |= palerain_option_dfuhelper_only;
break; break;
case 'h': case 'h':
usage(0, argv[0]); usage(0, argv[0]);
@@ -162,7 +161,7 @@ int optparse(int argc, char* argv[]) {
verbose++; verbose++;
break; break;
case 'V': case 'V':
kpf_flags |= checkrain_option_verbose_boot; palerain_flags |= palerain_option_verbose_boot;
force_use_verbose_boot = true; force_use_verbose_boot = true;
break; break;
case 'e': case 'e':
@@ -187,13 +186,13 @@ int optparse(int argc, char* argv[]) {
palerain_flags |= palerain_option_jbinit_log_to_file; palerain_flags |= palerain_option_jbinit_log_to_file;
break; break;
case 'd': case 'd':
host_flags |= host_option_demote; palerain_flags |= palerain_option_demote;
break; break;
case 'E': case 'E':
host_flags |= host_option_enter_recovery; palerain_flags |= palerain_option_enter_recovery;
break; break;
case 's': case 's':
checkrain_flags |= checkrain_option_safemode; palerain_flags |= palerain_option_safemode;
break; break;
case 'k': case 'k':
if (access(optarg, F_OK) != 0) { if (access(optarg, F_OK) != 0) {
@@ -254,12 +253,12 @@ int optparse(int argc, char* argv[]) {
} }
if (boyermoore_horspool_memmem(addr, st.st_size, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL) if (boyermoore_horspool_memmem(addr, st.st_size, (const unsigned char*)"[ra1npoc15-part] thanks to", strlen("[ra1npoc15-part] thanks to")) != NULL)
{ {
host_flags |= palerain_option_checkrain_is_clone; palerain_flags |= palerain_option_checkrain_is_clone;
LOG(LOG_VERBOSE3, "%s is checkra1n clone", optarg); LOG(LOG_VERBOSE3, "%s is checkra1n clone", optarg);
} }
else else
{ {
host_flags &= ~palerain_option_checkrain_is_clone; palerain_flags &= ~palerain_option_checkrain_is_clone;
LOG(LOG_VERBOSE3, "%s is checkra1n", optarg); LOG(LOG_VERBOSE3, "%s is checkra1n", optarg);
} }
munmap(addr, st.st_size); munmap(addr, st.st_size);
@@ -268,20 +267,20 @@ int optparse(int argc, char* argv[]) {
snprintf(ext_checkra1n, strlen(optarg) + 1, "%s", optarg); snprintf(ext_checkra1n, strlen(optarg) + 1, "%s", optarg);
break; break;
case 'R': case 'R':
host_flags |= host_option_reboot_device; palerain_flags |= palerain_option_reboot_device;
break; break;
case 'n': case 'n':
host_flags |= host_option_exit_recovery; palerain_flags |= palerain_option_exit_recovery;
break; break;
case 'I': case 'I':
host_flags |= host_option_device_info; palerain_flags |= palerain_option_device_info;
break; break;
case 'S': case 'S':
host_flags |= host_option_no_colors; palerain_flags |= palerain_option_no_colors;
break; break;
#ifdef TUI #ifdef TUI
case 't': case 't':
host_flags |= host_option_tui; palerain_flags |= palerain_option_tui;
break; break;
#endif #endif
#ifdef DEV_BUILD #ifdef DEV_BUILD
@@ -293,17 +292,17 @@ int optparse(int argc, char* argv[]) {
break; break;
#endif #endif
case palerain_option_case_force_revert: case palerain_option_case_force_revert:
checkrain_flags |= checkrain_option_force_revert; palerain_flags |= palerain_option_force_revert;
break; break;
case palerain_option_case_version: case palerain_option_case_version:
host_flags |= host_option_palerain_version; palerain_flags |= palerain_option_palerain_version;
break; break;
default: default:
usage(1, argv[0]); usage(1, argv[0]);
break; break;
} }
} }
if (checkrain_options_enabled(host_flags, host_option_palerain_version)) { if ((palerain_flags & palerain_option_palerain_version)) {
printf( printf(
"palera1n " PALERAIN_VERSION "\n" "palera1n " PALERAIN_VERSION "\n"
BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n" BUILD_COMMIT " " BUILD_NUMBER " (" BUILD_BRANCH ")\n\n"
@@ -321,17 +320,12 @@ int optparse(int argc, char* argv[]) {
return 0; return 0;
} }
if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) { if ((strstr(xargs_cmd, "serial=") != NULL) && !force_use_verbose_boot && (palerain_flags & palerain_option_setup_rootful)) {
kpf_flags &= ~checkrain_option_verbose_boot; palerain_flags &= ~palerain_option_verbose_boot;
} }
snprintf(checkrain_flags_cmd, 0x20, "checkra1n_flags 0x%x", checkrain_flags); snprintf(palerain_flags_cmd, 0x20, "palera1n_flags 0x%" PRIx64, palerain_flags);
snprintf(palerain_flags_cmd, 0x20, "palera1n_flags 0x%x", palerain_flags);
snprintf(kpf_flags_cmd, 0x20, "kpf_flags 0x%x", kpf_flags);
LOG(LOG_VERBOSE3, "checkrain_flags: %s", checkrain_flags_cmd);
LOG(LOG_VERBOSE3, "palerain_flags: %s", palerain_flags_cmd); LOG(LOG_VERBOSE3, "palerain_flags: %s", palerain_flags_cmd);
LOG(LOG_VERBOSE3, "kpf_flags: %s", kpf_flags_cmd);
LOG(LOG_VERBOSE3, "host_flags: 0x%x", host_flags);
if (override_kpf.magic == OVERRIDE_MAGIC) { if (override_kpf.magic == OVERRIDE_MAGIC) {
LOG(LOG_VERBOSE4, "kpf override length %u -> %u", override_kpf.orig_len, checkra1n_kpf_pongo_len); LOG(LOG_VERBOSE4, "kpf override length %u -> %u", override_kpf.orig_len, checkra1n_kpf_pongo_len);
LOG(LOG_VERBOSE4, "kpf override ptr %p -> %p", override_kpf.orig_ptr, **kpf_to_upload); LOG(LOG_VERBOSE4, "kpf override ptr %p -> %p", override_kpf.orig_ptr, **kpf_to_upload);
@@ -345,17 +339,17 @@ int optparse(int argc, char* argv[]) {
LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload); LOG(LOG_VERBOSE4, "overlay override ptr %p -> %p", override_overlay.orig_ptr, **overlay_to_upload);
} }
if (!checkrain_options_enabled(palerain_flags, palerain_option_rootful)) { if (!(palerain_flags & palerain_option_rootful)) {
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful) || checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful_forced)) { if ((palerain_flags & palerain_option_setup_rootful)) {
LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode."); LOG(LOG_FATAL, "Cannot setup rootful when rootless is requested. Use -f to enable rootful mode.");
return -1; return -1;
} }
} }
if (!( if (!(
checkrain_options_enabled(host_flags, host_option_dfuhelper_only) || (palerain_flags & palerain_option_dfuhelper_only) ||
checkrain_options_enabled(host_flags, host_option_enter_recovery) || (palerain_flags & palerain_option_enter_recovery) ||
checkrain_options_enabled(host_flags, host_option_exit_recovery) || (palerain_flags & palerain_option_exit_recovery) ||
checkrain_options_enabled(host_flags, host_option_reboot_device))) (palerain_flags & palerain_option_reboot_device)))
{ {
#ifdef NO_CHECKRAIN #ifdef NO_CHECKRAIN
if (checkra1n_len == 0 && ext_checkra1n == NULL) if (checkra1n_len == 0 && ext_checkra1n == NULL)
@@ -363,7 +357,7 @@ int optparse(int argc, char* argv[]) {
LOG(LOG_FATAL, "checkra1n omitted in build but no override specified"); LOG(LOG_FATAL, "checkra1n omitted in build but no override specified");
return -1; return -1;
} }
if (!(checkrain_options_enabled(host_flags, host_option_pongo_exit) || checkrain_options_enabled(host_flags, host_option_pongo_exit))) if (!((palerain_flags & palerain_option_pongo_exit) || (palerain_flags & palerain_option_pongo_exit)))
{ {
#ifdef NO_KPF #ifdef NO_KPF
if (checkra1n_kpf_pongo_len == 0) if (checkra1n_kpf_pongo_len == 0)
+6 -8
View File
@@ -33,7 +33,7 @@ void *pongo_usb_callback(stuff_t *arg) {
if (get_found_pongo()) if (get_found_pongo())
return NULL; return NULL;
set_found_pongo(1); set_found_pongo(1);
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) { if ((palerain_flags & palerain_option_setup_rootful)) {
strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1); strncat(xargs_cmd, " wdt=-1", 0x270 - strlen(xargs_cmd) - 1);
} }
LOG(LOG_INFO, "Found PongoOS USB Device"); LOG(LOG_INFO, "Found PongoOS USB Device");
@@ -43,10 +43,8 @@ void *pongo_usb_callback(stuff_t *arg) {
issue_pongo_command(handle, "sep auto"); issue_pongo_command(handle, "sep auto");
upload_pongo_file(handle, **kpf_to_upload, checkra1n_kpf_pongo_len); upload_pongo_file(handle, **kpf_to_upload, checkra1n_kpf_pongo_len);
issue_pongo_command(handle, "modload"); issue_pongo_command(handle, "modload");
issue_pongo_command(handle, kpf_flags_cmd);
issue_pongo_command(handle, checkrain_flags_cmd);
issue_pongo_command(handle, palerain_flags_cmd); issue_pongo_command(handle, palerain_flags_cmd);
if (checkrain_options_enabled(palerain_flags, palerain_option_rootful)) if ((palerain_flags & palerain_option_rootful))
{ {
issue_pongo_command(handle, "rootfs"); issue_pongo_command(handle, "rootfs");
} }
@@ -66,13 +64,13 @@ void *pongo_usb_callback(stuff_t *arg) {
issue_pongo_command(handle, "overlay"); issue_pongo_command(handle, "overlay");
} }
issue_pongo_command(handle, xargs_cmd); issue_pongo_command(handle, xargs_cmd);
if (checkrain_options_enabled(host_flags, host_option_pongo_full)) goto done; if ((palerain_flags & palerain_option_pongo_full)) goto done;
issue_pongo_command(handle, "bootx"); issue_pongo_command(handle, "bootx");
LOG(LOG_INFO, "Booting Kernel..."); LOG(LOG_INFO, "Booting Kernel...");
if (checkrain_options_enabled(palerain_flags, palerain_option_setup_partial_root)) { if ((palerain_flags & palerain_option_setup_partial_root)) {
LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created."); LOG(LOG_INFO, "Please wait up to 5 minutes for the bindfs to be created.");
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak."); LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -B (Create BindFS) option to jailbreak.");
} else if (checkrain_options_enabled(palerain_flags, palerain_option_setup_rootful)) { } else if ((palerain_flags & palerain_option_setup_rootful)) {
LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created."); LOG(LOG_INFO, "Please wait up to 10 minutes for the fakefs to be created.");
LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak."); LOG(LOG_INFO, "Once the device boots up to iOS, run again without the -c (Create FakeFS) option to jailbreak.");
} }
@@ -163,7 +161,7 @@ int upload_pongo_file(usb_device_handle_t handle, unsigned char *buf, unsigned i
if (verbose < 3 || verbose > 4) { if (verbose < 3 || verbose > 4) {
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);
} else { } else {
if (checkrain_options_enabled(host_flags, host_option_no_colors)) if ((palerain_flags & palerain_option_no_colors))
printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len); printf("/send mem:%p:%p\nUploaded %llu bytes]\n", (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
else else
printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len); printf("/send mem:%p:%p\n" BCYN "[Uploaded %llu bytes]\n" CRESET, (void*)buf, (void*)(buf + buf_len), (unsigned long long)buf_len);
+9 -9
View File
@@ -22,14 +22,14 @@ void bitfield_check_cb(newtComponent box, void* data) {
tui_screen_t tui_screen_options() { tui_screen_t tui_screen_options() {
tui_bit_info_t verbose_info = { &kpf_flags, checkrain_option_verbose_boot }; tui_bit_info_t verbose_info = { &palerain_flags, palerain_option_verbose_boot };
tui_bit_info_t rootful_info = { &palerain_flags, palerain_option_rootful }; tui_bit_info_t rootful_info = { &palerain_flags, palerain_option_rootful };
tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful }; tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful };
tui_bit_info_t force_revert_info = { &checkrain_flags, checkrain_option_force_revert }; tui_bit_info_t force_revert_info = { &palerain_flags, palerain_option_force_revert };
tui_bit_info_t safemode_info = { &checkrain_flags, checkrain_option_safemode }; tui_bit_info_t safemode_info = { &palerain_flags, palerain_option_safemode };
static checkrain_option_t flower_flags = 0, flower_option_flower_chain = (1 << 0); static uint64_t palerain_flags = 0;
tui_bit_info_t flower_chain_info = { &flower_flags, flower_option_flower_chain }; tui_bit_info_t flower_chain_info = { &palerain_flags, palerain_option_flower_chain };
const char* bootargs_entered = NULL; const char* bootargs_entered = NULL;
int ret = MAIN_SCREEN; int ret = MAIN_SCREEN;
@@ -41,11 +41,11 @@ tui_screen_t tui_screen_options() {
newtTextboxSetText(optionsNotice, "You may set the following options. If you don't know what they mean you'll probably have no reason to set them."); newtTextboxSetText(optionsNotice, "You may set the following options. If you don't know what they mean you'll probably have no reason to set them.");
// newtTextboxSetColors(optionsNotice, NEWT_COLORSET_LABEL, NEWT_COLORSET_LABEL); // newtTextboxSetColors(optionsNotice, NEWT_COLORSET_LABEL, NEWT_COLORSET_LABEL);
newtComponent verboseBootBox = newtCheckbox(1, 3, "Verbose boot", CHECKBOX_STATE(kpf_flags, checkrain_option_verbose_boot), NULL, NULL); newtComponent verboseBootBox = newtCheckbox(1, 3, "Verbose boot", CHECKBOX_STATE(palerain_flags, palerain_option_verbose_boot), NULL, NULL);
newtComponent rootfulBox = newtCheckbox(1, 4, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL); newtComponent rootfulBox = newtCheckbox(1, 4, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL);
newtComponent rootfulSetupBox = newtCheckbox(1, 5, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL); newtComponent rootfulSetupBox = newtCheckbox(1, 5, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL);
newtComponent forceRevertBox = newtCheckbox(1, 6, "Restore system", CHECKBOX_STATE(checkrain_flags, checkrain_option_force_revert), NULL, NULL); newtComponent forceRevertBox = newtCheckbox(1, 6, "Restore system", CHECKBOX_STATE(palerain_flags, palerain_option_force_revert), NULL, NULL);
newtComponent safeModeBox = newtCheckbox(1, 7, "Safe mode", CHECKBOX_STATE(checkrain_flags, checkrain_option_safemode), NULL, NULL); newtComponent safeModeBox = newtCheckbox(1, 7, "Safe mode", CHECKBOX_STATE(palerain_flags, palerain_option_safemode), NULL, NULL);
newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info); newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info);
newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info); newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info);
@@ -56,7 +56,7 @@ tui_screen_t tui_screen_options() {
newtComponent bootCmdlineLabel = newtLabel(1, 8, "Kernel command line:"); newtComponent bootCmdlineLabel = newtLabel(1, 8, "Kernel command line:");
newtComponent bootCmdlineEntry = newtEntry(1, 9, &xargs_cmd[6], WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL); newtComponent bootCmdlineEntry = newtEntry(1, 9, &xargs_cmd[6], WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL);
newtComponent flowerChainBox = newtCheckbox(1, 10, "Flower chain", CHECKBOX_STATE(flower_flags, flower_option_flower_chain), NULL, NULL); newtComponent flowerChainBox = newtCheckbox(1, 10, "Flower chain", CHECKBOX_STATE(palerain_flags, palerain_option_flower_chain), NULL, NULL);
newtComponentAddCallback(flowerChainBox, bitfield_check_cb, &flower_chain_info); newtComponentAddCallback(flowerChainBox, bitfield_check_cb, &flower_chain_info);