diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index 70e9ed1fad..4d719e7bbd 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -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) ; } diff --git a/src/system/boot/platform/u-boot/arch/arm/shell.S b/src/system/boot/platform/u-boot/arch/arm/shell.S new file mode 100644 index 0000000000..effd4f3a1c --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/arm/shell.S @@ -0,0 +1,57 @@ +#include + +#include + + + .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) + diff --git a/src/system/boot/platform/u-boot/start.S b/src/system/boot/platform/u-boot/start.S deleted file mode 100644 index 42cb2266c2..0000000000 --- a/src/system/boot/platform/u-boot/start.S +++ /dev/null @@ -1,13 +0,0 @@ -#include - -#include - - -/* - * 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 diff --git a/src/system/boot/platform/u-boot/start2.c b/src/system/boot/platform/u-boot/start2.c index a196c3cae2..ccecf5879d 100644 --- a/src/system/boot/platform/u-boot/start2.c +++ b/src/system/boot/platform/u-boot/start2.c @@ -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