Disambiguate kernel-specific file names

This patch removes possible ambiguities with respect to the naming of
kernel-dependent binaries and libraries. It also removes the use of
kernel-specific global side effects from the build system. The reach of
kernel-specific peculiarities has thereby become limited to the actual
users of the respective 'syscall-<kernel>' libraries.

Kernel-specific build artifacts are no longer generated at magic places
within the build directory (like okl4's includes, or the L4 build
directories of L4/Fiasco and Fiasco.OC, or the build directories of
various kernels). Instead, such artifacts have been largely moved to the
libcache. E.g., the former '<build-dir>/l4/' build directory for the L4
build system resides at '<build-dir>/var/libcache/syscall-foc/build/'.
This way, the location is unique to the kernel. Note that various tools
are still generated somewhat arbitrarily under '<build-dir>/tool/' as
there is no proper formalism for building host tools yet.

As the result of this work, it has become possible to use a joint Genode
build directory that is usable with all kernels of a given hardware
platform. E.g., on x86_32, one can now seamlessly switch between linux,
nova, sel4, okl4, fiasco, foc, and pistachio without rebuilding any
components except for core, the kernel, the dynamic linker, and the timer
driver. At the current stage, such a build directory must still be
created manually. A change of the 'create_builddir' tool will follow to
make this feature easily available.

This patch also simplifies various 'run/boot_dir' plugins by removing
the option for an externally hosted kernel. This option remained unused
for many years now.

Issue #2190
This commit is contained in:
Norman Feske
2016-12-10 01:30:38 +01:00
parent 3865ee7ccc
commit c450ddcb3d
258 changed files with 902 additions and 1489 deletions

View File

@@ -1,30 +1,23 @@
#
# Description of build platform
#
SPECS += genode linux sdl
#
# If you want to build the Linux-specific Genode
# binaries, use this config option.
# Detect host CPU architecture
#
ifeq ($(shell uname -m),x86_64)
SPECS ?= genode linux_x86_64 sdl
else
ifeq ($(shell uname -m),armv6l)
SPECS ?= genode linux_arm sdl arm_v6
else
ifeq ($(shell uname -m),armv7l)
SPECS ?= genode linux_arm sdl arm_v7a
else
SPECS ?= genode linux_x86_32 sdl
endif
endif
UNAME_MACHINE := $(shell uname -m)
ifeq ($(UNAME_MACHINE),i686)
SPECS += x86_32
endif
#
# If you want to build for the host platform,
# use the following config option.
# You need to specify '32bit' additionally to 'host'
# to include the 32bit-specific Genode include path
# containing integer definitions.
#
#SPECS ?= host 32bit
ifeq ($(UNAME_MACHINE),x86_64)
SPECS += x86_64
endif
ifeq ($(UNAME_MACHINE),armv6l)
SPECS += arm_v6
endif
ifeq ($(UNAME_MACHINE),armv7l)
SPECS += arm_v7a
endif

View File

@@ -1,7 +1,7 @@
#
# Make Linux headers of the host platform available to the program
#
include $(call select_from_repositories,lib/import/import-syscall.mk)
include $(call select_from_repositories,lib/import/import-syscall-linux.mk)
#
# Manually supply all library search paths of the host compiler to our tool
@@ -65,31 +65,37 @@ endif
#
# Use the host's startup codes, linker script, and dynamic linker
#
ifneq ($(filter hardening_tool_chain, $(SPECS)),)
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=Scrt1.o)
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crti.o)
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtbeginS.o)
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtendS.o)
else
LD_TEXT_ADDR ?=
LD_SCRIPT_STATIC ?=
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crt1.o)
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crti.o)
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtbegin.o)
EXT_OBJECTS += $(shell $(CUSTOM_CC) $(CC_MARCH) -print-file-name=crtend.o)
endif
EXT_OBJECTS += $(shell cc $(CC_MARCH) -print-file-name=crtn.o)
LX_LIBS_OPT += -lgcc -lgcc_s -lsupc++ -lc -lpthread
USE_HOST_LD_SCRIPT = yes
#
# We need to manually add the default linker script on the command line in case
# of standard library use. Otherwise, we were not able to extend it by the
# stack area section.
#
ifeq (x86_64,$(findstring x86_64,$(SPECS)))
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2
else
ifeq (arm,$(findstring arm,$(SPECS)))
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib/ld-linux.so.3
else
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib/ld-linux.so.2
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2
LD_SCRIPT_DEFAULT = ldscripts/elf_x86_64.xc
endif
ifeq (x86_32,$(findstring x86_32,$(SPECS)))
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib/ld-linux.so.2
LD_SCRIPT_DEFAULT = ldscripts/elf_i386.xc
endif
ifeq (arm,$(findstring arm,$(SPECS)))
CXX_LINK_OPT += -Wl,--dynamic-linker=/lib/ld-linux.so.3
LD_SCRIPT_STATIC = ldscripts/armelf_linux_eabi.xc
endif
#

View File

