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

Re: [Minios-devel] [UNIKRAFT PATCH v4 3/8] build: Introduce default linker script variable



Hi Sharan, this patch looks good, I'll push the series upstream soon.

Thanks,

-- Felipe

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 21.08.19, 12:50, "Sharan Santhanam" <Sharan.Santhanam@xxxxxxxxx> wrote:

    Each platform may define `UK_PLAT_PLATNAME_DEF_LDS`. This variable will
    be used by Unikraft build system to different default linker script
    from additional linker script and automatically generate rules to link
    the final application image. If the platform does not introduce this
    variable, then all the linker script would be defined as extra linker
    scripts.
    
    Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
    ---
     doc/guides/developers-platform.rst | 17 ++++++++++++-----
     plat/kvm/Makefile.uk               | 13 ++++++++++++-
     plat/xen/Makefile.uk               | 12 ++++++++++++
     support/build/Makefile.rules       |  5 +++--
     4 files changed, 39 insertions(+), 8 deletions(-)
    
    diff --git a/doc/guides/developers-platform.rst 
b/doc/guides/developers-platform.rst
    index c39fbb2..b9411ea 100644
    --- a/doc/guides/developers-platform.rst
    +++ b/doc/guides/developers-platform.rst
    @@ -15,23 +15,30 @@ treated as libraries in Unikraft but there are a few 
differences:
     
     3. You need to provide a linker script and name the file ``Linker.uk``.
     
    -4. You need to place all platform files in the Unikraft repo under
    +4. The default linker script for a platform is provided using the
    +   ``UK_PLAT_PLATNAME_DEF_LDS`` variable in the Makefile.uk of the platform
    +   library. The default linker script is also added as a source file to the
    +   platform library to be built. If the default linker script is not 
provided,
    +   then Unikraft would rely on the default linker script provided by the 
compiler
    +   tool chain.
    +
    +5. You need to place all platform files in the Unikraft repo under
        ``plat/platname/``.
     
    -5. A platform have to implement interfaces defined in ``include/uk/plat``
    +6. A platform have to implement interfaces defined in ``include/uk/plat``
        (this is analogue to architectures that have to implement interfaces in
        ``include/uk/arch``)
     
    -6. They do not use any external source files, i.e., all source code is
    +7. They do not use any external source files, i.e., all source code is
        within the Unikraft tree.
     
    -7. They must not have dependencies on external libraries, i.e., the
    +8. They must not have dependencies on external libraries, i.e., the
        Unikraft repo must be able to be built on its own. Remember that
        for such builds, ``libnolibc`` has to be sufficient ``libc`` replacement
        to compile, link, and execute internal libraries. This means that nolibc
        has to be extended from time to time.
     
    -8. All changes/additions to ``include/uk/plat`` and ``include/uk/arch``
    +9. All changes/additions to ``include/uk/plat`` and ``include/uk/arch``
        have to be completely independent of any library (internal and 
external).
        They do not include any header provided by any library and never 
conflict
        with any library. Most of the times this is challenging for defining 
data
    diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
    index 7d0c696..f52bd4e 100644
    --- a/plat/kvm/Makefile.uk
    +++ b/plat/kvm/Makefile.uk
    @@ -25,6 +25,17 @@ LIBKVMPLAT_CFLAGS              += -DKVMPLAT
     LIBKVMPLAT_CXXFLAGS            += -DKVMPLAT
     
     ##
    +## Default Linker script
    +ifeq ($(CONFIG_ARCH_X86_64),y)
    +UK_PLAT_KVM_DEF_LDS            := 
$(CONFIG_UK_BASE)/plat/kvm/x86/link64.lds.S
    +else
    +ifeq ($(CONFIG_ARCH_ARM_64),y)
    +UK_PLAT_KVM_DEF_LDS            := 
$(CONFIG_UK_BASE)/plat/kvm/arm/link64.lds.S
    +endif
    +endif
    +
    +
    +##
     ## Architecture library definitions for x86_64
     ##
     KVM_LDSCRIPT_SRC-$(CONFIG_ARCH_X86_64) := 
$(CONFIG_UK_BASE)/plat/kvm/x86/link64.lds.S
    @@ -81,7 +92,7 @@ LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/irq.c
     LIBKVMPLAT_SRCS-y              += $(LIBKVMPLAT_BASE)/io.c
     LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/lcpu.c|common
     LIBKVMPLAT_SRCS-y              += $(UK_PLAT_COMMON_BASE)/memory.c|common
    -LIBKVMPLAT_SRCS-y              += $(KVM_LDSCRIPT_SRC-y)
    +LIBKVMPLAT_SRCS-y              += $(UK_PLAT_KVM_DEF_LDS)
     
     ##
     ## PCI library definitions
    diff --git a/plat/xen/Makefile.uk b/plat/xen/Makefile.uk
    index 69b10ef..3f18525 100644
    --- a/plat/xen/Makefile.uk
    +++ b/plat/xen/Makefile.uk
    @@ -19,12 +19,24 @@ LIBXENPLAT_CFLAGS-y      += -DXENPLAT 
-D__XEN_INTERFACE_VERSION__=$(XEN_INTERFAC
     LIBXENPLAT_CXXFLAGS-y    += -DXENPLAT 
-D__XEN_INTERFACE_VERSION__=$(XEN_INTERFACE_VERSION)
     
     ##
    +## Default Linker script
    +ifeq ($(CONFIG_ARCH_X86_64),y)
    +UK_PLAT_XEN_DEF_LDS            := 
$(CONFIG_UK_BASE)/plat/xen/x86/link64.lds.S
    +else
    +ifeq ($(CONFIG_ARCH_ARM_32),y)
    +UK_PLAT_XEN_DEF_LDS            := 
$(CONFIG_UK_BASE)/plat/xen/arm/link32.lds.S
    +endif
    +endif
    +
    +##
     ## Platform library definitions
     ##
     LIBXENPLAT_ASINCLUDES-y        += -I$(LIBXENPLAT_BASE)/include
     LIBXENPLAT_ASINCLUDES-y        += -I$(UK_PLAT_COMMON_BASE)/include
     LIBXENPLAT_CINCLUDES-y         += -I$(LIBXENPLAT_BASE)/include
     LIBXENPLAT_CINCLUDES-y         += -I$(UK_PLAT_COMMON_BASE)/include
    +
    +LIBXENPLAT_SRCS-y              += $(UK_PLAT_XEN_DEF_LDS)
     LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/hypervisor.c
     LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/memory.c
     LIBXENPLAT_SRCS-y              += $(LIBXENPLAT_BASE)/io.c
    diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
    index 29e0ce9..3147f4c 100644
    --- a/support/build/Makefile.rules
    +++ b/support/build/Makefile.rules
    @@ -137,8 +137,9 @@ endef
     # Register a platform to the build system
     define addplat =
     UK_PLATS += $(1)
    -$(eval UK_PLAT_$(call uc,$(1))_BASE   := $(_IMPORT_BASE))
    -$(eval UK_PLAT_$(call uc,$(1))_LINKER := $(_IMPORT_BASE)/Linker.uk)
    +$(eval UK_PLAT_$(call uc,$(1))_BASE    := $(_IMPORT_BASE))
    +$(eval UK_PLAT_$(call uc,$(1))_LINKER  := $(_IMPORT_BASE)/Linker.uk)
    +$(eval UK_PLAT_$(call uc,$(1))_DEF_LDS :=)
     endef
     
     # addplat_s $platname,$switch
    -- 
    2.7.4
    
    

_______________________________________________
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®.