SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
Simon Kuenzer <simon.kuenzer@neclab.eu>
Senior Researcher, NEC Laboratories Europe GmbH
Xen Summit 2019, Chicago
A Journey through Unikraft’s Build System
This work has received funding from the European Union’s Horizon 2020 research and innovation
program under grant agreements no. 675806 (“5G CITY”). This work reflects only the author’s views
and the European Commission is not responsible for any use that may be made of the information it
contains.
Unikraft‘s Build System
Overview
4 © NEC Corporation 2019
Unikraft
KConfig
Makefile System
Internal Library
Config.uk
Makefile.uk
Sources
Build System: Loading & Parsing
Your Application
Config.uk
Makefile.uk
Sources
Makefile
External Library
Config.uk
Makefile.uk
Sources
5 © NEC Corporation 2019
Unikraft’s 3 Build Stages
(1) Fetch
Download and decompress external sources
e.g., a library hosted on GitHub, Sourceforge
Patch downloaded files
(2) Prepare
Further preparation steps to the sources, for instance:
• Call ./configure of downloaded library sources
• Generate further sources or headers required for building
(3) Compile & Link
Compile sources
Link libraries
Link final images
6 © NEC Corporation 2019
*_SRCS-y *_OBJS-y UK_ALIBS-y
UK_OLIBS-y
UK_IMAGES-y
Build Stage 3: Compiling and Linking
libA_a.c
libA_b.S libA.ld.o libA.o
... libB.o
Images
prebuilt.o
...
staticA.a
...
exportsyms.uk
libA_a.o
libA_b.o
......
extA.o
...
7 © NEC Corporation 2019
Make parameters
▌Unikraft’s base Makefile
$ make A=[APP] L=[LIBRARIES] P=[PLATFORMS] V=[1/0] [target]
Parameter Description
A=[APP] Path to application directory
L=[LIBRARIES] Colon-separated list of paths to external libraries
P=[PLATFORMS] Colon-separated list of paths to external platform libs
V=[1/0] Verbose mode (on/off)
[target] Build target
help Show overview of targets
menuconfig Configure and select target images
(default when there is no .config)
all/images Build everything (default) +libs
libs Build libraries +prepare
prepare Run preparations steps +fetch
fetch Download, extract, and patch external code
Unikraft Libraries
Integrate own libraries and applications
9 © NEC Corporation 2019
Libraries/Applications/Platforms: Necessary files
▌Makefile *applications only
 Invoke Unikraft build for simplification
▌Config.uk
 Configuration options
• Settings saved as part of .config
 Specifying library dependencies
and depending options
▌Makefile.uk
 Registration to the build system
 Specification of source files
 Extra custom Make rules
• For instance for preparing the sources
▌exportsyms.uk
 Masking of symbols
▌Linker.uk *platform libraries only
 Platform-dependent rules for linking final image
