diff --git a/Makefile b/Makefile index 941fad5..e5fb530 100644 --- a/Makefile +++ b/Makefile @@ -21,15 +21,16 @@ CFLAGS += -fdata-sections -ffunction-sections LDFLAGS += -static -no-pie -Wl,--gc-sections endif LIBS += $(DEP)/lib/libmbedtls.a $(DEP)/lib/libmbedcrypto.a $(DEP)/lib/libmbedx509.a $(DEP)/lib/libreadline.a -LIBS += $(DEP)/lib/libusb-1.0.a $(DEP)/lib/libmenutw.a $(DEP)/lib/libncursestw.a +LIBS += $(DEP)/lib/libusb-1.0.a ifeq ($(DEV_BUILD),1) +LIBS += $(DEP)/lib/libmenutw.a $(DEP)/lib/libncursestw.a CFLAGS += -O0 -g -DDEV_BUILD -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime else CFLAGS += -Os -g endif -export SRC DEP CC CFLAGS LDFLAGS LIBS TARGET_OS +export SRC DEP CC CFLAGS LDFLAGS LIBS TARGET_OS DEV_BUILD all: palera1n diff --git a/src/Makefile b/src/Makefile index 475baa8..230a08a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,9 +3,11 @@ all: palera1n OBJECTS = main.o dfuhelper.o devhelper.o lockdown_helper.o exec_checkra1n.o OBJECTS += pongo_usb.o optparse.o override_file.o pongo_helper.o log.o OBJECTS += xxd-checkra1n.o xxd-checkra1n-kpf-pongo.o xxd-ramdisk.dmg.o -OBJECTS += xxd-binpack.dmg.o tui_main.o tui_screen_options.o -OBJECTS += tui_screen_enter_recovery.o tui_screen_enter_dfu.o -OBJECTS += tui_screen_jailbreak.o tui_screen_main.o +OBJECTS += xxd-binpack.dmg.o +ifeq ($(DEV_BUILD),1) +OBJECTS += tui_screen_enter_recovery.o tui_screen_enter_dfu.o tui_main.o +OBJECTS += tui_screen_jailbreak.o tui_screen_main.o tui_screen_options.o +endif CHECKRA1N_VERSION ?= 0.1337.1 LIPO = lipo diff --git a/src/main.c b/src/main.c index 34dda1b..39075c2 100644 --- a/src/main.c +++ b/src/main.c @@ -81,7 +81,9 @@ int build_checks() { } bool dfuhelper_only = false, pongo_exit = false, start_from_pongo = false, palerain_version = false; +#ifdef DEV_BUILD bool use_tui = false; +#endif int palera1n(int argc, char *argv[]) { int ret = 0; @@ -91,11 +93,13 @@ int palera1n(int argc, char *argv[]) { if (palerain_version) goto normal_exit; if (start_from_pongo == true) goto pongo; +#ifdef DEV_BUILD if (use_tui) { ret = tui(); if (ret) goto cleanup; else goto normal_exit; } +#endif LOG(LOG_INFO, "Waiting for devices"); do_pongo_sleep = 1; pthread_t dfuhelper_thread; diff --git a/src/optparse.c b/src/optparse.c index c3cb35c..3372350 100644 --- a/src/optparse.c +++ b/src/optparse.c @@ -35,14 +35,21 @@ static struct option longopts[] = { {"override-ramdisk", required_argument, NULL, 'r'}, {"override-kpf", required_argument, NULL, 'K'}, {"disable-ohio", no_argument, NULL, 'O'}, +#ifdef DEV_BUILD {"tui", no_argument, NULL, 't'}, +#endif {NULL, 0, NULL, 0} }; static int usage(int e, char* prog_name) { fprintf(stderr, - "Usage: %s [-cCDhpPvVldsOLt] [-e boot arguments] [-f root device] [-k Pongo image] [-o overlay file] [-r ramdisk file] [-K KPF file]\n" +#ifdef DEV_BUILD + "Usage: %s [-cCDhpPvVldsOLt]" +#else + "Usage: %s [-cCDhpPvVldsOL]" +#endif + " [-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" @@ -67,7 +74,10 @@ static int usage(int e, char* prog_name) "\t-r, --override-ramdisk \t\tOverride ramdisk\n" "\t-K, --override-kpf \t\tOverride kernel patchfinder\n" "\t-O, --disable-ohio\t\t\tDisable Ohio\n" - "\t-t, --tui\t\t\t\tTerminal user interface\n", +#ifdef DEV_BUILD + "\t-t, --tui\t\t\t\tTerminal user interface\n" +#endif + , prog_name); exit(e); } @@ -75,7 +85,13 @@ static int usage(int e, char* prog_name) int optparse(int argc, char* argv[]) { int opt; int index; - while ((opt = getopt_long(argc, argv, "cCDhpvVldsOLte:f:o:r:K:k:", longopts, NULL)) != -1) + while ((opt = getopt_long(argc, argv, +#ifdef DEV_BUILD + "cCDhpvVldsOLte:f:o:r:K:k:", +#else + "cCDhpvVldsOLe:f:o:r:K:k:", +#endif + longopts, NULL)) != -1) { switch (opt) { case 'c': @@ -166,9 +182,11 @@ int optparse(int argc, char* argv[]) { case 'O': ohio = false; break; +#ifdef DEV_BUILD case 't': use_tui = true; break; +#endif case checkrain_option_force_revert: checkrain_flags |= checkrain_option_force_revert; break;