core: unify handling of boot modules

Instead of solving the problem to deliver ROM modules to core while booting
differently for the several kernels (multi-boot, elfweaver, core re-linking),
this commit unifies the approaches. It always builds core as a library, and
after all binaries are built from a run-script, the run-tool will link an
ELF image out of the core-library and all boot modules. Thereby, core can
access its ROM modules directly.

This approach now works for all kernels except Linux.

With this solution, there is no [build_dir]/bin/core binary available anymore.
For debugging purposes you will find a core binary without boot modules, but
with debug symbols under [run_dir].core.

Fix #2095
This commit is contained in:
Stefan Kalkowski
2016-09-15 16:08:33 +02:00
committed by Christian Helmuth
parent 340a18007c
commit 7e1692d997
80 changed files with 450 additions and 1395 deletions

View File

@@ -1,5 +1,3 @@
TARGET = core
GEN_CORE_DIR = $(BASE_DIR)/src/core
SRC_CC += \

View File

@@ -1,5 +1,3 @@
LD_TEXT_ADDR ?= 0x01000000
#
# Clean rule for removing the side effects of building the platform library
#

View File

@@ -1,32 +0,0 @@
/*
* \brief Dummy boot-modules-file for building standalone images of core
* \author Martin Stein
* \date 2011-12-16
*/
/*
* Copyright (C) 2011-2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
.section .data
.global _boot_modules_headers_begin
_boot_modules_headers_begin:
/* no headers */
.global _boot_modules_headers_end
_boot_modules_headers_end:
.section .data.boot_modules_binaries
.global _boot_modules_binaries_begin
_boot_modules_binaries_begin:
/* no binaries */
.global _boot_modules_binaries_end
_boot_modules_binaries_end:

View File

@@ -17,6 +17,7 @@
#include <base/log.h>
/* core includes */
#include <boot_modules.h>
#include <core_parent.h>
#include <platform.h>
#include <map_local.h>
@@ -40,23 +41,6 @@ static bool const verbose_boot_info = true;
extern unsigned _prog_img_beg, _prog_img_end;
/******************
** Boot modules **
******************/
struct Boot_module_header
{
char const *name; /* physical address of null-terminated string */
addr_t const base; /* physical address of module data */
size_t const size; /* size of module data in bytes */
};
extern Boot_module_header _boot_modules_headers_begin;
extern Boot_module_header _boot_modules_headers_end;
extern int _boot_modules_binaries_begin;
extern int _boot_modules_binaries_end;
/****************************************
** Support for core memory management **
****************************************/
@@ -176,7 +160,7 @@ void Platform::_init_allocators()
* attempt to map a page frame.
*/
addr_t const core_virt_beg = trunc_page((addr_t)&_prog_img_beg),
core_virt_end = round_page((addr_t)&_boot_modules_binaries_end)
core_virt_end = round_page((addr_t)&_prog_img_end)
+ 4096;
size_t const core_size = core_virt_end - core_virt_beg;
@@ -366,7 +350,7 @@ void Platform::_init_rom_modules()
addr_t const modules_first_frame_sel = bi.userImageFrames.start
+ (modules_core_offset >> get_page_size_log2());
Boot_module_header const *header = &_boot_modules_headers_begin;
Boot_modules_header const *header = &_boot_modules_headers_begin;
for (; header < &_boot_modules_headers_end; header++) {
/* offset relative to first module */

View File

@@ -1,15 +0,0 @@
TARGET = core
LIBS += core
SRC_S = boot_modules.s
LD_TEXT_ADDR ?= 0x02000000
# XXX hack, based on base-hw/lib/mk/core.mk
ifneq ($(wildcard $(BUILD_BASE_DIR)/boot_modules.s),)
BOOT_MODULES_VPATH = $(BUILD_BASE_DIR)
INC_DIR += $(BOOT_MODULES_VPATH)
else
# use dummy boot-modules by default
BOOT_MODULES_VPATH = $(REP_DIR)/src/core/
endif
vpath boot_modules.s $(BOOT_MODULES_VPATH)