From: chaoskagami Date: Tue, 21 Jun 2016 21:17:12 +0000 (-0400) Subject: Fixups to build system X-Git-Tag: v0.1.1 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=4ed76459ab5c6f213c81d0aae7e8199296ef30d7;p=corbenik%2Fcorbenik.git Fixups to build system --- diff --git a/Makefile b/Makefile index 1633750..76e916f 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,11 @@ dir_out := out 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 @@ -37,6 +38,17 @@ objects_cfw = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \ $(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 @@ -62,7 +74,7 @@ contrib: .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: diff --git a/external/Makefile b/external/Makefile index dbbf79a..dd7035d 100644 --- a/external/Makefile +++ b/external/Makefile @@ -7,7 +7,9 @@ all: loader bits screeninit 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 diff --git a/source/chain.c b/source/chain.c index 521ec9a..2627d66 100644 --- a/source/chain.c +++ b/source/chain.c @@ -1,4 +1,4 @@ -#ifdef CHAINLOADER +#if defined(CHAINLOADER) && CHAINLOADER == 1 #include "common.h" #include "firm/firm.h" diff --git a/source/menu.c b/source/menu.c index 85b34b2..6084722 100644 --- a/source/menu.c +++ b/source/menu.c @@ -300,7 +300,7 @@ poweroff() ; } -#ifdef CHAINLOADER +#if defined(CHAINLOADER) && CHAINLOADER == 1 void chainload_menu(); #endif @@ -312,7 +312,7 @@ 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 +#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 },