6989472: Provide simple jdk identification information in the install image

Reviewed-by: alanb
diff --git a/jdk/make/common/Release.gmk b/jdk/make/common/Release.gmk
index 271f746..1dc3a20 100644
--- a/jdk/make/common/Release.gmk
+++ b/jdk/make/common/Release.gmk
@@ -26,6 +26,9 @@
 include $(JDK_TOPDIR)/make/docs/CORE_PKGS.gmk
 include $(JDK_TOPDIR)/make/docs/NON_CORE_PKGS.gmk
 
+# What jdk version are we building
+THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
+
 #
 # Perform release engineering tasks.
 #
@@ -72,9 +75,6 @@
 
 JTG_DOCS            = $(JDK_TOPDIR)/src/solaris/doc
 
-#We use this for man page header
-jdkversion := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
-
 # The base names of all the license and document files for the jdk and jre
 #   (These files get placed in the jdk and jre install images)
 ifdef OPENJDK
@@ -185,7 +185,7 @@
         $(MKDIR) -p $1/man/$${ja_dir}/man1; \
         $(CAT) $${manbase}/ja/$${manpage} \
           | $(NATIVE2ASCII) -encoding $(JA_SOURCE_ENCODING) \
-          | $(SED) 's/@@VERSION@@/$(jdkversion)/g' \
+          | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
           | $(NATIVE2ASCII) -reverse -encoding $${ja_encoding} \
             > $1/man/$${ja_dir}/man1/$${manpage}; \
       done; \
@@ -215,6 +215,7 @@
 initial-image-jre initial-image-jdk \
 initial-image-jre-sol64 initial-image-jdk-sol64 \
 trim-image-jre trim-image-jdk \
+identify-image-jre identify-image-jdk \
 process-image-jre process-image-jdk \
 compare-image \
 sec-files sec-files-win jgss-files ::
@@ -224,11 +225,12 @@
 images:: sanity-images post-sanity-images  \
 	 $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
 	 trim-image-jre trim-image-jdk \
+         identify-image-jre identify-image-jdk \
 	 process-image-jre process-image-jdk sec-files sec-files-win jgss-files
 
 # Don't use these
-image-jre:: initial-image-jre trim-image-jre process-image-jre
-image-jdk:: initial-image-jdk trim-image-jdk process-image-jdk
+image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre
+image-jdk:: initial-image-jdk trim-image-jdk identify-image-jdk process-image-jdk
 
 #
 # Sources we ship in the SDK.
@@ -1088,6 +1090,45 @@
 	$(RM) $(JDK_BIN_LIST)
 
 ###################################################################
+# What did we build
+###################################################################
+
+# The jdk text info file that lives at the root of the install image.
+
+JDK_INFO_FILE = $(JDK_IMAGE_DIR)/release
+JRE_INFO_FILE = $(JRE_IMAGE_DIR)/release
+
+# Common way to emit a line into the release or info file
+define info-file-item # name value
+$(PRINTF) "%s=\"%s\"\n" $1 $2 >> $@
+endef
+
+# Values to emit
+MINIMUM_OS_NAME    := $(REQUIRED_OS_NAME)
+MINIMUM_OS_VERSION := $(REQUIRED_OS_VERSION)
+MINIMUM_OS_ARCH    := $(ARCH)
+
+$(JDK_INFO_FILE): FRC
+	$(prep-target)
+	$(call info-file-item, "JAVA_VERSION", "$(THIS_JDK_VERSION)")
+	$(call info-file-item, "OS_NAME",      "$(MINIMUM_OS_NAME)")
+	$(call info-file-item, "OS_VERSION",   "$(MINIMUM_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH",      "$(MINIMUM_OS_ARCH)")
+
+# Create release file to identify this image
+identify-image-jdk:: $(JDK_INFO_FILE)
+
+$(JRE_INFO_FILE): FRC
+	$(prep-target)
+	$(call info-file-item, "JAVA_VERSION", "$(THIS_JDK_VERSION)")
+	$(call info-file-item, "OS_NAME",      "$(MINIMUM_OS_NAME)")
+	$(call info-file-item, "OS_VERSION",   "$(MINIMUM_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH",      "$(MINIMUM_OS_ARCH)")
+
+# Create release file to identify this image
+identify-image-jre:: $(JRE_INFO_FILE)
+
+###################################################################
 # What do we compare against
 ###################################################################
 
@@ -1240,6 +1281,7 @@
         initial-image-jre-setup \
 	trim-image-jre trim-image-jdk \
 	process-image-jre process-image-jdk \
+	identify-image-jre identify-image-jdk \
 	install-previous-jre install-previous-jdk \
 	compare-image-jre compare-image-jdk \
 	compare-image compare-image-clobber \
diff --git a/jdk/make/common/shared/Defs-versions.gmk b/jdk/make/common/shared/Defs-versions.gmk
index 6784be6..a51cb2b 100644
--- a/jdk/make/common/shared/Defs-versions.gmk
+++ b/jdk/make/common/shared/Defs-versions.gmk
@@ -127,6 +127,7 @@
 
 # Solaris specific
 ifeq ($(PLATFORM), solaris)
+  REQUIRED_OS_NAME            = SunOS
   REQUIRED_OS_VERSION         = 5.10
   REQUIRED_OS_VARIANT_NAME    = Solaris
   REQUIRED_OS_VARIANT_VERSION = $(REQUIRED_OS_VERSION)
@@ -148,6 +149,7 @@
 
 # Linux specific
 ifeq ($(PLATFORM), linux)
+  REQUIRED_OS_NAME            = Linux
   REQUIRED_OS_VERSION         = 2.6
   REQUIRED_OS_VARIANT_NAME    = Fedora
   REQUIRED_OS_VARIANT_VERSION = 9
@@ -166,6 +168,7 @@
 
 # Windows specific
 ifeq ($(PLATFORM), windows)
+  REQUIRED_OS_NAME            = Windows
   ifeq ($(ARCH_DATA_MODEL),64)
     REQUIRED_OS_VERSION       = 5.2
     REQUIRED_OS_VARIANT_NAME  = Windows2003