.config
10 © NEC Corporation 2019
Makefile *applications only
▌Simplify application building
▌Changes to Unikraft base directory and invokes make
UK_ROOT ?= $(PWD)/../../unikraft
UK_LIBS ?= $(PWD)/../../libs
LIBS := $(UK_LIBS)/libA:$(UK_LIBS)/libB
all:
@$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS)
$(MAKECMDGOALS):
@$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS) (MAKECMDGOALS)
11 © NEC Corporation 2019
Config.uk
▌KConfig syntax1
▌Structure:
Title and Dependencies
Configuration parameters
(optional)
[1] https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
12 © NEC Corporation 2019
Config.uk: Title and Dependencies for Libraries
menuconfig defines a submenu for the following configuration options
• Note: Use just config without following if-block when the library does not
have any configuration parameters
select keyword is used to describe dependencies to other libraries
• Supports conditional expressions1
• Multiple select lines are possible for a single configuration
menuconfig LIBMYLIB
bool "ukmylib: my scheduler“
### libraries are off as default
default n
### dependencies
select LIBNOLIBC if !HAVE_LIBC
if LIBMYLIB
### list of configuration parameters goes here
endif
13 © NEC Corporation 2019
Config.uk: Dependencies for Applications
Invisible bool config to select dependencies
• Applications are not defining an own submenu. Because just a single
application can currently be selected for one Unikernel build, applications are
enabled as default
Like for libraries, select keyword is used to describe dependencies to
libraries
### Invisible option (no description) that is set as
### default to ‚y‘ in order to select dependencies
config LIBMYAPP
bool
default y
select LIBNOLIBC if !HAVE_LIBC
### list of configuration parameters goes here
14 © NEC Corporation 2019
Config.uk: Configuration Parameter
Name-space configuration options!
• Prepend library name in front of parameters: here: LIBMYLIB_
Configurations will appear as CONFIG_[CONFIGNAME]
in the build system and in the sources (include uk/config.h)
(here: CONFIG_LIBMYLIB_SETTING)
[type] can be one of bool, int (unsigned), hex, string:
Advanced options, like choice lists, are documented at:
https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
config LIBMYLIB_SETTING
[type] "[description]"
default [value]
select LIBOTHER
Makefile.uk #include <uk/config.h>
bool y/n „y“ is defined as 1
„n“ is not defined
int Hexadecimal Defined as hexadecimal
hex Hexadecimal Defined as hexadecimal
string String Defined as String
15 © NEC Corporation 2019
Makefile.uk
▌Makefile syntax
Unikraft provides helper functions and variables
Unikraft expects specific variables to be filled
▌Structure
Registration
Source files and build flags
Custom prepare rules
External sources (optional)
16 © NEC Corporation 2019
Makefile.uk: Registration
▌Registration with addlib / addlib_s helpers1
The first thing that has to be done in a Makefile.uk
Libraries (depending on being enabled)
Replace [libmylib] and CONFIG_LIBMYLIB accordingly:
Applications
Replace [libmyapp] accordingly:
The namespace for variables is defined by application/library name
here: prefixed in uppercase: LIBMYLIB_, LIBMYAPP_
The following variables are populated after the call
The following overrides are available after the call
$(eval $(call addlib_s,[libmylib],$(CONFIG_LIBMYLIB)))
[1] support/build/Makefile.rules
*_BASE Path to library folder
*_BUILD Path to library‘s output/build folder
Note: Place all generated files during building in here, never in the base
$(eval $(call addlib,[libmyapp]))
*_EXPORTS Path to an alternative exportsyms.uk (optional)
17 © NEC Corporation 2019
Makefile.uk: External sources (optional)
▌Download one archive with (additional) sources and extract them
with fetch / fetchas helpers1
Example with lwIP:
.tar.gz, .tgz, .tar.xz, .txz, and .zip are currently supported1
The following variables are populated after this call
▌If some downloaded source files need to be patched, use
patch helper1:
Example with lwIP:
This command applies all patches found in $(LIBLWIP_PATCHDIR) to the sub-
directory $(LIBLWIP_ZIPNAME) of the previously extracted sources
LIBLWIP_ZIPNAME=lwip-2.1.2
LIBLWIP_URL=http://download.savannah.nongnu.org/releases/lwip/$(LIBLWIP_ZIPNAME).zip
$(eval $(call fetch,liblwip,$(LIBLWIP_URL)))
[1] support/build/Makefile.rules
*_ORIGIN Path to folder containing extracted archive files
LIBLWIP_PATCHDIR=$(LIBLWIP_BASE)/patches
$(eval $(call patch,liblwip,$(LIBLWIP_PATCHDIR),$(LIBLWIP_ZIPNAME)))
18 © NEC Corporation 2019
Makefile.uk: Source files
▌Full paths to source files are added to the *_SRCS-y list:
Compile rule and target is automatically generated by build system
based on file extension:
• Currently supported: .S, .sx, .s, .c, .C, .cc, .cp, .cxx, .cpp, .CPP, .c++, .lds.S
• .o-binary is created within the library output directory based on the source filename:
– Note: Only the filename without extension matters for the target file name. The source file extension
and path is irrelevant. In conflicting cases, use variants (see next slide).
The following include and build flag lists apply for a source file:
# Source file from library directory
LIBMYLIB_SRCS-y += $(LIBMYLIB_BASE)/source.c
# Source file from extracted archive
LIBMYLIB_SRCS-y += $(LIBMYLIB_ORIGIN)/another_src.c
CFLAGS-y Global build flags (here: C sources, equivalents for other types exist)
CINCLUDES-y Global includes (here: C sources, equivalents for other types exist)
*_CFLAGS-y Library-internal build flags (here: C sources, equivalents exist)
*_CINCLUDES-y Library-internal includes (here: C sources, equivalents exist)
*_[FILENAME]_FLAGS Source file specific build flags
*_[FILENAME]_INCLUDES Source file specific includes
$(LIBMYLIB_BASE)/source.c.  $(LIBMYLIB_BUILD)/source.o
$(LIBMYLIB_ORIGIN)/another_src.c  $(LIBMYLIB_BUILD)/another_src.o
19 © NEC Corporation 2019
Makefile.uk: Source File Variants
▌Variants exist because of two reasons:
Conflicting output file names (previous slide)
Necessity to compile a single source file multiple times with different flags
(e.g., newlib *scanf() variants)
▌Variant names are added with a pipe symbol after source:
…produces:
Variants have their own specific build flags and includes:
LIBMYLIB_SRCS-y += $(LIBMYLIB_BASE)/source.c
LIBMYLIB_SRCS-y += $(LIBMYLIB_BASE)/source.c|variant
LIBMYLIB_SRCS-y += $(LIBMYLIB_ORIGIN)/source.c|origin
$(LIBMYLIB_BASE)/source.c  $(LIBMYLIB_BUILD)/source.o
$(LIBMYLIB_BASE)/source.c|variant  $(LIBMYLIB_BUILD)/source.variant.o
$(LIBMYLIB_ORIGIN)/source.c|origin  $(LIBMYLIB_BUILD)/source.origin.o
*_[FILENAME]_FLAGS Build flags for source file without variant specification
*_[FILENAME]_INCLUDES Includes for source file without variant specification
*_[FILENAME]_[VARIANT]_FLAGS Build flags for source file for variant [VARIANT]
*_[FILENAME]_[VARIANT]_INCLUDES Includes for source file for variant [VARIANT]
20 © NEC Corporation 2019
Makefile.uk: Externally Compiled Sources
▌Unikraft supports including externally compiled sources
Cases where it may happen:
Code only available as binary form
Compiling is done by different build system
(e.g., invoked by custom prepare rules)
▌Depending on the type, various places exist to add them:
.o-object files are added to the *_OBJS-y list:
.o-libraries are registered to the global list UK_OLIBS
(remember to use the library switch CONFIG_*):
Static libraries are registered to the global list UK_ALIBS
(remember to use the library switch CONFIG_*):
Note: Shared libraries (.so) are currently not supported
LIBMYLIB_OBJS-y += $(LIBMYLIB_BASE)/prebuilt.o
UK_ALIBS-$(CONIG_LIBMYLIB) += $(LIBMYLIB_BASE)/static_lib.a
UK_OLIBS-$(CONFIG_LIBMYLIB) += $(LIBMYLIB_BASE)/prebuilt_lib.o
21 © NEC Corporation 2019
Makefile.uk: Scope of Headers (Includes)
▌Global headers (e.g., library API)
(remember to use the library switch CONFIG_*):
▌Library-Internal headers
▌File-specific headers
▌Equivalent to this, you can set build flags within a specific scope
CFLAGS-$(CONFIG_LIBMYLIB), LIBMYLIB_CFLAGS-y,
LIBMYLIB_MYSRC_FLAGS, LIBMYLIB_MYSRC_VARIANT_FLAGS
CINCLUDES-$(CONFIG_LIBMYLIB) += -I$(LIBMYLIB_BASE)/include/api
LIBMYLIB_CINCLUDES-y += -I$(LIBMYLIB_BASE)/include/internal
# mysrc.c
LIBMYLIB_MYSRC_INCLUDES += -I$(LIBMYLIB_BASE)/include/mysrc
# Variant var0 of mysrc.c: mysrc.c|var0
LIBMYLIB_MYSRC_VAR0_INCLUDES += -I$(LIBMYLIB_BASE)/include/mysrc
22 © NEC Corporation 2019
Makefile.uk: Custom Prepare Rules
▌Reason
Generate files (headers, sources) needed for build
Invoke parts of ported library build system, like ./configure
▌Defined as custom Make rules
Use build_cmd to prettify the output1
(in cases where build_cmd is not applicable use verbose_cmd)
▌If used, set marker of fetch stage as dependency
Download marker: $(LIBMYLIB_BUILD)/.origin
Patched marker: $(LIBMYLIB_BUILD)/.patched
▌Register generated files to prepare stage
UK_PREPARE-$(CONFIG_LIBMYLIB) += [generated file/phony]
$(LIBMYLIB_BUILD)/generated.h: [dependencies]
$(call build_cmd,NM,libmylib,$@,$(NM) -n $(LIBMYLIB_BASE)/symtab.in > $@)
[1] support/build/Makefile.rules
23 © NEC Corporation 2019
exportsyms.uk
▌Re-masks the scope of each symbol of a library
 Re-defines for each symbol if it is available for final linking
 Intended to reduce potential clashing of symbols
