From fd4d6a4e55940edec61a6e7c02f2cd3a268cd7a6 Mon Sep 17 00:00:00 2001 From: thedax Date: Fri, 29 Mar 2019 18:16:03 -0400 Subject: [PATCH] exosphere: add new ConfigItem which allows the caller to retrieve the git commit hash. (#493) --- exosphere/Makefile | 3 ++- exosphere/src/configitem.c | 4 ++++ exosphere/src/configitem.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/exosphere/Makefile b/exosphere/Makefile index 4603f7e4a..7c638dfab 100644 --- a/exosphere/Makefile +++ b/exosphere/Makefile @@ -10,6 +10,7 @@ TOPDIR ?= $(CURDIR) include $(DEVKITPRO)/devkitA64/base_rules AMSBRANCH := $(shell git symbolic-ref --short HEAD) +AMSHASH = $(shell git rev-parse --short=16 HEAD) AMSREV := $(AMSBRANCH)-$(shell git rev-parse --short HEAD) ifneq (, $(strip $(shell git status --porcelain 2>/dev/null))) @@ -33,7 +34,7 @@ INCLUDES := include ../common/include # options for code generation #--------------------------------------------------------------------------------- ARCH := -march=armv8-a -mtune=cortex-a57 -mgeneral-regs-only #<- important -DEFINES := -D__CCPLEX__ -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\" +DEFINES := -D__CCPLEX__ -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\" -DATMOSPHERE_RELEASE_VERSION_HASH="0x$(AMSHASH)" CFLAGS := \ -g \ -O2 \ diff --git a/exosphere/src/configitem.c b/exosphere/src/configitem.c index 7029297d3..2eac9036e 100644 --- a/exosphere/src/configitem.c +++ b/exosphere/src/configitem.c @@ -260,6 +260,10 @@ uint32_t configitem_get(bool privileged, ConfigItem item, uint64_t *p_outvalue) /* UNOFFICIAL: The fact that we are executing means we aren't in the process of shutting down. */ *p_outvalue = 0; break; + case CONFIGITEM_EXOSPHERE_VERHASH: + /* UNOFFICIAL: Gets information about the current exosphere git commit hash. */ + *p_outvalue = ATMOSPHERE_RELEASE_VERSION_HASH; + break; default: result = 2; break; diff --git a/exosphere/src/configitem.h b/exosphere/src/configitem.h index 4bf6f30c1..e62a2266b 100644 --- a/exosphere/src/configitem.h +++ b/exosphere/src/configitem.h @@ -43,6 +43,7 @@ typedef enum { CONFIGITEM_EXOSPHERE_VERSION = 65000, CONFIGITEM_NEEDS_REBOOT = 65001, CONFIGITEM_NEEDS_SHUTDOWN = 65002, + CONFIGITEM_EXOSPHERE_VERHASH = 65003, } ConfigItem; #define REBOOT_KIND_NO_REBOOT 0