- cleanup,
- moved the startup asm code to u-boot/arch/arm/shell.S
- added netbsd loader entry point,
- store the invocation type (0: standalone, 1: netbsd),
- store the global data in a variable,
- added some debug code to see what U-Boot gives us.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32291 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2009-08-13 01:15:21 +00:00
parent cd5d972ea0
commit 1e33c1136e
4 changed files with 110 additions and 17 deletions

View File

@ -24,7 +24,6 @@ local librootFunctions =
local extraLinkerArgs = ;
if $(HAIKU_BOARD_LOADER_BASE) {
#extraLinkerArgs += -L$(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/board/$(TARGET_BOOT_BOARD) ;
extraLinkerArgs += --defsym BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ;
}

View File

@ -0,0 +1,57 @@
#include <arch/arm/arch_cpu.h>
#include <asm_defs.h>
.text
/*
* Entry points to the loader that U-Boot passes control to.
*/
/*
* called as standalone (raw binary)
* *MUST* be first symbol
*/
SYMBOL(_start_raw):
/*
* ELF entry
*/
SYMBOL(_start):
mov r0,#0
b _start_common
SYMBOL_END(_start_raw)
SYMBOL_END(_start)
/*
* called from bootm with netbsd loader compatible args
*/
SYMBOL(_start_netbsd):
mov r0,#1
b _start_common
SYMBOL_END(_start_netbsd)
SYMBOL(_start_common):
strb r0,gUBootOS
str r8,gUBootGlobalData
/* ... */
ldrb r0,gUBootOS
cmp r0,#0
beq start_raw
cmp r0,#1
beq start_netbsd
mov pc,lr
SYMBOL_END(_start_common)
SYMBOL(gUBootGlobalData):
.long 0
SYMBOL_END(gUBootGlobalData)
SYMBOL(gUBootOS):
.byte 0
SYMBOL_END(gUBootOS)

View File

@ -1,13 +0,0 @@
#include <arch/arm/arch_cpu.h>
#include <asm_defs.h>
/*
* Entry point to the loader that U-Boot passes control to.
*/
.text
.globl _start
_start:
/* I'm to stupid to get _start in a c file to work ..... */
b start2

View File

@ -29,7 +29,8 @@ extern uint8 __bss_start;
extern uint8 _end;
extern int main(stage2_args *args);
void _start(void);
extern void _start(void);
extern int start_raw(int argc, char **argv);
uint32 sBootOptions;
@ -53,6 +54,12 @@ call_ctors(void)
}
/* needed for libgcc unwind XXX */
void
abort(void)
{
panic("abort");
}
void
@ -93,8 +100,40 @@ platform_exit(void)
}
void
start2(void)
typedef struct uboot_arm_gd {
struct board_data *bd;
uint32 flags;
uint32 baudrate;
uint32 have_console;
uint32 reloc_off;
uint32 env_addr;
uint32 env_valid;
uint32 fb_base;
} uboot_arm_gd;
register volatile uboot_arm_gd *gGD asm ("r8");
extern uboot_arm_gd *gUBootGlobalData;
extern uint8 gUBootOS;
int
start_netbsd(struct board_info *bd, struct uimage *image, const char *consdev,
const char *cmdline)
{
const char *argv[] = { "haiku", cmdline };
int argc = 1;
if (cmdline)
argc++;
start_raw(argc, argv);
}
int
start_linux(int argc, int archnum, void *atags)
{
}
int
start_raw(int argc, char **argv)
{
stage2_args args;
@ -108,6 +147,17 @@ start2(void)
serial_init();
console_init();
cpu_init();
{ //DEBUG:
int i;
dprintf("argc = %d\n", argc);
for (i = 0; i < argc; i++)
dprintf("argv[%d] @%lx = '%s'\n", i, (uint32)argv[i], argv[i]);
dprintf("os: %d\n", gUBootOS);
dprintf("gd @ %p\n", gGD);
dprintf("gd->bd @ %p\n", gGD->bd);
}
// mmu_init();
// wait a bit to give the user the opportunity to press a key