Index: head/sys/boot/mips/beri/boot2/Makefile =================================================================== --- head/sys/boot/mips/beri/boot2/Makefile (revision 311457) +++ head/sys/boot/mips/beri/boot2/Makefile (revision 311458) @@ -1,89 +1,89 @@ #- # Copyright (c) 2013-2014 Robert N. M. Watson # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) # ("CTSRD"), as part of the DARPA CRASH research programme. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. 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. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. # # $FreeBSD$ BINDIR?= /boot INSTALLFLAGS= -b LOADERS= flashboot jtagboot FILES= ${LOADERS} ${LOADERS:S/$/.md5/} SRCS= relocate.S \ start.S \ boot2.c \ altera_jtag_uart.c \ cfi.c \ sdcard.c MAN= AFLAGS= -G0 CFLAGS= -ffreestanding \ -I${.CURDIR} \ -I${.CURDIR}/../../../common \ -I${.CURDIR}/../../../.. \ -D_KERNEL \ -Wall \ -G0 -Xassembler -G0 \ -fno-pic -mno-abicalls \ -msoft-float \ -g # where to get libstand from CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/ LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a LDFLAGS= -nostdlib \ -static \ -N \ -G0 \ -L${.CURDIR} .PATH: ${.CURDIR}/../common CFLAGS+= -I${.CURDIR}/../common flashboot.elf: relocate.o start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o - ${LD} ${_LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \ + ${CC} ${_LDFLAGS} -T ${.CURDIR}/flashboot.ldscript -o ${.TARGET} \ ${.ALLSRC} ${LIBSTAND} flashboot: flashboot.elf ${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET} flashboot.md5: flashboot md5 flashboot > flashboot.md5 jtagboot: start.o boot2.o altera_jtag_uart.o cfi.o sdcard.o - ${LD} ${_LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \ + ${CC} ${_LDFLAGS} -T ${.CURDIR}/jtagboot.ldscript -o ${.TARGET} \ ${.ALLSRC} ${LIBSTAND} jtagboot.md5: jtagboot md5 jtagboot > jtagboot.md5 CLEANFILES+= flashboot.elf .include Index: head/sys/boot/mips/beri/common/common.ldscript =================================================================== --- head/sys/boot/mips/beri/common/common.ldscript (revision 311457) +++ head/sys/boot/mips/beri/common/common.ldscript (revision 311458) @@ -1,77 +1,76 @@ /*- * Copyright (c) 2011-2014 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. * * $FreeBSD$ */ /* * MIPS segment definitions. */ __mips_ckseg_cached__ = 0xffffffff80000000; /* BSD kernel here. */ __mips64_xkphys_cached__ = 0x9800000000000000; /* Device memory here. */ __mips64_xkphys_uncached__ = 0x9000000000000000; /* Device I/O here. */ /* * Physical addresses of various peripherals. */ __cheri_flash_base__ = 0x74000000; __cheri_sdcard_base__ = 0x7f008000; /* * Location of boot2 in flash. */ __cheri_flash_boot_loader_base_ = 0x03fe0000; __cheri_flash_boot_loader_vaddr__ = __mips64_xkphys_cached__ + __cheri_flash_base__ + __cheri_flash_boot_loader_base_; /* * Location of boot file system in flash. */ __cheri_flash_bootfs_base__ = 0x1820000; __cheri_flash_bootfs_len__ = 0x27c0000; __cheri_flash_bootfs_vaddr__ = __mips64_xkphys_cached__ + __cheri_flash_base__ + __cheri_flash_bootfs_base__; /* * Location of SD card controller. */ __cheri_sdcard_vaddr__ = __mips64_xkphys_uncached__ + __cheri_sdcard_base__; /* * Location where the production kernel gets put. This must agree with other * definitions, such as in the kernel's own linker script. * * (As it happens, in the short run, we also place boot2 here, as Miniboot * expects to find an ELF binary there -- but that will change.) */ __kernel_base__ = 0x100000; __kernel_vaddr__ = __mips64_xkphys_cached__ + __kernel_base__; -OUTPUT_FORMAT("elf64-tradbigmips"); OUTPUT_ARCH(mips) Index: head/sys/boot/mips/beri/loader/loader.ldscript =================================================================== --- head/sys/boot/mips/beri/loader/loader.ldscript (revision 311457) +++ head/sys/boot/mips/beri/loader/loader.ldscript (revision 311458) @@ -1,85 +1,84 @@ /*- * Copyright (c) 2011-2014 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. * * $FreeBSD$ */ INCLUDE ../common/common.ldscript /* * Location where loader will execute. */ __loader_base__ = 0x20000; __loader_base_vaddr__ = __mips64_xkphys_cached__ + __loader_base__; /* * Highest address the loader is allowed to use below the kernel. */ __loader_end__ = 0x100000; __loader_end_vaddr__ = __mips64_xkphys_cached__ + __loader_end__; -OUTPUT_FORMAT("elf64-tradbigmips"); OUTPUT_ARCH(mips) ENTRY(start) SECTIONS { /* * We rely on boot2 having (a) configured a stack, and (b) loaded us * to an appropriate bit of physical/virtual memory such that no * self-relocating code is required here. */ . = __loader_base_vaddr__; . += SIZEOF_HEADERS; .text ALIGN(0x10): { start.o(.text*) *(EXCLUDE_FILE (start.o) .text*) *(.rodata*) __start_set_Xcommand_set = .; KEEP(*(set_Xcommand_set)) __stop_set_Xcommand_set = .; __start_set_Xficl_compile_set = .; KEEP(*(set_Xficl_compile_set)) __stop_set_Xficl_compile_set = .; } .data ALIGN(0x10): { *(.data*)} .bss ALIGN(0x10): { *(.bss*) } __heap = ALIGN(0x8); /* 64-bit aligned heap pointer */ __data_end = .; __boot_loader_len__ = . - __loader_base_vaddr__; __bss_start = ADDR(.bss); __bss_end = ALIGN(__bss_start + SIZEOF(.bss), 0x8); __heap_start = .; __heap_end = __loader_end_vaddr__; __heap_len = __heap_end - __heap_start; }