▌List of symbol names that should be available globally for final
linking. Non-listed symbols become private to the library.
 Example (libnolibc):
▌Note: The build system will throw a warning when no exportsyms.uk
file is provided
 The scope of each library symbol stays unchanged in such a case
asprintf
vasprintf
# comments are ignored
opterr
optind
optopt
optreset
optarg
getopt
[...]
Best Practices
25 © NEC Corporation 2019
Best Practices
▌Porting existing libraries/applications is a challenging task
 Existing sources often only fit to their build and configuration system
 Often not intended to run on something else than Linux (assumptions to the OS)
▌If possible, compile all sources with Unikraft
 Including external build binaries is risky
• Build flags may be incompatible (e.g., register usage/calling convention, LTO)
• Mismatch of depending libraries (external vs. Unikraft‘s version)
▌Learn from existing build system
 Extract list of source files and build flags when compiling with original build system
 Study steps that generate files needed for the build
• Try to run ./configure with settings fitting to Unikraft environment
• It is also possible to call ./configure from Unikraft as prepare step
▌Provide initial stubs for missing symbols
 Completing compiling & linking (but not running) first,
helps to get an better overview of missing functionality in Unikraft
XPDDS19: A Journey through Unikraft's Build System

Weitere ähnliche Inhalte

Ähnlich wie XPDDS19: A Journey through Unikraft's Build System

