[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH] build: Support external platform libraries



Hi Simon,

This patch looks good, except it has more or less 0 documentation :). It might 
be a good idea to provide minimal documentation on what the 3 files 
(Makefile.uk, Linker.uk, Config.uk) should contain to add a skeleton external 
library (as well as for the Makefile, e.g., @make -C $(UK_ROOT) A=$(PWD) 
L=$(LIBS) P=$(PATH_TO_EXT_PLATS_FOLDER).

Thanks,

-- Felipe

On 23.05.19, 16:12, "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx> wrote:

    This patch adds support for external platform libraries. Similar to
    external libraries, Such a library is handed over with the `make`
    command line parameter `P=`. Identical to internal platform libraries,
    an external platform library requires to have 3 files:
     - Makefile.uk
     - Linker.uk
     - Config.uk
    
    Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
    ---
     Config.uk |  4 ++++
     Makefile  | 63 ++++++++++++++++++++++++++++++++++++++++---------------
     2 files changed, 50 insertions(+), 17 deletions(-)
    
    diff --git a/Config.uk b/Config.uk
    index d0bfa823..6d09962b 100644
    --- a/Config.uk
    +++ b/Config.uk
    @@ -9,6 +9,9 @@ config KCONFIG_APP_IN
     config KCONFIG_ELIB_IN
        string
        option env="KCONFIG_ELIB_IN"
    +config KCONFIG_EPLAT_IN
    +   string
    +   option env="KCONFIG_EPLAT_IN"
     config UK_FULLVERSION
        string
        option env="UK_FULLVERSION"
    @@ -34,6 +37,7 @@ endmenu
     
     menu "Platform Configuration"
        source "plat/Config.uk"
    +   source "$KCONFIG_EPLAT_IN"
     endmenu
     
     menu "Library Configuration"
    diff --git a/Makefile b/Makefile
    index c0492920..7e91d4ef 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -97,6 +97,19 @@ $(if $(BUILD_DIR),, $(error could not create directory 
"$(O)"))
     endif
     override BUILD_DIR := $(realpath $(patsubst %/,%,$(patsubst 
%.,%,$(BUILD_DIR))))
     
    +# EPLAT_DIR (list of external platform libraries)
    +# Retrieved from P variable from the command line (paths separated by 
colon)
    +ifeq ("$(origin P)", "command line")
    +$(foreach E,$(subst :, ,$(P)), \
    +$(if $(wildcard $(E)), \
    +   $(eval EPLAT_DIR += $(E)) \
    +, \
    +   $(error Cannot find platform library: $(E)) \
    +) \
    +)
    +endif
    +EPLAT_DIR := $(realpath $(patsubst %/,%,$(patsubst %.,%,$(EPLAT_DIR))))
    +
     # ELIB_DIR (list of external libraries)
     # Retrieved from L variable from the command line (paths separated by 
colon)
     ifeq ("$(origin L)", "command line")
    @@ -124,6 +137,7 @@ KCONFIG_AUTOCONFIG    := $(KCONFIG_DIR)/auto.conf
     KCONFIG_TRISTATE      := $(KCONFIG_DIR)/tristate.config
     KCONFIG_AUTOHEADER    := $(UK_GENERATED_INCLUDES)/uk/_config.h
     KCONFIG_APP_IN        := $(KCONFIG_DIR)/app.uk
    +KCONFIG_EPLAT_IN      := $(KCONFIG_DIR)/eplat.uk
     KCONFIG_ELIB_IN       := $(KCONFIG_DIR)/elib.uk
     
     # Makefile support scripts
    @@ -488,6 +502,12 @@ $(foreach E,$(ELIB_DIR), \
     )
     $(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY))) # 
architecture libraries
     include $(CONFIG_UK_BASE)/plat/Makefile.uk # platform libraries
    +# external platform libraries
    +# NOTE: We include them after internal platform libs so that also base 
