From 6cd110f2adef175610df9885bcd043ab677b7061 Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Mon, 20 Jun 2016 19:25:36 -0400 Subject: [PATCH] Make the chainloader optional (set during build) --- Makefile | 4 +++- source/chain.c | 4 ++++ source/menu.c | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0d23ef8..1d09b58 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,10 @@ dir_out := out REVISION := $(shell git rev-parse HEAD | head -c10)+$(shell git rev-list --count HEAD) REL ?= master +EXTRA ?= -DCHAINLOADER=1 + CROSS_ASFLAGS := -mlittle-endian -mcpu=arm946e-s -march=armv5te -CROSS_CFLAGS := -MMD -MP -Wall -Wextra -Werror -fomit-frame-pointer -Os $(ASFLAGS) -fshort-wchar -fno-builtin -std=gnu11 -DVERSION=\"$(REVISION)\" -DREL=\"$(REL)\" +CROSS_CFLAGS := -MMD -MP -Wall -Wextra -Werror -fomit-frame-pointer -Os $(ASFLAGS) -fshort-wchar -fno-builtin -std=gnu11 -DVERSION=\"$(REVISION)\" -DREL=\"$(REL)\" $(EXTRA) CROSS_FLAGS := dir_out=$(abspath $(dir_out)) --no-print-directory CROSS_LDFLAGS := -nostdlib -Wl,-z,defs -lgcc -Wl,-Map,$(dir_build)/link.map diff --git a/source/chain.c b/source/chain.c index 89f58aa..a80987f 100644 --- a/source/chain.c +++ b/source/chain.c @@ -1,3 +1,5 @@ +#ifdef CHAINLOADER + #include "common.h" #include "firm/firm.h" #include "firm/headers.h" @@ -135,3 +137,5 @@ void chainload_menu() { show_menu(chains, NULL); } + +#endif diff --git a/source/menu.c b/source/menu.c index e67725d..dc4ef24 100644 --- a/source/menu.c +++ b/source/menu.c @@ -300,7 +300,9 @@ poweroff() ; } +#ifdef CHAINLOADER void chainload_menu(); +#endif static struct options_s main_s[] = { { 0, "Options", "Internal options for the CFW. These are part of Corbenik itself.", call_fun, (uint32_t)menu_options, 0 }, @@ -310,7 +312,9 @@ static struct options_s main_s[] = { { 0, "Reboot", "Reboots the console.", call_fun, (uint32_t)reset, 0 }, { 0, "Power off", "Powers off the console.", call_fun, (uint32_t)poweroff, 0 }, { 0, "Save Configuration", "Save the configuration. You must do this prior to booting, otherwise nothing is done.", call_fun, (uint32_t)save_config, 0 }, +#ifdef CHAINLOADER { 0, "Chainload", "Boot another ARM9 payload file.", call_fun, (uint32_t)chainload_menu, 0 }, +#endif { 0, "Boot Firmware", "Generates caches, patches the firmware, and boots it.", break_menu, 0, 0 }, // Sentinel. -- 2.39.5