mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-24 19:19:48 +02:00
idk
This commit is contained in:
1 parent
3f6e2315f0
commit
475864a249
3 files changed
+29
-1
No files matched your search
@@ -54,6 +54,7 @@ void exec_checkra1n() {
|
||||
unlink(checkra1n_path);
|
||||
return;
|
||||
}
|
||||
LOG(LOG_VERBOSE2, "%s %s spawned successfully", checkra1n_path, args);
|
||||
unlink(checkra1n_path);
|
||||
waitpid(pid, NULL, 0);
|
||||
return;
|
||||
|
||||
+28
@@ -24,6 +24,7 @@
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <mach-o/loader.h>
|
||||
#include <mach-o/ldsyms.h>
|
||||
#else
|
||||
#define MH_MAGIC 0xfeedface
|
||||
#define MH_CIGAM 0xcefaedfe
|
||||
@@ -219,6 +220,32 @@ int override_file(override_file_t *finfo, unsigned char orig[], unsigned int *or
|
||||
return 0;
|
||||
}
|
||||
|
||||
int build_checks() {
|
||||
#if defined(__APPLE__)
|
||||
struct mach_header_64* c1_header = (struct mach_header_64*)&checkra1n[0];
|
||||
if (c1_header->magic != MH_MAGIC_64 && c1_header->magic != MH_CIGAM_64) {
|
||||
LOG(LOG_FATAL, "Broken build: checkra1n is not a thin Mach-O");
|
||||
return -1;
|
||||
}
|
||||
if (c1_header->cputype != _mh_execute_header.cputype) {
|
||||
LOG(LOG_FATAL, "Broken build: checkra1n CPU type is not the same as %s CPU type", getprogname());
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
struct mach_header_64 *kpf_hdr = (struct mach_header_64 *)checkra1n_kpf_pongo;
|
||||
if (kpf_hdr->magic != MH_MAGIC_64 && kpf_hdr->magic != MH_CIGAM_64) {
|
||||
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not thin 64-bit Mach-O");
|
||||
return -1;
|
||||
} else if (kpf_hdr->filetype != MH_KEXT_BUNDLE) {
|
||||
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: Not a kext bundle");
|
||||
return -1;
|
||||
} else if (kpf_hdr->cputype != CPU_TYPE_ARM64) {
|
||||
LOG(LOG_FATAL, "Broken build: Invalid kernel patchfinder: CPU type is not arm64");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool dfuhelper_only = false;
|
||||
bool pongo_exit = false;
|
||||
bool start_from_pongo = false;
|
||||
@@ -226,6 +253,7 @@ bool palerain_version = false;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (build_checks()) return -1;
|
||||
int opt;
|
||||
int index;
|
||||
while ((opt = getopt_long(argc, argv, "DhpPvldse:f:o:r:K:", longopts, NULL)) != -1)
|
||||
|
||||
@@ -296,7 +296,6 @@ static void io_start(stuff_t *stuff)
|
||||
|
||||
static void io_stop(stuff_t *stuff)
|
||||
{
|
||||
LOG(LOG_VERBOSE, "PongoOS USB Device disconnected");
|
||||
int r = pthread_cancel(stuff->th);
|
||||
if(r != 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user