CMake - Introduction and best practices
CMake - Introduction and best practicesCMake - Introduction and best practices
CMake - Introduction and best practicesDaniel Pfeifer
 
Application of code composer studio in digital signal processing
Application of code composer studio in digital signal processingApplication of code composer studio in digital signal processing
Application of code composer studio in digital signal processingIAEME Publication
 
Introduction to s cons
Introduction to s consIntroduction to s cons
Introduction to s consdcshi
 
Development workflow guide for building docker apps
Development workflow guide for building docker appsDevelopment workflow guide for building docker apps
Development workflow guide for building docker appsAbdul Khan
 
Development workflow guide for building docker apps
Development workflow guide for building docker appsDevelopment workflow guide for building docker apps
Development workflow guide for building docker appsAbdul Khan
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 
Build process ppt.pptx
Build process ppt.pptxBuild process ppt.pptx
Build process ppt.pptxSHIVANISRECECE
 
Software Build processes and Git
Software Build processes and GitSoftware Build processes and Git
Software Build processes and GitAlec Clews
 
Understanding how C program works
Understanding how C program worksUnderstanding how C program works
Understanding how C program worksMindBridgeTech
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3aminmesbahi
 
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...Johannes Nicolai
 
Address Binding Scheme
Address Binding SchemeAddress Binding Scheme
Address Binding SchemeRajesh Piryani
 
Carmen En
Carmen EnCarmen En
Carmen EnCarmen
 
Autoconf&Automake
Autoconf&AutomakeAutoconf&Automake
Autoconf&Automakeniurui
 
Getting started with libfabric
Getting started with libfabricGetting started with libfabric
Getting started with libfabricJianxin Xiong
 
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuXPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuThe Linux Foundation
 

Ähnlich wie XPDDS19: A Journey through Unikraft's Build System (20)

Basic Make
Basic MakeBasic Make
Basic Make
 
Linkers
LinkersLinkers
Linkers
 
CMake - Introduction and best practices
CMake - Introduction and best practicesCMake - Introduction and best practices
CMake - Introduction and best practices
 
Application of code composer studio in digital signal processing
Application of code composer studio in digital signal processingApplication of code composer studio in digital signal processing
Application of code composer studio in digital signal processing
 
Introduction to s cons
Introduction to s consIntroduction to s cons
Introduction to s cons
 
