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

-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
#include "xxd-embedded.h"
#include "kerninfo.h"
#include "paleinfo.h"
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -155,8 +155,8 @@ extern char* pongo_path;
extern bool tui_started;
#endif
extern checkrain_option_t host_flags;
extern checkrain_option_p host_flags_p;
extern uint64_t palerain_flags;
extern uint64_t* palerain_flags_p;
extern pthread_t dfuhelper_thread, pongo_thread;
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 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 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 bool device_has_booted;
extern char xargs_cmd[0x270];
extern char checkrain_flags_cmd[0x20];
extern char palerain_flags_cmd[0x20];
extern char kpf_flags_cmd[0x20];
extern char dtpatch_cmd[0x20];
extern char rootfs_cmd[512];
extern char* ext_checkra1n;
+3 -3
View File
@@ -11,7 +11,7 @@
#include <locale.h>
#include <unistd.h>
#include <newt.h>
#include <kerninfo.h>
#include <paleinfo.h>
#define WIDTH 76
#define HEIGHT 19
@@ -33,8 +33,8 @@ typedef enum tui_screens {
} tui_screen_t;
typedef struct bitfield_checkbox_info {
checkrain_option_p flags_p;
checkrain_option_t opt;
uint64_t* flags_p;
uint64_t opt;
} tui_bit_info_t;
tui_screen_t tui_screen_main();