/branches/arm/boot/arch/arm32/loader/Makefile |
---|
27,7 → 27,7 |
# |
include ../../../../version |
-include ../../../../Makefile.config |
include ../../../Makefile.config |
## Toolchain configuration |
# |
41,15 → 41,6 |
TARGET = arm-linux-gnu |
TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm/bin |
ifeq ($(MACHINE), testarm) |
DMACHINE = MACHINE_GXEMUL_TESTARM |
endif |
ifeq ($(MACHINE), integratorcp) |
DMACHINE = MACHINE_ICP |
endif |
ifeq ($(COMPILER),gcc_native) |
CC = gcc |
AS = as |
66,17 → 57,28 |
OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
endif |
CFLAGS = -DRELEASE=$(RELEASE) -I. -I../../../generic -I../../.. -imacros ../../../../config.h -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -pipe |
CFLAGS = -DRELEASE=\"$(RELEASE)\" -I. -I../../../generic -I../../.. -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 |
ifdef REVISION |
CFLAGS += "-DREVISION=\"$(REVISION)\"" |
endif |
ifdef TIMESTAMP |
CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\"" |
endif |
ifdef MACHINE |
CFLAGS += "-DMACHINE=$(MACHINE)" |
endif |
SOURCES = \ |
main.c \ |
boot.S \ |
asm.S \ |
mm.c \ |
print/print.c \ |
print/gxemul.c \ |
_components.c \ |
../../../generic/printf.c \ |
../../../generic/string.c \ |
../../../genarch/division.c |
COMPONENTS = \ |
85,7 → 87,7 |
$(USPACEDIR)/srv/loader/loader \ |
$(USPACEDIR)/app/init/init \ |
$(USPACEDIR)/srv/devmap/devmap \ |
$(USPACEDIR)/srv/bd/rd/rd \ |
$(USPACEDIR)/srv/rd/rd \ |
$(USPACEDIR)/srv/vfs/vfs |
ifeq ($(RDFMT),tmpfs) |
COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs |
98,17 → 100,10 |
$(USPACEDIR)/srv/fb/fb \ |
$(USPACEDIR)/srv/kbd/kbd \ |
$(USPACEDIR)/srv/console/console \ |
$(USPACEDIR)/srv/fs/devfs/devfs \ |
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \ |
$(USPACEDIR)/srv/fs/fat/fat \ |
$(USPACEDIR)/srv/bd/file_bd/file_bd |
ifeq ($(MACHINE), testarm) |
RD_SRVS += \ |
$(USPACEDIR)/srv/bd/gxe_bd/gxe_bd |
endif |
$(USPACEDIR)/srv/fs/fat/fat |
RD_APPS = \ |
$(USPACEDIR)/app/getvc/getvc \ |
$(USPACEDIR)/app/tetris/tetris \ |
$(USPACEDIR)/app/tester/tester \ |
$(USPACEDIR)/app/trace/trace \ |
128,7 → 123,7 |
$(LD) -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) -o $@ |
depend: |
-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null |
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null |
clean: |
-for file in $(RD_SRVS) ; do \ |
150,7 → 145,7 |
../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs |
endif |
ifeq ($(RDFMT),fat) |
../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs |
../../../../tools/mkfat.sh $(USPACEDIR)/dist/ initrd.fs |
endif |
../../../../tools/mkhord.py 4096 initrd.fs initrd.img |
rm initrd.fs |
160,4 → 155,4 |
$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
%.o: %.c |
$(CC) -D$(DMACHINE) $(DEFS) $(CFLAGS) -c $< -o $@ |
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
/branches/arm/boot/arch/arm32/loader/boot.S |
---|
34,10 → 34,8 |
.global start |
.global jump_to_kernel |
.global page_table |
.global boot_stack |
start: |
ldr sp, =boot_stack |
b bootstrap |
jump_to_kernel: |
48,10 → 46,6 |
# |
bx r0 |
#bootloader stack |
.section ST |
.space 4096 |
boot_stack: |
# place page_table to PT section |
.section PT |
59,3 → 53,5 |
# make place for PTL0 page table |
page_table: |
.skip PTL0_ENTRIES * PTL0_ENTRY_SIZE |
/branches/arm/boot/arch/arm32/loader/_link.ld.in |
---|
17,9 → 17,6 |
*(COMMON); /* global variables */ |
*(.reginfo); |
. = 0x2000; |
*(ST); /* bootloader stack section */ |
. = 0x4000; |
*(PT); /* page table placed at 0x4000 */ |
[[COMPONENTS]] |
/branches/arm/boot/arch/arm32/loader/main.c |
---|
32,16 → 32,13 |
*/ |
/** @file |
* @brief Bootstrap. |
*/ |
*/ |
#include "main.h" |
#include "main.h" |
#include "asm.h" |
#include "_components.h" |
#include <printf.h> |
#include <align.h> |
#include <macros.h> |
#include <string.h> |
#include "mm.h" |
49,16 → 46,16 |
#define KERNEL_VIRTUAL_ADDRESS 0x80200000 |
char *release = STRING(RELEASE); |
char *release = RELEASE; |
#ifdef REVISION |
char *revision = ", revision " STRING(REVISION); |
char *revision = ", revision " REVISION; |
#else |
char *revision = ""; |
#endif |
#ifdef TIMESTAMP |
char *timestamp = "\nBuilt on " STRING(TIMESTAMP); |
char *timestamp = "\nBuilt on " TIMESTAMP; |
#else |
char *timestamp = ""; |
#endif |
67,7 → 64,7 |
/** Prints bootloader version information. */ |
static void version_print(void) |
{ |
printf("HelenOS ARM32 Bootloader\nRelease %s%s%s\nCopyright (c) 2009 HelenOS project\n", |
printf("HelenOS ARM32 Bootloader\nRelease %s%s%s\nCopyright (c) 2007 HelenOS project\n", |
release, revision, timestamp); |
} |
87,37 → 84,31 |
printf(" kernel entry point at %L\n", KERNEL_VIRTUAL_ADDRESS); |
printf(" %L: boot info structure\n", &bootinfo); |
unsigned int i, j; |
for (i = 0; i < COMPONENTS; i++) { |
printf(" %L: %s image (size %d bytes)\n", |
components[i].start, components[i].name, components[i].size); |
} |
printf("\nCopying components\n"); |
unsigned int top = 0; |
bootinfo.cnt = 0; |
unsigned int i, j; |
for (i = 0; i < COMPONENTS; i++) { |
printf(" %s...", components[i].name); |
top = ALIGN_UP(top, KERNEL_PAGE_SIZE); |
memcpy(((void *) KERNEL_VIRTUAL_ADDRESS) + top, components[i].start, components[i].size); |
if (i > 0) { |
bootinfo.tasks[bootinfo.cnt].addr = ((void *) KERNEL_VIRTUAL_ADDRESS) + top; |
bootinfo.tasks[bootinfo.cnt].size = components[i].size; |
strncpy(bootinfo.tasks[bootinfo.cnt].name, |
components[i].name, BOOTINFO_TASK_NAME_BUFLEN); |
bootinfo.cnt++; |
} |
top += components[i].size; |
printf("done.\n"); |
} |
j = bootinfo.cnt - 1; |
printf("\nCopying components\n"); |
printf("Component\tAddress\t\tSize (Bytes)\n"); |
printf("============================================\n"); |
for (i = COMPONENTS - 1; i > 0; i--, j--) { |
printf("%s\t\t0x%x\t%d\n", components[i].name, bootinfo.tasks[j].addr, components[i].size); |
memcpy((void *)bootinfo.tasks[j].addr, components[i].start, |
components[i].size); |
} |
printf("KERNEL\t\t0x%x\t%d\n", KERNEL_VIRTUAL_ADDRESS, components[0].size); |
memcpy((void *)KERNEL_VIRTUAL_ADDRESS, components[0].start, |
components[0].size); |
printf("\nBooting the kernel...\n"); |
jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo); |
jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, &bootinfo, sizeof(bootinfo)); |
} |
/** @} |
/branches/arm/boot/arch/arm32/loader/asm.h |
---|
32,7 → 32,7 |
*/ |
/** @file |
* @brief Functions implemented in assembly. |
*/ |
*/ |
#ifndef BOOT_arm32_ASM_H |
40,10 → 40,10 |
/** Copies cnt bytes from dst to src. |
* |
* |
* @param dst Destination address. |
* @param src Source address. |
* @param cnt Count of bytes to be copied. |
* @param cnt Count of bytes to be copied. |
*/ |
#define memcpy(dst, src, cnt) __builtin_memcpy((dst), (src), (cnt)) |
58,11 → 58,12 |
/** Jumps to the kernel entry point. |
* |
* @param entry Kernel entry point address. |
* @param bootinfo Structure holding information about loaded tasks. |
* |
* @param entry Kernel entry point address. |
* @param bootinfo Structure holding information about loaded tasks. |
* @param bootinfo_size Size of the bootinfo structure. |
*/ |
extern void jump_to_kernel(void *entry, void *bootinfo) __attribute__((noreturn)); |
extern void jump_to_kernel(void *entry, void *bootinfo, |
unsigned int bootinfo_size) __attribute__((noreturn)); |
#endif |
/branches/arm/boot/arch/arm32/loader/main.h |
---|
32,7 → 32,7 |
*/ |
/** @file |
* @brief Boot related declarations. |
*/ |
*/ |
#ifndef BOOT_arm32_MAIN_H |
39,13 → 39,17 |
#define BOOT_arm32_MAIN_H |
/** Aligns to the nearest higher address. |
* |
* @param addr Address or number to be aligned. |
* @param align Size of alignment, must be power of 2. |
*/ |
#define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1)) |
/** Maximum number of tasks in the #bootinfo_t struct. */ |
#define TASKMAP_MAX_RECORDS 32 |
/** Size of buffer for storing task name in task_t. */ |
#define BOOTINFO_TASK_NAME_BUFLEN 32 |
/** Struct holding information about single loaded task. */ |
typedef struct { |
/** Address where the task was placed. */ |
52,8 → 56,6 |
void *addr; |
/** Size of the task's binary. */ |
unsigned int size; |
/** Task name. */ |
char name[BOOTINFO_TASK_NAME_BUFLEN]; |
} task_t; |
72,3 → 74,4 |
/** @} |
*/ |
/branches/arm/boot/arch/arm32/loader/print/print.c |
---|
File deleted |
Property changes: |
Deleted: svn:mergeinfo |
/branches/arm/boot/arch/arm32/loader/print/gxemul.c |
---|
0,0 → 1,70 |
/* |
* Copyright (c) 2007 Michal Kebrt |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup arm32boot |
* @{ |
*/ |
/** @file |
* @brief GXemul specific code. |
*/ |
#include <printf.h> |
/** Address where characters to be printed are expected. */ |
#define PUTC_ADDRESS 0x10000000 |
/** Prints a character to the console. |
* |
* @param ch Character to be printed. |
*/ |
static void putc(char ch) |
{ |
*((volatile char *) PUTC_ADDRESS) = ch; |
} |
/** Prints a string to the console. |
* |
* @param str String to be printed. |
* @param len Number of characters to be printed. |
*/ |
void write(const char *str, const int len) |
{ |
int i; |
for (i = 0; i < len; ++i) { |
putc(str[i]); |
} |
} |
/** @} |
*/ |