hrev44170 adds 2 changesets to branch 'master' old head: eb93f2661d536dcb074a0a4e49842227e3023427 new head: 693b3532c760383c08d5dd95fdae3b2e3c84dca3 ---------------------------------------------------------------------------- d86473d: Cleanup U-Boot global data struct * there are only a few members we can really rely on, the rest is compile-time dependant. * don't use ARM-specific stuff. 693b353: Sam460ex: Add a Linux-type kernel entry point * the onboard U-Booot and 2nd-stage loader only know a few OS types, we'll try faking Linux there. [ François Revol <revol@xxxxxxx> ] ---------------------------------------------------------------------------- 4 files changed, 89 insertions(+), 6 deletions(-) build/jam/board/sam460ex/BoardSetup | 5 +- headers/private/system/arch/ppc/asm_defs.h | 17 +++++ src/system/boot/platform/u-boot/arch/ppc/shell.S | 62 ++++++++++++++++++ src/system/boot/platform/u-boot/start.cpp | 11 ++-- ############################################################################ Commit: d86473dfb94ed15a65725e11311823096018f8e3 URL: http://cgit.haiku-os.org/haiku/commit/?id=d86473d Author: François Revol <revol@xxxxxxx> Date: Thu May 17 15:25:49 2012 UTC Cleanup U-Boot global data struct * there are only a few members we can really rely on, the rest is compile-time dependant. * don't use ARM-specific stuff. ---------------------------------------------------------------------------- diff --git a/src/system/boot/platform/u-boot/start.cpp b/src/system/boot/platform/u-boot/start.cpp index 175039e..559fbc0 100644 --- a/src/system/boot/platform/u-boot/start.cpp +++ b/src/system/boot/platform/u-boot/start.cpp @@ -25,16 +25,19 @@ #define HEAP_SIZE (128 * 1024) -typedef struct uboot_arm_gd { +typedef struct uboot_gd { + // those are the only few members that we can trust + // others depend on compile-time config struct board_data *bd; uint32 flags; uint32 baudrate; + // those are ARM-only uint32 have_console; uint32 reloc_off; uint32 env_addr; uint32 env_valid; uint32 fb_base; -} uboot_arm_gd; +} uboot_gd; // GCC defined globals @@ -50,7 +53,7 @@ extern "C" void dump_uimage(struct image_header *image); // declared in shell.S extern struct image_header *gUImage; -extern uboot_arm_gd *gUBootGlobalData; +extern uboot_gd *gUBootGlobalData; extern uint32 gUBootOS; static uint32 sBootOptions; @@ -181,7 +184,7 @@ start_raw(int argc, const char **argv) dprintf("os: %d\n", gUBootOS); dprintf("gd @ %p\n", gUBootGlobalData); dprintf("gd->bd @ %p\n", gUBootGlobalData->bd); - dprintf("fb_base %p\n", (void*)gUBootGlobalData->fb_base); + //dprintf("fb_base %p\n", (void*)gUBootGlobalData->fb_base); dprintf("uimage @ %p\n", gUImage); if (gUImage) dump_uimage(gUImage); ############################################################################ Revision: hrev44170 Commit: 693b3532c760383c08d5dd95fdae3b2e3c84dca3 URL: http://cgit.haiku-os.org/haiku/commit/?id=693b353 Author: François Revol <revol@xxxxxxx> Date: Thu May 17 15:36:19 2012 UTC Sam460ex: Add a Linux-type kernel entry point * the onboard U-Booot and 2nd-stage loader only know a few OS types, we'll try faking Linux there. ---------------------------------------------------------------------------- diff --git a/build/jam/board/sam460ex/BoardSetup b/build/jam/board/sam460ex/BoardSetup index d634371..e80a3e0 100644 --- a/build/jam/board/sam460ex/BoardSetup +++ b/build/jam/board/sam460ex/BoardSetup @@ -13,8 +13,9 @@ HAIKU_BOOT_PLATFORM = u-boot ; # load address for haiku_loader HAIKU_BOARD_LOADER_BASE = 0x00000000 ; # entry points (raw binary, and netbsd loader emulation) -HAIKU_BOARD_LOADER_ENTRY_RAW = 0x00000000 ; -HAIKU_BOARD_LOADER_ENTRY_NBSD = 0x00000008 ; +HAIKU_BOARD_LOADER_ENTRY_LINUX = 0x00000000 ; +#HAIKU_BOARD_LOADER_ENTRY_NBSD = 0x00000008 ; +#HAIKU_BOARD_LOADER_ENTRY_RAW = 0x00000010 ; # load address for haiku_loader uimage # (must be different than real load address) diff --git a/headers/private/system/arch/ppc/asm_defs.h b/headers/private/system/arch/ppc/asm_defs.h new file mode 100644 index 0000000..798fa02 --- /dev/null +++ b/headers/private/system/arch/ppc/asm_defs.h @@ -0,0 +1,17 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold@xxxxxxx + * Distributed under the terms of the MIT License. + */ +#ifndef SYSTEM_ARCH_X86_ASM_DEFS_H +#define SYSTEM_ARCH_X86_ASM_DEFS_H + + +#define SYMBOL(name) .global name; name +#define SYMBOL_END(name) 1: .size name, 1b - name +#define STATIC_FUNCTION(name) .type name, @function; name +#define FUNCTION(name) .global name; .type name, @function; name +#define FUNCTION_END(name) 1: .size name, 1b - name + + +#endif /* SYSTEM_ARCH_X86_ASM_DEFS_H */ + diff --git a/src/system/boot/platform/u-boot/arch/ppc/shell.S b/src/system/boot/platform/u-boot/arch/ppc/shell.S new file mode 100644 index 0000000..3007373 --- /dev/null +++ b/src/system/boot/platform/u-boot/arch/ppc/shell.S @@ -0,0 +1,62 @@ +//#include <arch/ppc/arch_cpu.h> + +#include <asm_defs.h> + + + .text + +/* + * Entry points to the loader that U-Boot passes control to. + */ + +/* + * called as Linux kernel entry + * *MUST* be first symbol + */ +SYMBOL(_start_linux): +/* + * ELF entry + */ +SYMBOL(_start): + + li %r11, 0 + b _start_common + +SYMBOL_END(_start_linux) +SYMBOL_END(_start) + + + + + +SYMBOL(_start_common): + + lis %r12, gUBootGlobalData@ha + ori %r12, %r12, gUBootGlobalData@l + stw %r2, 0(%r12) + stw %r11, 8(%r12) // gUBootOS + + b start_linux_ppc_fdt + + // return + blr +SYMBOL_END(_start_common) + + +//XXX: doesn't seem to work +//.data + + +SYMBOL(gUBootGlobalData): + .long 0 +SYMBOL_END(gUBootGlobalData) +SYMBOL(gUImage): + .long 0 +SYMBOL_END(gUImage) +SYMBOL(gUBootOS): +//XXX: bug? Using .byte makes the next asm symbol +// to be at the same address +// .byte 0 + .long 0 +SYMBOL_END(gUBootOS) +