From 3febfe1ab1ff501b59b9a002623f7625aea155e4 Mon Sep 17 00:00:00 2001 From: Jon Feldman Date: Sun, 5 Feb 2017 03:36:33 -0500 Subject: [PATCH] Re-add the build info menu --- Makefile.am | 2 +- boot/menu.c | 18 ++++++++++++++++++ common.mk | 6 ++++-- configure.ac | 11 +++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2af932a..d9f537f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ install: @echo "Please don't call the install target directly, it doesn't work." @exit 1 -all-local: external loader boot bits +all-local: external loader boot bits patch mkdir -p out mkdir -p out@prefix@ mkdir -p out@libdir@/module diff --git a/boot/menu.c b/boot/menu.c index bec382c..1743665 100644 --- a/boot/menu.c +++ b/boot/menu.c @@ -169,6 +169,21 @@ static struct options_s help_d[] = { { NULL, NULL, unselectable, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two. }; + +#define quote(x) #x +#define string(x) quote(x) + +static struct options_s build_d[] = { + lnh("Build Info"), + ln (" Commit hash"), + ln (" " string(REVISION) " (" string(BRANCH) ")"), + ln (" Compiler"), + ln (" " string(COMPILER_ID) ), + ln (" Build configuration" ), + ln (" " string(CONFIGURE_OPTIONS) ), + { NULL, NULL, unselectable, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two. +}; + static struct options_s main_s[] = { { "Configuration", "Configuration options for the CFW.", @@ -176,6 +191,9 @@ static struct options_s main_s[] = { { "Readme", "Mini-readme.\nWhy are you opening help on this, though?\nThat's kind of silly.", option, help_d, (void(*)(void*))show_menu, NULL, 0, 0 }, + { "Build Info", + "Information such as GCC version for build, commit hash, flags, etc", + option, build_d, (void(*)(void*))show_menu, NULL, 0, 0 }, { "Reboot", "Reboots the console.", option, 0, reset, NULL, 0, 0 }, diff --git a/common.mk b/common.mk index 538fabc..735fe04 100644 --- a/common.mk +++ b/common.mk @@ -4,7 +4,9 @@ C9FLAGS=-mcpu=arm946e-s -march=armv5te -mlittle-endian -mword-relocations SIZE_OPTIMIZATION = -Wl,--gc-sections -ffunction-sections -REVISION := $(shell git rev-parse HEAD | head -c10)+$(shell git rev-list --count HEAD) +REVISION := $(shell git rev-parse HEAD) +COMMIT_COUNT := $(shell git rev-list --count HEAD) +BRANCH := $(shell git rev-parse --abbrev-ref HEAD) AM_CFLAGS= -std=gnu11 -Os -g -ffast-math \ -Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual \ @@ -13,7 +15,7 @@ AM_CFLAGS= -std=gnu11 -Os -g -ffast-math \ -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wswitch-default \ -Wundef -Wno-unused -Werror -Wno-error=cast-align -Wno-error=strict-overflow -Wno-error=pedantic \ $(THUMBFLAGS) $(SIZE_OPTIMIZATION) $(INCPATHS) $(C9FLAGS) \ - -fno-builtin -std=gnu11 -DREVISION=\"$(REVISION)\" \ + -fno-builtin -std=gnu11 -DREVISION=$(REVISION) -DBRANCH=$(BRANCH) -DCOMMIT_COUNT=$(COMMIT_COUNT) \ -DFW_NAME=\"corbenik\" $(PATHARGS) -DMALLOC_DEBUG=1 # -fsanitize=undefined diff --git a/configure.ac b/configure.ac index cd91708..449a2d2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,7 @@ AC_INIT([Corbenik], [0.3.0], [https://github.com/chaoskagami/corbenik], [corbenik]) + +export CONFIGURE_OPTIONS="$@" + AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz subdir-objects]) # Find AR and RANLIB for lto support before initializing libtool @@ -23,6 +26,11 @@ CHAINLOADER=1 test "$enable_chainloader" = "no" && CHAINLOADER=0 AC_DEFINE_UNQUOTED([CHAINLOADER], [$CHAINLOADER]) +COMPILER_ID="$($CC --version | head -n1)" +AC_DEFINE_UNQUOTED([COMPILER_ID], [$COMPILER_ID]) + +AC_DEFINE_UNQUOTED([CONFIGURE_OPTIONS], [$CONFIGURE_OPTIONS]) + AC_CONFIG_FILES([Makefile boot/Makefile external/Makefile include/Makefile]) AC_CONFIG_SUBDIRS([external/libctr9]) @@ -47,5 +55,8 @@ ldflags: ${LDFLAGS} ocflags: ${OCFLAGS} Chainloader: ${CHAINLOADER} + +Configure: ${CONFIGURE_OPTIONS} +Compiler ID: ${COMPILER_ID} " -- 2.39.5