REVISION := $(shell git rev-parse HEAD | head -c10)+$(shell git rev-list --count HEAD)
REL ?= master
-EXTRA ?= -DCHAINLOADER=1
+# Default to enabling chainloader.
+CHAINLOADER ?= 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)\" $(EXTRA)
+CROSS_CFLAGS := -MMD -MP -Wall -Wextra -Werror -fomit-frame-pointer -Os $(ASFLAGS) -fshort-wchar -fno-builtin -std=gnu11 -DVERSION=\"$(REVISION)\" -DREL=\"$(REL)\" -DCHAINLOADER=$(CHAINLOADER)
CROSS_FLAGS := dir_out=$(abspath $(dir_out)) --no-print-directory
CROSS_LDFLAGS := -nostdlib -Wl,-z,defs -lgcc -Wl,-Map,$(dir_build)/link.map
$(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
$(call rwildcard, $(dir_source), *.s *.c)))
+.PHONY: release
+release:
+ mkdir -p rel
+ make clean
+ make CHAINLOADER=0 REL=$(REL) full
+ mv out/release.zip rel/release-nochain.zip
+ cat out/release.zip.sha512 | sed 's/release.zip/release-nochain.zip/' > rel/release-nochain.zip.sha512
+ make clean
+ make CHAINLOADER=1 REL=$(REL) full
+ mv out/release.zip out/release.zip.sha512 rel/
+
.PHONY: all
all: hosttools font a9lh patch external
.PHONY: external
external:
- make -C external dir_out=$(dir_out) fw_folder=$(fw_folder)
+ make -C external dir_out=$(dir_out) fw_folder=$(fw_folder) CHAINLOADER=$(CHAINLOADER)
.PHONY: patch
patch:
cp loader/loader.cxi $(out)/module/loader.cxi
cp bits/backdoor.bin $(out)/bits/backdoor.bin
cp bits/emunand.bin $(out)/bits/emunand.bin
+ifeq "$(CHAINLOADER)" "1"
cp bits/chain.bin $(out)/bits/chain.bin
+endif
cp bits/reboot_hook.bin $(out)/bits/reboot_hook.bin
cp bits/reboot_code.bin $(out)/bits/reboot_code.bin
cp screeninit/build/screeninit.bin $(out)/bits/screeninit.bin
-#ifdef CHAINLOADER
+#if defined(CHAINLOADER) && CHAINLOADER == 1
#include "common.h"
#include "firm/firm.h"
;
}
-#ifdef CHAINLOADER
+#if defined(CHAINLOADER) && CHAINLOADER == 1
void chainload_menu();
#endif
{ 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
+#if defined(CHAINLOADER) && CHAINLOADER == 1
{ 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 },