]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/uklibid: Option to embed .config to `.uk_libinfo`
authorSimon Kuenzer <simon@unikraft.io>
Tue, 26 Sep 2023 22:44:10 +0000 (00:44 +0200)
committerRazvan Deaconescu <razvand@unikraft.io>
Fri, 20 Oct 2023 16:35:55 +0000 (19:35 +0300)
This commit introduces the option to embed a gzipped version of the
configuration (`.config`) used to generate the image.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

lib/uklibid/Config.uk
lib/uklibid/Makefile.uk
lib/uklibid/libinfo.S

index a3887cc8dc698e50365b39949c578557124944b6..36e87de3002a39d9c9b6a797b4b878fe7b27a741 100644 (file)
@@ -37,6 +37,13 @@ config LIBUKLIBID_INFO
                                Enables storing the C compiler ($(CC)) that was
                                used for during compilation for the unikernel
                                image.
+
+               config LIBUKLIBID_INFO_UKCONFIGGZ
+                       bool "Embed gzipped configuration (.config)"
+                       help
+                               If enabled, the current configuration `.config`
+                               of the build is gzipped and embedded to the
+                               global metadata infomration space.
        endmenu
 
        menu "Per library metadata"
index fc0bee78aa5adeb3a362ae16b705401bbec5aff8..8e39c0e17893026591544994cb9e5071a6e2195a 100644 (file)
@@ -44,5 +44,11 @@ ASFLAGS += -D__LIBUKLIBID_COMPILER__="$(CC_INFO)"
 LIBUKLIBID_SRCS-$(CONFIG_LIBUKLIBID_INFO) +=  $(LIBUKLIBID_BASE)/infosec.ld
 LIBUKLIBID_SRCS-$(CONFIG_LIBUKLIBID_INFO) += $(LIBUKLIBID_BASE)/libinfo.S|global
 LIBUKLIBID_LIBINFO_GLOBAL_FLAGS-y += -D__GLOBALINFO__
+LIBUKLIBID_LIBINFO_GLOBAL_CDEPS-$(CONFIG_LIBUKLIBID_INFO_UKCONFIGGZ) += $(LIBUKLIBID_BUILD)/config.gz
+LIBUKLIBID_LIBINFO_GLOBAL_FLAGS-$(CONFIG_LIBUKLIBID_INFO_UKCONFIGGZ) += -DUK_CONFIGGZINC="$(LIBUKLIBID_BUILD)/config.gz"
+
+$(LIBUKLIBID_BUILD)/config.gz: $(UK_CONFIG_OUT)
+       $(call build_cmd,GZ,libuklibid,$@, \
+               $(GZIP) -f -9 -c $< >$@)
 
 UK_PREPARE-$(CONFIG_LIBUKLIBID) += $(LIBUKLIBID_BUILD)/libraries.in.new
index bde6e74ecee2d113e18eb345b6ff1728724f6441..29dcd61e58f774da7c71d4ec78f5a0b7fda01aca 100644 (file)
@@ -34,6 +34,9 @@
        RECORD(UKLI_REC_COMPILER,
               .asciz STRINGIFY(__LIBUKLIBID_COMPILER__))
 #endif /* CONFIG_LIBUKLIBID_INFO_COMPILER */
+#if CONFIG_LIBUKLIBID_INFO_UKCONFIGGZ
+       RECORD(UKLI_REC_UKCONFIGGZ,    .incbin STRINGIFY(UK_CONFIGGZINC))
+#endif /* CONFIG_LIBUKLIBID_INFO_UKCONFIGGZ */
 
 #else /* !__GLOBALINFO__ */
        /* Records per library */