This commit is contained in:
Nick Chan committed 2023-01-21 18:27:07 +08:00
1 parent 19b1653805
commit f62961882b
3 files changed
+22 -12

No files matched your search

+9 -4
View File
@@ -1,17 +1,22 @@
SRC = $(shell pwd)
DEP = $(SRC)/dep_root
STRIP = strip
CC = cc
CFLAGS += -mmacosx-version-min=10.8 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\"
CC ?= cc
CFLAGS += -I$(DEP)/include -I$(SRC)/include -I$(SRC) -Wall -Wextra -DPALERAIN_VERSION=\"2.0.0\"
LIBS = $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a $(DEP)/lib/libplist-2.0.a $(DEP)/lib/libimobiledevice-glue-1.0.a -pthread
LIBS += $(DEP)/lib/libcrypto.35.tbd $(DEP)/lib/libssl.35.tbd $(DEP)/lib/libusb-1.0.a
ifeq ($(TARGET_OS),)
TARGET_OS = $(shell uname -s)
endif
ifeq ($(TARGET_OS),Darwin)
CFLAGS += -mmacosx-version-min=10.8
LIBS += $(DEP)/lib/libcrypto.35.tbd $(DEP)/lib/libssl.35.tbd $(DEP)/lib/libusb-1.0.a
LIBS += -framework CoreFoundation -framework SystemConfiguration -framework IOKit -framework Security
else
LDFLAGS += -static -fuse-ld=lld
LIBS += $(DEP)/lib/libcrypto.a $(DEP)/lib/libssl.a
endif
LDFLAGS = $(LIBS)
LIBS += $(DEP)/lib/libusb-1.0.a
LDFLAGS += $(LIBS)
ifeq ($(DEV_BUILD),1)
CFLAGS += -O0 -g
+4
View File
@@ -9,6 +9,7 @@ checkra1n-%:
chmod 755 $@
checkra1n: checkra1n-macos
ifeq ($(TARGET_OS),Darwin)
ifneq (,$(findstring arm64, $(CFLAGS)))
$(LIPO) -thin arm64 -output checkra1n checkra1n-macos
else ifneq (,$(findstring x86_64, $(CFLAGS)))
@@ -16,6 +17,9 @@ else ifneq (,$(findstring x86_64, $(CFLAGS)))
else
$(LIPO) -thin $(shell arch) -output checkra1n checkra1n-macos
endif
else
cp checkra1n-$(CHECKRA1N_NAME) checkra1n
endif
checkra1n.c: checkra1n checkra1n-kpf-pongo ramdisk.dmg binpack.dmg
xxd -iC checkra1n > checkra1n.c
+9 -8
View File
@@ -26,8 +26,8 @@
#include <mach-o/loader.h>
#include <mach-o/ldsyms.h>
#else
#define MH_MAGIC 0xfeedface
#define MH_CIGAM 0xcefaedfe
#define MH_MAGIC_64 0xfeedfacf
#define MH_CIGAM_64 0xcffaedfe
#define MH_KEXT_BUNDLE 0xb
typedef int cpu_type_t;
@@ -48,6 +48,7 @@ struct mach_header_64
uint32_t flags; /* flags */
uint32_t reserved; /* reserved */
};
#endif
#include "ANSI-color-codes.h"
@@ -162,7 +163,7 @@ static struct option longopts[] = {
{"override-kpf", required_argument, NULL, 'K'},
{NULL, 0, NULL, 0}};
int usage(int e)
int usage(int e, char* prog_name)
{
fprintf(stderr,
"Usage: %s [-DhpPvlds] [-e boot arguments] [-f root device] [-o overlay file] [-r ramdisk file] [-K KPF file]\n"
@@ -184,7 +185,7 @@ int usage(int e)
"\t-o, --override-overlay <file>\t\tOverride overlay\n"
"\t-r, --override-ramdisk <file>\t\tOverride ramdisk\n"
"\t-K, --override-kpf <file>\t\tOverride kernel patchfinder\n",
getprogname());
prog_name);
exit(e);
}
@@ -270,7 +271,7 @@ int main(int argc, char *argv[])
dfuhelper_only = true;
break;
case 'h':
usage(0);
usage(0, argv[0]);
assert(0);
case 'v':
verbose++;
@@ -321,7 +322,7 @@ int main(int argc, char *argv[])
palerain_version = true;
break;
default:
usage(1);
usage(1, argv[0]);
break;
}
}
@@ -347,8 +348,8 @@ int main(int argc, char *argv[])
}
else
{
fprintf(stderr, "%s: unknown argument: %s\n", getprogname(), argv[index]);
usage(1);
fprintf(stderr, "%s: unknown argument: %s\n", argv[0], argv[index]);
usage(1, argv[0]);
}
}
if (verbose >= 3)