variables
    +#       provided with /plat/Makefile.uk are populated
    +$(foreach E,$(EPLAT_DIR), \
    +   $(eval $(call _import_lib,$(E))); \
    +)
     include $(CONFIG_UK_BASE)/lib/Makefile.uk # libraries
     include $(CONFIG_UK_BASE)/Makefile.uk # Unikraft base
     
    @@ -580,7 +600,7 @@ HOSTCFLAGS = $(CFLAGS_FOR_BUILD)
     export HOSTCFLAGS
     
     # auto-generated KConfig files for including external app
    -$(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN): %: %.new
    +$(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) $(KCONFIG_EPLAT_IN): %: %.new
        @cmp -s $^ $@; if [ $$? -ne 0 ]; then cp $^ $@; fi
     
     $(KCONFIG_APP_IN).new:
    @@ -598,8 +618,16 @@ $(KCONFIG_ELIB_IN).new:
                echo 'source "$(E)/Config.uk"' >> $@; \
        )
     
    +# auto-generated KConfig file for including
    +# external platform libraries to the menu
    +$(KCONFIG_EPLAT_IN).new:
    +   @echo '# external platform libraries' > $@
    +   @$(foreach E,$(EPLAT_DIR), \
    +           echo 'source "$(E)/Config.uk"' >> $@; \
    +   )
    +
     # enforce execution
    -.PHONY: $(KCONFIG_APP_IN).new $(KCONFIG_ELIB_IN).new
    +.PHONY: $(KCONFIG_APP_IN).new $(KCONFIG_ELIB_IN).new 
$(KCONFIG_EPLAT_IN).new
     
     KCONFIG_TOOLS = conf mconf gconf nconf fixdep
     KCONFIG_TOOLS := $(addprefix $(KCONFIG_DIR)/,$(KCONFIG_TOOLS))
    @@ -629,25 +657,26 @@ COMMON_CONFIG_ENV = \
        UK_ARCH="$(CONFIG_UK_ARCH)" \
        KCONFIG_APP_IN="$(KCONFIG_APP_IN)" \
        KCONFIG_ELIB_IN="$(KCONFIG_ELIB_IN)" \
    +   KCONFIG_EPLAT_IN="$(KCONFIG_EPLAT_IN)" \
        UK_NAME="$(CONFIG_UK_NAME)"
     
    -xconfig: $(KCONFIG_DIR)/qconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +xconfig: $(KCONFIG_DIR)/qconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -gconfig: $(KCONFIG_DIR)/gconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +gconfig: $(KCONFIG_DIR)/gconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) srctree=$(CONFIG_UK_BASE) $< $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -menuconfig: $(KCONFIG_DIR)/mconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +menuconfig: $(KCONFIG_DIR)/mconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -nconfig: $(KCONFIG_DIR)/nconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +nconfig: $(KCONFIG_DIR)/nconf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -config: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +config: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    @@ -655,43 +684,43 @@ config: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) 
$(KCONFIG_ELIB_IN)
     # SKIP_LEGACY=y to disable the legacy options. However, in that case
     # no values are set for the legacy options so a subsequent oldconfig
     # will query them. Therefore, run an additional olddefconfig.
    -oldconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +oldconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -randconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +randconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
        @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -allyesconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +allyesconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig 
$(CONFIG_CONFIG_IN)
        @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -allnoconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +allnoconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
        @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -silentoldconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +silentoldconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -olddefconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +olddefconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
    -defconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +defconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) 
$(CONFIG_CONFIG_IN)
        @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
     
     # Override the UK_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
    -%_defconfig: $(KCONFIG_DIR)/conf $(A)/configs/%_defconfig 
$(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +%_defconfig: $(KCONFIG_DIR)/conf $(A)/configs/%_defconfig 
$(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) $(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) UK_DEFCONFIG=$(A)/configs/$@ \
                $< --defconfig=$(A)/configs/$@ $(CONFIG_CONFIG_IN)
     
    -savedefconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
    +savedefconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN) 
$(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $< \
                --savedefconfig=$(if 
$(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
                $(CONFIG_CONFIG_IN)
    @@ -701,7 +730,7 @@ savedefconfig: $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) 
$(KCONFIG_ELIB_IN)
     .PHONY: defconfig savedefconfig silentoldconfig
     
     # Regenerate $(KCONFIG_AUTOHEADER) whenever $(UK_CONFIG) changed
    -$(KCONFIG_AUTOHEADER): $(UK_CONFIG) $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) 
$(KCONFIG_ELIB_IN)
    +$(KCONFIG_AUTOHEADER): $(UK_CONFIG) $(KCONFIG_DIR)/conf $(KCONFIG_APP_IN) 
$(KCONFIG_ELIB_IN) $(KCONFIG_EPLAT_IN)
        @$(COMMON_CONFIG_ENV) $(KCONFIG_DIR)/conf --silentoldconfig 
$(CONFIG_CONFIG_IN)
     
     
    -- 
    2.20.1
    
    

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.