Development workflow guide for building docker apps
Development workflow guide for building docker appsDevelopment workflow guide for building docker apps
Development workflow guide for building docker apps
 
Development workflow guide for building docker apps
Development workflow guide for building docker appsDevelopment workflow guide for building docker apps
Development workflow guide for building docker apps
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 
Build process ppt.pptx
Build process ppt.pptxBuild process ppt.pptx
Build process ppt.pptx
 
Software Build processes and Git
Software Build processes and GitSoftware Build processes and Git
Software Build processes and Git
 
Understanding how C program works
Understanding how C program worksUnderstanding how C program works
Understanding how C program works
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3
 
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
 
Libraries
LibrariesLibraries
Libraries
 
Address Binding Scheme
Address Binding SchemeAddress Binding Scheme
Address Binding Scheme
 
Carmen En
Carmen EnCarmen En
Carmen En
 
Genode Programming
Genode ProgrammingGenode Programming
Genode Programming
 
Autoconf&Automake
Autoconf&AutomakeAutoconf&Automake
Autoconf&Automake
 
Getting started with libfabric
Getting started with libfabricGetting started with libfabric
Getting started with libfabric
 
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuXPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
 

Mehr von The Linux Foundation

ELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleThe Linux Foundation
 
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...The Linux Foundation
 
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...The Linux Foundation
 
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...The Linux Foundation
 
XPDDS19 Keynote: Unikraft Weather Report
XPDDS19 Keynote:  Unikraft Weather ReportXPDDS19 Keynote:  Unikraft Weather Report
XPDDS19 Keynote: Unikraft Weather ReportThe Linux Foundation
 
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...The Linux Foundation
 
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxThe Linux Foundation
 
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...The Linux Foundation
 
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, BitdefenderXPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, BitdefenderThe Linux Foundation
 
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...The Linux Foundation
 
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making... OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...The Linux Foundation
 
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, CitrixXPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, CitrixThe Linux Foundation
 
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltdXPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltdThe Linux Foundation
 
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...The Linux Foundation
 
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&DXPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&DThe Linux Foundation
 
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM SystemsXPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM SystemsThe Linux Foundation
 
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...The Linux Foundation
 
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...The Linux Foundation
 
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...The Linux Foundation
 
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSEXPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSEThe Linux Foundation
 

Mehr von The Linux Foundation (20)

ELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made Simple
 
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
 
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
 
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
 
XPDDS19 Keynote: Unikraft Weather Report
XPDDS19 Keynote:  Unikraft Weather ReportXPDDS19 Keynote:  Unikraft Weather Report
XPDDS19 Keynote: Unikraft Weather Report
 
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
 
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
 
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
 
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, BitdefenderXPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
 
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
 
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making... OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, CitrixXPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
 
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltdXPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
 
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
 
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&DXPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
 
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM SystemsXPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
 
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
 
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
 
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
 
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSEXPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
 

