mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Containers packed in single .elf file
This commit is contained in:
@@ -19,12 +19,11 @@ LIBC_PATH = 'loader/libs/c'
|
||||
LIBC_LIBPATH = LIBC_PATH
|
||||
LIBC_INCPATH = ['#' + join(LIBC_PATH, 'include'), \
|
||||
'#' + join(LIBC_PATH, 'include/arch/' + arch)]
|
||||
LIBC_CRT_PATH = '#' + join(LIBC_PATH, "crt/sys-baremetal/arch-" + arch + "/crt0.o")
|
||||
|
||||
LIBELF_PATH = 'loader/libs/elf'
|
||||
LIBELF_LIBPATH = LIBELF_PATH
|
||||
LIBELF_INCPATH = '#' + join(LIBELF_PATH, 'include')
|
||||
|
||||
|
||||
env = Environment(CC = 'arm-none-eabi-gcc',
|
||||
# We don't use -nostdinc because sometimes we need standard headers,
|
||||
# such as stdarg.h e.g. for variable args, as in printk().
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Simple linker script for userspace or svc tasks.
|
||||
* Linker script that packs all containers in loader image.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
* Copyright (C) 2007-2009 B Labs Ltd.
|
||||
*/
|
||||
ENTRY(_start)
|
||||
|
||||
@@ -13,23 +13,17 @@ SECTIONS
|
||||
.rodata1 : { *(.rodata1) }
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
_start_kernel = .;
|
||||
*(.kernel)
|
||||
_end_kernel = .;
|
||||
_start_bootdesc = .;
|
||||
*(.bootdesc)
|
||||
_end_bootdesc = .;
|
||||
_start_mm0 = .;
|
||||
*(.mm0)
|
||||
_end_mm0 = .;
|
||||
_start_fs0 = .;
|
||||
*(.fs0)
|
||||
_end_fs0 = .;
|
||||
_start_test0 = .;
|
||||
*(.test0)
|
||||
_end_test0 = .;
|
||||
*(.data)
|
||||
}
|
||||
_start_containers = .;
|
||||
|
||||
.cont.0 : { *(.cont.0) }
|
||||
.cont.1 : { *(.cont.1) }
|
||||
|
||||
_end_containers = .;
|
||||
.got : { *(.got) *(.got.plt) }
|
||||
.bss : { *(.bss) }
|
||||
}
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
|
||||
#include <elf/elf.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "arch.h"
|
||||
|
||||
/* These symbols are defined by the linker scripts. */
|
||||
/* These symbols are defined by the linker script. */
|
||||
extern char _start_kernel[];
|
||||
extern char _end_kernel[];
|
||||
extern char _start_containers[];
|
||||
extern char _end_containers[];
|
||||
|
||||
/* This is a kernel symbol exported to loader's linker script from kernel build */
|
||||
extern char bkpt_phys_to_virt[];
|
||||
|
||||
int
|
||||
main(void)
|
||||
void load_container_images(unsigned long start, unsigned long end)
|
||||
{
|
||||
void *kernel_entry = NULL;
|
||||
struct elf_image *elf_img = (struct elf_image *)start;
|
||||
int nsect_headers;
|
||||
|
||||
// Find all section headers
|
||||
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
void *kernel_entry = 0;
|
||||
|
||||
arch_init();
|
||||
|
||||
printf("elf-loader:\tStarted\n");
|
||||
printf("ELF Loader: Started.\n");
|
||||
|
||||
printf("Loading the kernel...\n");
|
||||
// load_image(&kernel_entry, _start_kernel, _end_kernel);
|
||||
load_elf_image(&kernel_entry, _start_kernel, _end_kernel);
|
||||
|
||||
printf("Loading containers...\n");
|
||||
load_container_images(_start_containers, _end_containers)
|
||||
|
||||
printf("elf-loader:\tkernel entry point is %p\n", kernel_entry);
|
||||
// arch_start_kernel(kernel_entry);
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
#
|
||||
# Codezero -- a microkernel for embedded systems.
|
||||
#
|
||||
# Copyright © 2009 B Labs Ltd
|
||||
|
||||
import os, sys, shelve
|
||||
|
||||
# Convert address from python literal to numeric value
|
||||
def address_remove_literal(address):
|
||||
value = hex(int(address, 16) - 0xf0000000)
|
||||
if value[-1] in ['l', 'L']:
|
||||
value = value[:-1]
|
||||
return value
|
||||
|
||||
ksym_header = \
|
||||
'''
|
||||
/*
|
||||
* %s autogenerated from %s.
|
||||
*
|
||||
* This file is included by the loader sources so that any
|
||||
* kernel symbol address can be known in advance and stopped
|
||||
* at by debuggers before virtual memory is enabled.
|
||||
*/
|
||||
'''
|
||||
|
||||
symbol_section = \
|
||||
'''
|
||||
.section .text
|
||||
.align 4
|
||||
.global %s
|
||||
.type %s, function
|
||||
.equ %s, %s
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user