@@ -6,7 +6,7 @@
include $(BASE_DIR)/lib/mk/base-common.inc
LIBS += syscall
LIBS += syscall-linux
SRC_CC += region_map_mmap.cc debug.cc
SRC_CC += signal_submit.cc

View File

@@ -7,4 +7,4 @@ include $(BASE_DIR)/lib/mk/base.inc
SRC_CC += platform_env.cc
LIBS += syscall cxx
LIBS += syscall-linux cxx

View File

@@ -6,7 +6,7 @@
include $(REP_DIR)/lib/mk/base-linux.inc
LIBS += startup base-linux-common
LIBS += startup-linux base-linux-common
SRC_CC += thread.cc thread_myself.cc thread_linux.cc
SRC_CC += capability_space.cc capability_raw.cc
SRC_CC += attach_stack_area.cc

View File

@@ -0,0 +1 @@
include $(BASE_DIR)/lib/mk/spec/arm/startup.inc

View File

@@ -0,0 +1 @@
include $(BASE_DIR)/lib/mk/spec/x86_32/startup.inc

View File

@@ -0,0 +1 @@
include $(BASE_DIR)/lib/mk/spec/x86_64/startup.inc

View File

@@ -1,21 +0,0 @@
#
# Specifics for the Linux-specific Genode components
#
#
# Startup code to be used when building a program and linker script that is
# specific for Linux. We also reserve the stack area via a segment in
# the program under Linux to prevent clashes with vdso.
#
ifneq ($(USE_HOST_LD_SCRIPT),yes)
LD_TEXT_ADDR ?= 0x01000000
LD_SCRIPT_STATIC = $(call select_from_repositories,src/ld/genode.ld) \
$(call select_from_repositories,src/ld/stack_area.nostdlib.ld)
else
LD_TEXT_ADDR ?=
LD_SCRIPT_STATIC ?=
endif
ifneq ($(filter hardening_tool_chain, $(SPECS)),)
CC_OPT += -fPIC
endif

View File

@@ -1,23 +0,0 @@
#
# Specifics for Linux on ARM
#
SPECS += linux arm
ifeq ($(shell gcc -dumpmachine),arm-linux-gnueabihf)
CC_MARCH += -mfloat-abi=hard
endif
#
# We need to manually add the default linker script on the command line in case
# of standard library use. Otherwise, we were not able to extend it by the
# stack area section.
#
ifeq ($(USE_HOST_LD_SCRIPT),yes)
LD_SCRIPT_STATIC = ldscripts/armelf_linux_eabi.xc
endif
#
# Include less-specific configuration
#
include $(call select_from_repositories,mk/spec/arm.mk)
include $(call select_from_repositories,mk/spec/linux.mk)

View File

@@ -1,19 +0,0 @@
#
# Specifics for Linux on 32-bit x86
#
SPECS += linux x86_32
#
# We need to manually add the default linker script on the command line in case
# of standard library use. Otherwise, we were not able to extend it by the
# stack area section.
#
ifeq ($(USE_HOST_LD_SCRIPT),yes)
LD_SCRIPT_DEFAULT = ldscripts/elf_i386.xc
endif
#
# Include less-specific configuration
#
include $(call select_from_repositories,mk/spec/x86_32.mk)
include $(call select_from_repositories,mk/spec/linux.mk)

View File

@@ -1,20 +0,0 @@
#
# Specifics for Linux on 64-bit x86
#
SPECS += linux x86_64
#
# We need to manually add the default linker script on the command line in case
# of standard library use. Otherwise, we were not able to extend it by the
# stack area section.
#
ifeq ($(USE_HOST_LD_SCRIPT),yes)
LD_SCRIPT_DEFAULT = ldscripts/elf_x86_64.xc
endif
#
# Include less-specific configuration
#
include $(call select_from_repositories,mk/spec/x86_64.mk)
include $(call select_from_repositories,mk/spec/linux.mk)

View File

@@ -1,6 +1,6 @@
TARGET = core
TARGET = core-linux
REQUIRES = linux
LIBS = cxx base-linux-common syscall startup
LIBS = cxx base-linux-common syscall-linux startup-linux
GEN_CORE_DIR = $(BASE_DIR)/src/core
@@ -38,7 +38,9 @@ INC_DIR += $(REP_DIR)/src/core/include \
$(REP_DIR)/src/include \
$(BASE_DIR)/src/include
HOST_INC_DIR += /usr/include
LD_TEXT_ADDR ?= 0x01000000
LD_SCRIPT_STATIC = $(call select_from_repositories,src/ld/genode.ld) \
$(call select_from_repositories,src/ld/stack_area.nostdlib.ld)
include $(GEN_CORE_DIR)/version.inc
@@ -59,4 +61,4 @@ vpath thread.cc $(BASE_DIR)/src/lib/base
vpath thread_myself.cc $(BASE_DIR)/src/lib/base
vpath trace.cc $(BASE_DIR)/src/lib/base
vpath env_reinit.cc $(REP_DIR)/src/lib/base
vpath %.cc $(PRG_DIR)
vpath %.cc $(REP_DIR)/src/core