diff --git a/Jamrules b/Jamrules index c8f6182603..711d802298 100644 --- a/Jamrules +++ b/Jamrules @@ -44,6 +44,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; diff --git a/build/jam/BootRules b/build/jam/BootRules new file mode 100644 index 0000000000..fde7d54313 --- /dev/null +++ b/build/jam/BootRules @@ -0,0 +1,129 @@ + +rule SetupBoot +{ + # Usage SetupBoot : : ; + # + # - Ideally sources, otherwise HDRSEARCH can not be + # set for the sources and the sources some header + # dependencies might be missing. + + local sources = [ FGristFiles $(1) ] ; + local objects = $(sources:S=$(SUFOBJ)) ; + + # add private kernel headers + if $(3) != false { + SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ; + } + + local object ; + for object in $(objects) { + # add boot flags for the object + ObjectCcFlags $(object) : $(TARGET_BOOT_CCFLAGS) $(2) ; + ObjectC++Flags $(object) : $(TARGET_BOOT_C++FLAGS) $(2) ; + ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ; + ASFLAGS on $(object) = $(TARGET_BOOT_CCFLAGS) ; + + # override warning flags + TARGET_WARNING_CCFLAGS on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ; + TARGET_WARNING_C++FLAGS on $(object) + = $(TARGET_KERNEL_WARNING_C++FLAGS) ; + } +} + +rule BootObjects +{ + SetupBoot $(1) : $(2) ; + Objects $(1) ; +} + +rule BootLd +{ + # BootLd : : : ; + + LINK on $(1) = $(TARGET_LD) ; + + LINKFLAGS on $(1) = $(4) ; + if $(3) { LINKFLAGS on $(1) += --script=$(3) ; } + + # Remove any preset LINKLIBS, but link against libgcc.a. Linking against + # libsupc++ is opt-out. + local libs ; + if ! [ on $(1) return HAIKU_NO_LIBSUPC++ ] { + libs += $(TARGET_BOOT_LIBSUPC++) ; + } + LINKLIBS on $(1) = $(libs) $(TARGET_BOOT_LIBGCC) ; + + # TODO: Do we really want to invoke SetupBoot here? The objects should + # have been compiled with BootObjects anyway, so we're doing that twice. + SetupBoot $(2) ; + + # Show that we depend on the libraries we need + LocalClean clean : $(1) ; + LocalDepends all : $(1) ; + Depends $(1) : $(2) ; + + MakeLocateDebug $(1) ; + + on $(1) XRes $(1) : $(RESFILES) ; + if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] { + SetType $(1) ; + MimeSet $(1) ; + SetVersion $(1) ; + } +} + +actions BootLd bind VERSION_SCRIPT +{ + $(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) \ + --version-script=$(VERSION_SCRIPT) +} + +rule BootMergeObject +{ + # BootMergeObject : : : ; + # Compiles source files and merges the object files to an object file. + # : Name of the object file to create. No grist will be added. + # : Sources to be compiled. Grist will be added. + # : Additional flags for compilation. + # : Object files or static libraries to be merged. No grist + # will be added. + # + + SetupBoot $(2) : $(3) ; + Objects $(2) ; + MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ; + LINKFLAGS on $(1) += $(TARGET_BOOT_LINKFLAGS) ; +} + +rule BootStaticLibrary +{ + # Usage BootStaticLibrary : : ; + # This is designed to take a set of sources and libraries and create + # a file called lib.a + + SetupBoot $(2) : $(3) : false ; + Library $(1) : $(2) ; +} + +rule BootStaticLibraryObjects +{ + # Usage BootStaticLibrary : ; + # This is designed to take a set of sources and libraries and create + # a file called + + # Show that we depend on the libraries we need + SetupBoot $(2) ; + LocalClean clean : $(1) ; + LocalDepends all : $(1) ; + Depends $(1) : $(2) ; + + MakeLocateDebug $(1) ; +} + +actions BootStaticLibraryObjects +{ + # Force recreation of the archive to avoid build errors caused by + # stale dependencies after renaming or deleting object files. + $(RM) "$(1)" + $(HAIKU_AR) -r "$(1)" "$(2)" ; +} diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index dd4a91d91e..6a564e7ff9 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -159,10 +159,13 @@ if $(HAIKU_GCC_VERSION[1]) = 2 { HAIKU_C++ ?= $(HAIKU_CC) ; HAIKU_LINK = $(HAIKU_CC) ; HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; +HAIKU_BOOT_LINKFLAGS = ; HAIKU_HDRS = [ FStandardHeaders ] ; HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ; HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ; +HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ; +HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ; HAIKU_CCFLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; HAIKU_C++FLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; HAIKU_DEFINES = __HAIKU__ ; @@ -249,7 +252,6 @@ switch $(HAIKU_CPU) { } case x86_64 : { - HAIKU_DEFINES += __x86_64__ ; HAIKU_BOOT_PLATFORM = bios_ia32 ; HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB # offset in floppy image (>= sizeof(haiku_loader)) @@ -329,6 +331,8 @@ HAIKU_ASFLAGS = ; HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin ; HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions ; HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; +HAIKU_BOOT_CCFLAGS += -finline -fno-builtin ; +HAIKU_BOOT_C++FLAGS += -finline -fno-builtin -fno-exceptions ; if $(HAIKU_GCC_VERSION[1]) >= 3 { HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ; @@ -340,6 +344,8 @@ if $(HAIKU_GCC_VERSION[1]) >= 4 { if $(HAIKU_GCC_VERSION[2]) >= 3 { HAIKU_KERNEL_CCFLAGS += -ffreestanding ; HAIKU_KERNEL_C++FLAGS += -ffreestanding ; + HAIKU_BOOT_CCFLAGS += -ffreestanding ; + HAIKU_BOOT_C++FLAGS += -ffreestanding ; } } @@ -377,6 +383,15 @@ switch $(HAIKU_ARCH) { } case x86_64 : { + # Kernel lives in the top 2GB of the address space, use kernel code model. + HAIKU_KERNEL_CCFLAGS += -mcmodel=kernel ; + HAIKU_KERNEL_C++FLAGS += -mcmodel=kernel ; + + # Bootloader is 32-bit. + HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ; + HAIKU_BOOT_CCFLAGS += -m32 ; + HAIKU_BOOT_C++FLAGS += -m32 ; + # Enable use of the gcc built-in atomic functions instead of atomic_*(). # The former are inlined and have thus less overhead. HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ; @@ -962,6 +977,7 @@ local buildVars = KERNEL_CCFLAGS KERNEL_C++FLAGS KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS + BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS WARNING_CCFLAGS WARNING_C++FLAGS KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS @@ -998,6 +1014,9 @@ if $(TARGET_PLATFORM) = haiku { TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ; TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ; + TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC) ; + TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++) ; + TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ; TARGET_BOOT_BOARD ?= $(HAIKU_BOOT_BOARD) ; @@ -1014,6 +1033,9 @@ if $(TARGET_PLATFORM) = haiku { TARGET_GCC_LIBGCC = ; TARGET_GCC_LIBGCC_OBJECTS = ; + TARGET_BOOT_LIBGCC = ; + TARGET_BOOT_LIBSUPC++ = ; + TARGET_BOOT_PLATFORM = ; TARGET_BOOT_BOARD = ; diff --git a/configure b/configure index 9d6ca5a3da..48911b31f3 100755 --- a/configure +++ b/configure @@ -242,6 +242,14 @@ standard_gcc_settings() fi ;; esac + + if [ "$targetArch" = "x86_64" ]; then + HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name` + HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a` + else + HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC + HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX + fi } # set_default_value @@ -549,6 +557,9 @@ HAIKU_STATIC_LIBSUPC++ ?= ${HAIKU_STATIC_LIBSUPCXX} ; HAIKU_SHARED_LIBSUPC++ ?= ${HAIKU_SHARED_LIBSUPCXX} ; HAIKU_C++_HEADERS_DIR ?= ${HAIKU_CXX_HEADERS_DIR} ; +HAIKU_BOOT_LIBGCC ?= ${HAIKU_BOOT_LIBGCC} ; +HAIKU_BOOT_LIBSUPC++ ?= ${HAIKU_BOOT_LIBSUPCXX} ; + HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ; HAIKU_AR ?= ${HAIKU_AR} ; diff --git a/headers/private/kernel/arch/x86/apm.h b/headers/private/kernel/arch/x86/apm.h index 905ac0d249..675ed5a6be 100644 --- a/headers/private/kernel/arch/x86/apm.h +++ b/headers/private/kernel/arch/x86/apm.h @@ -7,7 +7,7 @@ #include -#include +#include struct kernel_args; diff --git a/headers/private/kernel/arch/x86_64/arch_cpu.h b/headers/private/kernel/arch/x86_64/arch_cpu.h new file mode 100644 index 0000000000..dfdfe6ad73 --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_cpu.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_CPU_H +#define _KERNEL_ARCH_x86_64_CPU_H + +#include "../x86/arch_cpu.h" + +#endif /* _KERNEL_ARCH_x86_64_CPU_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_int.h b/headers/private/kernel/arch/x86_64/arch_int.h new file mode 100644 index 0000000000..cd1f423f15 --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_int.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_INT_H +#define _KERNEL_ARCH_x86_64_INT_H + +#include "../x86/arch_int.h" + +#endif /* _KERNEL_ARCH_x86_64_INT_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_kernel.h b/headers/private/kernel/arch/x86_64/arch_kernel.h new file mode 100644 index 0000000000..40d55a3ac4 --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_kernel.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_KERNEL_H +#define _KERNEL_ARCH_x86_64_KERNEL_H + +#include "../x86/arch_kernel.h" + +#endif /* _KERNEL_ARCH_x86_64_KERNEL_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_kernel_args.h b/headers/private/kernel/arch/x86_64/arch_kernel_args.h new file mode 100644 index 0000000000..ecb2638c9a --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_kernel_args.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_KERNEL_ARGS_H +#define _KERNEL_ARCH_x86_64_KERNEL_ARGS_H + +#include "../x86/arch_kernel_args.h" + +#endif /* _KERNEL_ARCH_x86_64_KERNEL_ARGS_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_system_info.h b/headers/private/kernel/arch/x86_64/arch_system_info.h new file mode 100644 index 0000000000..aeee330486 --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_system_info.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_SYSTEM_INFO_H +#define _KERNEL_ARCH_x86_64_SYSTEM_INFO_H + +#include "../x86/arch_system_info.h" + +#endif /* _KERNEL_ARCH_x86_64_SYSTEM_INFO_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_thread.h b/headers/private/kernel/arch/x86_64/arch_thread.h new file mode 100644 index 0000000000..0776b2865c --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_thread.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_THREAD_H +#define _KERNEL_ARCH_x86_64_THREAD_H + +#include "../x86/arch_thread.h" + +#endif /* _KERNEL_ARCH_x86_64_THREAD_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_thread_types.h b/headers/private/kernel/arch/x86_64/arch_thread_types.h new file mode 100644 index 0000000000..f0dc013900 --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_thread_types.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_THREAD_TYPES_H +#define _KERNEL_ARCH_x86_64_THREAD_TYPES_H + +#include "../x86/arch_thread_types.h" + +#endif /* _KERNEL_ARCH_x86_64_THREAD_TYPES_H */ diff --git a/headers/private/kernel/arch/x86_64/arch_user_debugger.h b/headers/private/kernel/arch/x86_64/arch_user_debugger.h new file mode 100644 index 0000000000..9491ef5013 --- /dev/null +++ b/headers/private/kernel/arch/x86_64/arch_user_debugger.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_USER_DEBUGGER_H +#define _KERNEL_ARCH_x86_64_USER_DEBUGGER_H + +#include "../x86/arch_user_debugger.h" + +#endif /* _KERNEL_ARCH_x86_64_USER_DEBUGGER_H */ diff --git a/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h b/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h index e66bebe92c..1b0ff82075 100644 --- a/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h +++ b/headers/private/kernel/boot/platform/bios_ia32/platform_kernel_args.h @@ -10,7 +10,7 @@ #endif -#include +#include #include diff --git a/headers/private/system/arch/x86_64/arch_config.h b/headers/private/system/arch/x86_64/arch_config.h new file mode 100644 index 0000000000..e788a335d0 --- /dev/null +++ b/headers/private/system/arch/x86_64/arch_config.h @@ -0,0 +1,15 @@ +/* + * Copyright 2004, Alex Smith, alex@alex-smith.me.uk. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_ARCH_x86_64_CONFIG_H +#define _KERNEL_ARCH_x86_64_CONFIG_H + +#define FUNCTION_CALL_PARAMETER_ALIGNMENT_TYPE unsigned long + +#define STACK_GROWS_DOWNWARDS + +//#define ATOMIC_FUNCS_ARE_SYSCALLS +//#define ATOMIC64_FUNCS_ARE_SYSCALLS + +#endif /* _KERNEL_ARCH_x86_64_CONFIG_H */ diff --git a/headers/private/system/arch/x86_64/arch_elf.h b/headers/private/system/arch/x86_64/arch_elf.h new file mode 100644 index 0000000000..410c003706 --- /dev/null +++ b/headers/private/system/arch/x86_64/arch_elf.h @@ -0,0 +1,6 @@ +#ifndef _KERNEL_ARCH_x86_64_ELF_H +#define _KERNEL_ARCH_x86_64_ELF_H + +#include "../x86/arch_elf.h" + +#endif /* _KERNEL_ARCH_x86_64_ELF_H */ diff --git a/headers/private/system/arch/x86_64/asm_defs.h b/headers/private/system/arch/x86_64/asm_defs.h new file mode 100644 index 0000000000..26d13c5691 --- /dev/null +++ b/headers/private/system/arch/x86_64/asm_defs.h @@ -0,0 +1,17 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef SYSTEM_ARCH_X86_64_ASM_DEFS_H +#define SYSTEM_ARCH_X86_64_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_64_ASM_DEFS_H */ + diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index ad8d151046..548883adb4 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -1,27 +1,37 @@ SubDir HAIKU_TOP src system boot ; -local librootFunctions = - abs.o - ctype.o - LocaleData.o - qsort.o - kernel_vsprintf.o - memcmp.o - memmove.o - strdup.o - strndup.o - strlen.o - strnlen.o - strcmp.o - strcasecmp.o - strncmp.o - strcat.o - strcpy.o - strlcat.o - strlcpy.o - strchr.o - strrchr.o - strtol.o +DEFINES += _BOOT_MODE ; + +SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ; + +UsePrivateHeaders [ FDirName libroot locale ] ; + +BootMergeObject boot_libroot.o : + abs.c + ctype.cpp + LocaleData.cpp + qsort.c + kernel_vsprintf.cpp + memcmp.c + memmove.c + strdup.c + strndup.cpp + strlen.cpp + strnlen.cpp + strcmp.c + strcasecmp.c + strncmp.c + strcat.c + strcpy.c + strlcat.c + strlcpy.c + strchr.c + strrchr.c + strtol.c + : -fno-pic ; local extraLinkerArgs = ; @@ -31,7 +41,7 @@ if $(HAIKU_BOARD_LOADER_BASE) { AddResources haiku_loader : boot_loader.rdef ; -KernelLd boot_loader_$(TARGET_BOOT_PLATFORM) : +BootLd boot_loader_$(TARGET_BOOT_PLATFORM) : boot_platform_$(TARGET_BOOT_PLATFORM).o boot_arch_$(TARGET_ARCH).o boot_loader.a @@ -47,9 +57,8 @@ KernelLd boot_loader_$(TARGET_BOOT_PLATFORM) : # needed by tarfs and video_splash.cpp boot_zlib.a - # libroot functions needed by the stage2 boot loader (compiled for the - # kernel) - $(librootFunctions:G=src!system!kernel!lib) + # libroot functions needed by the stage2 boot loader + boot_libroot.o : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld : -Bstatic $(extraLinkerArgs) diff --git a/src/system/boot/arch/arm/Jamfile b/src/system/boot/arch/arm/Jamfile index cd3dd05748..d035c41a1f 100644 --- a/src/system/boot/arch/arm/Jamfile +++ b/src/system/boot/arch/arm/Jamfile @@ -22,7 +22,7 @@ local kernelLibArchObjects = memset.o ; -KernelMergeObject boot_arch_$(TARGET_ARCH).o : +BootMergeObject boot_arch_$(TARGET_ARCH).o : debug_uart_8250.cpp arch_uart_8250.cpp arch_uart_pl011.cpp diff --git a/src/system/boot/arch/m68k/Jamfile b/src/system/boot/arch/m68k/Jamfile index a63209089a..349a350722 100644 --- a/src/system/boot/arch/m68k/Jamfile +++ b/src/system/boot/arch/m68k/Jamfile @@ -13,7 +13,7 @@ local kernelLibArchObjects = memset.o ; -KernelMergeObject boot_arch_$(TARGET_ARCH).o : +BootMergeObject boot_arch_$(TARGET_ARCH).o : arch_elf.cpp $(librootArchObjects) : -fno-pic @@ -21,17 +21,17 @@ KernelMergeObject boot_arch_$(TARGET_ARCH).o : $(kernelLibArchObjects) ; -KernelMergeObject boot_arch_$(TARGET_ARCH)_030.o : +BootMergeObject boot_arch_$(TARGET_ARCH)_030.o : mmu_030.cpp : -fno-pic -Wno-unused -m68030 ; -KernelMergeObject boot_arch_$(TARGET_ARCH)_040.o : +BootMergeObject boot_arch_$(TARGET_ARCH)_040.o : mmu_040.cpp : -fno-pic -Wno-unused -m68040 ; -KernelMergeObject boot_arch_$(TARGET_ARCH)_060.o : +BootMergeObject boot_arch_$(TARGET_ARCH)_060.o : mmu_060.cpp : -fno-pic -Wno-unused -m68060 ; diff --git a/src/system/boot/arch/mipsel/Jamfile b/src/system/boot/arch/mipsel/Jamfile index 55f63e6d73..33f0198b1d 100644 --- a/src/system/boot/arch/mipsel/Jamfile +++ b/src/system/boot/arch/mipsel/Jamfile @@ -8,7 +8,7 @@ local kernelLibArchObjects = memset.o ; -KernelMergeObject boot_arch_$(TARGET_ARCH).o : +BootMergeObject boot_arch_$(TARGET_ARCH).o : arch_elf.cpp : # additional flags : diff --git a/src/system/boot/arch/ppc/Jamfile b/src/system/boot/arch/ppc/Jamfile index c2b817b54c..07ad229e62 100644 --- a/src/system/boot/arch/ppc/Jamfile +++ b/src/system/boot/arch/ppc/Jamfile @@ -15,7 +15,7 @@ local kernelLibArchObjects = memset.o ; -KernelMergeObject boot_arch_$(TARGET_ARCH).o : +BootMergeObject boot_arch_$(TARGET_ARCH).o : debug_uart_8250.cpp arch_uart_8250.cpp arch_elf.cpp diff --git a/src/system/boot/arch/x86/Jamfile b/src/system/boot/arch/x86/Jamfile index 7315dc73fe..21eb0ac506 100644 --- a/src/system/boot/arch/x86/Jamfile +++ b/src/system/boot/arch/x86/Jamfile @@ -18,7 +18,7 @@ local kernelLibArchObjects = byteorder.o ; -KernelMergeObject boot_arch_$(TARGET_ARCH).o : +BootMergeObject boot_arch_$(TARGET_ARCH).o : $(kernelArchSources) $(kernelLibArchSources) : # additional flags diff --git a/src/system/boot/arch/x86_64/Jamfile b/src/system/boot/arch/x86_64/Jamfile new file mode 100644 index 0000000000..dae289606e --- /dev/null +++ b/src/system/boot/arch/x86_64/Jamfile @@ -0,0 +1,30 @@ +SubDir HAIKU_TOP src system boot arch x86_64 ; + +DEFINES += _BOOT_MODE ; + +local kernelArchSources = + arch_elf.cpp + cpuid.S +; + +local kernelLibArchSources = + arch_string.S +; + +local librootOsArchSources = + byteorder.S +; + +BootMergeObject boot_arch_$(TARGET_ARCH).o : + $(kernelArchSources) + $(kernelLibArchSources) + $(librootOsArchSources) + : # additional flags +; + +SEARCH on [ FGristFiles $(kernelArchSources) ] + = [ FDirName $(HAIKU_TOP) src system kernel arch x86 ] ; +SEARCH on [ FGristFiles $(kernelLibArchSources) ] + = [ FDirName $(HAIKU_TOP) src system kernel lib arch x86 ] ; +SEARCH on [ FGristFiles $(librootOsArchSources) ] + = [ FDirName $(HAIKU_TOP) src system libroot os arch x86 ] ; diff --git a/src/system/boot/loader/Jamfile b/src/system/boot/loader/Jamfile index 671ca94580..1cb962c7d7 100644 --- a/src/system/boot/loader/Jamfile +++ b/src/system/boot/loader/Jamfile @@ -50,7 +50,7 @@ UsePrivateHeaders shared storage ; SubDirC++Flags $(defines) -fno-rtti ; } -KernelStaticLibrary boot_loader : +BootStaticLibrary boot_loader : elf.cpp heap.cpp kernel_args.cpp @@ -81,7 +81,7 @@ KernelStaticLibrary boot_loader : # The partition support is built in an extra static library # so that only the ones that are used will be included. -KernelStaticLibrary boot_partitions : +BootStaticLibrary boot_partitions : FileMapDisk.cpp amiga_rdb.cpp apple.cpp diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile index 222c7755b8..1b2d8bbc27 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile +++ b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders kernel storage ; SubDirC++Flags -fno-rtti ; -KernelStaticLibrary boot_amiga_ffs : +BootStaticLibrary boot_amiga_ffs : amiga_ffs.cpp Volume.cpp Directory.cpp diff --git a/src/system/boot/loader/file_systems/bfs/Jamfile b/src/system/boot/loader/file_systems/bfs/Jamfile index f5840e9e48..e91cf720d1 100644 --- a/src/system/boot/loader/file_systems/bfs/Jamfile +++ b/src/system/boot/loader/file_systems/bfs/Jamfile @@ -10,7 +10,7 @@ local defines = [ FDefines _BOOT_MODE ] ; SubDirCcFlags $(defines) ; SubDirC++Flags -fno-rtti $(defines) ; -KernelStaticLibrary boot_bfs : +BootStaticLibrary boot_bfs : bfs.cpp Directory.cpp File.cpp diff --git a/src/system/boot/loader/file_systems/fat/Jamfile b/src/system/boot/loader/file_systems/fat/Jamfile index 69aee03778..52de886b8c 100644 --- a/src/system/boot/loader/file_systems/fat/Jamfile +++ b/src/system/boot/loader/file_systems/fat/Jamfile @@ -13,7 +13,7 @@ local defines = [ FDefines _BOOT_MODE ] ; SubDirCcFlags $(defines) ; SubDirC++Flags -fno-rtti $(defines) ; -KernelStaticLibrary boot_fatfs : +BootStaticLibrary boot_fatfs : fatfs.cpp Volume.cpp CachedBlock.cpp diff --git a/src/system/boot/loader/file_systems/hfs_plus/Jamfile b/src/system/boot/loader/file_systems/hfs_plus/Jamfile index 9a02d8a6ff..13bbb378ac 100644 --- a/src/system/boot/loader/file_systems/hfs_plus/Jamfile +++ b/src/system/boot/loader/file_systems/hfs_plus/Jamfile @@ -6,7 +6,7 @@ UsePrivateHeaders kernel storage ; SubDirC++Flags -fno-rtti ; -KernelStaticLibrary boot_hfs_plus : +BootStaticLibrary boot_hfs_plus : hfs_plus.cpp : -fno-pic ; diff --git a/src/system/boot/loader/file_systems/tarfs/Jamfile b/src/system/boot/loader/file_systems/tarfs/Jamfile index 0b7008aa77..4e7f4793d3 100644 --- a/src/system/boot/loader/file_systems/tarfs/Jamfile +++ b/src/system/boot/loader/file_systems/tarfs/Jamfile @@ -14,7 +14,7 @@ SubDirC++Flags -fno-rtti $(defines) ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src libs zlib ] ; -KernelStaticLibrary boot_zlib : +BootStaticLibrary boot_zlib : inflate.c inffast.c inftrees.c @@ -25,7 +25,7 @@ KernelStaticLibrary boot_zlib : ; -KernelStaticLibrary boot_tarfs : +BootStaticLibrary boot_tarfs : tarfs.cpp : -fno-pic ; diff --git a/src/system/boot/loader/net/Jamfile b/src/system/boot/loader/net/Jamfile index dda66c0fa7..5bb8291a3f 100644 --- a/src/system/boot/loader/net/Jamfile +++ b/src/system/boot/loader/net/Jamfile @@ -12,7 +12,7 @@ if $(TARGET_ARCH) = ppc { iscsi = iSCSITarget.cpp ; } -KernelStaticLibrary boot_net : +BootStaticLibrary boot_net : ARP.cpp ChainBuffer.cpp Ethernet.cpp diff --git a/src/system/boot/platform/amiga_m68k/Jamfile b/src/system/boot/platform/amiga_m68k/Jamfile index 9f223dd3cc..b867ef7f6f 100644 --- a/src/system/boot/platform/amiga_m68k/Jamfile +++ b/src/system/boot/platform/amiga_m68k/Jamfile @@ -19,13 +19,13 @@ UsePrivateHeaders [ FDirName storage ] ; #SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -KernelMergeObject boot_platform_amiga_m68k_shell.o : +BootMergeObject boot_platform_amiga_m68k_shell.o : shell.S : -Wa,--pcrel ; -KernelMergeObject boot_platform_amiga_m68k_other.o : +BootMergeObject boot_platform_amiga_m68k_other.o : # shell.S start.cpp rom_calls.cpp @@ -54,7 +54,7 @@ KernelMergeObject boot_platform_amiga_m68k_other.o : ; -KernelMergeObject boot_platform_amiga_m68k.o : +BootMergeObject boot_platform_amiga_m68k.o : : : boot_platform_amiga_m68k_shell.o boot_platform_amiga_m68k_other.o diff --git a/src/system/boot/platform/atari_m68k/Jamfile b/src/system/boot/platform/atari_m68k/Jamfile index 287666bf85..b71de5a25d 100644 --- a/src/system/boot/platform/atari_m68k/Jamfile +++ b/src/system/boot/platform/atari_m68k/Jamfile @@ -19,7 +19,7 @@ UsePrivateHeaders [ FDirName storage ] ; #SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -KernelMergeObject boot_platform_atari_m68k_shell.o : +BootMergeObject boot_platform_atari_m68k_shell.o : shell.S : -Wa,--pcrel ; @@ -30,7 +30,7 @@ KernelMergeObject boot_platform_atari_m68k_shell.o : # TODO: add 020+68851 support -KernelMergeObject boot_platform_atari_m68k_other.o : +BootMergeObject boot_platform_atari_m68k_other.o : # shell.S start.cpp toscalls.cpp @@ -59,7 +59,7 @@ KernelMergeObject boot_platform_atari_m68k_other.o : ; -KernelMergeObject boot_platform_atari_m68k.o : +BootMergeObject boot_platform_atari_m68k.o : : : boot_platform_atari_m68k_shell.o boot_platform_atari_m68k_other.o diff --git a/src/system/boot/platform/bios_ia32/Jamfile b/src/system/boot/platform/bios_ia32/Jamfile index 9219e5b392..6c0c273f88 100644 --- a/src/system/boot/platform/bios_ia32/Jamfile +++ b/src/system/boot/platform/bios_ia32/Jamfile @@ -17,7 +17,7 @@ UsePrivateHeaders [ FDirName storage ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -KernelMergeObject boot_platform_bios_ia32.o : +BootMergeObject boot_platform_bios_ia32.o : shell.S start.cpp debug.cpp diff --git a/src/system/boot/platform/bios_ia32/interrupts.cpp b/src/system/boot/platform/bios_ia32/interrupts.cpp index 3b4505c0a3..c5efc58ad5 100644 --- a/src/system/boot/platform/bios_ia32/interrupts.cpp +++ b/src/system/boot/platform/bios_ia32/interrupts.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include "debug.h" #include "keyboard.h" diff --git a/src/system/boot/platform/cfe/Jamfile b/src/system/boot/platform/cfe/Jamfile index 8114492e79..7f54c77414 100644 --- a/src/system/boot/platform/cfe/Jamfile +++ b/src/system/boot/platform/cfe/Jamfile @@ -6,7 +6,7 @@ UsePrivateHeaders [ FDirName graphics common ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -KernelMergeObject boot_platform_cfe.o : +BootMergeObject boot_platform_cfe.o : console.cpp debug.cpp devices.cpp diff --git a/src/system/boot/platform/cfe/arch/ppc/Jamfile b/src/system/boot/platform/cfe/arch/ppc/Jamfile index 14cc7e7567..f7408331d2 100644 --- a/src/system/boot/platform/cfe/arch/ppc/Jamfile +++ b/src/system/boot/platform/cfe/arch/ppc/Jamfile @@ -7,7 +7,7 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] SubDirC++Flags -fno-rtti ; -KernelStaticLibrary boot_platform_cfe_ppc : +BootStaticLibrary boot_platform_cfe_ppc : arch_mmu.cpp arch_cpu_asm.S arch_start_kernel.S diff --git a/src/system/boot/platform/generic/Jamfile b/src/system/boot/platform/generic/Jamfile index 0ca49679b0..fad4f47ad2 100644 --- a/src/system/boot/platform/generic/Jamfile +++ b/src/system/boot/platform/generic/Jamfile @@ -5,7 +5,7 @@ UsePrivateKernelHeaders ; SubDirC++Flags -D_BOOT_MODE -fno-rtti ; -KernelStaticLibrary boot_platform_generic : +BootStaticLibrary boot_platform_generic : text_menu.cpp video_blit.cpp video_splash.cpp diff --git a/src/system/boot/platform/openfirmware/Jamfile b/src/system/boot/platform/openfirmware/Jamfile index 227df039bf..43f2f2c765 100644 --- a/src/system/boot/platform/openfirmware/Jamfile +++ b/src/system/boot/platform/openfirmware/Jamfile @@ -6,7 +6,7 @@ UsePrivateHeaders [ FDirName graphics common ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -KernelMergeObject boot_platform_openfirmware.o : +BootMergeObject boot_platform_openfirmware.o : console.cpp debug.cpp devices.cpp diff --git a/src/system/boot/platform/openfirmware/arch/ppc/Jamfile b/src/system/boot/platform/openfirmware/arch/ppc/Jamfile index 651d61c6b5..a82fda7594 100644 --- a/src/system/boot/platform/openfirmware/arch/ppc/Jamfile +++ b/src/system/boot/platform/openfirmware/arch/ppc/Jamfile @@ -7,7 +7,7 @@ UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ] SubDirC++Flags -fno-rtti ; -KernelStaticLibrary boot_platform_openfirmware_ppc : +BootStaticLibrary boot_platform_openfirmware_ppc : arch_mmu.cpp arch_cpu_asm.S arch_start_kernel.S diff --git a/src/system/boot/platform/pxe_ia32/Jamfile b/src/system/boot/platform/pxe_ia32/Jamfile index 73c75ebe35..fe59db7dab 100644 --- a/src/system/boot/platform/pxe_ia32/Jamfile +++ b/src/system/boot/platform/pxe_ia32/Jamfile @@ -45,7 +45,7 @@ local bios_ia32_edid_src = ; -KernelMergeObject boot_platform_pxe_ia32.o : +BootMergeObject boot_platform_pxe_ia32.o : pxe_stage2.S smp_trampoline.S pxe_bios.S diff --git a/src/system/boot/platform/raspberrypi_arm/Jamfile b/src/system/boot/platform/raspberrypi_arm/Jamfile index 179f0d5555..9b4b72ef39 100644 --- a/src/system/boot/platform/raspberrypi_arm/Jamfile +++ b/src/system/boot/platform/raspberrypi_arm/Jamfile @@ -19,7 +19,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) board $(TARGET_BOOT_BOAR SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -KernelMergeObject boot_platform_raspberrypi_arm.o : +BootMergeObject boot_platform_raspberrypi_arm.o : entry.S start.c console.cpp diff --git a/src/system/boot/platform/routerboard_mipsel/Jamfile b/src/system/boot/platform/routerboard_mipsel/Jamfile index 94f292ddd6..979e6fd6c4 100644 --- a/src/system/boot/platform/routerboard_mipsel/Jamfile +++ b/src/system/boot/platform/routerboard_mipsel/Jamfile @@ -23,7 +23,7 @@ local genericPlatformSources = # video_splash.cpp ; -KernelMergeObject boot_platform_routerboard_mipsel.o : +BootMergeObject boot_platform_routerboard_mipsel.o : console.cpp cpu.cpp debug.c diff --git a/src/system/boot/platform/u-boot/Jamfile b/src/system/boot/platform/u-boot/Jamfile index 17327b84d4..7d9ba932f0 100644 --- a/src/system/boot/platform/u-boot/Jamfile +++ b/src/system/boot/platform/u-boot/Jamfile @@ -29,7 +29,7 @@ local uImageFakeOS = "netbsd" ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; # First build the non arch dependent parts -KernelMergeObject boot_platform_u-boot_common.o : +BootMergeObject boot_platform_u-boot_common.o : start.cpp debug.cpp console.cpp @@ -48,7 +48,7 @@ KernelMergeObject boot_platform_u-boot_common.o : : boot_platform_generic.a ; -KernelMergeObject boot_platform_u-boot.o : +BootMergeObject boot_platform_u-boot.o : : : # must come first to have _start_* at correct locations boot_platform_u-boot_$(TARGET_ARCH).o diff --git a/src/system/boot/platform/u-boot/arch/arm/Jamfile b/src/system/boot/platform/u-boot/arch/arm/Jamfile index a81e46bc90..2bf09c10e5 100644 --- a/src/system/boot/platform/u-boot/arch/arm/Jamfile +++ b/src/system/boot/platform/u-boot/arch/arm/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) board $(TARGET_BOOT_BOAR SubDirC++Flags -fno-rtti ; -KernelMergeObject boot_platform_u-boot_arm.o : +BootMergeObject boot_platform_u-boot_arm.o : # must come first to have _start_* at correct locations shell.S diff --git a/src/system/boot/platform/u-boot/arch/ppc/Jamfile b/src/system/boot/platform/u-boot/arch/ppc/Jamfile index ad93d5969d..46848e7d07 100644 --- a/src/system/boot/platform/u-boot/arch/ppc/Jamfile +++ b/src/system/boot/platform/u-boot/arch/ppc/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) board $(TARGET_BOOT_BOAR SubDirC++Flags -fno-rtti ; -KernelMergeObject boot_platform_u-boot_ppc.o : +BootMergeObject boot_platform_u-boot_ppc.o : # must come first to have _start_* at correct locations shell.S diff --git a/src/system/ldscripts/x86_64/boot_loader_bios_ia32.ld b/src/system/ldscripts/x86_64/boot_loader_bios_ia32.ld new file mode 100644 index 0000000000..6cc9efd4a6 --- /dev/null +++ b/src/system/ldscripts/x86_64/boot_loader_bios_ia32.ld @@ -0,0 +1,33 @@ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) + +ENTRY(_start) +SECTIONS +{ + . = 0x10000; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + . = ALIGN(0x4); + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + .rodata : { *(.rodata .rodata.*) } + + /* writable data */ + . = ALIGN(0x1000); + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + + /* uninitialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { *(.bss) } + + . = ALIGN(0x1000); + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) } +} diff --git a/src/system/ldscripts/x86_64/boot_loader_pxe_ia32.ld b/src/system/ldscripts/x86_64/boot_loader_pxe_ia32.ld new file mode 100644 index 0000000000..6cc9efd4a6 --- /dev/null +++ b/src/system/ldscripts/x86_64/boot_loader_pxe_ia32.ld @@ -0,0 +1,33 @@ +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) + +ENTRY(_start) +SECTIONS +{ + . = 0x10000; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + . = ALIGN(0x4); + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + .rodata : { *(.rodata .rodata.*) } + + /* writable data */ + . = ALIGN(0x1000); + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + + /* uninitialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { *(.bss) } + + . = ALIGN(0x1000); + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .stab .stabstr .debug*) } +}