Kürzlich hochgeladen

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Kürzlich hochgeladen (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

XPDDS19: A Journey through Unikraft's Build System

  • 1. Simon Kuenzer <simon.kuenzer@neclab.eu> Senior Researcher, NEC Laboratories Europe GmbH Xen Summit 2019, Chicago A Journey through Unikraft’s Build System This work has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreements no. 675806 (“5G CITY”). This work reflects only the author’s views and the European Commission is not responsible for any use that may be made of the information it contains.
  • 2.
  • 4. 4 © NEC Corporation 2019 Unikraft KConfig Makefile System Internal Library Config.uk Makefile.uk Sources Build System: Loading & Parsing Your Application Config.uk Makefile.uk Sources Makefile External Library Config.uk Makefile.uk Sources
  • 5. 5 © NEC Corporation 2019 Unikraft’s 3 Build Stages (1) Fetch Download and decompress external sources e.g., a library hosted on GitHub, Sourceforge Patch downloaded files (2) Prepare Further preparation steps to the sources, for instance: • Call ./configure of downloaded library sources • Generate further sources or headers required for building (3) Compile & Link Compile sources Link libraries Link final images
  • 6. 6 © NEC Corporation 2019 *_SRCS-y *_OBJS-y UK_ALIBS-y UK_OLIBS-y UK_IMAGES-y Build Stage 3: Compiling and Linking libA_a.c libA_b.S libA.ld.o libA.o ... libB.o Images prebuilt.o ... staticA.a ... exportsyms.uk libA_a.o libA_b.o ...... extA.o ...
  • 7. 7 © NEC Corporation 2019 Make parameters ▌Unikraft’s base Makefile $ make A=[APP] L=[LIBRARIES] P=[PLATFORMS] V=[1/0] [target] Parameter Description A=[APP] Path to application directory L=[LIBRARIES] Colon-separated list of paths to external libraries P=[PLATFORMS] Colon-separated list of paths to external platform libs V=[1/0] Verbose mode (on/off) [target] Build target help Show overview of targets menuconfig Configure and select target images (default when there is no .config) all/images Build everything (default) +libs libs Build libraries +prepare prepare Run preparations steps +fetch fetch Download, extract, and patch external code
  • 8. Unikraft Libraries Integrate own libraries and applications
  • 9. 9 © NEC Corporation 2019 Libraries/Applications/Platforms: Necessary files ▌Makefile *applications only  Invoke Unikraft build for simplification ▌Config.uk  Configuration options • Settings saved as part of .config  Specifying library dependencies and depending options ▌Makefile.uk  Registration to the build system  Specification of source files  Extra custom Make rules • For instance for preparing the sources ▌exportsyms.uk  Masking of symbols ▌Linker.uk *platform libraries only  Platform-dependent rules for linking final image .config
  • 10. 10 © NEC Corporation 2019 Makefile *applications only ▌Simplify application building ▌Changes to Unikraft base directory and invokes make UK_ROOT ?= $(PWD)/../../unikraft UK_LIBS ?= $(PWD)/../../libs LIBS := $(UK_LIBS)/libA:$(UK_LIBS)/libB all: @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS) $(MAKECMDGOALS): @$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS) (MAKECMDGOALS)
  • 11. 11 © NEC Corporation 2019 Config.uk ▌KConfig syntax1 ▌Structure: Title and Dependencies Configuration parameters (optional) [1] https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
  • 12. 12 © NEC Corporation 2019 Config.uk: Title and Dependencies for Libraries menuconfig defines a submenu for the following configuration options • Note: Use just config without following if-block when the library does not have any configuration parameters select keyword is used to describe dependencies to other libraries • Supports conditional expressions1 • Multiple select lines are possible for a single configuration menuconfig LIBMYLIB bool "ukmylib: my scheduler“ ### libraries are off as default default n ### dependencies select LIBNOLIBC if !HAVE_LIBC if LIBMYLIB ### list of configuration parameters goes here endif
  • 13. 13 © NEC Corporation 2019 Config.uk: Dependencies for Applications Invisible bool config to select dependencies • Applications are not defining an own submenu. Because just a single application can currently be selected for one Unikernel build, applications are enabled as default Like for libraries, select keyword is used to describe dependencies to libraries ### Invisible option (no description) that is set as ### default to ‚y‘ in order to select dependencies config LIBMYAPP bool default y select LIBNOLIBC if !HAVE_LIBC ### list of configuration parameters goes here
  • 14. 14 © NEC Corporation 2019 Config.uk: Configuration Parameter Name-space configuration options! • Prepend library name in front of parameters: here: LIBMYLIB_ Configurations will appear as CONFIG_[CONFIGNAME] in the build system and in the sources (include uk/config.h) (here: CONFIG_LIBMYLIB_SETTING) [type] can be one of bool, int (unsigned), hex, string: Advanced options, like choice lists, are documented at: https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt config LIBMYLIB_SETTING [type] "[description]" default [value] select LIBOTHER Makefile.uk #include <uk/config.h> bool y/n „y“ is defined as 1 „n“ is not defined int Hexadecimal Defined as hexadecimal hex Hexadecimal Defined as hexadecimal string String Defined as String
  • 15. 15 © NEC Corporation 2019 Makefile.uk ▌Makefile syntax Unikraft provides helper functions and variables Unikraft expects specific variables to be filled ▌Structure Registration Source files and build flags Custom prepare rules External sources (optional)
  • 16. 16 © NEC Corporation 2019 Makefile.uk: Registration ▌Registration with addlib / addlib_s helpers1 The first thing that has to be done in a Makefile.uk Libraries (depending on being enabled) Replace [libmylib] and CONFIG_LIBMYLIB accordingly: Applications Replace [libmyapp] accordingly: The namespace for variables is defined by application/library name here: prefixed in uppercase: LIBMYLIB_, LIBMYAPP_ The following variables are populated after the call The following overrides are available after the call $(eval $(call addlib_s,[libmylib],$(CONFIG_LIBMYLIB))) [1] support/build/Makefile.rules *_BASE Path to library folder *_BUILD Path to library‘s output/build folder Note: Place all generated files during building in here, never in the base $(eval $(call addlib,[libmyapp])) *_EXPORTS Path to an alternative exportsyms.uk (optional)
  • 17. 17 © NEC Corporation 2019 Makefile.uk: External sources (optional) ▌Download one archive with (additional) sources and extract them with fetch / fetchas helpers1 Example with lwIP: .tar.gz, .tgz, .tar.xz, .txz, and .zip are currently supported1 The following variables are populated after this call ▌If some downloaded source files need to be patched, use patch helper1: Example with lwIP: This command applies all patches found in $(LIBLWIP_PATCHDIR) to the sub- directory $(LIBLWIP_ZIPNAME) of the previously extracted sources LIBLWIP_ZIPNAME=lwip-2.1.2 LIBLWIP_URL=http://download.savannah.nongnu.org/releases/lwip/$(LIBLWIP_ZIPNAME).zip $(eval $(call fetch,liblwip,$(LIBLWIP_URL))) [1] support/build/Makefile.rules *_ORIGIN Path to folder containing extracted archive files LIBLWIP_PATCHDIR=$(LIBLWIP_BASE)/patches $(eval $(call patch,liblwip,$(LIBLWIP_PATCHDIR),$(LIBLWIP_ZIPNAME)))
  • 18. 18 © NEC Corporation 2019 Makefile.uk: Source files ▌Full paths to source files are added to the *_SRCS-y list: Compile rule and target is automatically generated by build system based on file extension: • Currently supported: .S, .sx, .s, .c, .C, .cc, .cp, .cxx, .cpp, .CPP, .c++, .lds.S • .o-binary is created within the library output directory based on the source filename: – Note: Only the filename without extension matters for the target file name. The source file extension and path is irrelevant. In conflicting cases, use variants (see next slide). The following include and build flag lists apply for a source file: # Source file from library directory LIBMYLIB_SRCS-y += $(LIBMYLIB_BASE)/source.c # Source file from extracted archive LIBMYLIB_SRCS-y += $(LIBMYLIB_ORIGIN)/another_src.c CFLAGS-y Global build flags (here: C sources, equivalents for other types exist) CINCLUDES-y Global includes (here: C sources, equivalents for other types exist) *_CFLAGS-y Library-internal build flags (here: C sources, equivalents exist) *_CINCLUDES-y Library-internal includes (here: C sources, equivalents exist) *_[FILENAME]_FLAGS Source file specific build flags *_[FILENAME]_INCLUDES Source file specific includes $(LIBMYLIB_BASE)/source.c.  $(LIBMYLIB_BUILD)/source.o $(LIBMYLIB_ORIGIN)/another_src.c  $(LIBMYLIB_BUILD)/another_src.o
  • 19. 19 © NEC Corporation 2019 Makefile.uk: Source File Variants ▌Variants exist because of two reasons: Conflicting output file names (previous slide) Necessity to compile a single source file multiple times with different flags (e.g., newlib *scanf() variants) ▌Variant names are added with a pipe symbol after source: …produces: Variants have their own specific build flags and includes: LIBMYLIB_SRCS-y += $(LIBMYLIB_BASE)/source.c LIBMYLIB_SRCS-y += $(LIBMYLIB_BASE)/source.c|variant LIBMYLIB_SRCS-y += $(LIBMYLIB_ORIGIN)/source.c|origin $(LIBMYLIB_BASE)/source.c  $(LIBMYLIB_BUILD)/source.o $(LIBMYLIB_BASE)/source.c|variant  $(LIBMYLIB_BUILD)/source.variant.o $(LIBMYLIB_ORIGIN)/source.c|origin  $(LIBMYLIB_BUILD)/source.origin.o *_[FILENAME]_FLAGS Build flags for source file without variant specification *_[FILENAME]_INCLUDES Includes for source file without variant specification *_[FILENAME]_[VARIANT]_FLAGS Build flags for source file for variant [VARIANT] *_[FILENAME]_[VARIANT]_INCLUDES Includes for source file for variant [VARIANT]
  • 20. 20 © NEC Corporation 2019 Makefile.uk: Externally Compiled Sources ▌Unikraft supports including externally compiled sources Cases where it may happen: Code only available as binary form Compiling is done by different build system (e.g., invoked by custom prepare rules) ▌Depending on the type, various places exist to add them: .o-object files are added to the *_OBJS-y list: .o-libraries are registered to the global list UK_OLIBS (remember to use the library switch CONFIG_*): Static libraries are registered to the global list UK_ALIBS (remember to use the library switch CONFIG_*): Note: Shared libraries (.so) are currently not supported LIBMYLIB_OBJS-y += $(LIBMYLIB_BASE)/prebuilt.o UK_ALIBS-$(CONIG_LIBMYLIB) += $(LIBMYLIB_BASE)/static_lib.a UK_OLIBS-$(CONFIG_LIBMYLIB) += $(LIBMYLIB_BASE)/prebuilt_lib.o
  • 21. 21 © NEC Corporation 2019 Makefile.uk: Scope of Headers (Includes) ▌Global headers (e.g., library API) (remember to use the library switch CONFIG_*): ▌Library-Internal headers ▌File-specific headers ▌Equivalent to this, you can set build flags within a specific scope CFLAGS-$(CONFIG_LIBMYLIB), LIBMYLIB_CFLAGS-y, LIBMYLIB_MYSRC_FLAGS, LIBMYLIB_MYSRC_VARIANT_FLAGS CINCLUDES-$(CONFIG_LIBMYLIB) += -I$(LIBMYLIB_BASE)/include/api LIBMYLIB_CINCLUDES-y += -I$(LIBMYLIB_BASE)/include/internal # mysrc.c LIBMYLIB_MYSRC_INCLUDES += -I$(LIBMYLIB_BASE)/include/mysrc # Variant var0 of mysrc.c: mysrc.c|var0 LIBMYLIB_MYSRC_VAR0_INCLUDES += -I$(LIBMYLIB_BASE)/include/mysrc
  • 22. 22 © NEC Corporation 2019 Makefile.uk: Custom Prepare Rules ▌Reason Generate files (headers, sources) needed for build Invoke parts of ported library build system, like ./configure ▌Defined as custom Make rules Use build_cmd to prettify the output1 (in cases where build_cmd is not applicable use verbose_cmd) ▌If used, set marker of fetch stage as dependency Download marker: $(LIBMYLIB_BUILD)/.origin Patched marker: $(LIBMYLIB_BUILD)/.patched ▌Register generated files to prepare stage UK_PREPARE-$(CONFIG_LIBMYLIB) += [generated file/phony] $(LIBMYLIB_BUILD)/generated.h: [dependencies] $(call build_cmd,NM,libmylib,$@,$(NM) -n $(LIBMYLIB_BASE)/symtab.in > $@) [1] support/build/Makefile.rules
  • 23. 23 © NEC Corporation 2019 exportsyms.uk ▌Re-masks the scope of each symbol of a library  Re-defines for each symbol if it is available for final linking  Intended to reduce potential clashing of symbols ▌List of symbol names that should be available globally for final linking. Non-listed symbols become private to the library.  Example (libnolibc): ▌Note: The build system will throw a warning when no exportsyms.uk file is provided  The scope of each library symbol stays unchanged in such a case asprintf vasprintf # comments are ignored opterr optind optopt optreset optarg getopt [...]
  • 25. 25 © NEC Corporation 2019 Best Practices ▌Porting existing libraries/applications is a challenging task  Existing sources often only fit to their build and configuration system  Often not intended to run on something else than Linux (assumptions to the OS) ▌If possible, compile all sources with Unikraft  Including external build binaries is risky • Build flags may be incompatible (e.g., register usage/calling convention, LTO) • Mismatch of depending libraries (external vs. Unikraft‘s version) ▌Learn from existing build system  Extract list of source files and build flags when compiling with original build system  Study steps that generate files needed for the build • Try to run ./configure with settings fitting to Unikraft environment • It is also possible to call ./configure from Unikraft as prepare step ▌Provide initial stubs for missing symbols  Completing compiling & linking (but not running) first, helps to get an better overview of missing functionality in Unikraft